Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Oct 2024 19:25:03 GMT
From:      Gleb Popov <arrowd@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 156ebeeb9c32 - main - ports-mgmt/appstream-generator: Tool to generate AppStream metadata from a package repository
Message-ID:  <202410251925.49PJP3iZ014713@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by arrowd:

URL: https://cgit.FreeBSD.org/ports/commit/?id=156ebeeb9c32c636068c325e57be748be04143fe

commit 156ebeeb9c32c636068c325e57be748be04143fe
Author:     Gleb Popov <arrowd@FreeBSD.org>
AuthorDate: 2023-04-20 16:04:27 +0000
Commit:     Gleb Popov <arrowd@FreeBSD.org>
CommitDate: 2024-10-25 19:24:43 +0000

    ports-mgmt/appstream-generator: Tool to generate AppStream metadata from a package repository
    
    Sponsored by:   Future Crew, LLC
---
 ports-mgmt/Makefile                                |  1 +
 ports-mgmt/appstream-generator/Makefile            | 46 +++++++++++++++
 ports-mgmt/appstream-generator/distinfo            |  3 +
 .../patch-contrib_setup_meson-install-templates.sh | 14 +++++
 .../files/poudriere-hook-bulk.sh                   | 65 ++++++++++++++++++++++
 ports-mgmt/appstream-generator/pkg-descr           |  4 ++
 ports-mgmt/appstream-generator/pkg-plist           | 27 +++++++++
 7 files changed, 160 insertions(+)

diff --git a/ports-mgmt/Makefile b/ports-mgmt/Makefile
index a28c7229e54a..2de6e02f145d 100644
--- a/ports-mgmt/Makefile
+++ b/ports-mgmt/Makefile
@@ -1,5 +1,6 @@
     COMMENT = Ports for managing, installing, and developing FreeBSD ports and packages
 
+    SUBDIR += appstream-generator
     SUBDIR += bsdadminscripts2
     SUBDIR += caronade
     SUBDIR += create-rb-port
diff --git a/ports-mgmt/appstream-generator/Makefile b/ports-mgmt/appstream-generator/Makefile
new file mode 100644
index 000000000000..6f8669cbc2c2
--- /dev/null
+++ b/ports-mgmt/appstream-generator/Makefile
@@ -0,0 +1,46 @@
+PORTNAME=	appstream-generator
+DISTVERSIONPREFIX=	v
+DISTVERSION=	0.9.1
+PORTREVISION=	1
+CATEGORIES=	ports-mgmt
+
+MAINTAINER=	arrowd@FreeBSD.org
+COMMENT=	Fast AppStream metadata generator
+WWW=		https://github.com/ximion/appstream-generator
+
+LICENSE=	LGPL3
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+BUILD_DEPENDS=	girtod:lang/gir-to-d \
+		ldc2:lang/ldc \
+		xsltproc:textproc/libxslt \
+		${LOCALBASE}/share/xsl/docbook/manpages/docbook.xsl:textproc/docbook-xsl
+LIB_DEPENDS=	libappstream.so:devel/appstream \
+		libappstream-compose.so:devel/appstream-compose \
+		libcurl.so:ftp/curl \
+		libglibd-2.0.so:devel/glibd \
+		liblmdb.so:databases/lmdb \
+		libphobos2-ldc-shared.so:lang/ldc
+
+USES=		gnome libarchive meson pkgconfig
+
+USE_GNOME=	glib20
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	arrowd
+GH_TAGNAME=	6645648126427ebdfe6debc45760ba8a351c3a5d
+
+OPTIONS_DEFINE=		MANPAGES
+MANPAGES_BUILD_DEPENDS=	xsltproc:textproc/libxslt
+
+MESON_ARGS=	-Ddownload-js=false -Dlocalbase=${LOCALBASE} -Drpmmd=false
+
+DATADIR=	${PREFIX}/share/appstream
+OPTIONS_SUB=	yes
+
+post-install:
+	cd ${WRKSRC}/data && \
+		${COPYTREE_SHARE} templates ${STAGEDIR}${DATADIR}
+	${INSTALL_SCRIPT} ${PATCHDIR}/poudriere-hook-bulk.sh ${STAGEDIR}${DATADIR}
+
+.include <bsd.port.mk>
diff --git a/ports-mgmt/appstream-generator/distinfo b/ports-mgmt/appstream-generator/distinfo
new file mode 100644
index 000000000000..78f0c2bbc4a2
--- /dev/null
+++ b/ports-mgmt/appstream-generator/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1729881137
+SHA256 (arrowd-appstream-generator-v0.9.1-6645648126427ebdfe6debc45760ba8a351c3a5d_GH0.tar.gz) = 9561d36f067650a84d6363a11795c4459fb8e460f56d1550b3303d2c45620177
+SIZE (arrowd-appstream-generator-v0.9.1-6645648126427ebdfe6debc45760ba8a351c3a5d_GH0.tar.gz) = 548743
diff --git a/ports-mgmt/appstream-generator/files/patch-contrib_setup_meson-install-templates.sh b/ports-mgmt/appstream-generator/files/patch-contrib_setup_meson-install-templates.sh
new file mode 100644
index 000000000000..a05bbcd76a2d
--- /dev/null
+++ b/ports-mgmt/appstream-generator/files/patch-contrib_setup_meson-install-templates.sh
@@ -0,0 +1,14 @@
+--- contrib/setup/meson-install-templates.sh.orig	2023-04-20 11:44:26 UTC
++++ contrib/setup/meson-install-templates.sh
+@@ -3,6 +3,8 @@ cd "$MESON_SOURCE_ROOT"
+ 
+ cd "$MESON_SOURCE_ROOT"
+ 
+-echo "Installing templates..."
+-install -d "${DESTDIR}/${MESON_INSTALL_PREFIX}/share/appstream/templates"
+-cp -dpru --no-preserve=ownership data/templates/* -t "${DESTDIR}/${MESON_INSTALL_PREFIX}/share/appstream/templates"
++# FreeBSD: We do this ourselves in the port
++
++#echo "Installing templates..."
++#install -d "${DESTDIR}/${MESON_INSTALL_PREFIX}/share/appstream/templates"
++#cp -dpru --no-preserve=ownership data/templates/* -t "${DESTDIR}/${MESON_INSTALL_PREFIX}/share/appstream/templates"
diff --git a/ports-mgmt/appstream-generator/files/poudriere-hook-bulk.sh b/ports-mgmt/appstream-generator/files/poudriere-hook-bulk.sh
new file mode 100644
index 000000000000..805d9bab446a
--- /dev/null
+++ b/ports-mgmt/appstream-generator/files/poudriere-hook-bulk.sh
@@ -0,0 +1,65 @@
+#!/bin/sh
+# /usr/local/etc/poudriere.d/hooks/bulk.sh
+
+status="$1"
+shift
+
+if [ "$status" != "done" ]; then
+	exit 0
+fi
+
+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
+if [ "$(basename ${PACKAGES})" == ".latest" ]; then
+	suite=$(basename $(dirname ${PACKAGES}))
+else
+	suite=$(basename ${PACKAGES})
+fi
+
+asgen_config=$(cat<<EOF
+{
+"ProjectName": "FreeBSD",
+"MediaBaseUrl": "${REPOSITORY_URL}/${ABI}/media"
+"ArchiveRoot": "${POUDRIERE_DATA}/packages",
+"Backend": "freebsd",
+"Suites": {
+  "$suite": {
+    "sections": ["default"],
+    "architectures": ["$ARCH"]
+    }
+  }
+}
+EOF
+)
+
+# Create the workspace dir if not exist.
+mkdir -p "${ASGEN_WORKSPACE}"
+
+# Write the config to the workspace dir.
+echo "$asgen_config" > ${ASGEN_WORKSPACE}/asgen-config.json
+
+# Generate the metainfo
+echo Running $ASGEN_CMD -w "${ASGEN_WORKSPACE}" run "$suite"
+$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"
+
+# Link media files
+ln -s "${ASGEN_WORKSPACE}/export/media" "${PACKAGES}/media"
+
+# Make a symlink to follow Poudriere layout
+if [ "$(basename ${PACKAGES})" == ".latest" ]; then
+	ln -fs .latest/AppStreamComponents.xml.gz ${PACKAGES}/../AppStreamComponents.xml.gz
+fi
+
+exit 0
diff --git a/ports-mgmt/appstream-generator/pkg-descr b/ports-mgmt/appstream-generator/pkg-descr
new file mode 100644
index 000000000000..b64963928e3e
--- /dev/null
+++ b/ports-mgmt/appstream-generator/pkg-descr
@@ -0,0 +1,4 @@
+AppStream is an effort to provide additional metadata and unique IDs for all
+software available in the package repository. This package contains the
+server-side of the AppStream infrastructure, a tool to generate metadata from
+FreeBSD packages.
diff --git a/ports-mgmt/appstream-generator/pkg-plist b/ports-mgmt/appstream-generator/pkg-plist
new file mode 100644
index 000000000000..bc5426035f66
--- /dev/null
+++ b/ports-mgmt/appstream-generator/pkg-plist
@@ -0,0 +1,27 @@
+bin/appstream-generator
+%%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
+%%DATADIR%%/templates/debian/static/css/style.css
+%%DATADIR%%/templates/debian/static/img
+%%DATADIR%%/templates/debian/static/js
+%%DATADIR%%/templates/default/base.html
+%%DATADIR%%/templates/default/issues_index.html
+%%DATADIR%%/templates/default/issues_page.html
+%%DATADIR%%/templates/default/main.html
+%%DATADIR%%/templates/default/metainfo_index.html
+%%DATADIR%%/templates/default/metainfo_page.html
+%%DATADIR%%/templates/default/section_page.html
+%%DATADIR%%/templates/default/sections_index.html
+%%DATADIR%%/templates/default/static/css/highlight.css
+%%DATADIR%%/templates/default/static/css/style.css
+%%DATADIR%%/templates/default/static/img/asgen.png
+%%DATADIR%%/templates/default/static/img/cpt-nogui.png
+%%DATADIR%%/templates/default/static/img/favicon.png
+%%DATADIR%%/templates/default/static/img/no-image.png
+%%DATADIR%%/templates/ubuntu
+%%MANPAGES%%share/man/man1/appstream-generator.1.gz
+share/metainfo/org.freedesktop.appstream.generator.metainfo.xml



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202410251925.49PJP3iZ014713>