Add support for generating appstream data

This commit is contained in:
Jeremy Soller 2024-10-15 21:13:15 -06:00
parent ac1b88e760
commit e1f1a57ade
No known key found for this signature in database
GPG Key ID: D02FD439211AF56F
3 changed files with 48 additions and 16 deletions

View File

@ -54,3 +54,18 @@ fi
export FIND
export STAT
if [ ! "$(uname -s)" = "Redox" ]
then
function docgen {
CC=cc AR=ar RANLIB=ranlib cargo run --release --manifest-path "$ROOT/docgen/Cargo.toml" --bin docgen -- "$@"
}
function pkg {
CC=cc AR=ar RANLIB=ranlib cargo run --release --manifest-path "$ROOT/pkgutils/Cargo.toml" --bin pkg -- "$@"
}
function pkgar {
CC=cc AR=ar RANLIB=ranlib cargo run --release --manifest-path "$ROOT/pkgar/Cargo.toml" --bin pkgar -- "$@"
}
fi

15
cook.sh
View File

@ -20,21 +20,6 @@ else
SHASUM="shasum -a 256"
fi
if [ ! "$(uname -s)" = "Redox" ]
then
function docgen {
CC=cc AR=ar RANLIB=ranlib cargo run --release --manifest-path "$ROOT/docgen/Cargo.toml" --bin docgen -- "$@"
}
function pkg {
CC=cc AR=ar RANLIB=ranlib cargo run --release --manifest-path "$ROOT/pkgutils/Cargo.toml" --bin pkg -- "$@"
}
function pkgar {
CC=cc AR=ar RANLIB=ranlib cargo run --release --manifest-path "$ROOT/pkgar/Cargo.toml" --bin pkgar -- "$@"
}
fi
function usage {
echo "cook.sh $1 <op>" >&2
echo " dist" >&2

34
repo.sh
View File

@ -4,10 +4,14 @@ shopt -s nullglob
source config.sh
APPSTREAM="0"
recipes=""
for arg in "${@:1}"
do
if [ "$arg" == "--debug" ]
if [ "$arg" == "--appstream" ]
then
APPSTREAM="1"
elif [ "$arg" == "--debug" ]
then
DEBUG=--debug
elif [ "$arg" == "--nonstop" ]
@ -115,6 +119,8 @@ done
mkdir -p "$REPO"
APPSTREAM_SOURCES=()
for recipe in $recipes
do
recipe_path=`target/release/find_recipe $recipe`
@ -133,8 +139,34 @@ do
echo -e "\033[01;38;5;155mrepo - publishing $recipe\033[0m" >&2
cp -v "${COOKBOOK_STAGE}.pkgar" "$REPO/$recipe.pkgar"
fi
if [ -e "${COOKBOOK_STAGE}/usr/share/metainfo" ]
then
APPSTREAM_SOURCES+=("${COOKBOOK_STAGE}")
fi
done
if [ "${APPSTREAM}" == "1" ]
then
echo -e "\033[01;38;5;155mrepo - generating appstream data\033[0m" >&2
APPSTREAM_ROOT="$ROOT/build/${TARGET}/appstream"
APPSTREAM_PKG="$REPO/appstream.pkgar"
rm -rf "${APPSTREAM_ROOT}" "${APPSTREAM_PKG}"
mkdir -p "${APPSTREAM_ROOT}"
if [ -n "${APPSTREAM_SOURCES}" ]
then
appstreamcli compose \
--origin=pkgar \
--result-root="${APPSTREAM_ROOT}" \
"${APPSTREAM_SOURCES[@]}"
fi
pkgar create \
--archive "${APPSTREAM_PKG}" \
--skey "${ROOT}/build/id_ed25519.toml" \
"${APPSTREAM_ROOT}"
fi
echo -e "\033[01;38;5;155mrepo - generating repo.toml\033[0m" >&2
echo "[packages]" > "$REPO/repo.toml"