<pre style='margin:0'>
Christopher Nielsen (mascguy) pushed a commit to branch master
in repository macports-ports.
</pre>
<p><a href="https://github.com/macports/macports-ports/commit/03217ed036984ba9a5be994bf780e88d819fad1f">https://github.com/macports/macports-ports/commit/03217ed036984ba9a5be994bf780e88d819fad1f</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit 03217ed036984ba9a5be994bf780e88d819fad1f
</span>Author: René Bertin <rjvbertin@gmail.com>
AuthorDate: Sat Sep 17 14:20:42 2022 +0200
<span style='display:block; white-space:pre;color:#404040;'> shared-mime-info: clean up cache on deactivate
</span><span style='display:block; white-space:pre;color:#404040;'> - Also replace the post-activate call to update-mime-database with a launchd daemon watching ${prefix}/share/mime/packages
</span><span style='display:block; white-space:pre;color:#404040;'> Closes: https://trac.macports.org/ticket/45396
</span>---
devel/shared-mime-info/Portfile | 42 ++++++++++++++++++++--
.../org.macports.shared-mime-info-updater.plist | 29 +++++++++++++++
2 files changed, 68 insertions(+), 3 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/devel/shared-mime-info/Portfile b/devel/shared-mime-info/Portfile
</span><span style='display:block; white-space:pre;color:#808080;'>index 1b78e40e6b3..12d742c32ff 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/devel/shared-mime-info/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/devel/shared-mime-info/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -17,7 +17,9 @@ platforms darwin
</span> description Database of common types.
long_description The core database of common types and the \
<span style='display:block; white-space:pre;background:#ffe0e0;'>- update-mime-database command used to extend it.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ update-mime-database command used to extend it. \n\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ Installs and starts a watcher daemon that keeps the \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ cache up-to-date when other ports add or remove mime definitions.
</span>
homepage https://www.freedesktop.org/wiki/Software/shared-mime-info/
master_sites https://gitlab.freedesktop.org/xdg/shared-mime-info/-/archive/${version}/
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -43,12 +45,46 @@ depends_lib path:lib/pkgconfig/glib-2.0.pc:glib2 \
</span> # xinstall -m 644 ${filespath}/ObjCpp.xml \
# ${destroot}${prefix}/share/mime/packages
# }
<span style='display:block; white-space:pre;background:#e0ffe0;'>+post-destroot {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ xinstall -d -m 755 ${destroot}${prefix}/Library/LaunchDaemons
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ xinstall -m 644 ${filespath}/org.macports.shared-mime-info-updater.plist \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${destroot}${prefix}/Library/LaunchDaemons
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ reinplace -locale C "s|@PREFIX@|${prefix}|g" \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ${destroot}${prefix}/Library/LaunchDaemons/org.macports.shared-mime-info-updater.plist
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span>
post-activate {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_debug "Updating MIME database..."
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- system "env XDG_DATA_DIRS=${prefix}/share ${prefix}/bin/update-mime-database -V ${prefix}/share/mime"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {${os.platform} eq "darwin"} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_msg "Activating MIME database auto-updater..."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ system "sudo launchctl load ${prefix}/Library/LaunchDaemons/org.macports.shared-mime-info-updater.plist"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_msg "Updating MIME database..."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ system "env XDG_DATA_DIRS=${prefix}/share ${prefix}/bin/update-mime-database -V ${prefix}/share/mime"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+pre-deactivate {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {${os.platform} eq "darwin"} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_debug "Deactivating MIME database auto-updater..."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ system "sudo launchctl unload ${prefix}/Library/LaunchDaemons/org.macports.shared-mime-info-updater.plist"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span> }
<span style='display:block; white-space:pre;background:#e0ffe0;'>+post-deactivate {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # cleanup
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach f [glob -nocomplain ${prefix}/share/mime/*] {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {${f} ne "${prefix}/share/mime/packages"} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ file delete -force ${f}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_msg [join ${notes}]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+notes-append "Please check if the auto-updater is still active after reactivating (another) version of) this port: \n\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ `sudo launchctl list | fgrep shared-mime-info-updater` \n\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ If the updater is not active, load it manually with \n\
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ `sudo launchctl load ${prefix}/Library/LaunchDaemons/org.macports.shared-mime-info-updater.plist`"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> pre-pkg {
xinstall -m 0755 ${filespath}/postinstall ${package.scripts}/
reinplace -locale C "s|@PREFIX@|${prefix}|g" ${package.scripts}/postinstall
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/devel/shared-mime-info/files/org.macports.shared-mime-info-updater.plist b/devel/shared-mime-info/files/org.macports.shared-mime-info-updater.plist
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 00000000000..9984e37dc22
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/devel/shared-mime-info/files/org.macports.shared-mime-info-updater.plist
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,29 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<?xml version="1.0" encoding="UTF-8"?>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<plist version="1.0">
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+<dict>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <key>Label</key>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <string>org.macports.shared-mime-info-updater</string>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <key>EnvironmentVariables</key>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <dict>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <key>XDG_DATA_DIRS</key>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <string>@PREFIX@/share</string>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ </dict>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <key>ProgramArguments</key>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <array>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <string>@PREFIX@/bin/update-mime-database</string>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <string>-V</string>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <string>@PREFIX@/share/mime</string>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ </array>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <key>RunAtLoad</key>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <true/>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <key>WatchPaths</key>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <array>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <string>@PREFIX@/share/mime/packages</string>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ </array>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <key>ThrottleInterval</key>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <integer>60</integer>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <key>Disabled</key>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ <false/>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+</dict>
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+</plist>
</span></pre><pre style='margin:0'>
</pre>