]>
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
9 # shellcheck source=/dev/null
12 if [ ! -d "pkg/$ID/debian" ]; then
13 echo "deb rules not found at pkg/$ID/debian, run mkosi once with -ff to make sure the rules are cloned" >&2
17 # We transplant the debian/ folder from the deb package sources into the upstream sources.
18 mount
--mkdir --bind "$SRCDIR/pkg/$ID/debian" "$SRCDIR"/debian
20 # We remove the patches so they don't get applied.
21 rm -rf "$SRCDIR"/debian
/patches
/*
23 # While the build directory can be specified through DH_OPTIONS, the default one is hardcoded everywhere so
24 # we have to use that. Because it is architecture dependent, we query it using dpkg-architecture first.
25 DEB_HOST_GNU_TYPE
="$(dpkg-architecture --query DEB_HOST_GNU_TYPE)"
26 mount
--mkdir --bind "$BUILDDIR" "$SRCDIR/obj-$DEB_HOST_GNU_TYPE"
28 if [ -d .git
/ ] && [ -z "$(git status --porcelain)" ]; then
29 TS
="$(git show --no-patch --format=%ct HEAD)"
31 TS
="${SOURCE_DATE_EPOCH:-$(date +%s)}"
34 # Add a new changelog entry to update the version. We use a fixed date since a dynamic one causes a full
36 cat >debian
/changelog.new
<<EOF
37 systemd ($(cat meson.version)-$(date "+%Y%m%d%H%M%S" --date "@$TS")) UNRELEASED; urgency=low
39 * Automatic build from mkosi
41 -- systemd test <systemd-devel@lists.freedesktop.org> $(date --rfc-email --date "@$TS")
44 cat debian
/changelog
>>debian
/changelog.new
45 mv debian
/changelog.new debian
/changelog
47 # FIXME: Remove after tmp.mount is kept intact in the debian packaging for UPSTREAM=1 builds.
48 sed --in-place '/tmp.mount/d' debian
/rules
49 sed --in-place '/tmp.mount/d' debian
/not-installed
52 DEB_BUILD_OPTIONS
=$
(awk '$1=$1' <<<"\
53 $( ((WITH_TESTS)) || echo nocheck) \
54 $( ((WITH_DOCS)) || echo nodoc) \
55 $( ((WITH_DEBUG)) && echo debug || echo nostrip) \
60 DEB_BUILD_PROFILES
=$
(awk '$1=$1' <<<"\
61 $( ((WITH_TESTS)) || echo nocheck) \
62 $( ((WITH_DOCS)) || echo nodoc) \
63 pkg.systemd.upstream \
65 DEB_CFLAGS_APPEND
="-O${OPTIMIZATION:-0}" \
66 DPKG_FORCE
="unsafe-io" \
67 DPKG_DEB_COMPRESSOR_TYPE
="none" \
68 DH_MISSING
="--fail-missing" \
69 CONFFLAGS_UPSTREAM
="-D mode=developer -D b_sanitize=${SANITIZERS:-none}" \
77 # debhelper installs files for each package to debian/<package> so we figure out which files were
78 # packaged by querying all the package names from debian/control and running find on each of the
79 # corresponding package directory in debian/.
80 grep "Package:" debian
/control |
82 xargs -d '\n' -I {} sh
-c "[ -d debian/{} ] && (cd debian/{} && find . ! -type d ! -path "*dh-exec
*" -printf '%P\n')" |
83 # Remove compression suffix from compressed manpages as the manpages in debian/tmp will be uncompressed.
84 sed --regexp-extended 's/([0-9])\.gz$/\1/' |
85 sort --unique >/tmp
/packaged-files
87 # We figure out the installed files by running find on debian/tmp/ which contains the files installed
89 (cd debian
/tmp
/ && find .
! -type d
! -path "*dh-exec*" -printf '%P\n') >/tmp
/installed-files
91 if [ -f debian
/not-installed
]; then
92 grep --invert-match "^#" debian
/not-installed
>>/tmp
/installed-files
95 sort --unique --output /tmp
/installed-files
/tmp
/installed-files
97 # We get all the installed files that were not packaged by finding entries in the installed file that are
98 # not in the packaged file.
99 comm -23 /tmp
/installed-files
/tmp
/packaged-files
> /tmp
/unpackaged-files
100 # If there are no unpackaged files something else went wrong.
101 if [ ! -s /tmp
/unpackaged-files
]; then
105 # Otherwise, we append the unpackaged files to the filelist for the systemd package and retry the build.
106 cat /tmp
/unpackaged-files
>>debian
/systemd.
install
112 cp ..
/*.deb ..
/*.ddeb
"$PACKAGEDIR"
113 cp ..
/*.deb ..
/*.ddeb
"$OUTPUTDIR"