5 # default to Debian testing
6 DISTRO
=${DISTRO:-debian}
7 RELEASE
=${RELEASE:-buster}
8 BRANCH
=${BRANCH:-upstream-ci}
10 CONTAINER
=${RELEASE}-${ARCH}
11 CACHE_DIR
=${SEMAPHORE_CACHE_DIR:=/tmp}
12 AUTOPKGTEST_DIR
="${CACHE_DIR}/autopkgtest"
13 # semaphore cannot expose these, but useful for interactive/local runs
14 ARTIFACTS_DIR
=/tmp
/artifacts
15 PHASES
=(${@:-SETUP RUN})
16 UBUNTU_RELEASE
="$(lsb_release -cs)"
19 # create autopkgtest LXC image; this sometimes fails with "Unable to fetch
20 # GPG key from keyserver", so retry a few times
21 for retry
in {1.
.5}; do
22 sudo lxc-create
-n $CONTAINER -t download
-- -d $DISTRO -r $RELEASE -a $ARCH --keyserver hkp
://keyserver.ubuntu.com
:80 && break
23 sleep $
((retry
*retry
))
26 # unconfine the container, otherwise some tests fail
27 echo 'lxc.apparmor.profile = unconfined' | sudo
tee -a /var
/lib
/lxc
/$CONTAINER/config
29 sudo lxc-start
-n $CONTAINER
31 # enable source repositories so that apt-get build-dep works
32 sudo lxc-attach
-n $CONTAINER -- sh
-ex <<EOF
33 sed 's/^deb/deb-src/' /etc/apt/sources.list >> /etc/apt/sources.list.d/sources.list
35 while [ -z "\$(ip route list 0/0)" ]; do sleep 1; done
36 apt-get -q --allow-releaseinfo-change update
37 apt-get -y dist-upgrade
38 apt-get install -y eatmydata
39 # The following four are needed as long as these deps are not covered by Debian's own packaging
40 apt-get install -y fdisk libfdisk-dev libp11-kit-dev libssl-dev libpwquality-dev
41 apt-get purge --auto-remove -y unattended-upgrades
42 systemctl unmask systemd-networkd
43 systemctl enable systemd-networkd
45 sudo lxc-stop
-n $CONTAINER
48 for phase
in "${PHASES[@]}"; do
51 # remove semaphore repos, some of them don't work and cause error messages
52 sudo
rm -f /etc
/apt
/sources.list.d
/*
54 # enable backports for latest LXC
55 echo "deb http://archive.ubuntu.com/ubuntu $UBUNTU_RELEASE-backports main restricted universe multiverse" | sudo
tee -a /etc
/apt
/sources.list.d
/backports.list
56 sudo apt-get
-q update
57 sudo apt-get
install -y -t "$UBUNTU_RELEASE-backports" lxc
58 sudo apt-get
install -y python3-debian git dpkg-dev fakeroot
60 [ -d $AUTOPKGTEST_DIR ] || git clone
--quiet --depth=1 https
://salsa.debian.org
/ci-team
/autopkgtest.git
"$AUTOPKGTEST_DIR"
65 # add current debian/ packaging
66 git fetch
--depth=1 https
://salsa.debian.org
/systemd-team
/systemd.git
$BRANCH
67 git checkout FETCH_HEAD debian
70 UPSTREAM_VER
=$
(git describe |
sed 's/^v//;s/-/./g')
71 cat << EOF > debian/changelog.new
72 systemd (${UPSTREAM_VER}.0) UNRELEASED; urgency=low
74 * Automatic build for upstream test
76 -- systemd test <pkg-systemd-maintainers@lists.alioth.debian.org> $(date -R)
79 cat debian
/changelog
>> debian
/changelog.new
80 mv debian
/changelog.new debian
/changelog
84 # disable autopkgtests which are not for upstream
85 sed -i '/# NOUPSTREAM/ q' debian
/tests
/control
86 # enable more unit tests
87 sed -i '/^CONFFLAGS =/ s/=/= --werror -Dtests=unsafe -Dsplit-usr=true -Dslow-tests=true -Dman=true /' debian
/rules
89 echo '1.0' > debian
/source
/format
91 # build source package
92 dpkg-buildpackage
-S -I -I$
(basename "$CACHE_DIR") -d -us -uc -nc
94 # now build the package and run the tests
95 rm -rf "$ARTIFACTS_DIR"
96 # autopkgtest exits with 2 for "some tests skipped", accept that
97 $AUTOPKGTEST_DIR/runner
/autopkgtest
--env DEB_BUILD_OPTIONS
=noudeb \
98 --env TEST_UPSTREAM
=1 ..
/systemd_
*.dsc \
100 -- lxc
-s $CONTAINER \
104 echo >&2 "Unknown phase '$phase'"