← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:py3-sort-archive-package-description-cache into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:py3-sort-archive-package-description-cache into launchpad:master.

Commit message:
Sort Archive.package_description_cache

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/398262

Its order is otherwise nondeterministic.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-sort-archive-package-description-cache into launchpad:master.
diff --git a/lib/lp/soyuz/doc/package-cache.txt b/lib/lp/soyuz/doc/package-cache.txt
index 61b7260..d99eaa4 100644
--- a/lib/lp/soyuz/doc/package-cache.txt
+++ b/lib/lp/soyuz/doc/package-cache.txt
@@ -404,7 +404,7 @@ information will be available, no packages information will be cached.
     0
 
     >>> print(cprov.archive.package_description_cache)
-    celso providelo cprov
+    celso cprov providelo
 
 We insert a new source cache with texts containing punctuation and
 duplicated words pointing to Celso's PPA.
@@ -438,7 +438,7 @@ unique and lowercase words free of any punctuation.
     0
 
     >>> print(cprov.archive.package_description_cache)
-    ding providelo celso cdrkit cdrkit-bin dong ubuntu cdrkit-extra cprov
+    cdrkit cdrkit-bin cdrkit-extra celso cprov ding dong providelo ubuntu
 
 Let's remove the unclean cache and update Celso's PPA cache, so
 everything will be back to normal.
diff --git a/lib/lp/soyuz/model/archive.py b/lib/lp/soyuz/model/archive.py
index 50774b5..df275c1 100644
--- a/lib/lp/soyuz/model/archive.py
+++ b/lib/lp/soyuz/model/archive.py
@@ -1092,7 +1092,7 @@ class Archive(SQLBase):
 
         # Collapse all relevant terms in 'package_description_cache' and
         # update the package counters.
-        self.package_description_cache = " ".join(cache_contents)
+        self.package_description_cache = " ".join(sorted(cache_contents))
         self.sources_cached = sources_cached.count()
         self.binaries_cached = binaries_cached.count()