← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~jelmer/launchpad/gina-reuse into lp:launchpad

 

Jelmer Vernooij has proposed merging lp:~jelmer/launchpad/gina-reuse into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~jelmer/launchpad/gina-reuse/+merge/45008

Eliminate a bit of code duplication between Soyuz and Gina - the urgency map dictionary.

This branch also cleans up some lint in gina.
-- 
https://code.launchpad.net/~jelmer/launchpad/gina-reuse/+merge/45008
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jelmer/launchpad/gina-reuse into lp:launchpad.
=== modified file 'lib/lp/soyuz/scripts/gina/handlers.py'
--- lib/lp/soyuz/scripts/gina/handlers.py	2010-11-23 07:44:56 +0000
+++ lib/lp/soyuz/scripts/gina/handlers.py	2011-01-02 22:40:39 +0000
@@ -40,6 +40,7 @@
     determine_binary_file_type,
     determine_source_file_type,
     )
+from lp.archiveuploader.changesfile import ChangesFile
 from lp.buildmaster.enums import BuildStatus
 from lp.registry.interfaces.person import (
     IPersonSet,
@@ -66,7 +67,6 @@
     PoolFileNotFound,
     prioritymap,
     SourcePackageData,
-    urgencymap,
     )
 
 
@@ -638,7 +638,7 @@
             sourcepackagename=name.id,
             maintainer=maintainer.id,
             dscsigningkey=key,
-            urgency=urgencymap[src.urgency],
+            urgency=ChangesFile.urgency_map[src.urgency],
             dateuploaded=src.date_uploaded,
             dsc=src.dsc,
             copyright=src.copyright,

=== modified file 'lib/lp/soyuz/scripts/gina/packages.py'
--- lib/lp/soyuz/scripts/gina/packages.py	2010-12-01 11:26:57 +0000
+++ lib/lp/soyuz/scripts/gina/packages.py	2011-01-02 22:40:39 +0000
@@ -19,7 +19,6 @@
     'PoolFileNotFound',
     'prioritymap',
     'SourcePackageData',
-    'urgencymap',
     ]
 
 import glob
@@ -34,12 +33,12 @@
 from canonical.launchpad.scripts import log
 from canonical.launchpad.validators.version import valid_debian_version
 from lp.archivepublisher.diskpool import poolify
+from lp.archiveuploader.changesfile import ChangesFile
 from lp.archiveuploader.utils import (
     DpkgSourceError,
     extract_dpkg_source,
     )
 from lp.registry.interfaces.gpg import GPGKeyAlgorithm
-from lp.registry.interfaces.sourcepackage import SourcePackageUrgency
 from lp.soyuz.enums import PackagePublishingPriority
 from lp.soyuz.scripts.gina import (
     call,
@@ -51,13 +50,6 @@
 # Data setup
 #
 
-urgencymap = {
-    "low": SourcePackageUrgency.LOW,
-    "medium": SourcePackageUrgency.MEDIUM,
-    "high": SourcePackageUrgency.HIGH,
-    "emergency": SourcePackageUrgency.EMERGENCY,
-    }
-
 prioritymap = {
     "required": PackagePublishingPriority.REQUIRED,
     "important": PackagePublishingPriority.IMPORTANT,
@@ -430,7 +422,7 @@
                      (self.package, "1.0"))
             self.format = "1.0"
 
-        if self.urgency not in urgencymap:
+        if self.urgency not in ChangesFile.urgency_map:
             log.warn("Invalid urgency in %s, %r, assumed %r" %
                      (self.package, self.urgency, "low"))
             self.urgency = "low"