Merge branch '122-gpg-batch'

This commit is contained in:
Andrey Smirnov
2014-10-10 17:54:50 +04:00
9 changed files with 37 additions and 1 deletions
+3 -1
View File
@@ -4,4 +4,6 @@ List of contributors, in chronological order:
* Sebastien Binet (https://github.com/sbinet)
* Ryan Uber (https://github.com/ryanuber)
* Simon Aquino (https://github.com/simonaquino)
* Vincent Batoufflet (https://github.com/vbatoufflet)
* Vincent Batoufflet (https://github.com/vbatoufflet)
* Ivan Kurnosov (https://github.com/zerkms)
* Dmitrii Kashin (https://github.com/freehck)
+1
View File
@@ -16,6 +16,7 @@ func getSigner(flags *flag.FlagSet) (utils.Signer, error) {
signer.SetKey(flags.Lookup("gpg-key").Value.String())
signer.SetKeyRing(flags.Lookup("keyring").Value.String(), flags.Lookup("secret-keyring").Value.String())
signer.SetPassphrase(flags.Lookup("passphrase").Value.String(), flags.Lookup("passphrase-file").Value.String())
signer.SetBatch(flags.Lookup("batch").Value.Get().(bool))
err := signer.Init()
if err != nil {
+1
View File
@@ -39,6 +39,7 @@ Example:
cmd.Flag.String("secret-keyring", "", "GPG secret keyring to use (instead of default)")
cmd.Flag.String("passphrase", "", "GPG passhprase for the key (warning: could be insecure)")
cmd.Flag.String("passphrase-file", "", "GPG passhprase-file for the key (warning: could be insecure)")
cmd.Flag.Bool("batch", false, "run GPG with detached tty")
cmd.Flag.Bool("skip-signing", false, "don't sign Release files with GPG")
cmd.Flag.String("origin", "", "origin name to publish")
cmd.Flag.String("label", "", "label to publish")
+1
View File
@@ -201,6 +201,7 @@ Example:
cmd.Flag.String("secret-keyring", "", "GPG secret keyring to use (instead of default)")
cmd.Flag.String("passphrase", "", "GPG passhprase for the key (warning: could be insecure)")
cmd.Flag.String("passphrase-file", "", "GPG passhprase-file for the key (warning: could be insecure)")
cmd.Flag.Bool("batch", false, "run GPG with detached tty")
cmd.Flag.Bool("skip-signing", false, "don't sign Release files with GPG")
cmd.Flag.String("origin", "", "origin name to publish")
cmd.Flag.String("label", "", "label to publish")
+1
View File
@@ -133,6 +133,7 @@ Example:
cmd.Flag.String("secret-keyring", "", "GPG secret keyring to use (instead of default)")
cmd.Flag.String("passphrase", "", "GPG passhprase for the key (warning: could be insecure)")
cmd.Flag.String("passphrase-file", "", "GPG passhprase-file for the key (warning: could be insecure)")
cmd.Flag.Bool("batch", false, "run GPG with detached tty")
cmd.Flag.Bool("skip-signing", false, "don't sign Release files with GPG")
cmd.Flag.String("component", "", "component names to update (for multi-component publishing, separate components with commas)")
cmd.Flag.Bool("force-overwrite", false, "overwrite files in package pool in case of mismatch")
+1
View File
@@ -100,6 +100,7 @@ Example:
cmd.Flag.String("secret-keyring", "", "GPG secret keyring to use (instead of default)")
cmd.Flag.String("passphrase", "", "GPG passhprase for the key (warning: could be insecure)")
cmd.Flag.String("passphrase-file", "", "GPG passhprase-file for the key (warning: could be insecure)")
cmd.Flag.Bool("batch", false, "run GPG with detached tty")
cmd.Flag.Bool("skip-signing", false, "don't sign Release files with GPG")
cmd.Flag.Bool("force-overwrite", false, "overwrite files in package pool in case of mismatch")
+3
View File
@@ -36,6 +36,9 @@ func (n *NullSigner) Init() error {
func (n *NullSigner) SetKey(keyRef string) {
}
func (n *NullSigner) SetBatch(batch bool) {
}
func (n *NullSigner) SetKeyRing(keyring, secretKeyring string) {
}
+16
View File
@@ -1102,6 +1102,10 @@ $ aptly publish repo testing
Options:
.
.TP
\-\fBbatch\fR=false
run GPG with detached tty
.
.TP
\-\fBcomponent\fR=
component name to publish (for multi\-component publishing, separate components with commas)
.
@@ -1181,6 +1185,10 @@ $ aptly publish snapshot wheezy\-main
Options:
.
.TP
\-\fBbatch\fR=false
run GPG with detached tty
.
.TP
\-\fBcomponent\fR=
component name to publish (for multi\-component publishing, separate components with commas)
.
@@ -1260,6 +1268,10 @@ $ aptly publish update wheezy ppa wheezy\-7\.5
Options:
.
.TP
\-\fBbatch\fR=false
run GPG with detached tty
.
.TP
\-\fBcomponent\fR=
component names to update (for multi\-component publishing, separate components with commas)
.
@@ -1317,6 +1329,10 @@ $ aptly publish update wheezy ppa
Options:
.
.TP
\-\fBbatch\fR=false
run GPG with detached tty
.
.TP
\-\fBforce\-overwrite\fR=false
overwrite files in package pool in case of mismatch
.
+10
View File
@@ -18,6 +18,7 @@ type Signer interface {
SetKey(keyRef string)
SetKeyRing(keyring, secretKeyring string)
SetPassphrase(passphrase, passphraseFile string)
SetBatch(batch bool)
DetachedSign(source string, destination string) error
ClearSign(source string, destination string) error
}
@@ -42,6 +43,12 @@ type GpgSigner struct {
keyRef string
keyring, secretKeyring string
passphrase, passphraseFile string
batch bool
}
// SetBatch control --no-tty flag to gpg
func (g *GpgSigner) SetBatch(batch bool) {
g.batch = batch
}
// SetKey sets key ID to use when signing files
@@ -79,6 +86,9 @@ func (g *GpgSigner) gpgArgs() []string {
if g.passphraseFile != "" {
args = append(args, "--passphrase-file", g.passphraseFile)
}
if g.batch {
args = append(args, "--no-tty")
}
return args
}