Add configure option to specify package signing key

Add the "GPGKEY" option to makepkg.conf for specifying signing packages
with the non-default key from the keyring.  Is overridded by makepkg's
--key option.

Signed-off-by: Allan McRae <allan@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Allan McRae 2011-04-17 22:38:35 +10:00 committed by Dan McGee
parent cb35affd1b
commit 4c31bc6e3f
4 changed files with 17 additions and 8 deletions

View file

@ -169,8 +169,9 @@ Options
Do not create a signature for the built package. Do not create a signature for the built package.
*\--key* <key>:: *\--key* <key>::
Specify a key to use when signing the package. If not specified, the default Specify a key to use when signing packages, overriding the GPGKEY setting
key from the keyring will be used. in linkman:makepkg.conf[5]. If not specified in either location, the
default key from the keyring will be used.
*\--noconfirm*:: *\--noconfirm*::
(Passed to pacman) Prevent pacman from waiting for user input before (Passed to pacman) Prevent pacman from waiting for user input before

View file

@ -110,6 +110,10 @@ Options
running in the DistCC cluster. In addition, you will want to modify your running in the DistCC cluster. In addition, you will want to modify your
`MAKEFLAGS`. `MAKEFLAGS`.
**GPGKEY=**""::
Specify a key to use for gpg signing instead of the default key in the
keyring. Can be overridden with makepkg's `--key` option.
**OPTIONS=(**strip !docs libtool emptydirs zipman**)**:: **OPTIONS=(**strip !docs libtool emptydirs zipman**)**::
This array contains options that affect the default packaging. They are This array contains options that affect the default packaging. They are
equivalent to options that can be placed in the PKGBUILD; the defaults are equivalent to options that can be placed in the PKGBUILD; the defaults are

View file

@ -101,6 +101,8 @@ PURGE_TARGETS=(usr/{,share}/info/dir .packlist *.pod)
#SRCPKGDEST=/home/srcpackages #SRCPKGDEST=/home/srcpackages
#-- Packager: name/email of the person or organization building packages #-- Packager: name/email of the person or organization building packages
#PACKAGER="John Doe <john@doe.com>" #PACKAGER="John Doe <john@doe.com>"
#-- Specify a key to use for package signing
#GPGKEY=""
######################################################################### #########################################################################
# EXTENSION DEFAULTS # EXTENSION DEFAULTS

View file

@ -1116,8 +1116,8 @@ create_signature() {
fi fi
local SIGNWITHKEY="" local SIGNWITHKEY=""
if [[ -n $SIGNKEY ]]; then if [[ -n $GPGKEY ]]; then
SIGNWITHKEY="-u ${SIGNKEY}" SIGNWITHKEY="-u ${GPGKEY}"
fi fi
# The signature will be generated directly in ascii-friendly format # The signature will be generated directly in ascii-friendly format
gpg --detach-sign --use-agent ${SIGNWITHKEY} "$filename" &>/dev/null || ret=$? gpg --detach-sign --use-agent ${SIGNWITHKEY} "$filename" &>/dev/null || ret=$?
@ -1697,7 +1697,7 @@ while true; do
-g|--geninteg) GENINTEG=1 ;; -g|--geninteg) GENINTEG=1 ;;
--holdver) HOLDVER=1 ;; --holdver) HOLDVER=1 ;;
-i|--install) INSTALL=1 ;; -i|--install) INSTALL=1 ;;
--key) shift; SIGNKEY=$1 ;; --key) shift; GPGKEY=$1 ;;
-L|--log) LOGGING=1 ;; -L|--log) LOGGING=1 ;;
-m|--nocolor) USE_COLOR='n' ;; -m|--nocolor) USE_COLOR='n' ;;
--nocheck) RUN_CHECK='n' ;; --nocheck) RUN_CHECK='n' ;;
@ -1727,6 +1727,7 @@ done
[[ -n ${SRCPKGDEST} ]] && _SRCPKGDEST=$(canonicalize_path ${SRCPKGDEST}) [[ -n ${SRCPKGDEST} ]] && _SRCPKGDEST=$(canonicalize_path ${SRCPKGDEST})
[[ -n ${PKGEXT} ]] && _PKGEXT=${PKGEXT} [[ -n ${PKGEXT} ]] && _PKGEXT=${PKGEXT}
[[ -n ${SRCEXT} ]] && _SRCEXT=${SRCEXT} [[ -n ${SRCEXT} ]] && _SRCEXT=${SRCEXT}
[[ -n ${GPGKEY} ]] && _GPGKEY=${GPGKEY}
# default config is makepkg.conf # default config is makepkg.conf
MAKEPKG_CONF=${MAKEPKG_CONF:-$confdir/makepkg.conf} MAKEPKG_CONF=${MAKEPKG_CONF:-$confdir/makepkg.conf}
@ -1792,6 +1793,7 @@ SRCPKGDEST=${SRCPKGDEST:-$startdir} #default to $startdir if undefined
PKGEXT=${_PKGEXT:-$PKGEXT} PKGEXT=${_PKGEXT:-$PKGEXT}
SRCEXT=${_SRCEXT:-$SRCEXT} SRCEXT=${_SRCEXT:-$SRCEXT}
GPGKEY=${_GPGKEY:-$GPGKEY}
if (( HOLDVER )) && [[ -n $FORCE_VER ]]; then if (( HOLDVER )) && [[ -n $FORCE_VER ]]; then
# The '\\0' is here to prevent gettext from thinking --holdver is an option # The '\\0' is here to prevent gettext from thinking --holdver is an option
@ -1948,9 +1950,9 @@ if [[ -z "$SIGNPKG" && $(check_buildenv sign) == 'y' ]]; then
SIGNPKG='y' SIGNPKG='y'
fi fi
if [[ $SIGNPKG == 'y' ]]; then if [[ $SIGNPKG == 'y' ]]; then
if ! gpg --list-key ${SIGNKEY} &>/dev/null; then if ! gpg --list-key ${GPGKEY} &>/dev/null; then
if [[ ! -z $SIGNKEY ]]; then if [[ ! -z $GPGKEY ]]; then
error "$(gettext "The key ${SIGNKEY} does not exist in your keyring.")" error "$(gettext "The key ${GPGKEY} does not exist in your keyring.")"
else else
error "$(gettext "There is no key in your keyring.")" error "$(gettext "There is no key in your keyring.")"
fi fi