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
=== modified file 'debian/changelog'
--- debian/changelog 2011-02-10 08:25:06 +0000
+++ debian/changelog 2011-03-03 02:19:29 +0000
@@ -1,3 +1,14 @@
1software-center (3.0.9) UNRELEASED; urgency=low
2
3 * softwarecenter/db/update.py,
4 test/test_appview.py,
5 test/test_database.py:
6 - track cataloged_time for items not in axi (e.g. for-purchase apps)
7 so that they will show up in What's New, add/modify unit tests
8 per the changes (LP: #684077)
9
10 -- Gary Lasker <gary.lasker@canonical.com> Wed, 02 Mar 2011 17:29:11 -0500
11
1software-center (3.0.8) maverick-proposed; urgency=low12software-center (3.0.8) maverick-proposed; urgency=low
213
3 [ Gary Lasker ]14 [ Gary Lasker ]
415
=== modified file 'softwarecenter/db/update.py'
--- softwarecenter/db/update.py 2010-09-29 11:19:48 +0000
+++ softwarecenter/db/update.py 2011-03-03 02:19:29 +0000
@@ -426,9 +426,14 @@
426 doc.add_value(XAPIAN_VALUE_PKGNAME, pkgname)426 doc.add_value(XAPIAN_VALUE_PKGNAME, pkgname)
427 doc.add_value(XAPIAN_VALUE_DESKTOP_FILE, parser.desktopf)427 doc.add_value(XAPIAN_VALUE_DESKTOP_FILE, parser.desktopf)
428 # cataloged_times428 # cataloged_times
429 if pkgname in cataloged_times and "catalogedtime" in axi_values:429 if "catalogedtime" in axi_values:
430 doc.add_value(axi_values["catalogedtime"], 430 if pkgname in cataloged_times:
431 xapian.sortable_serialise(cataloged_times[pkgname]))431 doc.add_value(axi_values["catalogedtime"],
432 xapian.sortable_serialise(cataloged_times[pkgname]))
433 else:
434 # also catalog apps not found in axi (e.g. for-purchase apps)
435 doc.add_value(axi_values["catalogedtime"],
436 xapian.sortable_serialise(time.time()))
432 # pocket (main, restricted, ...)437 # pocket (main, restricted, ...)
433 if parser.has_option_desktop("X-AppInstall-Section"):438 if parser.has_option_desktop("X-AppInstall-Section"):
434 archive_section = parser.get_desktop("X-AppInstall-Section")439 archive_section = parser.get_desktop("X-AppInstall-Section")
435440
=== modified file 'test/test_appview.py'
--- test/test_appview.py 2010-09-08 03:13:07 +0000
+++ test/test_appview.py 2011-03-03 02:19:29 +0000
@@ -86,16 +86,22 @@
86 enquire.set_query(query)86 enquire.set_query(query)
87 valueno = self.db._axi_values["catalogedtime"]87 valueno = self.db._axi_values["catalogedtime"]
88 enquire.set_sort_by_value(int(valueno), reverse=True)88 enquire.set_sort_by_value(int(valueno), reverse=True)
89 matches = enquire.get_mset(0, 20)89 matches = enquire.get_mset(0, 10)
90 for m in matches:90 for m in matches:
91 doc = db.get_document(m.docid)91 doc = db.get_document(m.docid)
92 #print xapian.sortable_unserialise(doc.get_value(valueno))92 #print xapian.sortable_unserialise(doc.get_value(valueno))
93 sorted_by_axi.append(self.db.get_pkgname(doc))93 sorted_by_axi.append(self.db.get_pkgname(doc))
94 # now compare to what we get from the store94 # now compare to what we get from the store
95 sorted_by_appstore = []95 sorted_by_appstore = []
96 # we don't want to include items for purchase in the compare,
97 # since although tagged with cataloged_time values, they don't
98 # actually appear in the axi
99 for_purchase_query = xapian.Query("AH" + AVAILABLE_FOR_PURCHASE_MAGIC_CHANNEL_NAME)
100 store_query = xapian.Query(xapian.Query.OP_AND_NOT,
101 query, for_purchase_query)
96 store = AppStore(self.cache, self.db, self.mock_icons, 102 store = AppStore(self.cache, self.db, self.mock_icons,
97 sortmode=SORT_BY_CATALOGED_TIME,103 sortmode=SORT_BY_CATALOGED_TIME,
98 limit=20, search_query=query,104 limit=10, search_query=store_query,
99 nonapps_visible=True)105 nonapps_visible=True)
100 for item in store:106 for item in store:
101 sorted_by_appstore.append(item[AppStore.COL_PKGNAME])107 sorted_by_appstore.append(item[AppStore.COL_PKGNAME])
102108
=== modified file 'test/test_database.py'
--- test/test_database.py 2010-09-21 13:52:00 +0000
+++ test/test_database.py 2011-03-03 02:19:29 +0000
@@ -224,6 +224,24 @@
224 doc = m.document224 doc = m.document
225 doc.get_value(value_time) >= last_time225 doc.get_value(value_time) >= last_time
226 last_time = doc.get_value(value_time)226 last_time = doc.get_value(value_time)
227
228 def test_non_axi_apps_cataloged_time(self):
229 db = xapian.WritableDatabase("./data/test.db",
230 xapian.DB_CREATE_OR_OVERWRITE)
231 res = update_from_app_install_data(db, self.cache, datadir="./data/")
232 db = StoreDatabase("./data/test.db", self.cache)
233 db.open(use_axi=True)
234
235 axi_value_time = db._axi_values["catalogedtime"]
236 sc_app = Application("Ubuntu Software Center Test", "software-center")
237 sc_doc = db.get_xapian_document(sc_app.appname, sc_app.pkgname)
238 sc_cataloged_time = sc_doc.get_value(axi_value_time)
239 so_app = Application("Scintillant Orange", "scintillant-orange")
240 so_doc = db.get_xapian_document(so_app.appname, so_app.pkgname)
241 so_cataloged_time = so_doc.get_value(axi_value_time)
242 # the test package Scintillant Orange should be cataloged at a
243 # later time than axi package Ubuntu Software Center
244 self.assertTrue(so_cataloged_time > sc_cataloged_time)
227245
228 def test_parse_axi_values_file(self):246 def test_parse_axi_values_file(self):
229 s = """247 s = """

Subscribers

People subscribed via source and target branches