forked from shramov/tll-http
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpack.sh
More file actions
executable file
·48 lines (37 loc) · 1.32 KB
/
pack.sh
File metadata and controls
executable file
·48 lines (37 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env bash
set -euo pipefail
# Detect distro tag for output path
source /etc/os-release
DISTRO_TAG="$(echo "${ID,,}-${VERSION_ID}" | tr -d '"')"
# Read package metadata from debian/changelog
PKG_NAME="$(dpkg-parsechangelog -S Source)"
PKG_VER="$(dpkg-parsechangelog -S Version)"
# Normalise version for filename part
PKG_VER_FILE="${PKG_VER#*:}"
ARCH="$(dpkg-architecture -qDEB_BUILD_ARCH)"
# Reproducibility: pin SOURCE_DATE_EPOCH from changelog
export SOURCE_DATE_EPOCH="$(date -d "$(dpkg-parsechangelog -S Date)" +%s)"
# Output dir
OUTDIR="build-deb/${DISTRO_TAG}/${PKG_VER_FILE}-${ARCH}"
mkdir -p "${OUTDIR}"
# Clean (no root needed if Rules-Requires-Root: no)
#if [ -f debian/rules ]; then
# debian/rules clean || true
#fi
# Build (binary-only), no signing, parallel, skip tests
export DEB_BUILD_OPTIONS="${DEB_BUILD_OPTIONS:+$DEB_BUILD_OPTIONS }nocheck parallel=$(nproc)"
dpkg-buildpackage -b -uc -us -j"$(nproc)"
# Move artifacts
shopt -s nullglob
for f in ../*_${PKG_VER_FILE}_${ARCH}.deb \
../*_${PKG_VER_FILE}_${ARCH}.ddeb \
../*_${PKG_VER_FILE}_${ARCH}.buildinfo \
../*_${PKG_VER_FILE}_*.changes \
../*_${PKG_VER_FILE}.dsc \
../*_${PKG_VER_FILE}.tar.*; do
mv -v "$f" "${OUTDIR}/"
done
shopt -u nullglob
echo "Artifacts in: ${OUTDIR}"
# Cleanup
rm -rf obj-x86_64-linux-gnu