]> git.donarmstrong.com Git - neurodebian.git/blobdiff - tools/backport-dsc
minor screw up fix
[neurodebian.git] / tools / backport-dsc
index eb757fcd70a4549c98b705d72c8c4e9ff8fa0070..11017e2f648847cdb8916be5354d3a168538223a 100755 (executable)
@@ -5,14 +5,15 @@ set -e
 set -u
 
 # version of this script
 set -u
 
 # version of this script
-backports_dsc_version=0.1
+backports_dsc_version=0.2
 
 ############
 # Defaults #
 ############
 
 
 ############
 # Defaults #
 ############
 
-bp_distribution=${BACKPORT_DISTRIBUTION:-lenny-backports}
-bp_version_suffix=${BACKPORT_VERSION_SUFFIX:-bpo50}
+bp_distribution=${BACKPORT_DISTRIBUTION:-squeeze-backports}
+bp_version_prefix=${BACKPORT_VERSION_PREFIX:-\~}
+bp_version_suffix=${BACKPORT_VERSION_SUFFIX:-bpo60}
 bp_maintainer_name=${DEBFULLNAME:-unamed}
 bp_maintainer_email=${DEBEMAIL:-unknown}
 bp_update_maintainer=1
 bp_maintainer_name=${DEBFULLNAME:-unamed}
 bp_maintainer_email=${DEBEMAIL:-unknown}
 bp_update_maintainer=1
@@ -42,7 +43,7 @@ print_version()
 cat << EOT
 backport-dsc $backports_dsc_version
 
 cat << EOT
 backport-dsc $backports_dsc_version
 
-Copyright (C) 2010 Michael Hanke <michael.hanke@gmail.com>
+Copyright (C) 2010-2012 Michael Hanke <michael.hanke@gmail.com>
 
 Licensed under GNU Public License version 2 or later.
 This is free software; see the source for copying conditions.  There is NO
 
 Licensed under GNU Public License version 2 or later.
 This is free software; see the source for copying conditions.  There is NO
@@ -90,7 +91,7 @@ Usage:  backport-dsc [OPTIONS] <dsc-file>
 Options:
 
 -d <distname>, --target-distribution <distname>
 Options:
 
 -d <distname>, --target-distribution <distname>
-  Arbitrary distribution name (e.g. lenny-backports). This will be the target
+  Arbitrary distribution name (e.g. squeeze-backports). This will be the target
   distribution used for the backport changelog entry. The distribution name
   also serves as an identifier to search for backport patches in the source
   package.
   distribution used for the backport changelog entry. The distribution name
   also serves as an identifier to search for backport patches in the source
   package.
@@ -128,9 +129,13 @@ Options:
   ideally indicating the backport target distribution. The resulting package
   version will follow this schema:
 
   ideally indicating the backport target distribution. The resulting package
   version will follow this schema:
 
-  <originalversion>~<suffix>+<digit>
+  <originalversion><prefix><suffix>+<digit>
 
 
-  e.g.: 1.2.3-4~bpo50+1
+  e.g.: 1.2.3-4~bpo60+1 with default <prefix>=~
+
+-p <string>, --version-prefix <string>
+  Version prefix that will be prepended to the backport version.  By default it
+  is ~ but want to be changed (e.g. to +) for forward-porting to next releases.
 
 --verbose
   Enable additional status messages.
 
 --verbose
   Enable additional status messages.
@@ -170,10 +175,13 @@ backport-dsc reads configuration from two files: system-wide from
 be sourced by backport-dsc. The following variables (each shown with an
 example setting) can be used to pre-configure backport-dsc:
 
 be sourced by backport-dsc. The following variables (each shown with an
 example setting) can be used to pre-configure backport-dsc:
 
-bp_distribution="lenny-backports"
+bp_distribution="squeeze-backports"
   Backport target distribution (see --backport-distribution)
 
   Backport target distribution (see --backport-distribution)
 
-bp_version_suffix="bpo50"
+bp_version_prefix="~"
+  Version prefix (see --version-prefix)
+
+bp_version_suffix="bpo60"
   Version suffix (see --version-suffix)
 
 bp_maintainer_name="Unknown fellow"
   Version suffix (see --version-suffix)
 
 bp_maintainer_name="Unknown fellow"
@@ -223,7 +231,7 @@ EOT
 # Note that we use `"$@"' to let each command-line parameter expand to a
 # separate word. The quotes around `$@' are essential!
 # We need CLOPTS as the `eval set --' would nuke the return value of getopt.
 # Note that we use `"$@"' to let each command-line parameter expand to a
 # separate word. The quotes around `$@' are essential!
 # We need CLOPTS as the `eval set --' would nuke the return value of getopt.
-CLOPTS=`getopt -o h,d:,s: --long help,verbose-help,version,target-distribution:,version-suffix:,maint-name:,maint-email:,no-color,no-backport-patches,verbose,mod-control:,no-maintainer-update, -n 'backport-dsc' -- "$@"`
+CLOPTS=`getopt -o h,d:,s:,p: --long help,verbose-help,version,target-distribution:,version-suffix:,version-prefix:,maint-name:,maint-email:,no-color,no-backport-patches,verbose,mod-control:,no-maintainer-update, -n 'backport-dsc' -- "$@"`
 
 if [ $? != 0 ] ; then
   echo "Terminating..." >&2
 
 if [ $? != 0 ] ; then
   echo "Terminating..." >&2
@@ -237,6 +245,7 @@ while true ; do
   case "$1" in
          -d|--target-distribution) shift; bp_distribution=$1; shift;;
          -s|--version-suffix) shift; bp_version_suffix=$1; shift;;
   case "$1" in
          -d|--target-distribution) shift; bp_distribution=$1; shift;;
          -s|--version-suffix) shift; bp_version_suffix=$1; shift;;
+         -p|--version-prefix) shift; bp_version_prefix=$1; shift;;
          --maint-name) shift; bp_maintainer_name=$1; shift;;
          --maint-email) shift; bp_maintainer_email=$1; shift;;
          --no-maintainer-update) bp_update_maintainer=0; shift;;
          --maint-name) shift; bp_maintainer_name=$1; shift;;
          --maint-email) shift; bp_maintainer_email=$1; shift;;
          --no-maintainer-update) bp_update_maintainer=0; shift;;
@@ -295,7 +304,7 @@ src_version=${src_version%%.dsc}
 wdir=$(mktemp -d -t backport-dsc.XXXXXX)
 sdir=$wdir/${src_name}-${src_version}
 
 wdir=$(mktemp -d -t backport-dsc.XXXXXX)
 sdir=$wdir/${src_name}-${src_version}
 
-bp_version="~${bp_version_suffix}+"
+bp_version="${bp_version_prefix}${bp_version_suffix}+"
 
 
 # setup environment for dpkg
 
 
 # setup environment for dpkg
@@ -315,6 +324,9 @@ bp_dch_cmd="dch --noconf --force-distribution --force-bad-version -c $sdir/debia
 # extract the original source package
 dpkg-source -x $dsc_file $sdir
 # note backport in changelog
 # extract the original source package
 dpkg-source -x $dsc_file $sdir
 # note backport in changelog
+# This will create a new changelog entry
+# All subsequent calls to dch should use -a to assure that those entries
+# are appended to the existing entry (otherwise with wheezy new entries will be added)
 $bp_dch_cmd -D ${bp_distribution} -l "${bp_version}" "Backported for ${bp_distribution}."
 
 if [ "$bp_update_maintainer" = 1 ]; then
 $bp_dch_cmd -D ${bp_distribution} -l "${bp_version}" "Backported for ${bp_distribution}."
 
 if [ "$bp_update_maintainer" = 1 ]; then
@@ -333,7 +345,7 @@ if [ "$bp_apply_patches" = 1 ]; then
       printf "${green}Enabling additional quilt patch series for $bp_distribution.\n${NC}"
     fi
     cat $sdir/debian/patches/series-$bp_distribution >> $sdir/debian/patches/series
       printf "${green}Enabling additional quilt patch series for $bp_distribution.\n${NC}"
     fi
     cat $sdir/debian/patches/series-$bp_distribution >> $sdir/debian/patches/series
-    $bp_dch_cmd "Added 'series-$bp_distribution' in quilt patch series."
+    $bp_dch_cmd -a "Added 'series-$bp_distribution' in quilt patch series."
   fi
   # look for backport patches
   for p in $(ls -1 $sdir/debian/patches/$bp_distribution-dsc-patch* 2> /dev/null || true); do
   fi
   # look for backport patches
   for p in $(ls -1 $sdir/debian/patches/$bp_distribution-dsc-patch* 2> /dev/null || true); do
@@ -341,7 +353,7 @@ if [ "$bp_apply_patches" = 1 ]; then
       printf "${green}Applying additional patch $(basename "$p").\n${NC}"
     fi
     patch -p1 --directory=$sdir < "$p"
       printf "${green}Applying additional patch $(basename "$p").\n${NC}"
     fi
     patch -p1 --directory=$sdir < "$p"
-    $bp_dch_cmd "Applied additional patch from debian/patches/$(basename "$p")."
+    $bp_dch_cmd -a "Applied additional patch from debian/patches/$(basename "$p")."
   done
 fi
 
   done
 fi
 
@@ -351,7 +363,7 @@ if [ -n "$bp_mod_control" ]; then
     printf "${green}Modifying debian/control with given instructions.\n${NC}"
   fi
   bash -c "sed -i $bp_mod_control $sdir/debian/control"
     printf "${green}Modifying debian/control with given instructions.\n${NC}"
   fi
   bash -c "sed -i $bp_mod_control $sdir/debian/control"
-  $bp_dch_cmd "Used following sed expression to modify debian/control:$bp_mod_control."
+  $bp_dch_cmd -a "Used following sed expression to modify debian/control:$bp_mod_control."
 fi
 
 # extract final version
 fi
 
 # extract final version