From 571cac576e8fe59ac7974f7bd153e59eb3475f0a Mon Sep 17 00:00:00 2001 From: Dmitry Smirnov Date: Sat, 5 Oct 2019 09:03:27 +1000 Subject: [PATCH] Added helper script to unpack MUT components; CI orig tarball handling correction. --- debian/unpack-components.sh | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 debian/unpack-components.sh diff --git a/debian/unpack-components.sh b/debian/unpack-components.sh new file mode 100755 index 0000000000..9554ca550d --- /dev/null +++ b/debian/unpack-components.sh @@ -0,0 +1,36 @@ +#!/bin/bash +: <<=cut + +=head1 DESCRIPTION + +Unpack MUT components. + +=head1 SYNOPSIS + + ./debian/unpack-components.sh + +=cut + +set -e +set -u + +DEB_SOURCE="$( dpkg-parsechangelog -SSource )" +DEB_VERSION_UPSTREAM="$( dpkg-parsechangelog -SVersion | sed -e 's/-[^-]*$//' )" + +if ls ../${DEB_SOURCE}_${DEB_VERSION_UPSTREAM}.orig-*.tar.* 2>>/dev/null; then + for T in ../${DEB_SOURCE}_${DEB_VERSION_UPSTREAM}.orig-*.tar.*; do + C="${T##*.orig-}" + C="${C%%.tar*}" + mkdir -p "${C}" + tar xf ${T} -C "${C}" --strip-components=1 + if [ "$(ls -m ${C})" == "${C}" ]; then + ## --strip-components=1 did not work. + mv "${C}" "${C}.tmp" + mv "${C}.tmp/${C}" . + rmdir "${C}.tmp" + fi + done +else + printf "W: no components to extract.\n" + exit 0 +fi