From: Michael Tremer Date: Tue, 19 May 2020 11:47:08 +0000 (+0000) Subject: debian: Build each build in their own directory X-Git-Tag: 0.9.1~17 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=748ea080d4dfacbddad332e2e13586f37f0c36b5;p=location%2Flibloc.git debian: Build each build in their own directory Otherwise we will have all packages in one large directory Signed-off-by: Michael Tremer --- diff --git a/debian/build.sh b/debian/build.sh index 024aedd..49315d7 100644 --- a/debian/build.sh +++ b/debian/build.sh @@ -27,13 +27,14 @@ main() { local tmp="$(mktemp -d)" # Extract the sources into it - tar xvfa "${sources}" -C "${tmp}" + mkdir -p "${tmp}/sources" + tar xvfa "${sources}" -C "${tmp}/sources" # Copy the tarball under the correct Debian name - cp -vf "${sources}" "${tmp}/${package//-/_}.orig.tar.xz" + cp -vf "${sources}" "${tmp}/sources/${package//-/_}.orig.tar.xz" - # Change into source directory - pushd "${tmp}/${package}" + # Change into temporary directory + pushd "${tmp}" # Prepare the build environment #if ! debuild -us -uc; then @@ -46,6 +47,9 @@ main() { for release in ${RELEASES[@]}; do local chroot="${release}-${host_arch}-sbuild" + mkdir -p "${release}" + pushd "${release}" + # Create a chroot environment if [ ! -d "/etc/sbuild/chroot/${chroot}" ]; then if ! sbuild-createchroot --arch="${host_arch}" "${release}" \ @@ -58,14 +62,27 @@ main() { # And for each architecture we want to support local arch for arch in ${ARCHITECTURES[@]}; do + mkdir -p "${arch}" + pushd "${arch}" + + # Copy sources + cp -r "${tmp}/sources" . + # Run the build process - if ! sbuild --dist="${release}" --host="${arch}"; then + if ! sbuild --dist="${release}" --host="${arch}" "sources/${package}"; then echo "Could not build package for ${release} on ${arch}" >&2 return 1 fi + + # Remove the sources + rm -rf "sources/${package}" + popd done + popd done + # Remove sources + rm -rf "${tmp}/sources" popd # Cleanup