From aa1e17f5ca7d47107f74dd8c6815b52c714957a9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Sun, 27 Sep 2020 12:18:21 +0200 Subject: [PATCH] debian: Remove now obsolete tarsource.sh script MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Ondřej Surý --- doc/developer/packaging-debian.rst | 7 - tools/build-debian-package.sh | 1 + tools/tarsource.sh | 329 ----------------------------- 3 files changed, 1 insertion(+), 336 deletions(-) delete mode 100755 tools/tarsource.sh diff --git a/doc/developer/packaging-debian.rst b/doc/developer/packaging-debian.rst index e643cf19d..da5c60d9a 100644 --- a/doc/developer/packaging-debian.rst +++ b/doc/developer/packaging-debian.rst @@ -94,12 +94,6 @@ buster.) a manually maintained changelog that contains proper Debian release versioning. - Furthermore, official Debian packages are built in ``3.0 (quilt)`` format - with an "orig" tarball and a "debian" tarball. These tarballs are created - by the ``tarsource.sh`` tool on any branch. The git repository however - contains a ``3.0 (git)`` source format specifier to easily allow direct - git builds. - .. _multi-dist: @@ -108,7 +102,6 @@ Multi-Distribution builds You can optionally append a distribution identifier in case you want to make multiple versions of the package available in the same repository. -Do the following after creating the changelog with `tarsource.sh`: .. code-block:: shell diff --git a/tools/build-debian-package.sh b/tools/build-debian-package.sh index bd87ac057..6791325e7 100755 --- a/tools/build-debian-package.sh +++ b/tools/build-debian-package.sh @@ -1,6 +1,7 @@ #!/bin/sh # # Written by Daniil Baturin, 2018 +# Rewritten by Ondřej Surý, 2020 # This file is public domain set -e diff --git a/tools/tarsource.sh b/tools/tarsource.sh deleted file mode 100755 index b548fb8ac..000000000 --- a/tools/tarsource.sh +++ /dev/null @@ -1,329 +0,0 @@ -#!/bin/bash -# 2018 by David Lamparter, placed in the Public Domain - -help() { - cat <&2 - exit 1 - ;; - esac -done - -cwd="`pwd`" -outdir="${outdir:-$cwd}" - -if test -e "$outdir" -a \! -d "$outdir"; then - echo "output $outdir must be a directory" >&2 - exit 1 -elif test \! -d "$outdir"; then - mkdir -p "$outdir" -fi - -cd "$outdir" -outdir="`pwd`" -cd "$cwd" -cd "`dirname $0`/.." -selfdir="`pwd`" -src="${src:-$selfdir}" - -if $writeversion; then - if $nongit; then - echo "The -V option cannot be used without a git tree" >&2 - exit 1 - fi - dirty=true -fi - -case "$zip" in -gz) ziptarget=dist-gzip; ziptool="gzip -n -9"; unzip="gzip -k -c";; -xz) ziptarget=dist-xz; ziptool="xz -z -e"; unzip="xz -d -k -c";; -*) echo "unknown compression format $zip" >&2 - exit 1 -esac - -# always overwrite file ownership in tars -taropt="--owner=root --group=root" - -onexit() { - rv="$?" - set +e - test -n "$tmpdir" -a -d "$tmpdir" && rm -rf "$tmpdir" - - if test "$rv" -ne 0; then - echo -e "\n\033[31;1mfailed\n" >&2 - if test "$dirty" = true; then - echo please try running the script without the -d option.>&2 - fi - fi - exit $rv -} -trap onexit EXIT -tmpdir="`mktemp -d -t frrtar.XXXXXX`" - -if test -e "$src/.git"; then - commit="`git -C \"$src\" rev-parse \"${commit:-HEAD}\"`" - - if $dirty; then - cd "$src" - echo -e "\033[31;1mgit: using dirty worktree in $src\033[m" >&2 - else - echo -e "\033[33;1mgit: preparing a clean clone of $src\033[m" - branch="${tmpdir##*/}" - cd "$tmpdir" - - git -C "$src" branch "$branch" "$commit" - git clone --single-branch -s -b "$branch" "$src" source - git -C "$src" branch -D "$branch" - cd source - fi - - # if we're creating a tarball from git, force the timestamps inside - # the tar to match the commit date - this makes the tarball itself - # reproducible - gitts="`TZ=UTC git show -s --format=%cd --date=local $commit`" - gitts="`TZ=UTC date -d "$gitts" '+%Y-%m-%dT%H:%M:%SZ'`" - taropt="--mtime=$gitts $taropt" - - # check if we're on a release tag - gittag="`git -C \"$src\" describe --tags --match 'frr-*' --first-parent --long $commit`" - gittag="${gittag%-g*}" - gittag="${gittag%-*}" - - # if there have been changes to packaging or tests, it's still the - # same release - changes="`git diff --name-only "$gittag" $commit | \ - egrep -v '\.git|^m4/|^config|^README|^alpine/|^debian/|^pkgsrc/|^ports/|^redhat/|^snapcraft/|^solaris/|^tests/|^tools/|^gdb/|^docker/|^\.' | \ - wc -l`" - if test "$changes" -eq 0; then - adjchangelog=true - echo "detected release build for tag $gittag" >&2 - $extraset || extraver="" - elif ! $adjchangelog; then - gitdate="`TZ=UTC date -d "$gitts" '+%Y%m%d'`" - gitrev="`git rev-parse --short $commit`" - dayseq="`git rev-list --since \"${gitts%T*} 00:00:00 +0000\" $commit | wc -l`" - dayseq="`printf '%02d' $(( $dayseq - 1 ))`" - - $extraset || extraver="-$gitdate-$dayseq-g$gitrev" - - git -C "$src" remote -v | grep fetch | sed -e 's% (fetch)$%%' \ - | egrep -i '\b(git@github\.com:frrouting/frr\.git|https://github\.com/FRRouting/frr\.git)$' \ - | while read remote; do - remote="${remote%% *}" - - git -C "$src" var -l | egrep "^remote.$remote.fetch=" \ - | while read fetch; do - fetch="${fetch#*=}" - from="${fetch%:*}" - to="${fetch#*:}" - if test "$from" = "+refs/pull/*/head"; then - name="`git -C \"$src\" name-rev --name-only --refs \"$to\" $commit`" - test "$name" = "undefined" && continue - realname="${name%~*}" - realname="${realname%%^*}" - realname="${realname%%@*}" - if test "$realname" = "$name"; then - echo "${name##*/}" > "$tmpdir/.gitpr" - break - fi - fi - done || true - test -n "$gitpr" && break - done || true - test $extraset = false -a -f "$tmpdir/.gitpr" && extraver="-PR`cat \"$tmpdir/.gitpr\"`$extraver" - fi - - debsrc="git ls-files debian/" -else - if $nongit; then - echo -e "\033[31;1mWARNING: this script should be executed from a git tree\033[m" >&2 - else - echo -e "\033[31;1mERROR: this script should be executed from a git tree\033[m" >&2 - exit 1 - fi - debsrc="echo debian" -fi - -if $writeversion; then - pkgver="`egrep ^AC_INIT configure.ac`" - pkgver="${pkgver#*,}" - pkgver="${pkgver%,*}" - pkgver="`echo $pkgver`" # strip whitespace - pkgver="${pkgver#[}" - pkgver="${pkgver%]}" - - echo -e "\033[32;1mwriting version ID \033[36;1mfrr-$pkgver$extraver\033[m" - - cat > config.version <> "$tmpdir/debian/changelog" - DEBVER="`dpkg-parsechangelog -l\"$tmpdir/debian/changelog\" -SVersion`" - - eval $debsrc | tar -cho $taropt \ - -T - -f ../frr_${DEBVER}.debian.tar - # add specially prepared files from above - tar -uf ../frr_${DEBVER}.debian.tar $taropt -C "$tmpdir" debian/changelog - - test -f ../frr_${DEBVER}.debian.tar.$zip && rm -f ../frr_${DEBVER}.debian.tar.$zip - $ziptool ../frr_${DEBVER}.debian.tar - - # pack up debian files proper - ln -s "$outdir/frr-${PACKAGE_VERSION}.tar.$zip" ../frr_${PACKAGE_VERSION}.orig.tar.$zip - dpkg-source -l"$tmpdir/debian/changelog" \ - --format='3.0 (custom)' --target-format='3.0 (quilt)' \ - -b . frr_${PACKAGE_VERSION}.orig.tar.$zip frr_${DEBVER}.debian.tar.$zip - - dpkg-genchanges -sa -S > ../frr_${DEBVER}_source.changes - - test -n "$keyid" && debsign ../frr_${DEBVER}_source.changes -k"$keyid" - - mv ../frr_${DEBVER}_source.changes "$outdir" || true - mv ../frr_${DEBVER}.dsc "$outdir" || true - mv ../frr_${DEBVER}.debian.tar.$zip "$outdir" || true - if test -h ../frr_${PACKAGE_VERSION}.orig.tar.$zip; then - rm ../frr_${PACKAGE_VERSION}.orig.tar.$zip || true - fi - ln -s frr-${PACKAGE_VERSION}.tar.$zip "$outdir/frr_${PACKAGE_VERSION}.orig.tar.$zip" || true - - cd "$outdir" - - lsfiles="$lsfiles \ - frr_${DEBVER}.dsc \ - frr_${DEBVER}.debian.tar.$zip \ - frr_${PACKAGE_VERSION}.orig.tar.$zip \ - frr_${DEBVER}_source.changes" -fi - -cd "$outdir" -if test -n "$keyid"; then - $unzip frr-${PACKAGE_VERSION}.tar.$zip > frr-${PACKAGE_VERSION}.tar - test -f frr-${PACKAGE_VERSION}.tar.asc && rm frr-${PACKAGE_VERSION}.tar.asc - if gpg -a --detach-sign -u "$keyid" frr-${PACKAGE_VERSION}.tar; then - lsfiles="$lsfiles frr-${PACKAGE_VERSION}.tar.asc" - fi - rm frr-${PACKAGE_VERSION}.tar -fi - -echo -e "\n\033[32;1mdone: \033[36;1mfrr-$PACKAGE_VERSION\033[m\n" -ls -l $lsfiles -- 2.39.5