Merge lp:~aptdaemon-developers/sessioninstaller/multiarch into lp:sessioninstaller

Proposed by Sebastian Heinlein
Status: Merged
Merged at revision: 126
Proposed branch: lp:~aptdaemon-developers/sessioninstaller/multiarch
Merge into: lp:sessioninstaller
Diff against target: 162 lines (+55/-12)
2 files modified
sessioninstaller/core.py (+43/-10)
sessioninstaller/utils.py (+12/-2)
To merge this branch: bzr merge lp:~aptdaemon-developers/sessioninstaller/multiarch
Reviewer Review Type Date Requested Status
Michael Vogt Approve
Review via email: mp+99693@code.launchpad.net

Description of the change

fix installing codecs on multi arch systems

To post a comment you must log in.
Revision history for this message
Sebastian Heinlein (glatzor) wrote :

This branch depends on the fix of bug 966916 in python-apt

Revision history for this message
Michael Vogt (mvo) wrote :

This looks good, thanks for you detailed analysis of this!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'sessioninstaller/core.py'
--- sessioninstaller/core.py 2012-03-28 10:16:59 +0000
+++ sessioninstaller/core.py 2012-03-28 10:23:18 +0000
@@ -33,6 +33,7 @@
3333
34import apt34import apt
35import apt.debfile35import apt.debfile
36import apt_pkg
36from aptdaemon.policykit1 import get_pid_from_dbus_name37from aptdaemon.policykit1 import get_pid_from_dbus_name
37from defer import Deferred, defer, inline_callbacks, return_value38from defer import Deferred, defer, inline_callbacks, return_value
38from defer.utils import dbus_deferred_method39from defer.utils import dbus_deferred_method
@@ -314,7 +315,7 @@
314 score -- the ranking of the package which should be used for ordering315 score -- the ranking of the package which should be used for ordering
315 restricted -- if the use or redistribution is restriceted316 restricted -- if the use or redistribution is restriceted
316 """317 """
317 if name in RESTRICTED_PACKAGES or restricted:318 if restricted:
318 #TRANSLATORS: %s is the name of a piece of software319 #TRANSLATORS: %s is the name of a piece of software
319 tooltip = _("The use of %s may be restricted in some "320 tooltip = _("The use of %s may be restricted in some "
320 "countries. You must verify that one of the following "321 "countries. You must verify that one of the following "
@@ -345,10 +346,8 @@
345 details -- additional information about the package346 details -- additional information about the package
346 score -- the ranking of the package which should be used for ordering347 score -- the ranking of the package which should be used for ordering
347 """348 """
348 restricted = pkg.candidate.origins[0].component in ("non-free",
349 "multiverse")
350 self.add_confirm(pkg.name, pkg.summary, active, details, score,349 self.add_confirm(pkg.name, pkg.summary, active, details, score,
351 restricted)350 _is_package_restricted(pkg))
352351
353 def get_selected_pkgs(self):352 def get_selected_pkgs(self):
354 """Return a list of the package names which are selected."""353 """Return a list of the package names which are selected."""
@@ -389,6 +388,8 @@
389 """Show a warning icon for restricted packages."""388 """Show a warning icon for restricted packages."""
390 if model.get_value(iter, COLUMN_TOOLTIP):389 if model.get_value(iter, COLUMN_TOOLTIP):
391 renderer.props.stock_id = Gtk.STOCK_DIALOG_WARNING390 renderer.props.stock_id = Gtk.STOCK_DIALOG_WARNING
391 else:
392 renderer.props.stock_id = None
392393
393 def run(self):394 def run(self):
394 """Run the dialog."""395 """Run the dialog."""
@@ -1267,6 +1268,27 @@
1267 pkgs = []1268 pkgs = []
1268 partial_providers = False1269 partial_providers = False
1269 self._init_cache(progress)1270 self._init_cache(progress)
1271
1272 # Get the architectures with an installed gstreamer library
1273 # Unfortunately the architecture isn't part of the request. So we
1274 # have to detect for which architectuers gstreamer has been installed
1275 # on the system, to avoid showing codecs for not used but enabeled
1276 # architecures, see LP #899001
1277 architectures = apt_pkg.get_architectures()
1278 supported_archs = set()
1279 if len(architectures) > 1:
1280 for gst_version in set([struct.version for struct in structures]):
1281 for arch in architectures:
1282 try:
1283 pkg = self._cache["libgstreamer%s-0:%s" % (gst_version,
1284 arch)]
1285 except KeyError:
1286 continue
1287 if pkg.is_installed:
1288 supported_archs.add(arch)
1289 else:
1290 supported_archs = architectures
1291
1270 for count, pkg in enumerate(self._cache):1292 for count, pkg in enumerate(self._cache):
1271 if not count % 100:1293 if not count % 100:
1272 while Gtk.events_pending():1294 while Gtk.events_pending():
@@ -1276,8 +1298,10 @@
1276 progress.hide()1298 progress.hide()
1277 progress.destroy()1299 progress.destroy()
1278 raise errors.ModifyCancelled1300 raise errors.ModifyCancelled
1279 if pkg.is_installed or not pkg.candidate or \1301 if (pkg.is_installed or
1280 not "Gstreamer-Version" in pkg.candidate.record:1302 not pkg.candidate or
1303 not "Gstreamer-Version" in pkg.candidate.record or
1304 not pkg.candidate.architecture in supported_archs):
1281 continue1305 continue
1282 # Check if the package could not be free in usage or distribution1306 # Check if the package could not be free in usage or distribution
1283 # Allow to prefer special packages1307 # Allow to prefer special packages
@@ -1285,8 +1309,7 @@
1285 score = GSTREAMER_SCORING[pkg.name]1309 score = GSTREAMER_SCORING[pkg.name]
1286 except KeyError:1310 except KeyError:
1287 score = 01311 score = 0
1288 if pkg.name in RESTRICTED_PACKAGES or \1312 if _is_package_restricted(pkg):
1289 pkg.candidate.origins[0].component in ("non-free", "multiverse"):
1290 score -= 101313 score -= 10
1291 provides = []1314 provides = []
1292 for struct in structures:1315 for struct in structures:
@@ -1309,7 +1332,8 @@
1309 provides.append(struct.name)1332 provides.append(struct.name)
1310 struct.satisfied = True1333 struct.satisfied = True
1311 if score > struct.best_score:1334 if score > struct.best_score:
1312 struct.best_provider = pkg.name1335 struct.best_provider = pkg.name.split(":")[0]
1336 struct.best_score = score
1313 if provides:1337 if provides:
1314 provides_all = len(structures) == len(provides)1338 provides_all = len(structures) == len(provides)
1315 if not provides_all:1339 if not provides_all:
@@ -1358,7 +1382,8 @@
1358 else:1382 else:
1359 #TRANSLATORS: Separator for a list of plugins1383 #TRANSLATORS: Separator for a list of plugins
1360 details = _(",\n").join(provides)1384 details = _(",\n").join(provides)
1361 install = pkg.name in best_providers1385 # Skip the architecture from the name
1386 install = pkg.name.split(":")[0] in best_providers
1362 confirm.add_confirm_package(pkg, install, details, score)1387 confirm.add_confirm_package(pkg, install, details, score)
1363 res = confirm.run()1388 res = confirm.run()
1364 if res == Gtk.ResponseType.OK:1389 if res == Gtk.ResponseType.OK:
@@ -1468,6 +1493,14 @@
1468 text += "\n• %s" % element1493 text += "\n• %s" % element
1469 return text1494 return text
14701495
1496
1497def _is_package_restricted(pkg):
1498 """If a package is possibly restricted in use."""
1499 return (pkg.name.split(":")[0] in RESTRICTED_PACKAGES or
1500 pkg.candidate.origins[0].component in ("non-free",
1501 "restricted",
1502 "multiverse"))
1503
1471def main():1504def main():
1472 log.setLevel(logging.DEBUG)1505 log.setLevel(logging.DEBUG)
1473 si = SessionInstaller()1506 si = SessionInstaller()
14741507
=== modified file 'sessioninstaller/utils.py'
--- sessioninstaller/utils.py 2010-06-26 10:21:41 +0000
+++ sessioninstaller/utils.py 2012-03-28 10:23:18 +0000
@@ -52,6 +52,10 @@
52 use the name and comment of the applications.52 use the name and comment of the applications.
53 """53 """
54 markup = ""54 markup = ""
55 try:
56 pkg, arch = pkg.split(":")
57 except ValueError:
58 arch = None
55 if axi:59 if axi:
56 for m in axi.postlist("XP" + pkg):60 for m in axi.postlist("XP" + pkg):
57 doc = axi.get_document(m.docid)61 doc = axi.get_document(m.docid)
@@ -65,11 +69,17 @@
65 app_name = de.getName()69 app_name = de.getName()
66 app_comment = de.getComment()70 app_comment = de.getComment()
67 if app_name:71 if app_name:
68 markup += "<b>%s</b>" % app_name72 markup += "<b>%s" % app_name
73 if arch:
74 markup += " (%s)" % arch
75 markup += "</b>"
69 if app_comment:76 if app_comment:
70 markup += "\n%s" % app_comment77 markup += "\n%s" % app_comment
71 if not markup:78 if not markup:
72 markup = "<b>%s</b>" % pkg79 if arch:
80 markup = "<b>%s (%s)</b>" % (pkg, arch)
81 else:
82 markup = "<b>%s</b>" % pkg
73 if summary:83 if summary:
74 markup += "\n%s" % summary84 markup += "\n%s" % summary
75 return markup85 return markup

Subscribers

People subscribed via source and target branches