Merge lp://staging/~dholbach/pkgme/nosign into lp://staging/pkgme

Proposed by Daniel Holbach
Status: Merged
Approved by: James Westby
Approved revision: 116
Merged at revision: 109
Proposed branch: lp://staging/~dholbach/pkgme/nosign
Merge into: lp://staging/pkgme
Diff against target: 67 lines (+23/-3)
2 files modified
pkgme/bin/main.py (+13/-3)
pkgme/tests/test_script.py (+10/-0)
To merge this branch: bzr merge lp://staging/~dholbach/pkgme/nosign
Reviewer Review Type Date Requested Status
James Westby Approve
Review via email: mp+108712@code.staging.launchpad.net

Commit message

Add a --nosign option to prevent debuild trying to sign the package.

To post a comment you must log in.
Revision history for this message
Daniel Holbach (dholbach) wrote :

This is an arguably dirty hack, with no test-cases, but I wanted to provide a basis to start from. Feel free to criticise or fix. :-)

Revision history for this message
James Westby (james-w) wrote :

Hi,

This looks great. A test that the argument is passed through would be great,
but I can try writing one if you would like.

Thanks,

James

Revision history for this message
Daniel Holbach (dholbach) wrote :

I added a test. Let me know if it's too much. Also bear in mind that gpgme is not in your typical virtualenv.

The way I ran it was:

DEBEMAIL="Daniel Holbach <...>" python -m testtools.run pkgme.tests.test_suite

Revision history for this message
Daniel Holbach (dholbach) wrote :

r110 fixes an identation issue. The gpgme import sould have been in the 'try:/except:' block.

Revision history for this message
Daniel Holbach (dholbach) wrote :

... and r112 closes the signature fd.

Revision history for this message
Daniel Holbach (dholbach) wrote :

According to our discussion on IRC, I changed the test to check for the signature 'manually' if gpgme can't be used. Let me know if that's good enough.

Revision history for this message
James Westby (james-w) wrote :

Hi,

I think the 'manual' check is ok, and I don't think we need the gpgme
check. We don't really care about whether the signature is valid, just
whether it signed.

Therefore please just simplify the tests lots and just have it
do the non-gpgme case.

Thanks for your persistence with this!

James

Revision history for this message
Daniel Holbach (dholbach) wrote :

Yes, I think you're right - I slightly overdid it. Using gpgme to have it fail on a non-existing signature is... well, a bit too much. Fixed and added hacked-together signature check.

Revision history for this message
James Westby (james-w) wrote :

Excellent, thanks Daniel.

review: Approve
Revision history for this message
Canonical CA Tarmac (ca-tarmac) wrote :
Download full text (4.2 KiB)

The attempt to merge lp:~dholbach/pkgme/nosign into lp:pkgme failed. Below is the output from the failed tests.

Tests running...
======================================================================
FAIL: pkgme.tests.test_script.ScriptTests.test_builds_source_package
----------------------------------------------------------------------
Traceback (most recent call last):
  File "pkgme/tests/test_script.py", line 63, in test_builds_source_package
    self.run_script(tempdir.abspath('foo'))
  File "pkgme/tests/test_script.py", line 44, in run_script
    self.assertEqual('', stderr.getvalue())
MismatchError: !=:
reference = ''
actual = '''\
ERROR: debuild --no-lintian -S failed with returncode 29. Output:
 | dpkg-buildpackage -rfakeroot -d -us -uc -S
 | dpkg-buildpackage: set CFLAGS to default value: -g -O2
 | dpkg-buildpackage: set CPPFLAGS to default value:
 | dpkg-buildpackage: set LDFLAGS to default value: -Wl,-Bsymbolic-functions
 | dpkg-buildpackage: set FFLAGS to default value: -g -O2
 | dpkg-buildpackage: set CXXFLAGS to default value: -g -O2
 | dpkg-buildpackage: source package foo
 | dpkg-buildpackage: source version 0.0.0
 | dpkg-buildpackage: source changed by A Person <email address hidden>
 | fakeroot debian/rules clean
 | dh clean
 | dh_testdir
 | dh_auto_clean
 | dh_clean
 | dpkg-source -b foo
 | dpkg-source: info: using source format `3.0 (native)'
 | dpkg-source: info: building foo in foo_0.0.0.tar.gz
 | dpkg-source: info: building foo in foo_0.0.0.dsc
 | dpkg-genchanges -S >../foo_0.0.0_source.changes
 | dpkg-genchanges: including full source code in upload
 | dpkg-buildpackage: source only upload: Debian-native package
 | Now signing changes and any dsc files...
 | Could not find a signing program (pgp or gpg)!
 | debuild: fatal error at line 1261:
 | running debsign failed

'''
======================================================================
FAIL: pkgme.tests.test_script.ScriptTests.test_writes_files
----------------------------------------------------------------------
Traceback (most recent call last):
  File "pkgme/tests/test_script.py", line 57, in test_writes_files
    self.run_script(tempdir.path)
  File "pkgme/tests/test_script.py", line 44, in run_script
    self.assertEqual('', stderr.getvalue())
MismatchError: !=:
reference = ''
actual = '''\
ERROR: debuild --no-lintian -S failed with returncode 29. Output:
 | dpkg-buildpackage -rfakeroot -d -us -uc -S
 | dpkg-buildpackage: set CFLAGS to default value: -g -O2
 | dpkg-buildpackage: set CPPFLAGS to default value:
 | dpkg-buildpackage: set LDFLAGS to default value: -Wl,-Bsymbolic-functions
 | dpkg-buildpackage: set FFLAGS to default value: -g -O2
 | dpkg-buildpackage: set CXXFLAGS to default value: -g -O2
 | dpkg-buildpackage: source package foo
 | dpkg-buildpackage: source version 0.0.0
 | dpkg-buildpackage: source changed by A Person <email address hidden>
 | fakeroot debian/rules clean
 | dh clean
 | dh_testdir
 | dh_auto_clean
 | dh_clean
 | dpkg-source -b pkgme-tests-VBgP24
 | dpkg-source: info: using source format `3.0 (native)'
 | dpkg-source: info: building foo in foo_0.0.0.tar.gz
 | dpkg-source: info: building foo in f...

Read more...

Revision history for this message
James Westby (james-w) wrote :

Ah, I think the

38 + distribution=options.distro, sign=(not options.nosign))

means that it is always requesting signing if you don't pass
--nosign now, and there's no fallback depending on interactive.

I think that if --nosign isn't passed optios.nosign would be
None, so sign could be changed to pass None through, it just
has to be a bit more code than doing the 'not':

    if options.nosign is None:
        sign = None
    else:
        sign = not options.nosign

Thanks,

James

Revision history for this message
Daniel Holbach (dholbach) wrote :

Done. Thanks a lot James!

Revision history for this message
James Westby (james-w) wrote :

Excellent, let's try again!

Thanks,

James

review: Approve
Revision history for this message
Canonical CA Tarmac (ca-tarmac) wrote :
Download full text (4.2 KiB)

The attempt to merge lp:~dholbach/pkgme/nosign into lp:pkgme failed. Below is the output from the failed tests.

Tests running...
======================================================================
FAIL: pkgme.tests.test_script.ScriptTests.test_builds_source_package
----------------------------------------------------------------------
Traceback (most recent call last):
  File "pkgme/tests/test_script.py", line 63, in test_builds_source_package
    self.run_script(tempdir.abspath('foo'))
  File "pkgme/tests/test_script.py", line 44, in run_script
    self.assertEqual('', stderr.getvalue())
MismatchError: !=:
reference = ''
actual = '''\
ERROR: debuild --no-lintian -S failed with returncode 29. Output:
 | dpkg-buildpackage -rfakeroot -d -us -uc -S
 | dpkg-buildpackage: set CFLAGS to default value: -g -O2
 | dpkg-buildpackage: set CPPFLAGS to default value:
 | dpkg-buildpackage: set LDFLAGS to default value: -Wl,-Bsymbolic-functions
 | dpkg-buildpackage: set FFLAGS to default value: -g -O2
 | dpkg-buildpackage: set CXXFLAGS to default value: -g -O2
 | dpkg-buildpackage: source package foo
 | dpkg-buildpackage: source version 0.0.0
 | dpkg-buildpackage: source changed by A Person <email address hidden>
 | fakeroot debian/rules clean
 | dh clean
 | dh_testdir
 | dh_auto_clean
 | dh_clean
 | dpkg-source -b foo
 | dpkg-source: info: using source format `3.0 (native)'
 | dpkg-source: info: building foo in foo_0.0.0.tar.gz
 | dpkg-source: info: building foo in foo_0.0.0.dsc
 | dpkg-genchanges -S >../foo_0.0.0_source.changes
 | dpkg-genchanges: including full source code in upload
 | dpkg-buildpackage: source only upload: Debian-native package
 | Now signing changes and any dsc files...
 | Could not find a signing program (pgp or gpg)!
 | debuild: fatal error at line 1261:
 | running debsign failed

'''
======================================================================
FAIL: pkgme.tests.test_script.ScriptTests.test_writes_files
----------------------------------------------------------------------
Traceback (most recent call last):
  File "pkgme/tests/test_script.py", line 57, in test_writes_files
    self.run_script(tempdir.path)
  File "pkgme/tests/test_script.py", line 44, in run_script
    self.assertEqual('', stderr.getvalue())
MismatchError: !=:
reference = ''
actual = '''\
ERROR: debuild --no-lintian -S failed with returncode 29. Output:
 | dpkg-buildpackage -rfakeroot -d -us -uc -S
 | dpkg-buildpackage: set CFLAGS to default value: -g -O2
 | dpkg-buildpackage: set CPPFLAGS to default value:
 | dpkg-buildpackage: set LDFLAGS to default value: -Wl,-Bsymbolic-functions
 | dpkg-buildpackage: set FFLAGS to default value: -g -O2
 | dpkg-buildpackage: set CXXFLAGS to default value: -g -O2
 | dpkg-buildpackage: source package foo
 | dpkg-buildpackage: source version 0.0.0
 | dpkg-buildpackage: source changed by A Person <email address hidden>
 | fakeroot debian/rules clean
 | dh clean
 | dh_testdir
 | dh_auto_clean
 | dh_clean
 | dpkg-source -b pkgme-tests-obsw6k
 | dpkg-source: info: using source format `3.0 (native)'
 | dpkg-source: info: building foo in foo_0.0.0.tar.gz
 | dpkg-source: info: building foo in f...

Read more...

lp://staging/~dholbach/pkgme/nosign updated
116. By Daniel Holbach

set default, thanks James

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches