summaryrefslogtreecommitdiffstats
path: root/bin/git-debian-init
diff options
context:
space:
mode:
Diffstat (limited to 'bin/git-debian-init')
-rwxr-xr-xbin/git-debian-init113
1 files changed, 113 insertions, 0 deletions
diff --git a/bin/git-debian-init b/bin/git-debian-init
new file mode 100755
index 0000000..37235d9
--- /dev/null
+++ b/bin/git-debian-init
@@ -0,0 +1,113 @@
+#!/bin/sh
+
+# source-tools - Manage Git repositories effectively and efficiently
+# Copyright (C) 2014-2017 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+set -e
+
+MODE="$(basename ${0} | sed -e s'|^git-||' -e 's|-init$||')"
+
+DSCS="${@}"
+
+for DSC in ${DSCS}
+do
+ PACKAGE="$(basename ${DSC} .dsc | awk -F_ '{ print $1 }')"
+
+ dget --download-only "${DSC}"
+ dpkg-source -x --no-copy --skip-debianization $(basename ${DSC}) ${PACKAGE}
+
+ cd ${PACKAGE}
+ git init --shared
+ git commit -a -s -S -m "Initial commit." --allow-empty
+
+ VERSION="$(awk '/^Version: / { print $2 }' ../$(basename ${DSC}) | head -n1)"
+
+ FILE_VERSION="$(echo ${VERSION} | awk -F: '{ print $2 }')"
+ FILE_VERSION="${FILE_VERSION:-${VERSION}}"
+
+ if [ -e debian ]
+ then
+ mv debian ../debian.orig
+ fi
+
+ git-upstream-add ${VERSION}
+
+ git checkout -b debian
+
+ if [ -e ../debian.orig ]
+ then
+ mv ../debian.orig debian
+ fi
+
+ if [ -e ../${PACKAGE}_${FILE_VERSION}.diff.gz ]
+ then
+ zcat ../${PACKAGE}_${FILE_VERSION}.diff.gz | patch -Np1
+ fi
+
+ if ls ../${PACKAGE}_${FILE_VERSION}.debian.tar.* > /dev/null 2>&1
+ then
+ tar xf ../${PACKAGE}_${FILE_VERSION}.debian.tar.*
+ fi
+
+ git-debian-add
+
+ case "${MODE}" in
+ debian)
+ ;;
+
+ *)
+ git checkout -b ${MODE}
+ ;;
+ esac
+done
+
+exit 0
+
+ if [ "${MODE}" = "progress-linux" ]
+ then
+ if [ -e debian/control.in ]
+ then
+ CONTROL=debian/control.in
+ else
+ CONTROL=debian/control
+ fi
+
+ sed -i -e "s|^Maintainer: \(.*$\)|Maintainer: Progress Linux Maintainers <maintainers@lists.progress-linux.org>\nXSBC-Original-Maintainer: \1|" ${CONTROL}
+ git commit -a -s -S -m 'Updating maintainer field.'
+
+ if grep -qs "^Uploaders:" ${CONTROL}
+ then
+ sed -i -e "s|^Uploaders: \(.*$\)|XSBC-Uploaders: Daniel Baumann <daniel.baumann@progress-linux.org\nXSBC-Original-Uploaders: \1|" ${CONTROL}
+ else
+ sed -i -e "s|^\(Maintainer: .*$\)|\1\nXSBC-Uploaders: Daniel Baumann <daniel.baumann@progress-linux.org|" ${CONTROL}
+ fi
+
+ git commit -a -s -S -m "Updating uploaders field."
+
+ if grep -qs "^Bugs:" ${CONTROL}
+ then
+ sed -i -e "s|^Bugs: \(.*$\)|Bugs: mailto:bugs@lists.progress-linux.org\nXSBC-Original-Bugs: \1|" ${CONTROL}
+ else
+ sed -i -e "s|^\(Uploaders: .*$\)|\1\nBugs: mailto:bugs@lists.progress-linux.org|" ${CONTROL}
+ fi
+
+ git commit -a -s -S -m "Updating bugs field."
+
+
+
+
+ fi
+done