| 1 |
=============================================== |
| 2 |
pydebsign is a yet another library of debsign |
| 3 |
=============================================== |
| 4 |
|
| 5 |
Status |
| 6 |
------ |
| 7 |
|
| 8 |
.. image:: https://secure.travis-ci.org/mkouhei/pydebsign.png?branch=devel |
| 9 |
:target: http://travis-ci.org/mkouhei/pydebsign |
| 10 |
.. image:: https://coveralls.io/repos/mkouhei/pydebsign/badge.png?branch=devel |
| 11 |
:target: https://coveralls.io/r/mkouhei/pydebsign?branch=devel |
| 12 |
.. image:: https://pypip.in/v/pydebsign/badge.png |
| 13 |
:target: https://crate.io/packages/pydebsign |
| 14 |
.. image:: https://readthedocs.org/projects/pydebsign/badge/?version=latest |
| 15 |
:target: https://readthedocs.org/projects/pydebsign/?badge=latest |
| 16 |
:alt: Documentation Status |
| 17 |
|
| 18 |
Motivation |
| 19 |
---------- |
| 20 |
|
| 21 |
`debsign` is a command of devscripts that sign a Debian .changes and .dsc file pare using GPG, |
| 22 |
the command cannot use in environment witout TTY, for example invokeking by CI. |
| 23 |
|
| 24 |
I had tried to use debsign from `subprocess` module of Python as follow, |
| 25 |
but entering passphrase prompt is always returned. |
| 26 |
It was the same in the case of using gnupg-agent and keyring.:: |
| 27 |
|
| 28 |
>>> import subprocess |
| 29 |
>>> import shlex |
| 30 |
>>> command0 = 'echo -e "%s\n%s\n"' % (`passphrase`, `passphrase`) |
| 31 |
>>> command1 = '/usr/bin/debsign -k %s %s' % (`keyid`, `.changes`) |
| 32 |
>>> process0 = subprocess.Popen(shlex.split(command0), |
| 33 |
... stdin=subprocess.PIPE, |
| 34 |
... stdout=subprocess.PIPE, |
| 35 |
... stderr=subprocess.PIPE) |
| 36 |
>>> process1 = subprocess.Popen(shlex.split(command1), |
| 37 |
... stdin=process0.stdout, |
| 38 |
... stdout=subprocess.PIPE, |
| 39 |
... stderr=subprocess.PIPE) |
| 40 |
>>> stdout, stderr = process.communicate() |
| 41 |
|
| 42 |
So, I decided to make a Python library to do the same behavior debsign. |
| 43 |
|
| 44 |
|
| 45 |
Goal |
| 46 |
---- |
| 47 |
|
| 48 |
* It is enable to sign `.changes` and `.dsc` files with GPG without the input of interactive passphrase. |
| 49 |
* It can also be used by a user can not login shell on the CI, such as Jenkins. |
| 50 |
|
| 51 |
|
| 52 |
Requires |
| 53 |
-------- |
| 54 |
|
| 55 |
* Debian system, or the system derived from Debian. |
| 56 |
|
| 57 |
* Debian GNU/Linux Wheezy |
| 58 |
* Debian GNU/Linux Jessie/Sid |
| 59 |
* Ubuntu 14.04 LTS |
| 60 |
|
| 61 |
* Debian package as follows; |
| 62 |
|
| 63 |
* gnupg |
| 64 |
* dput |
| 65 |
* lintian |
| 66 |
* python (= python2.7) or python3 |
| 67 |
|
| 68 |
* Python packages as follows; |
| 69 |
|
| 70 |
* python_gnupg (as debian package is python-gnupg or python3-gnupg) |
| 71 |
* python_debian (as debian package is python-debian or python3-debian) |
| 72 |
* chardet (as debian package is python-chardet or python3-chardet) |
| 73 |
|
| 74 |
|
| 75 |
Usage |
| 76 |
----- |
| 77 |
|
| 78 |
Generic usage;:: |
| 79 |
|
| 80 |
>>> from pydebsign import debsign |
| 81 |
>>> debsign.debsign_process('/path/to/some.changes', passphrase='secretkey') |
| 82 |
|
| 83 |
|
| 84 |
When use another GPG Keyring instead of default GPG keyring;:: |
| 85 |
|
| 86 |
>>> from pydebsign import debsign |
| 87 |
>>> debsign.debsign_process('/path/to/some.changes', passphrase='secretkey', |
| 88 |
... keyid='keyid', gnupghome='/path/to/gpghome') |
| 89 |
|