summaryrefslogtreecommitdiffstats
path: root/bin/git-debian-import
diff options
context:
space:
mode:
Diffstat (limited to 'bin/git-debian-import')
-rwxr-xr-xbin/git-debian-import72
1 files changed, 72 insertions, 0 deletions
diff --git a/bin/git-debian-import b/bin/git-debian-import
new file mode 100755
index 0000000..d94a943
--- /dev/null
+++ b/bin/git-debian-import
@@ -0,0 +1,72 @@
+#!/bin/sh
+
+set -e
+
+DSC="$1"
+
+TMPDIR="$(mktemp -d -p . dpkg-source.XXXX)"
+
+############ upstream
+
+git checkout upstream
+
+( find | grep -v '^./.git/.*' | grep -v './.git$' | xargs rm -rf ) || true
+
+dpkg-source -x --no-copy --skip-debianization ${DSC} ${TMPDIR}
+
+cd "${TMPDIR}"
+rm -rf .git
+mv $(find -mindepth 1 -maxdepth 1) ../
+cd "${OLDPWD}"
+
+rmdir ${TMPDIR}
+
+VERSION="$(awk '/^Version: / { print $2 }' ${DSC} | head -n1)"
+
+FILE_VERSION="$(echo ${VERSION} | awk -F: '{ print $2 }')"
+FILE_VERSION="${FILE_VERSION:-${VERSION}}"
+
+git-upstream-add ${VERSION}
+
+############## debian
+
+git checkout debian
+
+git cherry-pick -n upstream
+
+git commit -a -s -S -m "Merging upstream version ${VERSION}."
+
+rm -rf debian
+
+if [ -e $(dirname ${DSC})/$(basename ${DSC} .dsc).diff.gz ]
+then
+ zcat $(dirname ${DSC})/$(basename ${DSC} .dsc).diff.gz | patch -Np1
+fi
+
+if ls $(dirname ${DSC})/$(basename ${DSC} .dsc).debian.tar.* > /dev/null 2>&1
+then
+ tar xf $(dirname ${DSC})/$(basename ${DSC} .dsc).debian.tar.*
+fi
+
+git-debian-add
+
+################ progress-linux / bfh
+
+if git branch | grep -qs progress-linux
+then
+ BRANCH="progress-linux"
+elif git branch | grep -qs bfh
+then
+ BRANCH="bfh"
+fi
+
+git checkout ${BRANCH}
+
+git cherry-pick -n upstream
+git commit -a -s -S -m "Merging upstream version ${VERSION}."
+
+git cherry-pick -n debian
+
+DEBIAN_VERSION="$(dpkg-parsechangelog | awk '/^Version: / { print $2 }')"
+
+git commit -a -s -S -m "Merging debian version ${DEBIAN_VERSION}."