Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/sysutils/desktop-file-utils Borrow patches from OpenBS...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/64de2412424d
branches:  trunk
changeset: 437837:64de2412424d
user:      schmonz <schmonz%pkgsrc.org@localhost>
date:      Tue Sep 01 10:21:55 2020 +0000

description:
Borrow patches from OpenBSD ports to fix build, adding pledge() and
unveil() support while we're at it. NFCI for other platforms.

diffstat:

 sysutils/desktop-file-utils/Makefile                                    |   7 +-
 sysutils/desktop-file-utils/distinfo                                    |   5 +-
 sysutils/desktop-file-utils/patches/patch-src_install.c                 |  37 +++++++
 sysutils/desktop-file-utils/patches/patch-src_update-desktop-database.c |  51 ++++++++++
 sysutils/desktop-file-utils/patches/patch-src_validator.c               |  30 +++++
 5 files changed, 128 insertions(+), 2 deletions(-)

diffs (165 lines):

diff -r 1184a01b3c23 -r 64de2412424d sysutils/desktop-file-utils/Makefile
--- a/sysutils/desktop-file-utils/Makefile      Tue Sep 01 09:29:12 2020 +0000
+++ b/sysutils/desktop-file-utils/Makefile      Tue Sep 01 10:21:55 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.42 2020/07/31 09:17:53 wiz Exp $
+# $NetBSD: Makefile,v 1.43 2020/09/01 10:21:55 schmonz Exp $
 
 DISTNAME=      desktop-file-utils-0.26
 CATEGORIES=    sysutils gnome
@@ -17,6 +17,11 @@
 FILES_SUBST+=          APPLICATIONS_PATH="${PREFIX}/share/applications"
 FILES_SUBST+=          UPDATE_DESKTOPDB="${PREFIX}/bin/update-desktop-database"
 
+SUBST_CLASSES+=                paths
+SUBST_STAGE.paths=     pre-configure
+SUBST_FILES.paths=     src/update-desktop-database.c
+SUBST_VARS.paths=      LOCALBASE
+
 PRINT_PLIST_AWK+=      /^share\/applications\/mimeinfo.cache$$/ \
                                { print "@comment in INSTALL script: " $$0; \
                                  next; }
diff -r 1184a01b3c23 -r 64de2412424d sysutils/desktop-file-utils/distinfo
--- a/sysutils/desktop-file-utils/distinfo      Tue Sep 01 09:29:12 2020 +0000
+++ b/sysutils/desktop-file-utils/distinfo      Tue Sep 01 10:21:55 2020 +0000
@@ -1,6 +1,9 @@
-$NetBSD: distinfo,v 1.18 2020/07/31 09:17:53 wiz Exp $
+$NetBSD: distinfo,v 1.19 2020/09/01 10:21:55 schmonz Exp $
 
 SHA1 (desktop-file-utils-0.26.tar.xz) = 9fd94cb7de302163015fcbc0e157c61323b1205d
 RMD160 (desktop-file-utils-0.26.tar.xz) = a68b5994a7d099e2dffa279ea20c31cc7e39266e
 SHA512 (desktop-file-utils-0.26.tar.xz) = 5b4e435f0b635d8f898ac7f5759f74a08ffbe2a56d41fee0e84ff57e73b98d08b57b4416f20b99f696dad8bcb1c20792b39acf836b0814220c0b386ea5f6b831
 Size (desktop-file-utils-0.26.tar.xz) = 83132 bytes
+SHA1 (patch-src_install.c) = b3a410c90382fbc54abcd97a6e0eb96317d294af
+SHA1 (patch-src_update-desktop-database.c) = 162664c09deaf3b3f817e3f7d0b9f209151ca3b1
+SHA1 (patch-src_validator.c) = 41497fcd2da168e86d51387bba4bc3797adbc82f
diff -r 1184a01b3c23 -r 64de2412424d sysutils/desktop-file-utils/patches/patch-src_install.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/desktop-file-utils/patches/patch-src_install.c   Tue Sep 01 10:21:55 2020 +0000
@@ -0,0 +1,37 @@
+$NetBSD: patch-src_install.c,v 1.1 2020/09/01 10:21:55 schmonz Exp $
+
+From OpenBSD ports, add pledge() support.
+
+--- src/install.c.orig Thu Jan  1 00:00:00 1970
++++ src/install.c
+@@ -839,6 +839,13 @@ main (int argc, char **argv)
+ 
+   setlocale (LC_ALL, "");
+ 
++#ifdef HAVE_PLEDGE
++  if (pledge ("stdio rpath wpath cpath fattr", NULL) == -1) {
++    g_printerr ("pledge\n");
++    return 1;
++  }
++#endif
++
+   basename = g_path_get_basename (argv[0]);
+   if (g_strcmp0 (basename, "desktop-file-edit") == 0)
+     edit_mode = TRUE;
+@@ -854,6 +861,16 @@ main (int argc, char **argv)
+       g_option_group_add_entries (group, install_options);
+       g_option_context_add_group (context, group);
+     }
++#ifdef HAVE_PLEDGE
++  else
++    {
++      /* In edit mode we can drop the fattr pledge. */
++      if (pledge ("stdio rpath wpath cpath", NULL) == -1) {
++        g_printerr ("pledge in edit_mode\n");
++        return 1;
++      }
++    }
++#endif
+ 
+   group = g_option_group_new ("edit", _("Edition options for desktop file"), _("Show desktop file edition options"), NULL, NULL);
+   g_option_group_add_entries (group, edit_options);
diff -r 1184a01b3c23 -r 64de2412424d sysutils/desktop-file-utils/patches/patch-src_update-desktop-database.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/desktop-file-utils/patches/patch-src_update-desktop-database.c   Tue Sep 01 10:21:55 2020 +0000
@@ -0,0 +1,51 @@
+$NetBSD: patch-src_update-desktop-database.c,v 1.1 2020/09/01 10:21:55 schmonz Exp $
+
+From OpenBSD ports, "Unveil the required directory with .desktop
+files and where the cache file needs to be written out to."
+
+--- src/update-desktop-database.c.orig Thu Jan  1 00:00:00 1970
++++ src/update-desktop-database.c
+@@ -451,8 +451,8 @@ main (int    argc,
+      { NULL }
+    };
+ 
+-#if HAVE_PLEDGE
+-  if (pledge("stdio rpath wpath cpath fattr", NULL) == -1) {
++#ifdef HAVE_PLEDGE
++  if (pledge ("stdio rpath wpath cpath fattr unveil", NULL) == -1) {
+     g_printerr ("pledge\n");
+     return 1;
+   }
+@@ -478,9 +478,19 @@ main (int    argc,
+ 
+   print_desktop_dirs (desktop_dirs);
+ 
++#ifdef HAVE_PLEDGE
++  if (unveil ("@LOCALBASE@/share/locale/locale.alias", "r") == -1) {
++    g_printerr ("Can't unveil '@LOCALBASE@/share/locale/locale.alias': %s\n", g_strerror(errno));
++  }
++#endif
+   found_processable_dir = FALSE;
+   for (i = 0; desktop_dirs[i] != NULL; i++)
+     {
++#ifdef HAVE_PLEDGE
++      if (unveil (desktop_dirs[i], "rwc") == -1) {
++        g_printerr ("Can't unveil '%s' directory: %s\n", desktop_dirs[i], g_strerror(errno));
++      }
++#endif
+       error = NULL;
+       update_database (desktop_dirs[i], &error);
+ 
+@@ -495,6 +505,12 @@ main (int    argc,
+         found_processable_dir = TRUE;
+     }
+   g_option_context_free (context);
++
++#ifdef HAVE_PLEDGE
++  if (unveil (NULL, NULL) == -1) {
++    g_printerr ("unveil\n");
++  }
++#endif
+ 
+   if (!found_processable_dir)
+     {
diff -r 1184a01b3c23 -r 64de2412424d sysutils/desktop-file-utils/patches/patch-src_validator.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/desktop-file-utils/patches/patch-src_validator.c Tue Sep 01 10:21:55 2020 +0000
@@ -0,0 +1,30 @@
+$NetBSD: patch-src_validator.c,v 1.1 2020/09/01 10:21:55 schmonz Exp $
+
+From OpenBSD ports, add pledge() support.
+
+--- src/validator.c.orig       Thu Jan  1 00:00:00 1970
++++ src/validator.c
+@@ -28,6 +28,9 @@
+ 
+ #include <locale.h>
+ 
++#ifdef HAVE_PLEDGE
++#include <unistd.h>
++#endif
+ #include "validate.h"
+ 
+ static gboolean   warn_kde = FALSE;
+@@ -50,6 +53,13 @@ main (int argc, char *argv[])
+   GError         *error;
+   int i;
+   gboolean all_valid;
++
++#ifdef HAVE_PLEDGE
++  if (pledge ("stdio rpath", NULL) == -1) {
++    g_printerr ("pledge\n");
++    return 1;
++  }
++#endif
+ 
+   setlocale (LC_ALL, "");
+ 



Home | Main Index | Thread Index | Old Index