Merge lp:~mvo/pkgme/not-native-by-default into lp:pkgme

Proposed by Michael Vogt
Status: Superseded
Proposed branch: lp:~mvo/pkgme/not-native-by-default
Merge into: lp:pkgme
Diff against target: 155 lines (+75/-4)
6 files modified
pkgme/bin/main.py (+5/-1)
pkgme/debuild.py (+28/-0)
pkgme/package_files.py (+1/-1)
pkgme/tests/test_debuild.py (+38/-0)
pkgme/tests/test_package_files.py (+1/-1)
pkgme/tests/test_script.py (+2/-1)
To merge this branch: bzr merge lp:~mvo/pkgme/not-native-by-default
Reviewer Review Type Date Requested Status
Michael Vogt (community) Needs Resubmitting
Jonathan Lange Approve
Review via email: mp+115805@code.launchpad.net

This proposal has been superseded by a proposal from 2012-07-20.

Commit message

Make non-native packages by default.

Description of the change

This branch make pkgme create non-native branches by default.

The reason I suggest this is:
- Its conceptually cleaner to split the package into the orig and the debian part. Now that is not very relevant.
- If the packaging needs tweaking or updating this way the packager just needs to update and upload debian changes instead of the entire package. For large packages this is a significant win. This will not be relevant anymore when pkgme is perfect.

This is a modified version of the previous version that avoids breaking pkgme-service by making build_orig_tar_gz part of build_source_package.

To post a comment you must log in.
Revision history for this message
Michael Vogt (mvo) wrote :

<mvo> james_w: cool, so test+docstring+better place and we are good to go?
<james_w> mvo, I think so

I will work on this tomorrow morning.

review: Needs Fixing
Revision history for this message
Michael Vogt (mvo) wrote :

I added a docstring and a (functional) test now. I also switched from source format 1.0 back to 3.0, but quilt this time. Please have a look at let me know what you think.

Revision history for this message
Jonathan Lange (jml) wrote :

Code looks great, and thanks to your update I understand why we want to do this. Thank you!

review: Approve
Revision history for this message
Michael Vogt (mvo) wrote :

After merging this broke the world^Wpkgme-service I modified it so that now build_orig_tar_gz() run as part of build_source_package() which is ok I think. Alternatively I can change pkgme-service if that is a preferable way to fix this problem.

review: Needs Resubmitting
lp:~mvo/pkgme/not-native-by-default updated
126. By Michael Vogt

merge trunk

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'pkgme/bin/main.py'
--- pkgme/bin/main.py 2012-06-11 00:11:40 +0000
+++ pkgme/bin/main.py 2012-07-20 05:30:28 +0000
@@ -11,7 +11,10 @@
11 get_backend_selector,11 get_backend_selector,
12 get_default_loader,12 get_default_loader,
13 )13 )
14from pkgme.debuild import build_source_package14from pkgme.debuild import (
15 build_orig_tar_gz,
16 build_source_package,
17 )
15from pkgme.upload import (18from pkgme.upload import (
16 InvalidPPAName,19 InvalidPPAName,
17 parse_ppa_name,20 parse_ppa_name,
@@ -135,6 +138,7 @@
135 sign = None138 sign = None
136 else:139 else:
137 sign = not options.nosign140 sign = not options.nosign
141 build_orig_tar_gz(target_dir)
138 build_package(142 build_package(
139 target_dir, interactive=interactive, ppa=options.ppa,143 target_dir, interactive=interactive, ppa=options.ppa,
140 sign=sign)144 sign=sign)
141145
=== modified file 'pkgme/debuild.py'
--- pkgme/debuild.py 2011-08-01 12:53:04 +0000
+++ pkgme/debuild.py 2012-07-20 05:30:28 +0000
@@ -1,6 +1,8 @@
1import os1import os
2import re2import re
33
4from debian.changelog import Changelog
5
4from pkgme.run_script import run_subprocess6from pkgme.run_script import run_subprocess
57
68
@@ -14,9 +16,35 @@
1416
1517
16def build_source_package(directory, sign=True):18def build_source_package(directory, sign=True):
19 """Build a source package using debuild"""
17 cmd = ['debuild', '--no-lintian', '-S']20 cmd = ['debuild', '--no-lintian', '-S']
18 if not sign:21 if not sign:
19 cmd.extend(['-uc', '-us'])22 cmd.extend(['-uc', '-us'])
20 output = run_subprocess(cmd, cwd=directory)23 output = run_subprocess(cmd, cwd=directory)
21 changes_file = find_changes_file(output)24 changes_file = find_changes_file(output)
22 return os.path.abspath(os.path.join(directory, changes_file))25 return os.path.abspath(os.path.join(directory, changes_file))
26
27
28def build_orig_tar_gz(target_dir):
29 """Build a pkgname_version.orig.tar.gz from the target_dir
30
31 Note that this will expect a debian/ directory in the target_dir
32 to gather pkgname/version but it will (of course) exclude debian/
33 from the resulting .orig.tar.gz
34 """
35 changelog = Changelog(
36 open(os.path.join(target_dir, "debian", "changelog")))
37 pkgname = changelog.get_package()
38 version = changelog.get_version()
39 target_file = os.path.join(
40 target_dir, "..", "%s_%s.orig.tar.gz" % (pkgname, version))
41 cmd = ["tar",
42 "-c",
43 "-z",
44 "--exclude", "debian",
45 "--transform", "s,.,%s-%s," % (pkgname, version),
46 "-f", target_file,
47 ".",
48 ]
49 run_subprocess(cmd, cwd=target_dir)
50 return target_file
2351
=== modified file 'pkgme/package_files.py'
--- pkgme/package_files.py 2012-07-18 08:51:10 +0000
+++ pkgme/package_files.py 2012-07-20 05:30:28 +0000
@@ -249,7 +249,7 @@
249 filename = "source/format"249 filename = "source/format"
250250
251 def get_contents(self):251 def get_contents(self):
252 return "1.0\n"252 return "3.0 (quilt)\n"
253253
254254
255default_package_file_group.add_file_cls(SourceFormat)255default_package_file_group.add_file_cls(SourceFormat)
256256
=== added file 'pkgme/tests/test_debuild.py'
--- pkgme/tests/test_debuild.py 1970-01-01 00:00:00 +0000
+++ pkgme/tests/test_debuild.py 2012-07-20 05:30:28 +0000
@@ -0,0 +1,38 @@
1import os
2import tarfile
3
4from testtools import TestCase
5
6from pkgme.debuild import build_orig_tar_gz
7from pkgme.testing import (
8 TempdirFixture,
9 )
10
11class DebuildTestCase(TestCase):
12
13 def test_build_orig_tar_gz(self):
14 tempdir = self.useFixture(TempdirFixture())
15 pkgdir = os.path.join(tempdir.path, "testpkg")
16 # setup fake env
17 os.makedirs(os.path.join(pkgdir, "debian"))
18 changelog_path = os.path.join(pkgdir, "debian", "changelog")
19 with open(changelog_path, "w") as f:
20 f.write("""
21testpkg (0.1) unstable; urgency=low
22
23 * some changes
24
25 -- Some Guy <foo@example.com> Thu, 19 Apr 2012 10:53:30 +0200
26""")
27 with open(os.path.join(pkgdir, "canary"), "w") as f:
28 f.write("pieep")
29 # build it
30 result_path = build_orig_tar_gz(pkgdir)
31 # verify
32 self.assertEqual(
33 "testpkg_0.1.orig.tar.gz", os.path.basename(result_path))
34 with tarfile.open(result_path) as f:
35 self.assertEqual(
36 ["testpkg-0.1", "testpkg-0.1/canary"],
37 [m.name for m in f.getmembers()])
38
039
=== modified file 'pkgme/tests/test_package_files.py'
--- pkgme/tests/test_package_files.py 2012-07-18 08:51:10 +0000
+++ pkgme/tests/test_package_files.py 2012-07-20 05:30:28 +0000
@@ -444,7 +444,7 @@
444444
445 def test_contents(self):445 def test_contents(self):
446 package_file = self.get_object()446 package_file = self.get_object()
447 self.assertEqual("1.0\n", package_file.get_contents())447 self.assertEqual("3.0 (quilt)\n", package_file.get_contents())
448448
449 def test_overwrite(self):449 def test_overwrite(self):
450 package_file = self.get_object()450 package_file = self.get_object()
451451
=== modified file 'pkgme/tests/test_script.py'
--- pkgme/tests/test_script.py 2012-06-08 19:24:34 +0000
+++ pkgme/tests/test_script.py 2012-07-20 05:30:28 +0000
@@ -73,7 +73,8 @@
73 self.create_marker_file(tempdir, prefix="foo")73 self.create_marker_file(tempdir, prefix="foo")
74 self.run_script(tempdir.abspath('foo'))74 self.run_script(tempdir.abspath('foo'))
75 self.assertThat(tempdir.path, DirContains(75 self.assertThat(tempdir.path, DirContains(
76 ["foo_0.0.0.tar.gz",76 ["foo_0.0.0.orig.tar.gz",
77 "foo_0.0.0.debian.tar.gz",
77 "foo_0.0.0.dsc",78 "foo_0.0.0.dsc",
78 "foo_0.0.0_source.build",79 "foo_0.0.0_source.build",
79 "foo_0.0.0_source.changes",80 "foo_0.0.0_source.changes",

Subscribers

People subscribed via source and target branches

to all changes: