aboutsummaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2021-10-11 09:31:35 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2021-10-20 09:11:08 +0000
commitddacf99b4fc010511a09e1af376d0fca7399e208 (patch)
treefb9ccebeffee8c84c7f4c215667916118d88255a /misc
parent9bf3f5996681f44aeba130a47d3406f5e0ebfed9 (diff)
downloadports-ddacf99b4fc010511a09e1af376d0fca7399e208.tar.gz
ports-ddacf99b4fc010511a09e1af376d0fca7399e208.zip
shared-mime-info: use triggers
the rebuild of the database is now handled by a trigger and happen only once at the end of the transaction instead of after each package installation. While make shared-mime-info a runtime only dependency Reviewed by: manu, mat Differential Revision: https://reviews.freebsd.org/D32452
Diffstat (limited to 'misc')
-rw-r--r--misc/shared-mime-info/Makefile16
-rw-r--r--misc/shared-mime-info/files/pkg-install.in12
-rw-r--r--misc/shared-mime-info/files/shared-mime-info.ucl.in27
-rw-r--r--misc/shared-mime-info/pkg-plist36
4 files changed, 48 insertions, 43 deletions
diff --git a/misc/shared-mime-info/Makefile b/misc/shared-mime-info/Makefile
index 4302cf031973..bc81d9447691 100644
--- a/misc/shared-mime-info/Makefile
+++ b/misc/shared-mime-info/Makefile
@@ -2,6 +2,7 @@
PORTNAME= shared-mime-info
DISTVERSION= 2.0
+PORTREVISION= 1
CATEGORIES= misc gnome
MAINTAINER= desktop@FreeBSD.org
@@ -14,7 +15,8 @@ BUILD_DEPENDS= gmake:devel/gmake \
itstool:textproc/itstool \
minixmlto:textproc/minixmlto
-USES= gettext gnome localbase meson pathfix pkgconfig shebangfix tar:xz
+USES= gettext gnome localbase meson pathfix pkgconfig shebangfix \
+ tar:xz trigger
CONFIGURE_ARGS= -Dupdate-mimedb=false \
-Dxdgmime-path=${WRKSRC}/src/xdgmime
USE_GNOME= glib20 libxml2
@@ -27,13 +29,8 @@ GL_TUPLE= xdg:xdgmime:6663a2288d11b37bc07f5a01b4b85dcd377787e1:xdgmime/src/xdgmi
bash_CMD= /bin/sh
SHEBANG_FILES= ${WRKSRC}/data/freedesktop_generate.sh
-SUB_FILES= pkg-install
-SUB_LIST= MIMEDIRS="${MIMEDIRS:O:u}"
-
-MIMEDIRS= ${LOCALBASE}/share/mime \
- ${PREFIX}/share/mime
MIMESUBDIRS= application audio image inode message model multipart \
- packages text video x-epoc x-content
+ packages text video x-epoc x-content font
BINARY_ALIAS= xmlto=minixmlto
@@ -45,4 +42,9 @@ post-patch:
pre-configure:
cd ${WRKSRC}/src/xdgmime/src && ${SETENV} ${MAKE_ENV} ${GMAKE}
+post-install:
+ for dir in ${MIMESUBDIRS} ; do \
+ ${MKDIR} ${STAGEDIR}${PREFIX}/share/mime/$${dir} ; \
+ done
+
.include <bsd.port.mk>
diff --git a/misc/shared-mime-info/files/pkg-install.in b/misc/shared-mime-info/files/pkg-install.in
deleted file mode 100644
index b2c3db6d3ca3..000000000000
--- a/misc/shared-mime-info/files/pkg-install.in
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-
-case $2 in
-POST-INSTALL)
- for mdir in %%MIMEDIRS%%; do
- if [ -d ${mdir} ]; then
- %%PREFIX%%/bin/update-mime-database ${mdir}
- fi
- done
- exit 0
- ;;
-esac
diff --git a/misc/shared-mime-info/files/shared-mime-info.ucl.in b/misc/shared-mime-info/files/shared-mime-info.ucl.in
new file mode 100644
index 000000000000..38d1d2cfec04
--- /dev/null
+++ b/misc/shared-mime-info/files/shared-mime-info.ucl.in
@@ -0,0 +1,27 @@
+path: "%%PREFIX%%/share/mime/packages"
+cleanup: {
+ type: lua
+ script: <<EOS
+local mimedir = "%%PREFIX%%/share/mime/"
+local files = { "XMLnamespaces", "aliases", "generic-icons", "globs", "globs2", "icons", "mime.cache", "subclasses", "treemagic", "types", "version"}
+for _,filename in pairs(files) do
+ local fpath = mimedir .. filename
+ local st = pkg.stat(fpath)
+ if st then
+ os.remove(fpath)
+ end
+end
+local res = pkg.readdir(mimedir)
+if #res == 0 then
+ os.remove(mimedir)
+end
+EOS
+}
+trigger: {
+ type: lua
+ sandbox: false
+ script: <<EOS
+print("Building the Shared MIME-Info database cache")
+pkg.exec({"%%PREFIX%%/bin/update-mime-database", "%%PREFIX%%/share/mime"})
+EOS
+}
diff --git a/misc/shared-mime-info/pkg-plist b/misc/shared-mime-info/pkg-plist
index 0026c0d3c9d8..700f9fa4ba3c 100644
--- a/misc/shared-mime-info/pkg-plist
+++ b/misc/shared-mime-info/pkg-plist
@@ -79,27 +79,15 @@ share/locale/zh_CN/LC_MESSAGES/shared-mime-info.mo
share/locale/zh_HK/LC_MESSAGES/shared-mime-info.mo
share/locale/zh_TW/LC_MESSAGES/shared-mime-info.mo
share/mime/packages/freedesktop.org.xml
-@rmtry share/mime/XMLnamespaces
-@rmtry share/mime/aliases
-@rmtry share/mime/generic-icons
-@rmtry share/mime/globs
-@rmtry share/mime/globs2
-@rmtry share/mime/icons
-@rmtry share/mime/magic
-@rmtry share/mime/mime.cache
-@rmtry share/mime/subclasses
-@rmtry share/mime/treemagic
-@rmtry share/mime/types
-@rmtry share/mime/version
-@postunexec rm -fr %D/share/mime/x-epoc 2>/dev/null || true
-@postunexec rm -fr %D/share/mime/x-content 2>/dev/null || true
-@postunexec rm -fr %D/share/mime/video 2>/dev/null || true
-@postunexec rm -fr %D/share/mime/text 2>/dev/null || true
-@postunexec rm -fr %D/share/mime/multipart 2>/dev/null || true
-@postunexec rm -fr %D/share/mime/model 2>/dev/null || true
-@postunexec rm -fr %D/share/mime/message 2>/dev/null || true
-@postunexec rm -fr %D/share/mime/inode 2>/dev/null || true
-@postunexec rm -fr %D/share/mime/image 2>/dev/null || true
-@postunexec rm -fr %D/share/mime/font 2>/dev/null || true
-@postunexec rm -fr %D/share/mime/audio 2>/dev/null || true
-@postunexec rm -fr %D/share/mime/application 2>/dev/null || true
+@dir share/mime/x-epoc
+@dir share/mime/x-content
+@dir share/mime/video
+@dir share/mime/text
+@dir share/mime/multipart
+@dir share/mime/model
+@dir share/mime/message
+@dir share/mime/inode
+@dir share/mime/image
+@dir share/mime/font
+@dir share/mime/audio
+@dir share/mime/application