[PackageKit-commit] packagekit: Branch 'master' - 7 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Tue Jul 28 14:39:25 PDT 2009
backends/portage/portageBackend.py | 44 ++----
backends/yum/Makefile.am | 1
backends/yum/yumBackend.py | 107 +++++++++++++++
backends/yum/yumMediaManager.py | 84 ++++++++++++
contrib/debuginfo-install/pk-debuginfo-install.c | 2
contrib/gstreamer-plugin/pk-gstreamer-install.c | 131 ++++++++++---------
po/pl.po | 156 +++++++++++++----------
7 files changed, 372 insertions(+), 153 deletions(-)
New commits:
commit 3a75f454a53294a62a8f1eb93d0c3e53cc02a966
Author: Muayyad Alsadi <alsadi at ojuba.org>
Date: Tue Jul 28 22:35:50 2009 +0100
Add the start of MediaManager code for external media handling
Signed-off-by: Richard Hughes <richard at hughsie.com>
diff --git a/backends/yum/Makefile.am b/backends/yum/Makefile.am
index a91c5b0..b5f61d1 100644
--- a/backends/yum/Makefile.am
+++ b/backends/yum/Makefile.am
@@ -3,6 +3,7 @@ dist_helper_DATA = \
yum-comps-groups.conf \
yumBackend.py \
yumComps.py \
+ yumMediaManager.py \
yumFilter.py
plugindir = $(PK_PLUGIN_DIR)
diff --git a/backends/yum/yumBackend.py b/backends/yum/yumBackend.py
index b26ba0c..0bccc84 100755
--- a/backends/yum/yumBackend.py
+++ b/backends/yum/yumBackend.py
@@ -15,20 +15,26 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-# Copyright (C) 2007-2008
+# Copyright (C) 2007-2009
# Tim Lauridsen <timlau at fedoraproject.org>
# Seth Vidal <skvidal at fedoraproject.org>
# Luke Macken <lmacken at redhat.com>
# James Bowes <jbowes at dangerouslyinc.com>
# Robin Norwood <rnorwood at redhat.com>
# Richard Hughes <richard at hughsie.com>
+#
+# MediaGrabber:
+# Based on the logic of pirut by Jeremy Katz <katzj at redhat.com>
+# Rewritten by Muayyad Alsadi <alsadi at ojuba.org>
# imports
from packagekit.backend import *
from packagekit.progress import *
+from packagekit.enums import *
from packagekit.package import PackagekitPackage
import yum
from urlgrabber.progress import BaseMeter, format_number
+from urlgrabber.grabber import URLGrabber, URLGrabError
from yum.rpmtrans import RPMBaseCallback
from yum.constants import *
from yum.update_md import UpdateMetadata
@@ -52,6 +58,7 @@ import ConfigParser
from yumFilter import *
from yumComps import *
+from yumMediaManager import MediaManager
# Global vars
yumbase = None
@@ -2805,6 +2812,7 @@ class PackageKitYumBase(yum.YumBase):
self.missingGPGKey = None
self.dsCallback = DepSolveCallback(backend)
self.backend = backend
+ self.mediagrabber = self.MediaGrabber
# Setup Repo GPG support callbacks
try:
self.repos.confirm_func = self._repo_gpg_confirm
@@ -2816,6 +2824,103 @@ class PackageKitYumBase(yum.YumBase):
else:
raise PkError(ERROR_INTERNAL_ERROR, _format_str(traceback.format_exc()))
+ def MediaGrabber(self, *args, **kwargs):
+ """
+ Handle physical media.
+
+ This module can be summarized like this:
+ For all media:
+ - Lock it
+ - If not mounted: mount it
+ - If it's the wanted media: break
+ - If no media found: ask the user to insert it and loop again
+ ....
+ Release the media
+ """
+ media_id = kwargs["mediaid"]
+ disc_number = kwargs["discnum"]
+ name = kwargs["name"]
+ discs_s = ''
+ found = False
+
+ manager = MediaManager()
+ media = None
+ found = False
+
+ # loop over and over, retry because the user might insert disc #2 when we need disc #5
+ while 1:
+ # check for the needed media in every media provided by yumMediaManager
+ for media in manager:
+ # mnt now holds the mount point
+ mnt = media.acquire()
+ found = False
+
+ # if not mounted skip this media for this loop
+ if not mnt:
+ continue
+
+ # load ".discinfo" from the media and parse it
+ if os.path.exists("%s/.discinfo" %(mnt,)):
+ f = open("%s/.discinfo" %(mnt,), "r")
+ lines = f.readlines()
+ f.close()
+ theid = lines[0].strip()
+ discs_s = lines[3].strip()
+
+ # if discs_s == ALL then no need to match disc number
+ if discs_s != 'ALL':
+ discs = map(lambda x: int(x), discs_s.split(","))
+ samenum = disc_number in discs
+ else:
+ samenum = True
+
+ # if the media is different or of different number skip it and loop over
+ if media_id != theid or not samenum:
+ continue
+
+ # the actual copying is done by URLGrabber
+ ug = URLGrabber(checkfunc = kwargs["checkfunc"])
+ try:
+ ug.urlgrab("%s/%s" %(mnt, kwargs["relative"]),
+ kwargs["local"], text=kwargs["text"],
+ range=kwargs["range"], copy_local=1)
+ except (IOError, URLGrabError):
+ pass
+ else:
+ found = True
+
+ # if we found it end the for loop
+ if found:
+ break
+
+ # if we found it end the while loop
+ if found:
+ break
+
+ # construct human readable media_text
+ if disc_number:
+ media_text = "%s #%d" % (name, disc_number)
+ else:
+ media_text = name
+
+ # see http://lists.freedesktop.org/archives/packagekit/2009-May/004808.html
+ # and http://cgit.freedesktop.org/packagekit/commit/?id=79e8736197b552a5ce206a712cd3b6c80cf2e86d
+ self.backend.media_change_required(MEDIA_TYPE_DISC, name, media_text)
+ self.backend.error(ERROR_MEDIA_CHANGE_REQUIRED,
+ "Insert media labeled '%s' or disable media repos" % media_text,
+ exit = False)
+ break
+
+ # if we got a media object destruct it to release the media (which will unmount and unlock if needed)
+ if media:
+ del media
+
+ # I guess we come here when the user in PK clicks cancel
+ if not found:
+ # yumRepo will catch this
+ raise yum.Errors.MediaError, "The disc was not inserted"
+ return kwargs["local"]
+
def _repo_gpg_confirm(self, keyData):
""" Confirm Repo GPG signature import """
if not keyData:
diff --git a/backends/yum/yumMediaManager.py b/backends/yum/yumMediaManager.py
new file mode 100644
index 0000000..9f1db43
--- /dev/null
+++ b/backends/yum/yumMediaManager.py
@@ -0,0 +1,84 @@
+#!/usr/bin/python
+# Licensed under the GNU General Public License Version 2
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Copyright (C) 2009
+# Muayyad Saleh Alsadi <alsadi at ojuba.org>
+
+"""
+This is a module for dealing with removable media
+NOTE: releasing (unmounting and unlocking) is done when media is destructed
+"""
+
+class MediaDevice(object):
+ """
+ You should just use acquire() to get the mount point (the implementation is
+ supposed to be smart enough to return mount point when it's already mounted)
+ You don't need to manually call release(), just destruct MediaDevice object
+ and the implementation should do that if needed.
+ """
+ def __init__(self, media_id):
+ """
+ media_id argument is the implementation-specific id, provided by MediaManager.
+ """
+ self._unmount_needed = False
+ self._unlocked_needed = False
+ raise NotImplemented
+
+ def __del__(self):
+ if self._unmount_needed:
+ self.unmount()
+ if self._unlocked_needed:
+ self.unlock()
+
+ def is_removable(self):
+ raise NotImplemented
+
+ def is_mounted(self):
+ raise NotImplemented
+
+ def is_locked(self):
+ raise NotImplemented
+
+ def get_mount_point(self):
+ raise NotImplemented
+
+ def lock(self):
+ raise NotImplemented
+
+ def unlock(self):
+ raise NotImplemented
+
+ def mount(self):
+ raise NotImplemented
+
+ def unmount(self):
+ raise NotImplemented
+
+ def acquire(self):
+ raise NotImplemented
+
+ def release(self):
+ raise NotImplemented
+
+class MediaManager (object):
+ """Just iterate over an instance of this class to get MediaDevice objects"""
+ def __init__(self):
+ raise NotImplemented
+
+ def __iter__(self):
+ raise NotImplemented
+
commit 816307af5d6f4f424ccf84f98621f6dc72380413
Merge: 8e02700... 84b665d...
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Jul 28 22:10:23 2009 +0100
Merge branch 'master' of git+ssh://hughsie@git.packagekit.org/srv/git/PackageKit
commit 84b665d72b459c6f997bb3cd7e5dcc8b155bc75f
Author: Mounir Lamouri (volkmar) <mounir.lamouri at gmail.com>
Date: Tue Jul 28 22:02:39 2009 +0200
portage: update-system prevents failures and block outputs
diff --git a/backends/portage/portageBackend.py b/backends/portage/portageBackend.py
index 3ca49f2..e084016 100755
--- a/backends/portage/portageBackend.py
+++ b/backends/portage/portageBackend.py
@@ -1470,42 +1470,34 @@ class PackageKitPortageBackend(PackageKitBaseBackend, PackagekitPackage):
"Portage backend does not support GPG signature")
return
- # inits
myopts = {}
- myopts.pop("--deep", None)
- myopts.pop("--newuse", None)
- myopts.pop("--update", None)
myopts["--deep"] = True
myopts["--newuse"] = True
myopts["--update"] = True
- spinner = ""
- favorites = []
settings, trees, mtimedb = _emerge.actions.load_emerge_config()
- myparams = _emerge.create_depgraph_params.create_depgraph_params(myopts, "")
- spinner = _emerge.stdout_spinner.stdout_spinner()
+ myparams = _emerge.create_depgraph_params.create_depgraph_params(
+ myopts, "")
- depgraph = _emerge.depgraph.depgraph(settings, trees, myopts, myparams, spinner)
- retval, favorites = depgraph.select_files(["@system", "@world"])
+ # creating list of ebuilds needed for the system update
+ # using backtrack_depgraph to prevent errors
+ retval, depgraph, _ = _emerge.depgraph.backtrack_depgraph(
+ settings, trees, myopts, myparams, "",
+ ["@system", "@world"], None)
if not retval:
- self.error(ERROR_INTERNAL_ERROR, "Wasn't able to get dependency graph")
+ self.error(ERROR_INTERNAL_ERROR,
+ "Wasn't able to get dependency graph")
return
- if "resume" in mtimedb and \
- "mergelist" in mtimedb["resume"] and \
- len(mtimedb["resume"]["mergelist"]) > 1:
- mtimedb["resume_backup"] = mtimedb["resume"]
- del mtimedb["resume"]
- mtimedb.commit()
-
- mtimedb["resume"] = {}
- mtimedb["resume"]["myopts"] = myopts.copy()
- mtimedb["resume"]["favorites"] = [str(x) for x in favorites]
-
- mergetask = _emerge.Scheduler.Scheduler(settings, trees, mtimedb,
- myopts, spinner, depgraph.altlist(),
- favorites, depgraph.schedulerGraph())
- mergetask.merge()
+ try:
+ self.block_output()
+ # compiling/installing
+ mergetask = _emerge.Scheduler.Scheduler(settings, trees, mtimedb,
+ myopts, None, depgraph.altlist(),
+ None, depgraph.schedulerGraph())
+ mergetask.merge()
+ finally:
+ self.unblock_output()
def main():
backend = PackageKitPortageBackend("") #'', lock=True)
commit 8e027002c07f2cfe437c0c5c0ecbccaee446d43a
Merge: 7f27d0d... 768fc3d...
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Jul 28 15:22:08 2009 +0100
Merge branch 'master' of git+ssh://hughsie@git.packagekit.org/srv/git/PackageKit
commit 768fc3deb7b5d757c436e58e1bb23ab14c1cd8fd
Author: raven <raven at fedoraproject.org>
Date: Tue Jul 28 14:12:52 2009 +0000
Sending translation for Polish
diff --git a/po/pl.po b/po/pl.po
index fd2a08a..7d1f88b 100644
--- a/po/pl.po
+++ b/po/pl.po
@@ -5,13 +5,15 @@ msgid ""
msgstr ""
"Project-Id-Version: pl\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2009-07-21 14:37+0000\n"
-"PO-Revision-Date: 2009-07-21 20:34+0200\n"
+"POT-Creation-Date: 2009-07-28 08:41+0000\n"
+"PO-Revision-Date: 2009-07-28 16:11+0200\n"
"Last-Translator: Piotr DrÄ
g <piotrdrag at gmail.com>\n"
"Language-Team: Polish <pl at li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
+"|| n%100>=20) ? 1 : 2);\n"
#. TRANSLATORS: this is an atomic transaction
#: ../client/pk-console.c:231
@@ -39,7 +41,7 @@ msgstr "FaÅsz"
#. TRANSLATORS: this is the transactions role, e.g. "update-system"
#. TRANSLATORS: the trasaction role, e.g. update-system
-#: ../client/pk-console.c:237 ../src/pk-polkit-action-lookup.c:256
+#: ../client/pk-console.c:237 ../src/pk-polkit-action-lookup.c:297
msgid "Role"
msgstr "Rola"
@@ -54,7 +56,7 @@ msgstr "(sekundy)"
#. TRANSLATORS: this is The command line used to do the action
#. TRANSLATORS: the command line of the thing that wants the authentication
-#: ../client/pk-console.c:246 ../src/pk-polkit-action-lookup.c:270
+#: ../client/pk-console.c:246 ../src/pk-polkit-action-lookup.c:311
msgid "Command line"
msgstr "Wiersz poleceÅ"
@@ -128,9 +130,13 @@ msgid "Details about the update:"
msgstr "SzczegóÅy aktualizacji:"
#. TRANSLATORS: details about the update, package name and version
-#: ../client/pk-console.c:341
+#. TRANSLATORS: title, the names of the packages that the method is processing
+#: ../client/pk-console.c:341 ../src/pk-polkit-action-lookup.c:322
msgid "Package"
-msgstr "Pakiet"
+msgid_plural "Packages"
+msgstr[0] "Pakiet"
+msgstr[1] "Pakiety"
+msgstr[2] "Pakietów"
#. TRANSLATORS: details about the update, any packages that this update updates
#: ../client/pk-console.c:344
@@ -433,7 +439,7 @@ msgstr "Nie można znaleÅºÄ pakietów do zainstalowania"
#. TRANSLATORS: installing new packages from package list
#. TRANSLATORS: we are now installing the debuginfo packages we found earlier
#: ../client/pk-console.c:1381
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:868
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:886
#, c-format
msgid "Installing packages"
msgstr "Instalowanie pakietów"
@@ -524,8 +530,8 @@ msgstr "Podpolecenia:"
#. TRANSLATORS: if we should show debugging data
#: ../client/pk-console.c:1781 ../client/pk-generate-pack.c:185
#: ../client/pk-monitor.c:128
-#: ../contrib/command-not-found/pk-command-not-found.c:521
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:532
+#: ../contrib/command-not-found/pk-command-not-found.c:610
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:550
#: ../src/pk-main.c:211
msgid "Show extra debugging information"
msgstr "WyÅwietla dodatkowe informacje o debugowaniu"
@@ -827,72 +833,92 @@ msgstr "ProszÄ wybraÄ poprawny pakiet: "
msgid "Please enter a number from 1 to %i: "
msgstr "ProszÄ podaÄ numer od 1 do %i: "
+#. TRANSLATORS: downloading repo data so we can search
+#: ../contrib/command-not-found/pk-command-not-found.c:349
+msgid "Downloading details about the software sources."
+msgstr "Pobieranie szczegóÅów o źródÅach oprogramowania."
+
+#. TRANSLATORS: downloading file lists so we can search
+#: ../contrib/command-not-found/pk-command-not-found.c:353
+msgid "Downloading filelists (this may take some time to complete)."
+msgstr "Pobieranie list plików (może to zajÄ
Ä trochÄ czasu)."
+
+#. TRANSLATORS: waiting for native lock
+#: ../contrib/command-not-found/pk-command-not-found.c:357
+msgid "Waiting for package manager lock."
+msgstr "Oczekiwanie na blokadÄ menedżera pakietów."
+
+#. TRANSLATORS: loading package cache so we can search
+#: ../contrib/command-not-found/pk-command-not-found.c:361
+msgid "Loading list of packages."
+msgstr "Wczytywanie listy pakietów."
+
#. TRANSLATORS: we failed to find the package, this shouldn't happen
-#: ../contrib/command-not-found/pk-command-not-found.c:372
+#: ../contrib/command-not-found/pk-command-not-found.c:414
msgid "Failed to search for file"
msgstr "Znalezienie pliku nie powiodÅo siÄ"
#. TRANSLATORS: we failed to launch the executable, the error follows
-#: ../contrib/command-not-found/pk-command-not-found.c:496
+#: ../contrib/command-not-found/pk-command-not-found.c:551
msgid "Failed to launch:"
msgstr "Uruchomienie nie powiodÅo siÄ:"
#. TRANSLATORS: tool that gets called when the command is not found
-#: ../contrib/command-not-found/pk-command-not-found.c:537
+#: ../contrib/command-not-found/pk-command-not-found.c:626
msgid "PackageKit Command Not Found"
msgstr "Nie znaleziono polecenia PackageKit"
#. TRANSLATORS: the prefix of all the output telling the user why it's not executing
-#: ../contrib/command-not-found/pk-command-not-found.c:560
+#: ../contrib/command-not-found/pk-command-not-found.c:652
msgid "Command not found."
msgstr "Nie znaleziono polecenia."
#. TRANSLATORS: tell the user what we think the command is
-#: ../contrib/command-not-found/pk-command-not-found.c:567
+#: ../contrib/command-not-found/pk-command-not-found.c:659
msgid "Similar command is:"
msgstr "Podobne polecenie:"
#. TRANSLATORS: Ask the user if we should run the similar command
-#: ../contrib/command-not-found/pk-command-not-found.c:576
+#: ../contrib/command-not-found/pk-command-not-found.c:668
msgid "Run similar command:"
msgstr "Wykonaj podobne polecenie:"
#. TRANSLATORS: show the user a list of commands that they could have meant
#. TRANSLATORS: show the user a list of commands we could run
-#: ../contrib/command-not-found/pk-command-not-found.c:588
-#: ../contrib/command-not-found/pk-command-not-found.c:597
+#: ../contrib/command-not-found/pk-command-not-found.c:680
+#: ../contrib/command-not-found/pk-command-not-found.c:689
msgid "Similar commands are:"
msgstr "Podobne polecenia:"
#. TRANSLATORS: ask the user to choose a file to run
-#: ../contrib/command-not-found/pk-command-not-found.c:604
+#: ../contrib/command-not-found/pk-command-not-found.c:696
msgid "Please choose a command to run"
msgstr "ProszÄ wybraÄ polecenie do wykonania"
#. TRANSLATORS: tell the user what package provides the command
-#: ../contrib/command-not-found/pk-command-not-found.c:619
+#: ../contrib/command-not-found/pk-command-not-found.c:715
msgid "The package providing this file is:"
msgstr "Pakiet dostarczajÄ
cy ten plik:"
#. TRANSLATORS: as the user if we want to install a package to provide the command
-#: ../contrib/command-not-found/pk-command-not-found.c:624
+#: ../contrib/command-not-found/pk-command-not-found.c:720
#, c-format
msgid "Install package '%s' to provide command '%s'?"
msgstr "ZainstalowaÄ pakiet \"%s\", aby dostarczyÄ polecenie \"%s\"?"
#. TRANSLATORS: Show the user a list of packages that provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:645
+#: ../contrib/command-not-found/pk-command-not-found.c:741
msgid "Packages providing this file are:"
msgstr "Pakiety dostarczajÄ
ce ten plik:"
#. TRANSLATORS: Show the user a list of packages that they can install to provide this command
-#: ../contrib/command-not-found/pk-command-not-found.c:654
+#: ../contrib/command-not-found/pk-command-not-found.c:750
msgid "Suitable packages are:"
msgstr "Odpowiednie pakiety:"
#. get selection
#. TRANSLATORS: ask the user to choose a file to install
-#: ../contrib/command-not-found/pk-command-not-found.c:662
+#: ../contrib/command-not-found/pk-command-not-found.c:758
msgid "Please choose a package to install"
msgstr "ProszÄ wybraÄ pakiet do zainstalowania"
@@ -951,186 +977,186 @@ msgid "Installing..."
msgstr "Instalowanie..."
#. TRANSLATORS: we are starting to install the packages
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:186
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:187
msgid "Starting install"
msgstr "Rozpoczynanie instalacji"
#. TRANSLATORS: we couldn't find the package name, non-fatal
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:379
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:397
#, c-format
msgid "Failed to find the package %s, or already installed: %s"
msgstr "Znalezienie pakietu %s nie powiodÅo siÄ lub jest już zainstalowany: %s"
#. command line argument, simulate what would be done, but don't actually do it
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:535
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:553
msgid ""
"Don't actually install any packages, only simulate what would be installed"
msgstr "Nie instaluje żadnych pakietów, tylko symuluje instalacjÄ"
#. command line argument, do we skip packages that depend on the ones specified
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:538
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:556
msgid "Do not install dependencies of the core packages"
msgstr "Nie instaluje zależnoÅci podstawowych pakietów"
#. command line argument, do we operate quietly
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:541
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:559
msgid "Do not display information or progress"
msgstr "Nie wyÅwietla informacji lub postÄpu"
#. TRANSLATORS: tool that gets called when the command is not found
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:559
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:577
msgid "PackageKit Debuginfo Installer"
msgstr "Instalator pakietów debugowania PackageKit"
#. TRANSLATORS: the use needs to specify a list of package names on the command line
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:571
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:589
#, c-format
msgid "ERROR: Specify package names to install."
msgstr "BÅÄD: proszÄ podaÄ nazwy pakietów do zainstalowania."
#. TRANSLATORS: we are getting the list of repositories
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:605
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:623
#, c-format
msgid "Getting sources list"
msgstr "Pobieranie listy źródeÅ"
#. TRANSLATORS: all completed 100%
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:623
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:663
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:698
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:782
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:826
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:893
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:937
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:641
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:681
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:716
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:800
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:844
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:911
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:955
#, c-format
msgid "OK."
msgstr "OK."
#. TRANSLATORS: tell the user what we found
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:626
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:644
#, c-format
msgid "Found %i enabled and %i disabled sources."
msgstr "Znaleziono %i wÅÄ
czone i %i wyÅÄ
czone źródÅa."
#. TRANSLATORS: we're finding repositories that match out pattern
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:633
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:651
#, c-format
msgid "Finding debugging sources"
msgstr "Wyszukiwanie źródeŠpakietów debugowania"
#. TRANSLATORS: tell the user what we found
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:666
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:684
#, c-format
msgid "Found %i disabled debuginfo repos."
msgstr "Znaleziono %i wyÅÄ
czone repozytoria pakietów debugowania."
#. TRANSLATORS: we're now enabling all the debug sources we found
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:673
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:691
#, c-format
msgid "Enabling debugging sources"
msgstr "WÅÄ
czanie źródeŠpakietów debugowania"
#. TRANSLATORS: operation was not successful
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:683
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:767
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:811
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:878
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:922
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:701
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:785
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:829
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:896
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:940
msgid "FAILED."
msgstr "NIEUDANE."
#. TRANSLATORS: tell the user how many we enabled
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:701
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:719
#, c-format
msgid "Enabled %i debugging sources."
msgstr "WÅÄ
czono %i źródÅa pakietów debugowania."
#. TRANSLATORS: we're now finding packages that match in all the repos
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:708
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:726
#, c-format
msgid "Finding debugging packages"
msgstr "Wyszukiwanie źródeŠpakietów debugowania"
#. TRANSLATORS: we couldn't find the package name, non-fatal
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:720
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:738
#, c-format
msgid "Failed to find the package %s: %s"
msgstr "Znalezienie pakietu %s nie powiodÅo siÄ: %s"
#. TRANSLATORS: we couldn't find the debuginfo package name, non-fatal
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:743
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:761
#, c-format
msgid "Failed to find the debuginfo package %s: %s"
msgstr "Znalezienie pakietu debugowania %s nie powiodÅo siÄ: %s"
#. TRANSLATORS: no debuginfo packages could be found to be installed
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:771
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:789
#, c-format
msgid "Found no packages to install."
msgstr "Nie znaleziono pakietów do zainstalowania."
#. TRANSLATORS: tell the user we found some packages, and then list them
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:785
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:803
#, c-format
msgid "Found %i packages:"
msgstr "Znaleziono %i pakiety:"
#. TRANSLATORS: tell the user we are searching for deps
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:801
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:819
#, c-format
msgid "Finding packages that depend on these packages"
msgstr "Wyszukiwanie pakietów zależnych od tych pakietów"
#. TRANSLATORS: could not install, detailed error follows
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:814
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:832
#, c-format
msgid "Could not find dependant packages: %s"
msgstr "Nie można znaleÅºÄ zależnych pakietów: %s"
#. TRANSLATORS: tell the user we found some more packages
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:830
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:848
#, c-format
msgid "Found %i extra packages."
msgstr "Znaleziono %i dodatkowe pakiety."
#. TRANSLATORS: tell the user we found some more packages
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:834
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:852
#, c-format
msgid "No extra packages required."
msgstr "Dodatkowe pakiety nie sÄ
wymagane."
#. TRANSLATORS: tell the user we found some packages (and deps), and then list them
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:843
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:861
#, c-format
msgid "Found %i packages to install:"
msgstr "Znaleziono %i pakiety do zainstalowania:"
#. TRANSLATORS: simulate mode is a testing mode where we quit before the action
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:856
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:874
#, c-format
msgid "Not installing packages in simulate mode"
msgstr "Pakiety nie zostanÄ
zainstalowane w trybie symulacji"
-#. TRANSLATORS: coul dnot install, detailed error follows
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:881
+#. TRANSLATORS: could not install, detailed error follows
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:899
#, c-format
msgid "Could not install packages: %s"
msgstr "Nie można zainstalowaÄ pakietów: %s"
#. TRANSLATORS: we are now disabling all debuginfo repos we previously enabled
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:913
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:931
#, c-format
msgid "Disabling sources previously enabled"
msgstr "WyÅÄ
czanie źródeÅ poprzednio wÅÄ
czonych"
#. TRANSLATORS: no debuginfo packages could be found to be installed, detailed error follows
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:925
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:943
#, c-format
msgid "Could not disable the debugging sources: %s"
msgstr "Nie można wyÅÄ
czyÄ ÅºródeÅ pakietów debugowania: %s"
#. TRANSLATORS: we disabled all the debugging repos that we enabled before
-#: ../contrib/debuginfo-install/pk-debuginfo-install.c:940
+#: ../contrib/debuginfo-install/pk-debuginfo-install.c:958
#, c-format
msgid "Disabled %i debugging sources."
msgstr "WyÅÄ
czono %i źródÅa pakietów debugowania."
@@ -1411,6 +1437,6 @@ msgstr ""
"bezpieczne."
#. TRANSLATORS: if the transaction is forced to install only trusted packages
-#: ../src/pk-polkit-action-lookup.c:263
+#: ../src/pk-polkit-action-lookup.c:304
msgid "Only trusted"
msgstr "Tylko zaufane"
commit 7f27d0dfb0e084e27be229a6d90ad40645513b98
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Jul 28 14:47:45 2009 +0100
gstreamer-plugin: check for invalid codecs and don't send if all are invalid
diff --git a/contrib/gstreamer-plugin/pk-gstreamer-install.c b/contrib/gstreamer-plugin/pk-gstreamer-install.c
index 9c7a83f..3619013 100644
--- a/contrib/gstreamer-plugin/pk-gstreamer-install.c
+++ b/contrib/gstreamer-plugin/pk-gstreamer-install.c
@@ -27,11 +27,11 @@
#include <dbus/dbus-glib.h>
typedef struct {
- GstStructure *structure;
- char *type_name;
- char *codec_name;
- char *app_name;
-} codec_info;
+ GstStructure *structure;
+ gchar *type_name;
+ gchar *codec_name;
+ gchar *app_name;
+} PkGstCodecInfo;
enum {
FIELD_VERSION = 0,
@@ -43,57 +43,47 @@ enum {
/**
* pk_gst_parse_codec:
**/
-static codec_info *
-pk_gst_parse_codec (const char *codec)
+static PkGstCodecInfo *
+pk_gst_parse_codec (const gchar *codec)
{
- char **split;
+ gchar **split = NULL;
+ gchar **ss = NULL;
GstStructure *s;
- char *type_name, *caps;
- codec_info *info;
+ gchar *type_name = NULL;
+ gchar *caps = NULL;
+ PkGstCodecInfo *info = NULL;
split = g_strsplit (codec, "|", -1);
if (split == NULL || g_strv_length (split) != 5) {
g_message ("PackageKit: not a GStreamer codec line");
- g_strfreev (split);
- return NULL;
+ goto out;
}
- if (strcmp (split[0], "gstreamer") != 0 ||
- strcmp (split[1], "0.10") != 0) {
+ if (g_strcmp0 (split[0], "gstreamer") != 0 ||
+ g_strcmp0 (split[1], "0.10") != 0) {
g_message ("PackageKit: not for GStreamer 0.10");
- g_strfreev (split);
- return NULL;
+ goto out;
}
if (g_str_has_prefix (split[4], "uri") != FALSE) {
- char **ss;
-
+ /* split uri */
ss = g_strsplit (split[4], " ", 2);
- info = g_new0 (codec_info, 1);
+ info = g_new0 (PkGstCodecInfo, 1);
info->app_name = g_strdup (split[2]);
info->codec_name = g_strdup (split[3]);
info->type_name = g_strdup (ss[0]);
- g_strfreev (ss);
- g_strfreev (split);
-
- return info;
+ goto out;
}
- {
- char **ss;
- ss = g_strsplit (split[4], "-", 2);
- type_name = g_strdup (ss[0]);
- caps = g_strdup (ss[1]);
- g_strfreev (ss);
- }
+ /* split */
+ ss = g_strsplit (split[4], "-", 2);
+ type_name = g_strdup (ss[0]);
+ caps = g_strdup (ss[1]);
s = gst_structure_from_string (caps, NULL);
if (s == NULL) {
g_message ("PackageKit: failed to parse caps: %s", caps);
- g_strfreev (split);
- g_free (caps);
- g_free (type_name);
- return NULL;
+ goto out;
}
/* remove fields that are almost always just MIN-MAX of some sort
@@ -108,13 +98,17 @@ pk_gst_parse_codec (const char *codec)
gst_structure_remove_field (s, "clock-rate");
gst_structure_remove_field (s, "bitrate");
- info = g_new0 (codec_info, 1);
+ info = g_new0 (PkGstCodecInfo, 1);
info->app_name = g_strdup (split[2]);
info->codec_name = g_strdup (split[3]);
info->type_name = type_name;
info->structure = s;
- g_strfreev (split);
+out:
+ g_free (caps);
+ g_free (type_name);
+ g_strfreev (ss);
+ g_strfreev (split);
return info;
}
@@ -122,17 +116,16 @@ pk_gst_parse_codec (const char *codec)
* pk_gst_field_get_type:
**/
static int
-pk_gst_field_get_type (const char *field_name)
+pk_gst_field_get_type (const gchar *field_name)
{
- if (strstr (field_name, "version") != NULL)
+ if (g_strrstr (field_name, "version") != NULL)
return FIELD_VERSION;
- if (strcmp (field_name, "layer") == 0)
+ if (g_strcmp0 (field_name, "layer") == 0)
return FIELD_LAYER;
- if (strcmp (field_name, "systemstream") == 0)
+ if (g_strcmp0 (field_name, "systemstream") == 0)
return FIELD_SYSTEMSTREAM;
- if (strcmp (field_name, "variant") == 0)
+ if (g_strcmp0 (field_name, "variant") == 0)
return FIELD_VARIANT;
-
return -1;
}
@@ -140,7 +133,7 @@ pk_gst_field_get_type (const char *field_name)
* pk_gst_fields_type_compare:
**/
static gint
-pk_gst_fields_type_compare (const char *a, const char *b)
+pk_gst_fields_type_compare (const gchar *a, const gchar *b)
{
gint a_type, b_type;
@@ -156,7 +149,7 @@ pk_gst_fields_type_compare (const char *a, const char *b)
/**
* pk_gst_structure_to_provide:
**/
-static char *
+static gchar *
pk_gst_structure_to_provide (GstStructure *s)
{
GString *string;
@@ -167,11 +160,11 @@ pk_gst_structure_to_provide (GstStructure *s)
fields = NULL;
for (i = 0; i < num_fields; i++) {
- const char *field_name;
+ const gchar *field_name;
field_name = gst_structure_nth_field_name (s, i);
if (pk_gst_field_get_type (field_name) < 0) {
- //g_message ("PackageKit: ignoring field named %s", field_name);
+ g_message ("PackageKit: ignoring field named %s", field_name);
continue;
}
@@ -180,13 +173,13 @@ pk_gst_structure_to_provide (GstStructure *s)
string = g_string_new("");
for (l = fields; l != NULL; l = l->next) {
- char *field_name;
+ gchar *field_name;
GType type;
field_name = l->data;
type = gst_structure_get_field_type (s, field_name);
- //g_message ("PackageKit: field is: %s, type: %s", field_name, g_type_name (type));
+ g_message ("PackageKit: field is: %s, type: %s", field_name, g_type_name (type));
if (type == G_TYPE_INT) {
int value;
@@ -199,7 +192,7 @@ pk_gst_structure_to_provide (GstStructure *s)
gst_structure_get_boolean (s, field_name, &value);
g_string_append_printf (string, "(%s=%s)", field_name, value ? "true" : "false");
} else if (type == G_TYPE_STRING) {
- const char *value;
+ const gchar *value;
value = gst_structure_get_string (s, field_name);
g_string_append_printf (string, "(%s=%s)", field_name, value);
@@ -219,7 +212,7 @@ pk_gst_structure_to_provide (GstStructure *s)
* pk_gst_codec_free:
**/
static void
-pk_gst_codec_free (codec_info *codec)
+pk_gst_codec_free (PkGstCodecInfo *codec)
{
if (codec->structure)
gst_structure_free (codec->structure);
@@ -249,13 +242,13 @@ pk_gst_get_arch_suffix (void)
}
/* 32 bit machines */
- if (strcmp (buf.machine, "i386") == 0 ||
- strcmp (buf.machine, "i586") == 0 ||
- strcmp (buf.machine, "i686") == 0)
+ if (g_strcmp0 (buf.machine, "i386") == 0 ||
+ g_strcmp0 (buf.machine, "i586") == 0 ||
+ g_strcmp0 (buf.machine, "i686") == 0)
goto out;
/* 64 bit machines */
- if (strcmp (buf.machine, "x86_64") == 0) {
+ if (g_strcmp0 (buf.machine, "x86_64") == 0) {
suffix = "()(64bit)";
goto out;
}
@@ -270,7 +263,7 @@ out:
* main:
**/
int
-main (int argc, char **argv)
+main (int argc, gchar **argv)
{
DBusGConnection *connection;
DBusGProxy *proxy = NULL;
@@ -284,6 +277,8 @@ main (int argc, char **argv)
gint retval = GST_INSTALL_PLUGINS_ERROR;
const gchar *suffix;
gchar **resources = NULL;
+ GPtrArray *array = NULL;
+ gchar *resource;
const GOptionEntry options[] = {
{ "transient-for", '\0', 0, G_OPTION_ARG_INT, &xid, "The XID of the parent window", NULL },
@@ -333,18 +328,19 @@ main (int argc, char **argv)
/* use a ()(64bit) suffix for 64 bit */
suffix = pk_gst_get_arch_suffix ();
+ array = g_ptr_array_new ();
len = g_strv_length (codecs);
resources = g_new0 (gchar*, len+1);
/* process argv */
for (i=0; i<len; i++) {
- codec_info *info;
- char *s;
- char *type;
+ PkGstCodecInfo *info;
+ gchar *s;
+ gchar *type;
info = pk_gst_parse_codec (codecs[i]);
if (info == NULL) {
- g_print ("skipping %s\n", codecs[i]);
+ g_message ("skipping %s", codecs[i]);
continue;
}
g_message ("PackageKit: Codec nice name: %s", info->codec_name);
@@ -360,12 +356,23 @@ main (int argc, char **argv)
}
/* "encode" */
- resources[i] = g_strdup_printf ("%s|%s", info->codec_name, type);
+ resource = g_strdup_printf ("%s|%s", info->codec_name, type);
+ g_ptr_array_add (array, resource);
/* free codec structure */
pk_gst_codec_free (info);
}
+ /* nothing parsed */
+ if (array->len == 0) {
+ g_message ("no codec lines could be parsed");
+ goto out;
+ }
+
+ /* convert to a GStrv */
+ resources = (gchar **) g_ptr_array_free (array, FALSE);
+ array = NULL;
+
/* don't timeout, as dbus-glib sets the timeout ~25 seconds */
dbus_g_proxy_set_default_timeout (proxy, INT_MAX);
@@ -392,6 +399,10 @@ main (int argc, char **argv)
retval = GST_INSTALL_PLUGINS_SUCCESS;
out:
+ if (array != NULL) {
+ g_ptr_array_foreach (array, (GFunc) g_free, NULL);
+ g_ptr_array_free (array, TRUE);
+ }
g_strfreev (resources);
if (proxy != NULL)
g_object_unref (proxy);
commit ec0030e9b852c0352ec6d59b1e2d8d6a1f58948c
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Jul 28 14:28:36 2009 +0100
debuginfo-install: fix a tiny memory leak
diff --git a/contrib/debuginfo-install/pk-debuginfo-install.c b/contrib/debuginfo-install/pk-debuginfo-install.c
index 538a5e3..e0aa17d 100644
--- a/contrib/debuginfo-install/pk-debuginfo-install.c
+++ b/contrib/debuginfo-install/pk-debuginfo-install.c
@@ -745,7 +745,7 @@ main (int argc, char *argv[])
/* add to array to install */
if (package_id != NULL) {
egg_debug ("going to try to install: %s", package_id);
- g_ptr_array_add (package_ids_recognised, g_strdup (package_id));
+ g_ptr_array_add (package_ids_recognised, package_id);
} else {
goto not_found;
}
More information about the PackageKit-commit
mailing list