build(opensuse): improve opensuse build process.

This commit is contained in:
Alexandre Pujol 2024-03-17 21:34:06 +00:00
parent 233b1f2f0e
commit 158c6006b1
No known key found for this signature in database
GPG Key ID: C5469996F0DF68EC
2 changed files with 6 additions and 5 deletions

View File

@ -26,7 +26,7 @@ full: build
ROOT = $(shell find "${BUILD}/root" -type f -printf "%P\n") ROOT = $(shell find "${BUILD}/root" -type f -printf "%P\n")
PROFILES = $(shell find "${BUILD}/apparmor.d" -type f -printf "%P\n") PROFILES = $(shell find "${BUILD}/apparmor.d" -type f -printf "%P\n")
install: install:
@install -Dm755 ${BUILD}/aa-log ${DESTDIR}/usr/bin/aa-log @install -Dm0755 ${BUILD}/aa-log ${DESTDIR}/usr/bin/aa-log
@for file in ${ROOT}; do \ @for file in ${ROOT}; do \
install -Dm0644 "${BUILD}/root/$${file}" "${DESTDIR}/$${file}"; \ install -Dm0644 "${BUILD}/root/$${file}" "${DESTDIR}/$${file}"; \
done; done;
@ -78,7 +78,7 @@ dpkg:
rpm: rpm:
@bash dists/build.sh rpm @bash dists/build.sh rpm
@sudo rpm -i ${PKGNAME}-*.rpm @sudo rpm -ivh --force ${PKGNAME}-*.rpm
tests: tests:
@go test ./cmd/... -v -cover -coverprofile=coverage.out @go test ./cmd/... -v -cover -coverprofile=coverage.out

View File

@ -8,7 +8,8 @@
set -eu -o pipefail set -eu -o pipefail
readonly COMMAND="$1" readonly COMMAND="$1"
readonly OUTPUT="${PKGDEST:-$PWD}" readonly OUTPUT="$PWD"
readonly PKGDEST="${PKGDEST:-$PWD}"
readonly PKGNAME=apparmor.d readonly PKGNAME=apparmor.d
VERSION="0.$(git rev-list --count HEAD)" VERSION="0.$(git rev-list --count HEAD)"
readonly VERSION readonly VERSION
@ -27,7 +28,7 @@ main() {
;; ;;
rpm) rpm)
RPMBUILD_ROOT=$(mktemp -d) RPMBUILD_ROOT=$(mktemp -d /tmp/$PKGNAME.XXXXXX)
ARCH=$(uname -m) ARCH=$(uname -m)
readonly RPMBUILD_ROOT ARCH readonly RPMBUILD_ROOT ARCH
@ -39,7 +40,7 @@ main() {
sed -i "s/^Version:.*/Version: $VERSION/" "SPECS/$PKGNAME.spec" sed -i "s/^Version:.*/Version: $VERSION/" "SPECS/$PKGNAME.spec"
rpmbuild -bb --define "_topdir $RPMBUILD_ROOT" "SPECS/$PKGNAME.spec" rpmbuild -bb --define "_topdir $RPMBUILD_ROOT" "SPECS/$PKGNAME.spec"
cp "$RPMBUILD_ROOT/RPMS/$ARCH/"*.rpm "$OUTPUT" mv "$RPMBUILD_ROOT/RPMS/$ARCH/"*.rpm "$OUTPUT"
rm -rf "$RPMBUILD_ROOT" rm -rf "$RPMBUILD_ROOT"
;; ;;