Skip to content

Commit

Permalink
mkosi: use obscpio directory as source if present
Browse files Browse the repository at this point in the history
When using the obs_scm service the content will be unpacked in
SOURCES/foobar/ but mkosi will run from SOURCES/ and not find the recipes.
If SOURCES/foobar.obsinfo is present and SOURCES/foobar/mkosi.conf is also
present, then use SOURCES/foobar/ as the source dir, so that we can
store recipes in git and use obs_scm.
  • Loading branch information
bluca committed Jan 30, 2025
1 parent facc334 commit 09ea418
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion build-recipe-mkosi
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,16 @@ recipe_build_mkosi() {
fi
fi

# If we are running with the obs_scm service, the sources will be unpacked in a directory
# in SOURCES/, so try to find the right one, by checking where the top level mkosi.conf is.
workdir="$TOPDIR/SOURCES/"
for d in "$TOPDIR"/SOURCES/*.obsinfo; do
if [ ! -d "${d%.obsinfo}" ]; then continue; fi
if [ ! -f "${d%.obsinfo}/mkosi.conf" ]; then continue; fi
workdir="${d%.obsinfo}"
break
done

local image_version=""
if [ -n "$RELEASE" ]; then
image_version="--image-version=${RELEASE}"
Expand All @@ -97,7 +107,7 @@ recipe_build_mkosi() {
image_version="--image-version=0"
fi
set -- mkosi \
--directory "$TOPDIR/SOURCES" \
--directory "$workdir" \
--default \
"$RECIPEFILE" \
$RELEASE_ARG \
Expand Down

0 comments on commit 09ea418

Please sign in to comment.