]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Various fixes for building-rpms-from-source.md
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Sun, 5 Nov 2023 11:13:51 +0000 (12:13 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 6 Nov 2023 15:06:04 +0000 (16:06 +0100)
- Fix quotes in rpms from source doc

These statements should not be surrounded by quotes as we don't want
them to expand to the empty string if unset.

- Use fewer subshells
- Don't use line continuations for pipes

docs/building-rpms-from-source.md

index e9ed8853072d9c4eab333951389b668b05e4e310..afb92cf023548abf6ba56d52b1eee299d71e23e1 100644 (file)
@@ -62,9 +62,9 @@ mkosi-chroot \
     "$DEPS" \
     --define "_topdir $CHROOT_SRCDIR/mkosi" \
     --define "_sourcedir $CHROOT_SRCDIR/mkosi/rpm" \
-    "$CHROOT_SRCDIR/mkosi/rpm/mkosi.spec" \
-    | grep -E -v "mkosi" \
-    | xargs -d '\n' dnf install --best
+    "$CHROOT_SRCDIR/mkosi/rpm/mkosi.spec" |
+        grep -E -v "mkosi" |
+        xargs -d '\n' dnf install --best
 
 if [ "$1" = "build" ]; then
     until mkosi-chroot \
@@ -128,12 +128,12 @@ cd "$SRCDIR/mkosi"
 rpmbuild \
     -bb \
     --build-in-place \
-    "$([ "$WITH_TESTS" = "0" ] && echo --nocheck)" \
+    $([ "$WITH_TESTS" = "0" ] && echo --nocheck) \
     --define "_topdir $SRCDIR/mkosi" \
     --define "_sourcedir $SRCDIR/mkosi/rpm" \
     --define "_rpmdir $OUTPUTDIR" \
-    "$([ -n "$BUILDDIR" ] && echo --define)" \
-    "$([ -n "$BUILDDIR" ] && echo "_vpath_builddir $BUILDDIR")" \
+    ${BUILDDIR:+--define} \
+    ${BUILDDIR:+"_vpath_builddir $BUILDDIR"} \
     --define "_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm" \
     "$SRCDIR/mkosi/rpm/mkosi.spec"
 ```