Merge lp:~dholbach/harvest/packagesets into lp:harvest
Proposed by
Daniel Holbach
Status: | Superseded |
---|---|
Proposed branch: | lp:~dholbach/harvest/packagesets |
Merge into: | lp:harvest |
Prerequisite: | lp:~dholbach/harvest/schema-changes |
Diff against target: |
276 lines (+136/-72) 8 files modified
INSTALL (+21/-61) harvest/common/launchpad.py (+46/-0) harvest/common/utils.py (+0/-9) harvest/opportunities/management/commands/init-harvest.py (+24/-0) harvest/opportunities/management/commands/updatepackagesets.py (+41/-0) harvest/opportunities/models.py (+3/-0) harvest/opportunities/views.py (+0/-2) harvest/settings.py.sample (+1/-0) |
To merge this branch: | bzr merge lp:~dholbach/harvest/packagesets |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Paul Hummer (community) | Needs Information | ||
harvest-dev | Pending | ||
Review via email: mp+17900@code.launchpad.net |
This proposal has been superseded by a proposal from 2010-01-27.
To post a comment you must log in.
=== added file 'harvest/ common/ launchpad. py' common/ launchpad. py 1970-01-01 00:00:00 +0000 common/ launchpad. py 2010-01-22 17:07:20 +0000 launchpad import Launchpad, EDGE_SERVICE_ROOT credentials import Credentials lp_instance= EDGE_SERVICE_ ROOT):
--- harvest/
+++ harvest/
@@ -0,0 +1,38 @@
+from launchpadlib.
+from launchpadlib.
+from launchpadlib.errors import HTTPError
+
+from django.conf import settings
+
+import sys
+import os
+
+def lp_login(
A docstring here would be really helpful. Something like:
"""Return a logged in launchpad object."""
+ cachedir = os.path. join(settings. PROJECT_ PATH, 'lp_data/cache') join(settings. PROJECT_ PATH, 'lp_data/ lp_credentials' ) PROJECT_ NAME.strip( ) isdir(creddir) : creddir) join(creddir, '%s.credentials' % project) exists( cred): load(open( cred)) credentials, lp_instance, cachedir) get_token_ and_login( project, lp_instance,
+ creddir = os.path.
+ project = settings.
+ if not os.path.
+ os.makedirs(
+ cred = os.path.
+
+ if os.path.
+ credentials = Credentials()
+ credentials.
+ launchpad = Launchpad(
+ else:
+ try:
+ launchpad = Launchpad.
+ cachedir)
+ except HTTPError, e:
+ print >> sys.stderr, 'Error connecting to Launchpad: %s' % str(e)
+ sys.exit(1)
It would be better to raise an exception here, instead of printing to standard error and exiting. Sometimes the e part of the except is rather unhelpful.
+ f = open(cred, 'w') credentials. save(f) (lp): s['ubuntu' ].current_ series
+ os.chmod(cred, 0600)
+ launchpad.
+ f.close()
+ return launchpad
+
+def get_packagesets
+ current_series = lp.distribution
+ packagesets = filter(lambda a: a.distroseries == current_series, lp.packagesets)
+ return packagesets
=== modified file 'harvest/ opportunities/ models. py' opportunities/ models. py 2010-01-22 17:07:20 +0000 opportunities/ models. py 2010-01-22 17:07:20 +0000 THRESHOLD = 200
--- harvest/
+++ harvest/
@@ -7,9 +7,12 @@
TYPE_GREEN_
TYPE_RED_THRESHOLD = 1000
+class PackageSet( models. Model): SlugField( _("Name" ), max_length=40)
+ name = models.
class SourcePackage( models. Model): SlugField( _("Name" ), max_length=70) ManyToManyField (PackageSet, null=True)
name = models.
+ packagesets = models.
class Meta:
ordering = ['name']
So, by this model definition, is it safe to say that packages can be in many different package sets? Have you tested this at all? I think we need a property on packagesets that can link back to the SourcePackages as well.