| 1 |
#!/usr/bin/env bash |
| 2 |
# SPDX-License-Identifier: LGPL-2.1-or-later |
| 3 |
set -e |
| 4 |
|
| 5 |
if [[ "$1" == "build" ]] || ((NO_BUILD)); then |
| 6 |
exit 0 |
| 7 |
fi |
| 8 |
|
| 9 |
if [[ ! -f "pkg/$PKG_SUBDIR${GIT_SUBDIR:+/$GIT_SUBDIR}/systemd.spec" ]]; then |
| 10 |
echo "spec not found at pkg/$PKG_SUBDIR${GIT_SUBDIR:+/$GIT_SUBDIR}/systemd.spec, run mkosi once with -ff to make sure the spec is cloned" >&2 |
| 11 |
exit 1 |
| 12 |
fi |
| 13 |
|
| 14 |
mkosi-chroot \ |
| 15 |
rpmspec \ |
| 16 |
--with upstream \ |
| 17 |
--query \ |
| 18 |
--buildrequires \ |
| 19 |
--define "_topdir /var/tmp" \ |
| 20 |
--define "_sourcedir $PWD/pkg/$PKG_SUBDIR${GIT_SUBDIR:+/$GIT_SUBDIR}" \ |
| 21 |
"pkg/$PKG_SUBDIR${GIT_SUBDIR:+/$GIT_SUBDIR}/systemd.spec" | |
| 22 |
grep --invert-match --regexp systemd --regexp /bin/sh --regexp "rpmlib(" --regexp udev | |
| 23 |
sort --unique | |
| 24 |
tee /tmp/buildrequires | |
| 25 |
xargs --delimiter '\n' mkosi-install |
| 26 |
|
| 27 |
until mkosi-chroot \ |
| 28 |
rpmbuild \ |
| 29 |
-bd \ |
| 30 |
--noprep \ |
| 31 |
--build-in-place \ |
| 32 |
--with upstream \ |
| 33 |
--define "_topdir /var/tmp" \ |
| 34 |
--define "_sourcedir $PWD/pkg/$PKG_SUBDIR${GIT_SUBDIR:+/$GIT_SUBDIR}" \ |
| 35 |
--define "_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm" \ |
| 36 |
"pkg/$PKG_SUBDIR${GIT_SUBDIR:+/$GIT_SUBDIR}/systemd.spec" |
| 37 |
do |
| 38 |
EXIT_STATUS=$? |
| 39 |
if [[ $EXIT_STATUS -ne 11 ]]; then |
| 40 |
exit $EXIT_STATUS |
| 41 |
fi |
| 42 |
|
| 43 |
mkosi-chroot \ |
| 44 |
rpm \ |
| 45 |
--query \ |
| 46 |
--package \ |
| 47 |
--requires \ |
| 48 |
/var/tmp/SRPMS/systemd-*.buildreqs.nosrc.rpm | |
| 49 |
grep --invert-match '^rpmlib(' | |
| 50 |
sort --unique >/tmp/dynamic-buildrequires |
| 51 |
|
| 52 |
sort /tmp/buildrequires /tmp/dynamic-buildrequires | |
| 53 |
uniq --unique | |
| 54 |
tee --append /tmp/buildrequires | |
| 55 |
xargs --delimiter '\n' mkosi-install |
| 56 |
done |