diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/git-debian-add | 7 | ||||
-rwxr-xr-x | bin/git-upstream-add | 7 | ||||
-rwxr-xr-x | bin/pimport.sh | 82 |
3 files changed, 73 insertions, 23 deletions
diff --git a/bin/git-debian-add b/bin/git-debian-add index 06e25b9..a14b9e5 100755 --- a/bin/git-debian-add +++ b/bin/git-debian-add @@ -20,6 +20,13 @@ HASH="${2}" chmod 0755 debian/rules +if [ -e .gitattributes ] +then + ( cat .gitattributes | grep -v 'filter=lfs' > .gitattributes.tmp ) || true + rm -f .gitattributes + mv .gitattributes.tmp .gitattributes +fi + git add -A -f git commit -a -s -m "Adding ${MODE} version ${VERSION}." ${GIT_OPTIONS} git-${MODE}-tag ${VERSION} ${HASH} diff --git a/bin/git-upstream-add b/bin/git-upstream-add index b4a6a97..615df42 100755 --- a/bin/git-upstream-add +++ b/bin/git-upstream-add @@ -22,6 +22,13 @@ then exit 1 fi +if [ -e .gitattributes ] +then + ( cat .gitattributes | grep -v 'filter=lfs' > .gitattributes.tmp ) || true + rm -f .gitattributes + mv .gitattributes.tmp .gitattributes +fi + if [ ! -d .git ] then git init --shared diff --git a/bin/pimport.sh b/bin/pimport.sh index 573789e..820c797 100755 --- a/bin/pimport.sh +++ b/bin/pimport.sh @@ -78,40 +78,56 @@ WHITE="\033[1;33;37m" NORMAL="\033[0m" PURPLE="\033[1;33;35m" -DSC="${1}" +IMPORT="${1}" -case "${DSC}" in - *.dsc) +case "${IMPORT}" in + *.dsc|*.debian.tar.*) ;; *) - echo "Usage: ${0} DSC" + echo "Usage: ${0} *.dsc" + echo "Usage: ${0} debian.tar.*" exit 1 ;; esac -case "${DSC}" in +case "${IMPORT}" in http*) - DSC_TEMPDIR="$(mktemp -d)" + IMPORT_TEMPDIR="$(mktemp -d)" + + cd "${IMPORT_TEMPDIR}" + + case "${IMPORT}" in + *.dsc) + dget -d "${IMPORT}" + ;; + + *) + wget "${IMPORT}" + ;; + esac - cd "${DSC_TEMPDIR}" - dget -d "${DSC}" cd "${OLDPWD}" - DSC="${DSC_TEMPDIR}/$(basename ${DSC})" + IMPORT="${IMPORT_TEMPDIR}/$(basename ${IMPORT})" ;; esac -PACKAGE="$(basename ${DSC} | awk -F_ '{ print $1 }')" -DEB_VERSION="$(awk '/^Version: / { print $2 }' ${DSC})" +PACKAGE="$(basename ${IMPORT} | awk -F_ '{ print $1 }')" -case "${DEB_VERSION}" in - *-*) - DEB_UPSTREAM_VERSION="$(echo ${DEB_VERSION} | awk -F- '{ $NF=""; print $0 }' | sed -e 's| |-|g' -e 's|-$||g')" - ;; +case "${IMPORT}" in + *.dsc) + DEB_VERSION="$(awk '/^Version: / { print $2 }' ${IMPORT})" - *) - DEB_UPSTREAM_VERSION="${DEB_VERSION}" + case "${DEB_VERSION}" in + *-*) + DEB_UPSTREAM_VERSION="$(echo ${DEB_VERSION} | awk -F- '{ $NF=""; print $0 }' | sed -e 's| |-|g' -e 's|-$||g')" + ;; + + *) + DEB_UPSTREAM_VERSION="${DEB_VERSION}" + ;; + esac ;; esac @@ -190,11 +206,11 @@ Unpack_upstream () TEMPDIR="$(mktemp -d -p . -u)" - dpkg-source -x --no-copy --skip-debianization ${DSC} "${TEMPDIR}" + dpkg-source -x --no-copy --skip-debianization ${IMPORT} "${TEMPDIR}" rm -rf "${TEMPDIR}/debian" find "${TEMPDIR}" -type d -name ".git" -exec rm -rf {} \; || true - DEBIAN_TAR="$(dirname $(readlink -f ${DSC}))/$(awk '/debian.tar.*$/ { print $3 }' ${DSC} | head -n1)" + DEBIAN_TAR="$(dirname $(readlink -f ${IMPORT}))/$(awk '/debian.tar.*$/ { print $3 }' ${IMPORT} | head -n1)" case "${DEBIAN_TAR}" in *.debian.tar.*) @@ -264,7 +280,7 @@ Unpack_debian () TEMPDIR="$(mktemp -d -p . -u)" - dpkg-source -x --no-copy --skip-patches ${DSC} ${TEMPDIR} + dpkg-source -x --no-copy --skip-patches ${IMPORT} ${TEMPDIR} find "${TEMPDIR}" -type d -name ".git" -exec rm -rf {} \; || true find "${TEMPDIR}" -maxdepth 1 -mindepth 1 -print0 | xargs -0 -I '{}' mv '{}' . @@ -425,6 +441,11 @@ Update_bugs_field () esac git commit -a -s -S -m "Updating bugs field." + + if [ $(grep -c "^Bugs:" ${CONTROL}) -gt 1 ] + then + echo "WARNING: duplicates of 'Bugs:' fields in debian/control{,.in} found!" + fi fi } @@ -503,9 +524,24 @@ Update_source_format () } echo "################################################################################" -echo "git: importing ${DSC}" +echo "git: importing ${IMPORT}" echo "################################################################################" +case "${IMPORT}" in + *.debian.tar.*) + git checkout debian + + rm -rf debian + tar xf ${IMPORT_TEMPDIR}/*.debian.tar.* + git-debian-add + + git checkout - + + rm -rf "${IMPORT_TEMPDIR}" + exit 0 + ;; +esac + Add_initial_commit Create_upstream_branch @@ -520,9 +556,9 @@ Remove_everything Unpack_debian Add_debian_version -if [ -n "${DSC_TEMPDIR}" ] +if [ -n "${IMPORT_TEMPDIR}" ] then - rm -rf "${DSC_TEMPDIR}" + rm -rf "${IMPORT_TEMPDIR}" fi # progress-linux / bfh |