summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbackport45
-rw-r--r--backport_others14
2 files changed, 39 insertions, 20 deletions
diff --git a/backport b/backport
index 4941aa0..2eb6b05 100755
--- a/backport
+++ b/backport
@@ -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
diff --git a/backport_others b/backport_others
index 697ede1..5e5ab1c 100644
--- a/backport_others
+++ b/backport_others
@@ -9,14 +9,14 @@ usage()
{
echo "Usage: ./backport_others [options] squeeze|wheezy|jessie"
echo "Options:"
-echo " -n Skip apt-get update/upgrade and pbuilder update"
+echo " -s Skip apt-get update/upgrade and pbuilder update"
}
-update=true
-while getopts ":n" flag; do
+skip=false
+while getopts ":s" flag; do
case $flag in
- n)
- update=false
+ s)
+ skip=true
;;
\?)
echo "Invalid option: -$OPTARG" >&2
@@ -30,7 +30,7 @@ if [ $# -lt 1 ]; then usage; exit 1; fi
DIST=$1
# Update pbuilder chroot
-if [ "$update" = true ]
+if [ "$skip" = true ]
then
sudo -E pbuilder update
fi
@@ -45,6 +45,6 @@ export DIST
# Packages to backport to squeeze/wheezy/jessie (without rpy2):
for i in lattice nlme rmatrix mgcv boot cluster codetools foreign kernsmooth r-cran-class r-cran-coda r-cran-spatial r-cran-nnet r-cran-mass rodbc rpart survival r-cran-littler rpy rkward r-cran-rjags; do
- ./backport -n $i $DIST
+ ./backport -s $i $DIST
done

Contact - Imprint