diff options
author | ranke <ranke@f247ebf9-aa24-0410-a698-f940e971ad2b> | 2015-12-14 05:31:40 +0000 |
---|---|---|
committer | ranke <ranke@f247ebf9-aa24-0410-a698-f940e971ad2b> | 2015-12-14 05:31:40 +0000 |
commit | b8b2e403ae64b417a5928cb6a96b00478869b4f3 (patch) | |
tree | 42ee7eff7cdc13e7f73671d73ba5edaedbc02d25 /backport | |
parent | 1cd094b531ff2a9f1d6acb4b781c118d12b51343 (diff) |
Fix and improvements
- Copy sources to $DIST directory so quilt using packages work (littler, r-cran-coda, r-cran-rjags...)
- Do not use getopts as the approach used did not work with multiple options
- Use -s/--skip instead of -n to skip updates
- Use -k/--keep to keep sources under $DIST directory
git-svn-id: svn+ssh://stiller/home/schatz/reps/r-backports@112 f247ebf9-aa24-0410-a698-f940e971ad2b
Diffstat (limited to 'backport')
-rwxr-xr-x | backport | 45 |
1 files changed, 32 insertions, 13 deletions
@@ -25,23 +25,34 @@ usage() { echo "Usage: ./backport [options] sourcepackage squeeze|wheezy|jessie" echo "Options:" -echo " -n Skip apt-get update/upgrade and pbuilder update" +echo " -k, --keep Keep copied source package and directory used for package building" +echo " -s, --skip Skip apt-get update/upgrade and pbuilder update" } -update=true -while getopts ":n" flag; do - case $flag in - n) - update=false +# Loop over options +skip=false +keep=false +while test -n "${1}"; do + case "$1" in + -k | --keep) + keep=true + shift ;; - \?) - echo "Invalid option: -$OPTARG" >&2 + -s | --skip) + skip=true + shift + ;; + -*) + echo "Error: Unknown option: $1" >&2 + exit 1 + ;; + *) # No more options + break ;; esac - shift $((OPTIND-1)) done -# Check for number of arguments +# Positional arguments if [ $# -lt 2 ]; then usage; exit 1; fi pkg=$1 DIST=$2 @@ -60,7 +71,7 @@ then fi # Get current source from unstable -if [ "$update" = true ] +if [ "$skip" = false ] then sudo apt-get update sudo apt-get upgrade @@ -69,6 +80,7 @@ sudo apt-get source $pkg # Copy sources to $DIST directory to enable parallel builds mkdir -p $DIST +cp -r $pkg\_* $DIST cp -r $pkg-* $DIST # Go to package building directory @@ -99,7 +111,7 @@ script=../$pkg-reverts.sh if [ -f $script ]; then source $script; fi -if [ "$update" = true ] +if [ "$skip" = false ] then sudo -E pbuilder update fi @@ -112,4 +124,11 @@ if [ $? -ne 0 ]; then exit fi -cd .. +cd ../.. + +# Clean sources from $DIST directory +if [ "$keep" = false ] +then + rm -f $DIST/$pkg\_* + rm -rf $DIST/$pkg-* +fi |