Allow packaging subsequent revisions

This is relevant to Debian packaging.
This commit is contained in:
Pierre Pronchery 2015-05-28 20:38:27 +02:00
parent e3e9a72e28
commit 8e6c363ff8

View File

@ -21,6 +21,7 @@ DEBUG=
DEVNULL="/dev/null" DEVNULL="/dev/null"
DOMAIN="defora.org" DOMAIN="defora.org"
EMAIL= EMAIL=
FORCE=0
FULLNAME= FULLNAME=
HOMEPAGE="http://www.$DOMAIN" HOMEPAGE="http://www.$DOMAIN"
ID="@ID@" ID="@ID@"
@ -228,7 +229,7 @@ _package_debian()
{ {
pkgname=$(echo "$DEBIAN_PREFIX$PACKAGE" | $TR A-Z a-z) pkgname=$(echo "$DEBIAN_PREFIX$PACKAGE" | $TR A-Z a-z)
$DEBUG $RM -r -- "debian" || return 2 ([ $FORCE -eq 0 ] || $DEBUG $RM -r -- "debian") || return 2
#check for changes #check for changes
_info "Checking for changes..." _info "Checking for changes..."
@ -274,7 +275,7 @@ _package_debian()
[ -n "$license" ] || _warning "Unknown license" [ -n "$license" ] || _warning "Unknown license"
#debian files #debian files
for i in $DEBIAN_FILES; do [ $FORCE -eq 0 ] || for i in $DEBIAN_FILES; do
_info "Creating debian/$i..." _info "Creating debian/$i..."
"_debian_$i" > "debian/$i" "_debian_$i" > "debian/$i"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
@ -288,7 +289,7 @@ _package_debian()
_info "Creating debian/changelog..." _info "Creating debian/changelog..."
_debian_changelog _debian_changelog
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
$DEBUG $RM -r -- "debian" [ $FORCE -eq 0 ] || $DEBUG $RM -r -- "debian"
_error "Could not create debian/changelog" _error "Could not create debian/changelog"
return 2 return 2
fi fi
@ -302,7 +303,7 @@ _package_debian()
#debian/source/format #debian/source/format
_debian_source_format > "debian/source/format" _debian_source_format > "debian/source/format"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
$DEBUG $RM -r -- "debian" [ $FORCE -eq 0 ] || $DEBUG $RM -r -- "debian"
_error "Could not create debian/source/format" _error "Could not create debian/source/format"
return 2 return 2
fi fi
@ -334,7 +335,10 @@ _debian_changelog()
{ {
[ -n "$DEBFULLNAME" ] || DEBFULLNAME="$FULLNAME" [ -n "$DEBFULLNAME" ] || DEBFULLNAME="$FULLNAME"
[ -n "$DEBEMAIL" ] || DEBEMAIL="$EMAIL" [ -n "$DEBEMAIL" ] || DEBEMAIL="$EMAIL"
DEBFULLNAME="$DEBFULLNAME" DEBEMAIL="$DEBEMAIL" $DCH --create \ create=
[ -f "debian/changelog" ] || create="--create"
DEBFULLNAME="$DEBFULLNAME" DEBEMAIL="$DEBEMAIL" $DEBUG $DCH $create \
--distribution "unstable" \ --distribution "unstable" \
--package "$pkgname" --newversion "$VERSION-$revision" \ --package "$pkgname" --newversion "$VERSION-$revision" \
"$DEBIAN_MESSAGE" "$DEBIAN_MESSAGE"
@ -864,8 +868,9 @@ _size()
#usage #usage
_usage() _usage()
{ {
echo "Usage: deforaos-package.sh [-Dv][-e e-mail][-i id][-l license][-m method][-n name][-O name=value...] revision" 1>&2 echo "Usage: deforaos-package.sh [-Dfv][-e e-mail][-i id][-l license][-m method][-n name][-O name=value...] revision" 1>&2
echo " -D Run in debugging mode" 1>&2 echo " -D Run in debugging mode" 1>&2
echo " -f Reset the packaging information" 1>&2
echo " -v Verbose mode" 1>&2 echo " -v Verbose mode" 1>&2
return 1 return 1
} }
@ -880,7 +885,7 @@ _warning()
#main #main
#parse options #parse options
while getopts "De:i:l:m:n:O:v" name; do while getopts "De:fi:l:m:n:O:v" name; do
case "$name" in case "$name" in
D) D)
DEBUG="_debug" DEBUG="_debug"
@ -888,6 +893,9 @@ while getopts "De:i:l:m:n:O:v" name; do
e) e)
EMAIL="$OPTARG" EMAIL="$OPTARG"
;; ;;
f)
FORCE=1
;;
i) i)
ID="$OPTARG" ID="$OPTARG"
;; ;;