Merge lp:~jml/pkgme-service/set-debemail into lp:pkgme-service

Proposed by Jonathan Lange
Status: Rejected
Rejected by: Jonathan Lange
Proposed branch: lp:~jml/pkgme-service/set-debemail
Merge into: lp:pkgme-service
Diff against target: 94 lines (+37/-3)
4 files modified
django_project/schema.py (+1/-0)
src/djpkgme/tasks.py (+6/-2)
src/djpkgme/tests/test_integration.py (+0/-1)
src/djpkgme/tests/test_tasks.py (+30/-0)
To merge this branch: bzr merge lp:~jml/pkgme-service/set-debemail
Reviewer Review Type Date Requested Status
James Westby (community) Approve
Review via email: mp+99305@code.launchpad.net

Commit message

Set the DEBEMAIL based on a configuration setting.

Description of the change

This branch adds a config field called PKGME_MAINTAINER_EMAIL and uses that config field to set the DEBEMAIL environment variable while pkgme is running.

This in turn causes pkgme to use PKGME_MAINTAINER_EMAIL as the value of the maintainer field in the changelog entry that it creates. Of course, this relies on https://code.launchpad.net/~jml/pkgme/default-maintainer/+merge/99299 to actually work.

I haven't updated any configs because I'm not exactly sure which ones to update. We'll want to set the production value to the email address of https://launchpad.net/~ca-pkgme-service-bot, which a full name like "pkgme-service production bot" or something. I guess it would be nice to use a different email address in development environments.

To post a comment you must log in.
Revision history for this message
James Westby (james-w) wrote :

Hi,

I think I would have done this using the devportal-metadata.json as I find
environment variables to be a little distasteful, but I have no problem with
merging this.

Given that this assumes that the setting is set, I would add it to the main.cfg
so it is always set to start with. I think it has to be added to the configglue
schema as well.

Thanks,

James

review: Approve

Unmerged revisions

80. By Jonathan Lange

Add a setting PKGME_MAINTAINER_EMAIL and use that to set the maintainer
for packages made by pkgme.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'django_project/schema.py'
2--- django_project/schema.py 2012-02-28 19:09:58 +0000
3+++ django_project/schema.py 2012-03-26 13:01:20 +0000
4@@ -28,6 +28,7 @@
5 myapps_token = schema.StringOption()
6 myapps_token_secret = schema.StringOption()
7 myapps_base_url = schema.StringOption()
8+ pkgme_maintainer_email = schema.StringOption()
9 pkgme_output_directory = schema.StringOption()
10 pkgme_output_url = schema.StringOption()
11 extra_installed_apps = schema.ListOption(item=schema.StringOption())
12
13=== modified file 'src/djpkgme/tasks.py'
14--- src/djpkgme/tasks.py 2012-03-12 16:35:10 +0000
15+++ src/djpkgme/tasks.py 2012-03-26 13:01:20 +0000
16@@ -26,6 +26,7 @@
17 download_file,
18 )
19 from fixtures import (
20+ EnvironmentVariableFixture,
21 TempDir,
22 )
23 from pkgme import write_packaging
24@@ -343,8 +344,11 @@
25 working_path = self.prepare_file(download_path, output_dir)
26 metadata_filename = self.write_metadata(metadata, working_path)
27 # Run pkgme: generate the packaging and build a source package.
28- write_packaging(
29- working_path, allowed_backend_names=ALLOWED_BACKEND_NAMES)
30+ debemail = settings.PKGME_MAINTAINER_EMAIL
31+ with EnvironmentVariableFixture('DEBEMAIL', debemail):
32+ write_packaging(
33+ working_path,
34+ allowed_backend_names=ALLOWED_BACKEND_NAMES)
35 # XXX: This duplicates work done by write_packaging. However, we
36 # need the package_name in order to create the tarball in a way
37 # that looks good.
38
39=== modified file 'src/djpkgme/tests/test_integration.py'
40--- src/djpkgme/tests/test_integration.py 2012-03-05 11:07:58 +0000
41+++ src/djpkgme/tests/test_integration.py 2012-03-26 13:01:20 +0000
42@@ -15,7 +15,6 @@
43 TempDir,
44 )
45 from pkgme.run_script import ScriptFailed
46-from testtools import run_test_with
47 from testtools.content import (
48 Content,
49 text_content,
50
51=== modified file 'src/djpkgme/tests/test_tasks.py'
52--- src/djpkgme/tests/test_tasks.py 2012-03-12 14:33:13 +0000
53+++ src/djpkgme/tests/test_tasks.py 2012-03-26 13:01:20 +0000
54@@ -8,6 +8,10 @@
55 import tarfile
56 import traceback
57
58+# In lucid, python-debian exports its package as 'debian_bundle'.
59+from testtools import try_imports
60+changelog = try_imports(['debian.changelog', 'debian_bundle.changelog'])
61+
62 from devportalbinary.metadata import MetadataBackend
63 from django.conf import settings
64 from fixtures import TempDir
65@@ -626,3 +630,29 @@
66 basename = os.path.basename(output_tar_path)
67 cleaned_package_name = PackageName.clean(name)
68 self.assertEqual("%s.tar.gz" % cleaned_package_name, basename)
69+
70+ def test_uses_pkgme_maintainer_email(self):
71+ unpack_dir = self.useFixture(TempDir()).path
72+ metadata = self.factory.make_metadata()
73+ debemail = 'Dude <dude@example.com>'
74+ with patch_settings(PKGME_MAINTAINER_EMAIL=debemail):
75+ output_tar_path = self.run_task(
76+ metadata, self.factory.make_packagable_tarball())
77+ output_tar = tarfile.open(output_tar_path, 'r:gz')
78+ try:
79+ output_tar.extractall(unpack_dir)
80+ finally:
81+ output_tar.close()
82+ package_name = metadata['package_name']
83+ package_tarball_path = os.path.join(
84+ unpack_dir, '%s_0.tar.gz' % (package_name,))
85+ t = tarfile.open(package_tarball_path)
86+ try:
87+ t.extractall(unpack_dir)
88+ finally:
89+ t.close()
90+ debian_dir = os.path.join(unpack_dir, package_name, 'debian')
91+ changelog_path = os.path.join(debian_dir, 'changelog')
92+ cl = changelog.Changelog(open(changelog_path).read())
93+ [change_block] = list(cl)
94+ self.assertEqual(debemail, change_block.author)

Subscribers

People subscribed via source and target branches