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
=== modified file 'django_project/schema.py'
--- django_project/schema.py 2012-02-28 19:09:58 +0000
+++ django_project/schema.py 2012-03-26 13:01:20 +0000
@@ -28,6 +28,7 @@
28 myapps_token = schema.StringOption()28 myapps_token = schema.StringOption()
29 myapps_token_secret = schema.StringOption()29 myapps_token_secret = schema.StringOption()
30 myapps_base_url = schema.StringOption()30 myapps_base_url = schema.StringOption()
31 pkgme_maintainer_email = schema.StringOption()
31 pkgme_output_directory = schema.StringOption()32 pkgme_output_directory = schema.StringOption()
32 pkgme_output_url = schema.StringOption()33 pkgme_output_url = schema.StringOption()
33 extra_installed_apps = schema.ListOption(item=schema.StringOption())34 extra_installed_apps = schema.ListOption(item=schema.StringOption())
3435
=== modified file 'src/djpkgme/tasks.py'
--- src/djpkgme/tasks.py 2012-03-12 16:35:10 +0000
+++ src/djpkgme/tasks.py 2012-03-26 13:01:20 +0000
@@ -26,6 +26,7 @@
26 download_file,26 download_file,
27 )27 )
28from fixtures import (28from fixtures import (
29 EnvironmentVariableFixture,
29 TempDir,30 TempDir,
30 )31 )
31from pkgme import write_packaging32from pkgme import write_packaging
@@ -343,8 +344,11 @@
343 working_path = self.prepare_file(download_path, output_dir)344 working_path = self.prepare_file(download_path, output_dir)
344 metadata_filename = self.write_metadata(metadata, working_path)345 metadata_filename = self.write_metadata(metadata, working_path)
345 # Run pkgme: generate the packaging and build a source package.346 # Run pkgme: generate the packaging and build a source package.
346 write_packaging(347 debemail = settings.PKGME_MAINTAINER_EMAIL
347 working_path, allowed_backend_names=ALLOWED_BACKEND_NAMES)348 with EnvironmentVariableFixture('DEBEMAIL', debemail):
349 write_packaging(
350 working_path,
351 allowed_backend_names=ALLOWED_BACKEND_NAMES)
348 # XXX: This duplicates work done by write_packaging. However, we352 # XXX: This duplicates work done by write_packaging. However, we
349 # need the package_name in order to create the tarball in a way353 # need the package_name in order to create the tarball in a way
350 # that looks good.354 # that looks good.
351355
=== modified file 'src/djpkgme/tests/test_integration.py'
--- src/djpkgme/tests/test_integration.py 2012-03-05 11:07:58 +0000
+++ src/djpkgme/tests/test_integration.py 2012-03-26 13:01:20 +0000
@@ -15,7 +15,6 @@
15 TempDir,15 TempDir,
16 )16 )
17from pkgme.run_script import ScriptFailed17from pkgme.run_script import ScriptFailed
18from testtools import run_test_with
19from testtools.content import (18from testtools.content import (
20 Content,19 Content,
21 text_content,20 text_content,
2221
=== modified file 'src/djpkgme/tests/test_tasks.py'
--- src/djpkgme/tests/test_tasks.py 2012-03-12 14:33:13 +0000
+++ src/djpkgme/tests/test_tasks.py 2012-03-26 13:01:20 +0000
@@ -8,6 +8,10 @@
8import tarfile8import tarfile
9import traceback9import traceback
1010
11# In lucid, python-debian exports its package as 'debian_bundle'.
12from testtools import try_imports
13changelog = try_imports(['debian.changelog', 'debian_bundle.changelog'])
14
11from devportalbinary.metadata import MetadataBackend15from devportalbinary.metadata import MetadataBackend
12from django.conf import settings16from django.conf import settings
13from fixtures import TempDir17from fixtures import TempDir
@@ -626,3 +630,29 @@
626 basename = os.path.basename(output_tar_path)630 basename = os.path.basename(output_tar_path)
627 cleaned_package_name = PackageName.clean(name)631 cleaned_package_name = PackageName.clean(name)
628 self.assertEqual("%s.tar.gz" % cleaned_package_name, basename)632 self.assertEqual("%s.tar.gz" % cleaned_package_name, basename)
633
634 def test_uses_pkgme_maintainer_email(self):
635 unpack_dir = self.useFixture(TempDir()).path
636 metadata = self.factory.make_metadata()
637 debemail = 'Dude <dude@example.com>'
638 with patch_settings(PKGME_MAINTAINER_EMAIL=debemail):
639 output_tar_path = self.run_task(
640 metadata, self.factory.make_packagable_tarball())
641 output_tar = tarfile.open(output_tar_path, 'r:gz')
642 try:
643 output_tar.extractall(unpack_dir)
644 finally:
645 output_tar.close()
646 package_name = metadata['package_name']
647 package_tarball_path = os.path.join(
648 unpack_dir, '%s_0.tar.gz' % (package_name,))
649 t = tarfile.open(package_tarball_path)
650 try:
651 t.extractall(unpack_dir)
652 finally:
653 t.close()
654 debian_dir = os.path.join(unpack_dir, package_name, 'debian')
655 changelog_path = os.path.join(debian_dir, 'changelog')
656 cl = changelog.Changelog(open(changelog_path).read())
657 [change_block] = list(cl)
658 self.assertEqual(debemail, change_block.author)

Subscribers

People subscribed via source and target branches