Merge lp:~gary-lasker/software-center/for-3.0-fix-lp684077 into lp:software-center/3.0

Proposed by Gary Lasker
Status: Merged
Merged at revision: 1123
Proposed branch: lp:~gary-lasker/software-center/for-3.0-fix-lp684077
Merge into: lp:software-center/3.0
Diff against target: 98 lines (+45/-5)
4 files modified
debian/changelog (+11/-0)
softwarecenter/db/update.py (+8/-3)
test/test_appview.py (+8/-2)
test/test_database.py (+18/-0)
To merge this branch: bzr merge lp:~gary-lasker/software-center/for-3.0-fix-lp684077
Reviewer Review Type Date Requested Status
software-store-developers Pending
Review via email: mp+51999@code.launchpad.net

Description of the change

This fix for bug 684077 is cherrypicked from natty. It includes unit tests updated for the 3.0 branch.

Thanks!

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2011-02-10 08:25:06 +0000
3+++ debian/changelog 2011-03-03 02:19:29 +0000
4@@ -1,3 +1,14 @@
5+software-center (3.0.9) UNRELEASED; urgency=low
6+
7+ * softwarecenter/db/update.py,
8+ test/test_appview.py,
9+ test/test_database.py:
10+ - track cataloged_time for items not in axi (e.g. for-purchase apps)
11+ so that they will show up in What's New, add/modify unit tests
12+ per the changes (LP: #684077)
13+
14+ -- Gary Lasker <gary.lasker@canonical.com> Wed, 02 Mar 2011 17:29:11 -0500
15+
16 software-center (3.0.8) maverick-proposed; urgency=low
17
18 [ Gary Lasker ]
19
20=== modified file 'softwarecenter/db/update.py'
21--- softwarecenter/db/update.py 2010-09-29 11:19:48 +0000
22+++ softwarecenter/db/update.py 2011-03-03 02:19:29 +0000
23@@ -426,9 +426,14 @@
24 doc.add_value(XAPIAN_VALUE_PKGNAME, pkgname)
25 doc.add_value(XAPIAN_VALUE_DESKTOP_FILE, parser.desktopf)
26 # cataloged_times
27- if pkgname in cataloged_times and "catalogedtime" in axi_values:
28- doc.add_value(axi_values["catalogedtime"],
29- xapian.sortable_serialise(cataloged_times[pkgname]))
30+ if "catalogedtime" in axi_values:
31+ if pkgname in cataloged_times:
32+ doc.add_value(axi_values["catalogedtime"],
33+ xapian.sortable_serialise(cataloged_times[pkgname]))
34+ else:
35+ # also catalog apps not found in axi (e.g. for-purchase apps)
36+ doc.add_value(axi_values["catalogedtime"],
37+ xapian.sortable_serialise(time.time()))
38 # pocket (main, restricted, ...)
39 if parser.has_option_desktop("X-AppInstall-Section"):
40 archive_section = parser.get_desktop("X-AppInstall-Section")
41
42=== modified file 'test/test_appview.py'
43--- test/test_appview.py 2010-09-08 03:13:07 +0000
44+++ test/test_appview.py 2011-03-03 02:19:29 +0000
45@@ -86,16 +86,22 @@
46 enquire.set_query(query)
47 valueno = self.db._axi_values["catalogedtime"]
48 enquire.set_sort_by_value(int(valueno), reverse=True)
49- matches = enquire.get_mset(0, 20)
50+ matches = enquire.get_mset(0, 10)
51 for m in matches:
52 doc = db.get_document(m.docid)
53 #print xapian.sortable_unserialise(doc.get_value(valueno))
54 sorted_by_axi.append(self.db.get_pkgname(doc))
55 # now compare to what we get from the store
56 sorted_by_appstore = []
57+ # we don't want to include items for purchase in the compare,
58+ # since although tagged with cataloged_time values, they don't
59+ # actually appear in the axi
60+ for_purchase_query = xapian.Query("AH" + AVAILABLE_FOR_PURCHASE_MAGIC_CHANNEL_NAME)
61+ store_query = xapian.Query(xapian.Query.OP_AND_NOT,
62+ query, for_purchase_query)
63 store = AppStore(self.cache, self.db, self.mock_icons,
64 sortmode=SORT_BY_CATALOGED_TIME,
65- limit=20, search_query=query,
66+ limit=10, search_query=store_query,
67 nonapps_visible=True)
68 for item in store:
69 sorted_by_appstore.append(item[AppStore.COL_PKGNAME])
70
71=== modified file 'test/test_database.py'
72--- test/test_database.py 2010-09-21 13:52:00 +0000
73+++ test/test_database.py 2011-03-03 02:19:29 +0000
74@@ -224,6 +224,24 @@
75 doc = m.document
76 doc.get_value(value_time) >= last_time
77 last_time = doc.get_value(value_time)
78+
79+ def test_non_axi_apps_cataloged_time(self):
80+ db = xapian.WritableDatabase("./data/test.db",
81+ xapian.DB_CREATE_OR_OVERWRITE)
82+ res = update_from_app_install_data(db, self.cache, datadir="./data/")
83+ db = StoreDatabase("./data/test.db", self.cache)
84+ db.open(use_axi=True)
85+
86+ axi_value_time = db._axi_values["catalogedtime"]
87+ sc_app = Application("Ubuntu Software Center Test", "software-center")
88+ sc_doc = db.get_xapian_document(sc_app.appname, sc_app.pkgname)
89+ sc_cataloged_time = sc_doc.get_value(axi_value_time)
90+ so_app = Application("Scintillant Orange", "scintillant-orange")
91+ so_doc = db.get_xapian_document(so_app.appname, so_app.pkgname)
92+ so_cataloged_time = so_doc.get_value(axi_value_time)
93+ # the test package Scintillant Orange should be cataloged at a
94+ # later time than axi package Ubuntu Software Center
95+ self.assertTrue(so_cataloged_time > sc_cataloged_time)
96
97 def test_parse_axi_values_file(self):
98 s = """

Subscribers

People subscribed via source and target branches