]> git.ipfire.org Git - location/libloc.git/commitdiff
debian: Build each build in their own directory
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 19 May 2020 11:47:08 +0000 (11:47 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 19 May 2020 11:47:08 +0000 (11:47 +0000)
Otherwise we will have all packages in one large directory

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
debian/build.sh

index 024aedd727f8721a3fc74853621194ff37fe397b..49315d7c141a4b44dc80e11d7f9b5896e99ec01d 100644 (file)
@@ -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