forked from canonical/core-base
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild-package.sh
executable file
·44 lines (42 loc) · 1.79 KB
/
build-package.sh
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
#!/bin/bash
set -eu
case "$1" in
pull)
craftctl default
export DEBIAN_FRONTEND=noninteractive
export DEBCONF_NONINTERACTIVE_SEEN=true
apt-get build-dep -y ./
;;
build)
# unset the LD_FLAGS and LD_LIBRARY_PATH vars that snapcraft sets for us
# as those will point to the $CRAFT_STAGE which on re-builds will
# contain things like libc and friends that confuse the debian package
# build system
# TODO: should we unset $PATH to not include $CRAFT_STAGE too?
unset LD_FLAGS
unset LD_LIBRARY_PATH
# run the real build (but just build the binary package, and don't
# bother compressing it too much)
dpkg-buildpackage -b -uc -us -Zgzip -zfast
mkdir -p "${CRAFT_PART_INSTALL}/local-debs"
source="$(dpkg-parsechangelog -SSource)"
version="$(dpkg-parsechangelog -SVersion)"
arch="$(dpkg --print-architecture)"
dcmd mv "../${source}_${version}_${arch}.changes" "${CRAFT_PART_INSTALL}/local-debs"
;;
stage)
craftctl default
# It is possible to add .deb packages into a "test-debs" folder in the
# project. These packages are managed as an APT source, and pinned to
# have maximum priority, so, if installed from APT, they will have preference
# over the packages in the standard and PPA repositories, no matter their version
# number. This allows to easily test packages before uploading them to the
# Core Desktop PPA.
if [ -e ${CRAFT_PROJECT_DIR}/test-debs ]; then
cp -a ${CRAFT_PROJECT_DIR}/test-debs/*.deb ${CRAFT_STAGE}/local-debs/
fi
cd "${CRAFT_STAGE}/local-debs"
dpkg-scanpackages . >Packages
apt-ftparchive release . >Release
;;
esac