]>
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 if [ ! -d "pkg/$PKG_SUBDIR/debian" ]; then
6 echo "deb rules not found at pkg/$PKG_SUBDIR/debian, run mkosi once with -ff to make sure the rules are cloned" >&2
10 # We transplant the debian/ folder from the deb package sources into the upstream sources.
11 mount
--mkdir --bind "$SRCDIR/pkg/$PKG_SUBDIR/debian" "$SRCDIR"/debian
13 # We hide the patches/ directory by mounting an empty directory on top so they don't get applied.
15 mount
--bind "$TMP" "$SRCDIR"/debian
/patches
17 # While the build directory can be specified through DH_OPTIONS, the default one is hardcoded everywhere so
18 # we have to use that. Because it is architecture dependent, we query it using dpkg-architecture first.
19 DEB_HOST_GNU_TYPE
="$(dpkg-architecture --query DEB_HOST_GNU_TYPE)"
20 mount
--mkdir --bind "$BUILDDIR" "$SRCDIR/obj-$DEB_HOST_GNU_TYPE"
22 if [ -d .git
/ ] && [ -z "$(git status --porcelain)" ]; then
23 TS
="$(git show --no-patch --format=%ct HEAD)"
25 TS
="${SOURCE_DATE_EPOCH:-$(date +%s)}"
28 # Add a new changelog entry to update the version. We use a fixed date since a dynamic one causes a full
30 cat >debian
/changelog.new
<<EOF
31 systemd ($(cat meson.version).$(date "+%Y%m%d%H%M%S" --date "@$TS")) UNRELEASED; urgency=low
33 * Automatic build from mkosi
35 -- systemd test <systemd-devel@lists.freedesktop.org> $(date --rfc-email --date "@$TS")
38 cat debian
/changelog
>>debian
/changelog.new
39 mv debian
/changelog.new debian
/changelog
42 DEB_BUILD_OPTIONS
="$( ((WITH_TESTS)) || echo nocheck) $( ((WITH_DOCS)) || echo nodoc) nostrip terse optimize=-lto" \
43 DEB_BUILD_PROFILES
="$( ((WITH_TESTS)) || echo nocheck) $( ((WITH_DOCS)) || echo nodoc) pkg.systemd.upstream" \
44 DEB_CFLAGS_APPEND
="-Og" \
45 DPKG_FORCE
="unsafe-io" \
46 DPKG_DEB_COMPRESSOR_TYPE
="none" \
47 DH_MISSING
="--fail-missing" \
48 CONFFLAGS_UPSTREAM
="-D mode=developer -D b_sanitize=${SANITIZERS:-none}" \
56 # debhelper installs files for each package to debian/<package> so we figure out which files were
57 # packaged by querying all the package names from debian/control and running find on each of the
58 # corresponding package directory in debian/.
59 grep "Package:" debian
/control |
61 xargs -d '\n' -I {} sh
-c "[ -d debian/{} ] && (cd debian/{} && find . ! -type d ! -path "*dh-exec
*" -printf '%P\n')" |
62 # Remove compression suffix from compressed manpages as the manpages in debian/tmp will be uncompressed.
63 sed --regexp-extended 's/([0-9])\.gz$/\1/' |
64 sort --unique >/tmp
/packaged-files
66 # We figure out the installed files by running find on debian/tmp/ which contains the files installed
68 (cd debian
/tmp
/ && find .
! -type d
! -path "*dh-exec*" -printf '%P\n') >/tmp
/installed-files
70 if [ -f debian
/not-installed
]; then
71 grep --invert-match "^#" debian
/not-installed
>>/tmp
/installed-files
74 sort --unique --output /tmp
/installed-files
/tmp
/installed-files
76 # We get all the installed files that were not packaged by finding entries in the installed file that are
77 # not in the packaged file.
78 comm -23 /tmp
/installed-files
/tmp
/packaged-files
> /tmp
/unpackaged-files
79 # If there are no unpackaged files something else went wrong.
80 if [ ! -s /tmp
/unpackaged-files
]; then
84 # Otherwise, we append the unpackaged files to the filelist for the systemd package and retry the build.
85 cat /tmp
/unpackaged-files
>>debian
/systemd.
install
89 cp ..
/*.deb
"$PACKAGEDIR"
90 cp ..
/*.deb
"$OUTPUTDIR"