build: unify locally build package output directory.

This commit is contained in:
Alexandre Pujol 2024-10-07 14:05:40 +01:00
parent 31af758639
commit 4f861158cf
No known key found for this signature in database
GPG Key ID: C5469996F0DF68EC
5 changed files with 12 additions and 11 deletions

View File

@ -4,7 +4,7 @@ include:
- template: Security/SAST.gitlab-ci.yml
variables:
PKGDEST: $CI_PROJECT_DIR/packages
PKGDEST: $CI_PROJECT_DIR/.pkg
PACKAGER: 'Alexandre Pujol <alexandre@pujol.io>'
stages:

View File

@ -120,5 +120,4 @@ serve:
clean:
@rm -rf \
debian/.debhelper debian/debhelper* debian/*.debhelper debian/${PKGNAME} \
${PKGNAME}-*.pkg.tar.zst.sig ${PKGNAME}-*.pkg.tar.zst coverage.out \
${PKGNAME}_*.* ${PKGNAME}-*.rpm ${BUILD}
.pkg/${PKGNAME}* ${BUILD} coverage.out

View File

@ -8,7 +8,7 @@
set -eu -o pipefail
readonly COMMAND="$1"
readonly OUTPUT="${PKGDEST:-$PWD}"
readonly OUTPUT=".pkg"
readonly PKGNAME=apparmor.d
VERSION="0.$(git rev-list --count HEAD)"
readonly VERSION

View File

@ -12,6 +12,7 @@ readonly PREFIX="builder-"
readonly PKGNAME=apparmor.d
readonly VOLUME=/tmp/build
readonly BUILDIR=/home/build/tmp
readonly OUTPUT=".pkg"
readonly COMMAND="$1"
VERSION="0.$(git rev-list --count HEAD)"
PACKAGER="$(git config user.name) <$(git config user.email)>"
@ -62,7 +63,7 @@ build_in_docker_makepkg() {
fi
docker exec --workdir="$BUILDIR/$PKGNAME" "$img" bash dists/build.sh pkg
mv "$VOLUME/$PKGNAME"-*.pkg.* .
mv "$VOLUME/$PKGNAME"-*.pkg.* "$OUTPUT"
}
build_in_docker_dpkg() {
@ -85,7 +86,7 @@ build_in_docker_dpkg() {
fi
docker exec --workdir="$BUILDIR/$PKGNAME" "$img" bash dists/build.sh dpkg
mv "$VOLUME/$PKGNAME/${PKGNAME}_${VERSION}-1"_*.* .
mv "$VOLUME/$PKGNAME/${PKGNAME}_${VERSION}-1"_*.* "$OUTPUT"
}
build_in_docker_rpm() {
@ -104,14 +105,14 @@ build_in_docker_rpm() {
fi
docker exec --workdir="$BUILDIR/$PKGNAME" "$img" bash dists/build.sh rpm
mv "$VOLUME/$PKGNAME/$PKGNAME-$VERSION-"*.rpm .
mv "$VOLUME/$PKGNAME/$PKGNAME-$VERSION-"*.rpm "$OUTPUT"
}
main() {
case "$COMMAND" in
archlinux)
# build_in_docker_makepkg "$COMMAND"
PKGDEST=. makepkg -Cf
PKGDEST="$OUTPUT" makepkg -Cf
;;
debian | ubuntu | whonix)
@ -128,4 +129,5 @@ main() {
esac
}
mkdir -p "$OUTPUT"
main "$@"

View File

@ -22,7 +22,7 @@ build {
only = ["qemu.archlinux"]
destination = "/tmp/src/"
sources = [
"${path.cwd}/../apparmor.d-${var.version}-1-x86_64.pkg.tar.zst",
"${path.cwd}/../.pkg/apparmor.d-${var.version}-1-x86_64.pkg.tar.zst",
]
}
@ -61,12 +61,12 @@ build {
}
post-processor "vagrant" {
output = "${var.base_dir}/packer_${var.prefix}${source.name}.box"
output = "${var.base_dir}/packer_${var.prefix}${source.name}-${var.flavor}.box"
}
post-processor "shell-local" {
inline = [
"vagrant box add --force --name ${var.prefix}${source.name} ${var.base_dir}/packer_${var.prefix}${source.name}.box"
"vagrant box add --force --name ${var.prefix}${source.name}-${var.flavor} ${var.base_dir}/packer_${var.prefix}${source.name}-${var.flavor}.box"
]
}