set -e
usage() {
- echo "usage: dcp-init [-C key=val] [-d REPODIR] PACKAGE [PATCH...]"
+ echo "usage: dcp-init [-sh] [-C key=val] [-d REPODIR] PACKAGE [(PATCH|-m)...]"
echo " PATCH ::= [-p LEVEL] [-bB BRANCH] FILE"
echo " -b creates a new branch at the current patch"
echo " -B creates a new branch at the upstream sources"
+ echo " -m merges the current branch into the master branch"
}
rungit() {
mkdir "$td/apt-tmp"
(cd "$td/apt-tmp"; apt-get source "$1") || false
- echo Achtung
- sleep 10
-
sdir=
for f in "$td/apt-tmp"/*; do
if [ -d "$f" ]; then
}
initrepo() {
- rungit init -q
+ rungit init
mkdir "$td/control"
touch "$td/control/conf"
rungit add control
mkdir "$td/control/update.d"
cat >"$td/control/functions" <<EOF
readconf() {
+ if [ -r "\$HOME/.dcp-build-conf" ]; then
+ while read key val; do
+ export "CONF_\$key"="\$val"
+ done <"\$HOME/.dcp-build-conf"
+ fi
while read key val; do
export "CONF_\$key"="\$val"
done <control/conf
set -e
-cmd=(dpkg-buildpackage -b)
+cmd=(dpkg-buildpackage -b -rfakeroot)
if [ -n "\$CONF_MAINTAINER" ]; then
cmd=("\${cmd[@]}" "-m\$CONF_MAINTAINER")
fi
defdir=/srv/dcp
repodir=
confopts=()
+shared=n
while [ "${1:0:1}" = - ]; do
opt="${1:1}"
elif [ "$opt" = h ]; then
usage
exit 0
+ elif [ "$opt" = s ]; then
+ shared=y
elif [ "$opt" = C ]; then
confopts=("${confopts[@]}" "$1")
shift
level=0
}
initvals
+curbranch=master
while [ $# -gt 0 ]; do
arg="$1"
shift
level="$1"
shift
elif [ "$arg" = -b ]; then
- rungit checkout -q -b "$1"
+ curbranch="$1"
shift
+ rungit checkout -q -b "$curbranch"
elif [ "$arg" = -B ]; then
- rungit checkout -q -b "$1" upstream
+ curbranch="$1"
+ shift
+ rungit checkout -q -b "$curbranch" upstream
+ elif [ "$arg" = -m ]; then
+ rungit checkout -q master
+ rungit merge -n "$curbranch"
else
echo "dcp-init: unknown patch option '$arg'" >&2
exit 1
done
git clone -q --bare "$td" "$repodir"
+if [ "$shared" = y ]; then
+ chmod -R g+w "$repodir"
+ td="$repodir" rungit config core.sharedrepository 1
+fi
rm -rf "$td"