]>
git.ipfire.org Git - thirdparty/systemd.git/blob - mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.build.chroot
2 # SPDX-License-Identifier: LGPL-2.1-or-later
5 # shellcheck source=/dev/null
8 if [ ! -d "pkg/$ID/debian" ]; then
9 echo "deb rules not found at pkg/$ID/debian, run mkosi once with -ff to make sure the rules are cloned" >&2
13 # We transplant the debian/ folder from the deb package sources into the upstream sources.
14 mount
--mkdir --bind "$SRCDIR/pkg/$ID/debian" "$SRCDIR"/debian
16 # We remove the patches so they don't get applied.
17 rm -rf "$SRCDIR"/debian
/patches
/*
19 # While the build directory can be specified through DH_OPTIONS, the default one is hardcoded everywhere so
20 # we have to use that. Because it is architecture dependent, we query it using dpkg-architecture first.
21 DEB_HOST_GNU_TYPE
="$(dpkg-architecture --query DEB_HOST_GNU_TYPE)"
22 mount
--mkdir --bind "$BUILDDIR" "$SRCDIR/obj-$DEB_HOST_GNU_TYPE"
24 if [ -d .git
/ ] && [ -z "$(git status --porcelain)" ]; then
25 TS
="$(git show --no-patch --format=%ct HEAD)"
27 TS
="${SOURCE_DATE_EPOCH:-$(date +%s)}"
30 # Add a new changelog entry to update the version. We use a fixed date since a dynamic one causes a full
32 cat >debian
/changelog.new
<<EOF
33 systemd ($(cat meson.version)-$(date "+%Y%m%d%H%M%S" --date "@$TS")) UNRELEASED; urgency=low
35 * Automatic build from mkosi
37 -- systemd test <systemd-devel@lists.freedesktop.org> $(date --rfc-email --date "@$TS")
40 cat debian
/changelog
>>debian
/changelog.new
41 mv debian
/changelog.new debian
/changelog
44 DEB_BUILD_OPTIONS
=$
(awk '$1=$1' <<<"\
45 $( ((WITH_TESTS)) || echo nocheck) \
46 $( ((WITH_DOCS)) || echo nodoc) \
47 $( ((WITH_DEBUG)) && echo debug || echo nostrip) \
52 DEB_BUILD_PROFILES
=$
(awk '$1=$1' <<<"\
53 $( ((WITH_TESTS)) || echo nocheck) \
54 $( ((WITH_DOCS)) || echo nodoc) \
55 pkg.systemd.upstream \
57 DEB_CFLAGS_APPEND
="-O${OPTIMIZATION:-0}" \
58 DPKG_FORCE
="unsafe-io" \
59 DPKG_DEB_COMPRESSOR_TYPE
="none" \
60 DH_MISSING
="--fail-missing" \
61 CONFFLAGS_UPSTREAM
="-D mode=developer -D b_sanitize=${SANITIZERS:-none}" \
69 # debhelper installs files for each package to debian/<package> so we figure out which files were
70 # packaged by querying all the package names from debian/control and running find on each of the
71 # corresponding package directory in debian/.
72 grep "Package:" debian
/control |
74 xargs -d '\n' -I {} sh
-c "[ -d debian/{} ] && (cd debian/{} && find . ! -type d ! -path "*dh-exec
*" -printf '%P\n')" |
75 # Remove compression suffix from compressed manpages as the manpages in debian/tmp will be uncompressed.
76 sed --regexp-extended 's/([0-9])\.gz$/\1/' |
77 sort --unique >/tmp
/packaged-files
79 # We figure out the installed files by running find on debian/tmp/ which contains the files installed
81 (cd debian
/tmp
/ && find .
! -type d
! -path "*dh-exec*" -printf '%P\n') >/tmp
/installed-files
83 if [ -f debian
/not-installed
]; then
84 grep --invert-match "^#" debian
/not-installed
>>/tmp
/installed-files
87 sort --unique --output /tmp
/installed-files
/tmp
/installed-files
89 # We get all the installed files that were not packaged by finding entries in the installed file that are
90 # not in the packaged file.
91 comm -23 /tmp
/installed-files
/tmp
/packaged-files
> /tmp
/unpackaged-files
92 # If there are no unpackaged files something else went wrong.
93 if [ ! -s /tmp
/unpackaged-files
]; then
97 # Otherwise, we append the unpackaged files to the filelist for the systemd package and retry the build.
98 cat /tmp
/unpackaged-files
>>debian
/systemd.
install
104 cp ..
/*.deb ..
/*.ddeb
"$PACKAGEDIR"
105 cp ..
/*.deb ..
/*.ddeb
"$OUTPUTDIR"