mirror of
https://github.com/systemd/systemd.git
synced 2024-11-26 19:53:45 +08:00
mkosi: Move copying packages to the output directory to the postinst script
Now that we have the mkosi.clangd script to run clangd from the mkosi build script, it becomes clear that doing cleanup with mkosi.clean has a big gap in that we always run the mkosi.clean script and thus we also run it when we run the mkosi.clangd script, causing the previously built packages to be removed when we run clangd without producing new ones. In mkosi we're improving the situation by only running clean scripts when we clean up the output directory and disallowing writing to the output directory from build scripts. Let's adapt systemd to these changes by moving the copying of packages to the output directory to the postinst script.
This commit is contained in:
parent
815569791f
commit
7aea1c9e80
@ -52,6 +52,4 @@ EOF
|
|||||||
--copy-source="$1" \
|
--copy-source="$1" \
|
||||||
--pretty=no \
|
--pretty=no \
|
||||||
"$BUILDDIR"/systemd.raw
|
"$BUILDDIR"/systemd.raw
|
||||||
|
|
||||||
cp "$BUILDDIR"/systemd.raw "$OUTPUTDIR"
|
|
||||||
}
|
}
|
||||||
|
@ -68,6 +68,11 @@ sed --in-place "pkg/$PKG_SUBDIR/PKGBUILD" \
|
|||||||
--expression "s/^_tag=.*/_tag=$(cat meson.version)/" \
|
--expression "s/^_tag=.*/_tag=$(cat meson.version)/" \
|
||||||
--expression "s/^pkgrel=.*/pkgrel=$(date "+%Y%m%d%H%M%S" --date "@$TS")/"
|
--expression "s/^pkgrel=.*/pkgrel=$(date "+%Y%m%d%H%M%S" --date "@$TS")/"
|
||||||
|
|
||||||
|
(
|
||||||
|
shopt -s nullglob
|
||||||
|
rm -f "$BUILDDIR"/*.pkg.tar
|
||||||
|
)
|
||||||
|
|
||||||
# We get around makepkg's root check by setting EUID to something else.
|
# We get around makepkg's root check by setting EUID to something else.
|
||||||
# Linting the PKGBUILD takes multiple seconds every build so avoid that by nuking all the linting functions.
|
# Linting the PKGBUILD takes multiple seconds every build so avoid that by nuking all the linting functions.
|
||||||
# shellcheck disable=SC2046
|
# shellcheck disable=SC2046
|
||||||
@ -82,14 +87,8 @@ env --chdir="pkg/$PKG_SUBDIR" \
|
|||||||
_systemd_UPSTREAM=1 \
|
_systemd_UPSTREAM=1 \
|
||||||
_systemd_QUIET=$( ((MESON_VERBOSE)); echo $? ) \
|
_systemd_QUIET=$( ((MESON_VERBOSE)); echo $? ) \
|
||||||
BUILDDIR="$PWD/pkg/$PKG_SUBDIR" \
|
BUILDDIR="$PWD/pkg/$PKG_SUBDIR" \
|
||||||
PKGDEST="$OUTPUTDIR" \
|
PKGDEST="$BUILDDIR" \
|
||||||
PKGEXT=".pkg.tar" \
|
PKGEXT=".pkg.tar" \
|
||||||
MESON_EXTRA_CONFIGURE_OPTIONS="$MKOSI_MESON_OPTIONS $MESON_OPTIONS"
|
MESON_EXTRA_CONFIGURE_OPTIONS="$MKOSI_MESON_OPTIONS $MESON_OPTIONS"
|
||||||
|
|
||||||
(
|
cp "$BUILDDIR"/*.pkg.tar "$PACKAGEDIR"
|
||||||
shopt -s nullglob
|
|
||||||
rm -f "$BUILDDIR"/*.pkg.tar
|
|
||||||
)
|
|
||||||
|
|
||||||
cp "$OUTPUTDIR"/*.pkg.tar "$PACKAGEDIR"
|
|
||||||
cp "$OUTPUTDIR"/*.pkg.tar "$BUILDDIR"
|
|
||||||
|
@ -53,6 +53,11 @@ if ((WIPE)) && [[ -d "$BUILDDIR/meson-private" ]]; then
|
|||||||
MKOSI_MESON_OPTIONS="$MKOSI_MESON_OPTIONS --wipe"
|
MKOSI_MESON_OPTIONS="$MKOSI_MESON_OPTIONS --wipe"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
(
|
||||||
|
shopt -s nullglob
|
||||||
|
rm -f "$BUILDDIR"/*.rpm
|
||||||
|
)
|
||||||
|
|
||||||
IFS=
|
IFS=
|
||||||
# TODO: Replace meson_build and meson_install overrides with "--undefine __meson_verbose" once
|
# TODO: Replace meson_build and meson_install overrides with "--undefine __meson_verbose" once
|
||||||
# https://github.com/mesonbuild/meson/pull/12835 is available.
|
# https://github.com/mesonbuild/meson/pull/12835 is available.
|
||||||
@ -73,7 +78,7 @@ CXX_LD="$( ((LLVM)) && echo lld)" \
|
|||||||
$( ((WITH_DOCS)) || echo "--without=docs") \
|
$( ((WITH_DOCS)) || echo "--without=docs") \
|
||||||
--define "_topdir /var/tmp" \
|
--define "_topdir /var/tmp" \
|
||||||
--define "_sourcedir $PWD/pkg/$PKG_SUBDIR" \
|
--define "_sourcedir $PWD/pkg/$PKG_SUBDIR" \
|
||||||
--define "_rpmdir $OUTPUTDIR" \
|
--define "_rpmdir $BUILDDIR" \
|
||||||
${BUILDDIR:+"--define=_vpath_builddir $BUILDDIR"} \
|
${BUILDDIR:+"--define=_vpath_builddir $BUILDDIR"} \
|
||||||
--define "_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm" \
|
--define "_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm" \
|
||||||
--define "_binary_payload w.ufdio" \
|
--define "_binary_payload w.ufdio" \
|
||||||
@ -101,12 +106,6 @@ CXX_LD="$( ((LLVM)) && echo lld)" \
|
|||||||
--noclean \
|
--noclean \
|
||||||
"pkg/$PKG_SUBDIR/systemd.spec"
|
"pkg/$PKG_SUBDIR/systemd.spec"
|
||||||
|
|
||||||
(
|
cp "$BUILDDIR"/*.rpm "$PACKAGEDIR"
|
||||||
shopt -s nullglob
|
|
||||||
rm -f "$BUILDDIR"/*.rpm
|
|
||||||
)
|
|
||||||
|
|
||||||
cp "$OUTPUTDIR"/*.rpm "$PACKAGEDIR"
|
|
||||||
cp "$OUTPUTDIR"/*.rpm "$BUILDDIR"
|
|
||||||
|
|
||||||
make_sysext_unsigned /var/tmp/BUILD/*/BUILDROOT
|
make_sysext_unsigned /var/tmp/BUILD/*/BUILDROOT
|
||||||
|
@ -133,8 +133,8 @@ fi
|
|||||||
rm -f "$BUILDDIR"/*.deb "$BUILDDIR"/*.ddeb
|
rm -f "$BUILDDIR"/*.deb "$BUILDDIR"/*.ddeb
|
||||||
|
|
||||||
cp ../*.deb ../*.ddeb "$PACKAGEDIR"
|
cp ../*.deb ../*.ddeb "$PACKAGEDIR"
|
||||||
cp ../*.deb ../*.ddeb "$OUTPUTDIR"
|
|
||||||
cp ../*.deb ../*.ddeb "$BUILDDIR"
|
cp ../*.deb ../*.ddeb "$BUILDDIR"
|
||||||
|
|
||||||
# These conflict with the packages that we actually want to install, so remove them
|
# These conflict with the packages that we actually want to install, so remove them
|
||||||
rm -f "$BUILDDIR"/systemd-standalone-*.deb "$BUILDDIR"/systemd-standalone-*.ddeb
|
rm -f "$BUILDDIR"/systemd-standalone-*.deb "$BUILDDIR"/systemd-standalone-*.ddeb
|
||||||
)
|
)
|
||||||
|
@ -75,7 +75,7 @@ build() {
|
|||||||
$( ((WITH_TESTS)) || echo "--nocheck") \
|
$( ((WITH_TESTS)) || echo "--nocheck") \
|
||||||
--define "_topdir /var/tmp" \
|
--define "_topdir /var/tmp" \
|
||||||
--define "_sourcedir $PWD/pkg/$PKG_SUBDIR" \
|
--define "_sourcedir $PWD/pkg/$PKG_SUBDIR" \
|
||||||
--define "_rpmdir $OUTPUTDIR" \
|
--define "_rpmdir $BUILDDIR" \
|
||||||
${BUILDDIR:+"--define=_vpath_builddir $BUILDDIR"} \
|
${BUILDDIR:+"--define=_vpath_builddir $BUILDDIR"} \
|
||||||
--define "_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm" \
|
--define "_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm" \
|
||||||
--define "_binary_payload w.ufdio" \
|
--define "_binary_payload w.ufdio" \
|
||||||
@ -106,6 +106,11 @@ build() {
|
|||||||
return $EXIT_STATUS
|
return $EXIT_STATUS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(
|
||||||
|
shopt -s nullglob
|
||||||
|
rm -f "$BUILDDIR"/*.rpm
|
||||||
|
)
|
||||||
|
|
||||||
if ! build; then
|
if ! build; then
|
||||||
if [[ ! -s /tmp/unpackaged-files ]]; then
|
if [[ ! -s /tmp/unpackaged-files ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
@ -119,12 +124,6 @@ if ! build; then
|
|||||||
build --noprep --nocheck
|
build --noprep --nocheck
|
||||||
fi
|
fi
|
||||||
|
|
||||||
(
|
cp "$BUILDDIR"/*.rpm "$PACKAGEDIR"
|
||||||
shopt -s nullglob
|
|
||||||
rm -f "$BUILDDIR"/*.rpm
|
|
||||||
)
|
|
||||||
|
|
||||||
cp "$OUTPUTDIR"/*.rpm "$PACKAGEDIR"
|
|
||||||
cp "$OUTPUTDIR"/*.rpm "$BUILDDIR"
|
|
||||||
|
|
||||||
make_sysext_unsigned /var/tmp/BUILD/*/BUILDROOT
|
make_sysext_unsigned /var/tmp/BUILD/*/BUILDROOT
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
set -e
|
set -e
|
||||||
set -o nounset
|
set -o nounset
|
||||||
|
|
||||||
|
find "$BUILDDIR" \( -name "*.rpm" -o -name "*.deb" -o -name "*.pkg.tar" -o -name systemd.raw \) -exec cp -t "$OUTPUTDIR" {} \;
|
||||||
|
|
||||||
useradd \
|
useradd \
|
||||||
--uid 4711 \
|
--uid 4711 \
|
||||||
--user-group \
|
--user-group \
|
||||||
|
Loading…
Reference in New Issue
Block a user