From 453cc058d9ee6d7cb47529d99061216e72149a5f Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 9 May 2021 06:21:55 +0200 Subject: Adding bin. Signed-off-by: Daniel Baumann --- bin/git-debian-init | 113 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100755 bin/git-debian-init (limited to 'bin/git-debian-init') 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 +# +# 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 . + +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 \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