Merge lp:~albertomilone/jockey/pkg-version into lp:jockey

Proposed by Alberto Milone on 2010-04-11
Status: Needs review
Proposed branch: lp:~albertomilone/jockey/pkg-version
Merge into: lp:jockey
Diff against target: 93 lines (+18/-1)
5 files modified
jockey/backend.py (+1/-0)
jockey/handlers.py (+9/-0)
jockey/ui.py (+4/-1)
tests/backend.py (+2/-0)
tests/handlers.py (+2/-0)
To merge this branch: bzr merge lp:~albertomilone/jockey/pkg-version
Reviewer Review Type Date Requested Status
Martin Pitt (community) 2010-04-11 Disapprove on 2010-04-12
Review via email: mp+23189@code.launchpad.net

Description of the change

This branch adds initial support for retrieving the package version which, together with the code in pkg-version-ubuntu, allows us to fix LP: #543176

To post a comment you must log in.
Martin Pitt (pitti) wrote :

Looks fine, please merge.

review: Approve
Martin Pitt (pitti) wrote :

Erm, wait a minute. A handler already has a "version" field. When I saw that patch, I thought we just forgot to export it, but we do. Why doesn't the nvidia driver just set this?

review: Needs Information
Martin Pitt (pitti) wrote :

Discussed on IRC. IMHO this will introduce duplicate structures into the core code which we won't ever get rid of again, and only for a corner case. Remember that you explicitly wanted to name the package "current", not "195"; so we should actually call it "current". Otherwise it'll create more confusion than it solves, since the package names in Jockey do not (always) reflect the package names in software-center etc.

If i18n is a concern, we have the ability to translate package descriptions, so maybe we should use that?

review: Disapprove
Alberto Milone (albertomilone) wrote :

A few things depend on the version field (in which we can find the driver flavour) already: the kernel module name, the package name and the recommended() method.

The package version doesn't necessarily match the driver flavour.

Unmerged revisions

627. By Alberto Milone on 2010-04-11

Add pkg_version() method which determines the value
of handler_info['pkg_version'].

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'jockey/backend.py'
2--- jockey/backend.py 2010-03-11 16:11:53 +0000
3+++ jockey/backend.py 2010-04-11 19:09:16 +0000
4@@ -237,6 +237,7 @@
5 'changed': str(h.changed()),
6 'recommended': str(h.recommended()),
7 'announce': str(h.announce),
8+ 'pkg_version': str(h.pkg_version()),
9 }
10 for f in ['description', 'rationale', 'can_change']:
11 v = getattr(h, f)()
12
13=== modified file 'jockey/handlers.py'
14--- jockey/handlers.py 2010-02-01 23:56:33 +0000
15+++ jockey/handlers.py 2010-04-11 19:09:16 +0000
16@@ -77,6 +77,7 @@
17 self.version = None
18 self.repository = None
19 self._recommended = False
20+ self._pkg_version = None
21
22 def _package_defaults(self):
23 '''Set fallback name/description/freeness from package.'''
24@@ -190,6 +191,14 @@
25 version of a driver is provided, then it should return False.
26 '''
27 return self._recommended
28+
29+ def pkg_version(self):
30+ '''Return the package version of a certain driver.
31+
32+ This method should return the package version retrieved by the package
33+ manager.
34+ '''
35+ return self._pkg_version
36
37 def available(self):
38 '''Return if the conditions to use this handler on the system are met.
39
40=== modified file 'jockey/ui.py'
41--- jockey/ui.py 2010-04-08 07:41:46 +0000
42+++ jockey/ui.py 2010-04-11 19:09:16 +0000
43@@ -243,7 +243,10 @@
44 result = handler_info['name']
45 result = self._(result)
46 if 'version' in handler_info:
47- result += ' (%s)' % (self._('version %s') % handler_info['version'])
48+ if 'pkg_version' in handler_info:
49+ result += ' (%s)' % (self._('version %s') % handler_info['pkg_version'])
50+ else:
51+ result += ' (%s)' % (self._('version %s') % handler_info['version'])
52 if bool(handler_info['recommended']):
53 result += ' [%s]' % self.string_recommended
54 return result
55
56=== modified file 'tests/backend.py'
57--- tests/backend.py 2009-09-21 11:21:44 +0000
58+++ tests/backend.py 2010-04-11 19:09:16 +0000
59@@ -122,6 +122,7 @@
60 'changed': 'False',
61 'recommended': 'False',
62 'announce': 'True',
63+ 'pkg_version': 'None',
64 })
65
66 def test_set_enabled(self):
67@@ -333,6 +334,7 @@
68 'package': 'mesa-vanilla',
69 'recommended': 'False',
70 'announce': 'True',
71+ 'pkg_version': 'None',
72 })
73
74 def test_handler_files(self):
75
76=== modified file 'tests/handlers.py'
77--- tests/handlers.py 2009-04-01 08:24:07 +0000
78+++ tests/handlers.py 2010-04-11 19:09:16 +0000
79@@ -132,6 +132,7 @@
80 self.assert_(h.free())
81 self.assert_(h.enabled())
82 self.assertEqual(h.recommended(), False)
83+ self.assertEqual(h.pkg_version(), None)
84 self.assert_(h.used())
85 self.assertEqual(h.available(), None)
86
87@@ -166,6 +167,7 @@
88 self.failIf(h.free())
89 self.assert_(h.enabled())
90 self.assertEqual(h.recommended(), False)
91+ self.assertEqual(h.pkg_version(), None)
92 self.failIf(h.used())
93 self.assertEqual(h.available(), None)
94

Subscribers

People subscribed via source and target branches

to status/vote changes: