Merge lp:~mvo/software-center/lp780812 into lp:software-center

Proposed by Michael Vogt
Status: Merged
Merged at revision: 2871
Proposed branch: lp:~mvo/software-center/lp780812
Merge into: lp:software-center
Diff against target: 61 lines (+12/-9)
3 files modified
softwarecenter/db/update.py (+6/-4)
softwarecenter/ui/gtk3/models/appstore2.py (+3/-2)
test/test_reinstall_purchased.py (+3/-3)
To merge this branch: bzr merge lp:~mvo/software-center/lp780812
Reviewer Review Type Date Requested Status
Gary Lasker (community) Approve
Review via email: mp+97836@code.launchpad.net

Description of the change

This fixes the bug that for "reinstall-previous-purchases" the deb_line is not updated to the current
distro series. It updates the test as well.

There is a small drive-by-fix in there too that I noticed while working on the code. If a package is
in the cache but no longer available (in my case monster-rpg2) its displayed in the listview with a
"install" button because the code only checks for the availalbility of it in the cache.

To post a comment you must log in.
Revision history for this message
Gary Lasker (gary-lasker) wrote :

Hi Michael. I'm getting a test failure, and I think this one test in test_reinstall_purchased.py simply needs to have its expected results updated because we now properly update to the current distro series. I'll wait for you to take a double-check to make sure this is the case. Other than that, this one looks ready for merge! Thanks!

PYTHONPATH=. python test_reinstall_purchased.py
..................DEBUG:softwarecenter.db.update:indexing app 'Photobomb (already purchased)'
DEBUG:softwarecenter.db.update:WEIGHT WEIGHT_DESKTOP_X-APPINSTALL-DESCRIPTION not found
F
======================================================================
FAIL: test_reinstall_purchased_xapian (__main__.TestPurchased)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_reinstall_purchased.py", line 146, in test_reinstall_purchased_xapian
    "deb https://username:random3atoken@"
AssertionError: 'deb https://username:<email address hidden>/commercial-ppa-uploaders/photobomb/ubuntu precise main' != 'deb https://username:<email address hidden>/commercial-ppa-uploaders/photobomb/ubuntu natty main'

----------------------------------------------------------------------
Ran 19 tests in 2.839s

FAILED (failures=1)

review: Needs Fixing
Revision history for this message
Gary Lasker (gary-lasker) wrote :

I'm pretty sure the test case fix I mentioned above is correct, so I 'll just make that one-line update and merge. Let me know if this piece needs to change for any reason.

Thanks again!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'softwarecenter/db/update.py'
2--- softwarecenter/db/update.py 2012-03-15 03:52:56 +0000
3+++ softwarecenter/db/update.py 2012-03-16 10:46:24 +0000
4@@ -292,13 +292,15 @@
5
6 def get_desktop(self, key, translated=True):
7 if self._subscription_has_option_desktop(key):
8- if key.startswith('Deb-Line'):
9+ DEB_LINE_KEY = 'X-AppInstall-Deb-Line'
10+ if key.startswith(DEB_LINE_KEY):
11 debline_orig = getattr(
12- self.sca_subscription, self._apply_mapping('Deb-Line'))
13- if key == 'Deb-Line-Orig':
14+ self.sca_subscription, self._apply_mapping(DEB_LINE_KEY))
15+ if key == 'X-AppInstall-Deb-Line-Orig':
16 return debline_orig
17 else:
18- return self.update_debline(debline_orig)
19+ deb_line = self.update_debline(debline_orig)
20+ return deb_line
21
22 return getattr(self.sca_subscription, self._apply_mapping(key))
23 return super(SCAPurchasedApplicationParser, self).get_desktop(key)
24
25=== modified file 'softwarecenter/ui/gtk3/models/appstore2.py'
26--- softwarecenter/ui/gtk3/models/appstore2.py 2012-03-15 01:32:28 +0000
27+++ softwarecenter/ui/gtk3/models/appstore2.py 2012-03-16 10:46:24 +0000
28@@ -146,8 +146,9 @@
29 def is_available(self, doc):
30 if doc.available is None:
31 pkgname = self.get_pkgname(doc)
32- doc.available = (pkgname in self.cache or
33- self.is_purchasable(doc))
34+ doc.available = (
35+ (pkgname in self.cache and self.cache[pkgname].candidate)
36+ or self.is_purchasable(doc))
37 return doc.available
38
39 def is_installed(self, doc):
40
41=== modified file 'test/test_reinstall_purchased.py'
42--- test/test_reinstall_purchased.py 2012-02-15 18:02:04 +0000
43+++ test/test_reinstall_purchased.py 2012-03-16 10:46:24 +0000
44@@ -250,14 +250,14 @@
45 parser = self._make_application_parser()
46
47 expected_results = {
48- "Deb-Line": "deb https://username:random3atoken@"
49+ "X-AppInstall-Deb-Line": "deb https://username:random3atoken@"
50 "private-ppa.launchpad.net/commercial-ppa-uploaders"
51 "/photobomb/ubuntu quintessential main",
52- "Deb-Line-Orig":
53+ "X-AppInstall-Deb-Line-Orig":
54 "deb https://username:random3atoken@"
55 "private-ppa.launchpad.net/commercial-ppa-uploaders"
56 "/photobomb/ubuntu natty main",
57- "Purchased-Date": "2011-09-16 06:37:52",
58+ "X-AppInstall-Purchased-Date": "2011-09-16 06:37:52",
59 }
60 for key in expected_results:
61 result = parser.get_desktop(key)

Subscribers

People subscribed via source and target branches