1
0
mirror of https://git.freebsd.org/ports.git synced 2026-06-02 11:08:52 +00:00

ports-mgmt/appstream-generator: Install the hook script into Poudriere hooks dir

This commit is contained in:
Gleb Popov
2026-04-20 20:53:35 +03:00
parent 124039b819
commit 85cb5e2752
3 changed files with 33 additions and 14 deletions
+4 -2
View File
@@ -1,7 +1,7 @@
PORTNAME= appstream-generator
DISTVERSIONPREFIX= v
DISTVERSION= 0.10.2
PORTREVISION= 3
PORTREVISION= 4
CATEGORIES= ports-mgmt
MASTER_SITES= LOCAL/arrowd/:assets
DISTFILES= ${_ASSETS_DISTNAME}${EXTRACT_SUFX}:assets
@@ -61,7 +61,9 @@ post-patch:
post-install:
cd ${WRKSRC}/data && \
${COPYTREE_SHARE} templates ${STAGEDIR}${DATADIR}
${INSTALL_SCRIPT} ${PATCHDIR}/poudriere-hook-bulk.sh ${STAGEDIR}${DATADIR}
@${MKDIR} -p ${STAGEDIR}${PREFIX}/etc/poudriere.d/hooks
${INSTALL_SCRIPT} ${PATCHDIR}/poudriere-hook-bulk.sh \
${STAGEDIR}${PREFIX}/etc/poudriere.d/hooks/appstream-post-bulk.sh.sample
repackage-js:
pkg info npm > /dev/null
@@ -1,6 +1,15 @@
#!/bin/sh
# /usr/local/etc/poudriere.d/hooks/bulk.sh
# Variables to be set by operator
#
# The location for the generated data
# This should be persistent across "poudriere bulk" runs and be specific to
# the given jail-ports-set combination (i.e. have ${MASTERNAME} in the path)
ASGEN_WORKSPACE=/asgen/${MASTERNAME}
# The URL to the repository root (which will contain AppStreamComponents.xml.gz)
REPOSITORY_URL=https://pkg.freebsd.org/FreeBSD:16:amd64/latest
status="$1"
shift
@@ -8,11 +17,9 @@ if [ "$status" != "done" ]; then
exit 0
fi
echo "==> Running AppStream post-bulk hook"
ASGEN_CMD=/usr/local/bin/appstream-generator
# The location for the generated data
# This should be persistent across "poudriere bulk" runs and be specific to
# the given jail-ports-set combination (i.e. have ${MASTERNAME} in the path)
ASGEN_WORKSPACE=/asgen/${MASTERNAME}
ARCH=$(uname -p)
# PACKAGES ends with "/.latest", so we chop it first
@@ -25,7 +32,7 @@ fi
asgen_config=$(cat<<EOF
{
"ProjectName": "FreeBSD",
"MediaBaseUrl": "${REPOSITORY_URL}/${ABI}/media"
"MediaBaseUrl": "${REPOSITORY_URL}/media",
"ArchiveRoot": "${POUDRIERE_DATA}/packages",
"Backend": "freebsd",
"Suites": {
@@ -51,15 +58,25 @@ $ASGEN_CMD -w "${ASGEN_WORKSPACE}" run "$suite"
# TODO: Upstream recommends running cleanup once in a week
$ASGEN_CMD -w "${ASGEN_WORKSPACE}" cleanup
# Copy the metadata archive back to Poudriere repository root
cp "${ASGEN_WORKSPACE}/export/data/${suite}/default/Components-${ARCH}.xml.gz" "${PACKAGES}/AppStreamComponents.xml.gz"
# Symlink the metadata archives back to Poudriere repository root
for f in ${ASGEN_WORKSPACE}/export/data/${suite}/default/*.gz; do
dest_f=AppStream$(basename ${f} | sed s/-${ARCH}//)
ln -fs ${f} ${PACKAGES}/${dest_f}
done
# Link media files
ln -s "${ASGEN_WORKSPACE}/export/media" "${PACKAGES}/media"
# Symlink the media dir
ln -fs "${ASGEN_WORKSPACE}/export/media" "${PACKAGES}/media"
# Make a symlink to follow Poudriere layout
# Follow Poudriere layout if ATOMIC_PACKAGE_REPOSITORY is enabled
if [ "$(basename ${PACKAGES})" == ".latest" ]; then
ln -fs .latest/AppStreamComponents.xml.gz ${PACKAGES}/../AppStreamComponents.xml.gz
for f in ${ASGEN_WORKSPACE}/export/data/${suite}/default/*.gz; do
dest_f=AppStream$(basename ${f} | sed s/-${ARCH}//)
ln -fs ${f} ${PACKAGES_ROOT}/${dest_f}
done
ln -fs "${ASGEN_WORKSPACE}/export/media" "${PACKAGES_ROOT}/media"
fi
echo "==> AppStream metadata exported to ${PACKAGES}/AppStreamComponents.xml.gz"
echo "==> HTML report is available at ${ASGEN_WORKSPACE}/export/html"
exit 0
+1 -1
View File
@@ -1,7 +1,7 @@
bin/appstream-generator
etc/poudriere.d/hooks/appstream-post-bulk.sh.sample
%%DATADIR%%/asgen-hints.json
%%DATADIR%%/hicolor-theme-index.theme
%%DATADIR%%/poudriere-hook-bulk.sh
%%DATADIR%%/templates/debian/base.html
%%DATADIR%%/templates/debian/main.html
%%DATADIR%%/templates/debian/static/css/highlight.css