]> git.donarmstrong.com Git - neurodebian.git/commitdiff
Merge remote-tracking branch 'neurohydra/master'
authorYaroslav Halchenko <debian@onerussian.com>
Wed, 26 Oct 2011 18:07:48 +0000 (14:07 -0400)
committerYaroslav Halchenko <debian@onerussian.com>
Wed, 26 Oct 2011 18:07:48 +0000 (14:07 -0400)
* neurohydra/master:
  NF: nd_rebuildarchive helper to rebuild archive for a new release
  ENH: allow for custom version suffix prefix in backport-dsc

tools/backport-dsc
tools/nd_rebuildarchive [new file with mode: 0755]

index eb757fcd70a4549c98b705d72c8c4e9ff8fa0070..2cd665cdcbd1c39cf3f2d043b7dffe5203e050b5 100755 (executable)
@@ -11,8 +11,9 @@ backports_dsc_version=0.1
 # 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
@@ -128,9 +129,13 @@ Options:
   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.
@@ -173,7 +178,10 @@ example setting) can be used to pre-configure backport-dsc:
 bp_distribution="lenny-backports"
   Backport target distribution (see --backport-distribution)
 
-bp_version_suffix="bpo50"
+bp_version_prefix="~"
+  Version suffix (see --version-prefix)
+
+bp_version_suffix="bpo60"
   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.
-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
@@ -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;;
+         -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;;
@@ -295,7 +304,7 @@ src_version=${src_version%%.dsc}
 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
diff --git a/tools/nd_rebuildarchive b/tools/nd_rebuildarchive
new file mode 100755 (executable)
index 0000000..a189315
--- /dev/null
@@ -0,0 +1,73 @@
+#!/bin/bash
+
+if [ -z "$1" ]; then
+cat << EOT
+Script to re-build entire archive from one release for another.
+
+Often usecase -- rebuilding for a new Ubuntu brew every 6 months.
+
+Synopsis
+--------
+
+  nd_rebuildarchive old_release new_release
+
+e.g.
+  
+  nd_rebuildarchive natty oneiric
+
+EOT
+exit 1 
+fi
+
+set -eu
+
+old_dist=$1
+dist=$2
+
+# some NeuroDebian variables hardcoded in for now
+repo_server=neuro.debian.net
+repo_user=neurodebian
+repo_toppath=www
+repo_urlpath=debian
+repo_distspath=$repo_toppath/$repo_urlpath/dists
+
+family=nd+ubuntu
+
+list_file="$old_dist-$dist.list"
+summary_file="$old_dist-$dist.summary"
+
+[ -e "$list_file" ] || \
+    ssh -l $repo_user $repo_server cat $repo_distspath/$old_dist/*/source/Sources.gz \
+    | zgrep -e '^\(Package\|Directory\| [a-z0-9]\{32\} [0-9]* \S*.dsc$\)' \
+    | sed -e 's,.* \([^ ][^ ]*\)$,\1,g' | tr '\n' ' '| sed -e 's,\.dsc,.dsc\n,g' \
+    > "$list_file"
+   
+CMD=
+#echo
+dist_id=$(nd_querycfg "release backport ids" "$dist")
+cat $list_file \
+| while read name topdir dscfile; do
+    echo "I: Forwardporting for $dist_id $dscfile"
+
+    [ -e $dscfile ]  \
+       || dget -d http://$repo_server/$repo_urlpath/$topdir/$dscfile || { 
+       echo -e "E: $dscfile\t\tFAILED to fetch" >> $summary_file
+       continue
+    }
+
+    
+    bpdscfile=$(/home/neurodebian/neurodebian/tools/backport-dsc \
+        --target-distribution "$dist" \
+       --no-maintainer-update \
+        --version-prefix "+" \
+        --version-suffix "$dist_id" \
+        "$dscfile" | tail -n1 | sed -e 's/^.* //g')
+
+    echo " I: Building backported dscfile: $bpdscfile"
+
+    $CMD sudo nd_build $family $dist $bpdscfile && {
+       echo -e "I: $bpdscfile\t\tOk" >> $summary_file
+    } || {
+       echo -e "E: $bpdscfile\t\tFAILED to build" >> $summary_file
+    }
+done
\ No newline at end of file