Sync from SUSE:SLFO:Main desktop-file-utils revision 6b1f5fe964373186edaa91ec2af1ed01

This commit is contained in:
Adrian Schröter 2024-05-03 12:02:28 +02:00
commit 8bd51c37ac
9 changed files with 1060 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

BIN
desktop-file-utils-0.27.tar.xz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,14 @@
Index: b/src/validate.c
===================================================================
--- a/src/validate.c
+++ b/src/validate.c
@@ -329,6 +329,9 @@ static DesktopKeyDefinition registered_d
/* Since 1.5 */
{ DESKTOP_BOOLEAN_TYPE, "SingleMainWindow", FALSE, FALSE, FALSE, NULL },
+ /* SuSE specific */
+ { DESKTOP_BOOLEAN_TYPE, "X-SuSE-translate", FALSE, FALSE, FALSE, NULL },
+
/* Keys reserved for KDE */
/* since 0.9.4 */

618
desktop-file-utils.changes Normal file
View File

@ -0,0 +1,618 @@
-------------------------------------------------------------------
Fri Oct 6 20:46:05 UTC 2023 - Antonio Teixeira <antonio.teixeira@suse.com>
- Update to version 0.27:
* common
+ Remove Autotools support.
+ Minor updates to project documentation.
+ Add pledge(2) support to remaining utilities
+ Add --version support to utilities.
* desktop-file-validate
+ Support desktop spec version 1.5.
+ Add LXQt to categories.
+ Use DDE category for Deepin desktop.
+ Add Endless to list of desktop IDs.
+ Fix field code escaping in messages.
* desktop-entry-mode.el
+ Highlight action groups when ID includes hyphens.
- Drop patches (upstreamed):
* 0001-validate-support-SingleMainWindow-key-from-1.5.patch
* 0002-validate-Support-version-1.5.patch
- Refresh desktop-file-utils-suse-keys.patch
-------------------------------------------------------------------
Thu Apr 20 09:04:41 UTC 2023 - Guido Berhoerster <guido+opensuse@berhoerster.name>
- suse-update-mime-defaults:
* add support for MATE desktop
* ensure C locale is set for sorting order
* fix quoting of DESTDIR
-------------------------------------------------------------------
Fri Jun 24 07:32:30 UTC 2022 - Christophe Giboudeaux <christophe@krop.fr>
- Add patches to avoid bogus errors in post-build checks:
* 0001-validate-support-SingleMainWindow-key-from-1.5.patch
* 0002-validate-Support-version-1.5.patch
-------------------------------------------------------------------
Fri Mar 25 14:02:47 UTC 2022 - Callum Farmer <gmbr3@opensuse.org>
- suse-update-mime-defaults: add Budgie desktop environment
-------------------------------------------------------------------
Tue Sep 7 21:33:46 UTC 2021 - Alexei Podvalsky <avvissu@yandex.by>
- suse-update-mime-defaults: add Pantheon desktop environment
-------------------------------------------------------------------
Thu Jul 16 18:38:50 UTC 2020 - andy great <andythe_great@pm.me>
- Clean spec file.
-------------------------------------------------------------------
Mon Jun 29 12:00:00 UTC 2020 - cunix@mail.de
- Update to version 0.26:
* Support for Autotools removed in the next release.
* update-desktop-database
+ Fix erroneous installation as "desktop-file-update"
when using the Meson build system
- Update to version 0.25:
* common
+ Add Meson build system
* desktop-file-validate
+ Allow desktop file spec version 1.4.
+ Make it possible to deprecate keys starting with "X-".
+ Add the "Implements" field from spec version 1.2.
+ Add the "PrefersNonDefaultGPU" key and deprecate "X-KDE-RunOnDiscreteGpu".
+ Set locale for correct output message encoding.
+ Add coloured output support.
+ Fix parsing of escaped double quote in quoted strings.
+ Add GNOME Flashback, GNOME Classic desktops.
- desktop-file-utils-suse-keys.patch rebased.
- Switched to Meson build system.
- "--with-lispdir" deleted because no build loop anymore visible.
- "install_man_desktop-file-edit_as_symlink.patch" added to install
duplicated manual page as a symlink instead of a file copy with
help from added script "install_man.py".
-------------------------------------------------------------------
Wed Jul 31 21:17:49 UTC 2019 - bjorn.lie@gmail.com
- Update to version 0.24:
+ Allow desktop file spec version 1.2.
+ Add Budgie, Deepin, Enlightenment and Pantheon to list of
registered desktop environments.
+ Sort output lines internally to conserve reproducibility.
+ Use pledge(2) on OpenBSD to limit capabilities.
+ Fix missing ; when appending to a list not ending with one.
+ Add font as valid media type (bsc#1148080).
+ Fix broken emacs blocking compile.
- Drop desktop-file-utils-add-Pantheon.patch: Fixed upstream.
- Drop no longer needed manual install of emacs lisp file.
- Use modern macros.
-------------------------------------------------------------------
Wed Jul 31 16:41:20 CEST 2019 - sbrabec@suse.com
- Remove BuildRequires: xz. Unpacking xz now works out of the box.
- Mute %filetriggerpostun on uninstall.
-------------------------------------------------------------------
Fri Jul 19 22:06:36 CEST 2019 - sbrabec@suse.com
- Revert pkconfig package name change back to correct pkg-config.
-------------------------------------------------------------------
Wed Jun 19 10:05:28 UTC 2019 - Cliff Zhao <qzhao@suse.com>
- Add desktop-file-utils-add-Pantheon.patch: Backporting upstream
patch to Add Pantheon to desktop env list(fdo#105785 bnc#1094774).
-------------------------------------------------------------------
Wed May 8 09:36:13 UTC 2019 - Dominique Leuenberger <dimstar@opensuse.org>
- Move RPM macros to %_rpmmacrodir.
-------------------------------------------------------------------
Fri Mar 2 14:07:32 UTC 2018 - crrodriguez@opensuse.org
- suse-update-mime-defaults requires coreutils and awk
add both to package requires
-------------------------------------------------------------------
Mon Oct 9 16:01:45 CEST 2017 - sbrabec@suse.com
- suse-update-mime-defaults: Do not be confused by "r" environment
variable. Requires DESTDIR=/foo command line argument instead
(boo#1049867).
-------------------------------------------------------------------
Thu Jun 22 10:07:09 UTC 2017 - dimstar@opensuse.org
- Replace %desktop_database_post/postun with respective file
triggers in desktop-file-utils: any file put into
/usr/share/applications will trigger the execution of the script.
In order to not break the macros short-term they are being
redefined to %nil.
-------------------------------------------------------------------
Sat Oct 15 06:57:19 UTC 2016 - zaitor@opensuse.org
- Update to version 0.23:
+ Accept version 1.1 desktop files.
+ Add Cinnamon, EDE and LXQt to the list of registered desktop
environments (fdo#73497, fdo#56353, fdo#79561).
+ Allow multipart/related MIME type; it's used for MHTML
(fdo#93376).
+ Ensure DBusActivatable filenames conform to reverse-DNS
notation (fdo#66904).
+ Downgrade trailing semicolons to optional (fdo#76902).
+ Fix buffer over-read (fdo#94303).
- Drop upstreamed fixed patches:
+ desktop-file-utils-fdo94303-fix-buffer-over-read.patch.
+ U_add-Cinnamon-desktop-environment_50271fe.patch.
+ U_add-EDE-desktop-environment_97d6ba3.patch.
+ U_trailing-semicolons-are-optional_aec5711.patch.
- Rebase desktop-file-utils-suse-keys.patch.
-------------------------------------------------------------------
Wed Oct 12 19:28:12 UTC 2016 - dimstar@opensuse.org
- Use standardized patch tags as documented at
https://en.opensuse.org/openSUSE:Packaging_Patches_guidelines.
-------------------------------------------------------------------
Tue May 24 08:40:37 UTC 2016 - dimstar@opensuse.org
- Fix suse-update-mime-defaults: Ensure the directory structure to
write the cache info to is in place (boo#976973).
-------------------------------------------------------------------
Mon May 9 21:03:33 CEST 2016 - hpj@suse.com
- Add desktop-file-utils-fdo94303-fix-buffer-over-read.patch
(fdo#94303).
-------------------------------------------------------------------
Wed Apr 13 21:01:34 CEST 2016 - hpj@suse.com
- Update to GNOME 3.20 Fate#318572
-------------------------------------------------------------------
Tue Mar 10 15:17:27 UTC 2015 - tchvatal@suse.com
- Cleanup with spec-cleaner
- Update suse-update-mime-defaults to search subfolders for desktop
files by changing to find from simple ls bnc#867135
-------------------------------------------------------------------
Mon Jan 5 16:36:42 UTC 2015 - dimstar@opensuse.org
- http://standards.freedesktop.org/mime-apps-spec/mime-apps-spec-latest.html
+ the mime app list is now called $desktop-mimeapps.list in place
of $desktop-defaults.list. Each DE is allowed to have 'better'
defaults.
-------------------------------------------------------------------
Mon Dec 15 00:09:35 UTC 2014 - stefan.bruens@rwth-aachen.de
- Add U_trailing-semicolons-are-optional_aec5711.patch
bfo#76902, fixes a no longer correct rpmlint warning for some
upstream desktop files without trailing semicolon
- Add U_add-EDE-desktop-environment_97d6ba3.patch,
U_add-Cinnamon-desktop-environment_50271fe.patch
bfo#56353, bfo#73497
-------------------------------------------------------------------
Fri Aug 30 17:55:02 UTC 2013 - hrvoje.senjan@gmail.com
- Update to version 0.22:
+ desktop-file-validate
- add DBusActivatable key to allowed keys
- warn about OnlyShowIn in Action groups
- allow validating multiple desktop files
- improve help output
- update man page
+ update-desktop-database
- list only once a desktop file per mime type
+ misc
- honor NOCONFIGURE=1
- Rebase desktop-file-utils-suse-keys.patch to new release
-------------------------------------------------------------------
Thu Oct 11 14:07:29 UTC 2012 - vuntz@opensuse.org
- Update to verison 0.21:
+ desktop-file-validate:
- update to current version of menu specification:
. only print hint if no main category is present, not an
error
. make Science a main category
. add new registered categories: Adult, Feed, Humanities,
Maps, Shooter, Spirituality, XFCE
. update related categories
. add TDE to list of registered OnlyShowIn
- accept and validate GNOME3/GSettings for AutostartCondition
- output hint if more than one main category is present
- output hint about suggested related categories
+ misc:
- do not require glib >= 2.28 for build
-------------------------------------------------------------------
Mon Oct 1 11:22:30 UTC 2012 - vuntz@opensuse.org
- Import SuSEconfig script from glib2 here:
+ This is needed as SuSEconfig is now dead, and we need a way to
generate the defaults.list file needed for the default MIME
associations. Part of bnc#782120.
+ Add suse-update-mime-defaults as source, and install it.
+ Call suse-update-mime-defaults in %post.
+ Call suse-update-mime-defaults from the %desktop_database_post
and %desktop_database_postun macros defined in
macros.desktop-file-utils. This way, packages using those
macros will regenerate the defaults.list files on
install/removal.
-------------------------------------------------------------------
Wed Sep 26 08:24:42 UTC 2012 - idonmez@suse.com
- BuildIgnore dbus-1-x11 to break the cycle
-------------------------------------------------------------------
Tue Mar 6 09:27:34 UTC 2012 - vuntz@opensuse.org
- Update to version 0.20:
+ desktop-file-install:
- fix list of locale strings without trailing slash
+ desktop-file-validate:
- add MATE and Razor to list of registered environments
- validate Desktop Actions
- Rebase desktop-file-utils-suse-keys.patch.
-------------------------------------------------------------------
Tue Dec 20 15:17:51 UTC 2011 - vuntz@opensuse.org
- Update to version 0.19:
+ desktop-file-install:
- respect order of edit options
- add --add-not-show-in/--remove-not-show-in options
- add options to set Name, GenericName, Comment, Icon keys
- add --set-key/--set-value options to set an arbitrary key
- remove localized keys when setting/removing a key
- copy translations when copying a key
- create a desktop-file-edit symlink to desktop-file-install to
simply edit .desktop files (without having to pass --dir)
- look at RPM_BUILD_ROOT to know where to install desktop files
- minor UI improvements
+ desktop-file-validate:
- add Unity to list of registered environments
- deal with various zz-application/zz-winassoc-XXX mime types
- mark all zz-application/* MIME types as aliases
- add support for updated Keywords key
+ update-desktop-database:
- deal with various zz-application/zz-winassoc-XXX mime types
- mark all zz-application/* MIME types as aliases
- ignore desktop files with Hidden=true
+ misc:
- modernize build system a bit
- update man pages
- Add xz BuildRequires because we can't build a package for a
xz-compressed tarball without explicitly specifying that... See
bnc#697467 for more details.
- Remove /bin/rm and /bin/rmdir PreReq: those were only needed for
the old %postun scriptlet that got removed a while ago.
- Drop desktop-file-utils-unity.patch: fixed upstream.
- Rebase desktop-file-utils-suse-keys.patch.
-------------------------------------------------------------------
Wed Oct 19 14:33:50 UTC 2011 - vuntz@opensuse.org
- Revert the MIME defaults heuristic changes: this won't work
without a glib2 patch that will not get in for now, and this
creates warnings in scriptlets.
-------------------------------------------------------------------
Wed Oct 5 20:41:12 CEST 2011 - sbrabec@suse.cz
- Added MIME defaults heuristic (bnc#456026, fdo#30214).
-------------------------------------------------------------------
Sun Sep 18 17:17:12 UTC 2011 - jengelh@medozas.de
- Remove redundant tags/sections from specfile
(cf. packaging guidelines)
-------------------------------------------------------------------
Mon Jul 25 15:55:16 CEST 2011 - vuntz@opensuse.org
- Add desktop-file-utils-unity.patch: add Unity to list of accepted
desktop environments; taken from git.
-------------------------------------------------------------------
Sat Feb 19 12:27:01 CET 2011 - vuntz@opensuse.org
- Drop SuSEconfig.desktop-file-utils: we don't use SuSEconfig
anymore to run update-desktop-database, since we now rely on each
individual package to do that with the %desktop_database_post and
%desktop_database_postun macros.
- Remove %postun scriptlet: nothing will touch
/usr/local/share/applications/ automatically anymore, so removing
the files there won't be needed anymore.
-------------------------------------------------------------------
Tue Jan 18 08:41:03 CET 2011 - vuntz@opensuse.org
- Fix %desktop_database_postun macros to not call
update-desktop-database twice.
-------------------------------------------------------------------
Thu Jan 13 11:09:11 CET 2011 - vuntz@opensuse.org
- Update to version 0.18:
+ desktop-file-validate:
- accept x-scheme-handler/* mime types
+ update-desktop-database:
- sort mime types alphabetically in generated cache
- accept x-scheme-handler/* mime types
+ misc:
- improve build system
- minor documentation fixes
-------------------------------------------------------------------
Tue Oct 12 12:19:16 UTC 2010 - lnussel@suse.de
- fix macros
-------------------------------------------------------------------
Thu Oct 7 14:11:12 CEST 2010 - vuntz@opensuse.org
- Add rpm macros to update the mime database:
%desktop_database_post and %desktop_database_postun. This will
replace SuSEconfig.desktop-file-utils in the future, once we have
converted packages.
- Add a %post scriptlet to update the desktop database.
-------------------------------------------------------------------
Fri Sep 10 12:34:14 CEST 2010 - vuntz@opensuse.org
- Update to version 0.17:
+ desktop-file-validate:
- accept chemical/* mime types as valid types
- make icon names with an extension for Icon key a non-fatal
error
+ update-desktop-database:
- accept chemical/* mime types as valid types
- ignore --verbose if --quiet is also passed
- make sure to always output lists in the keyfile we generate
+ misc:
- improve build system
- update documentation
- add man pages
- Tag desktop-file-utils-suse-keys.patch.
-------------------------------------------------------------------
Wed Mar 10 04:21:26 CET 2010 - vuntz@opensuse.org
- Update to version 0.16:
+ desktop-file-install
- do not unlink the destination file if it's the same as the
source file in desktop-file-install
+ desktop-file-validate
- check that a main category is included in the Categories
- check that categories required by another one are present
- do not always show warnings about KDE specific uses
- check that the Comment does not look like the Name and the
GenericName
- display error about multiple keys with the same name earlier
- improve MIME type check to make sure that the MIME types are
valid
- add LXDE in the list of registered OnlyShowIn values
- add "warning" to error strings to make them easily greppable
- handle AutostartCondition key, as proposed for the autostart
specification and used in GNOME
- accept empty Categories key as valid
- make new errors non-fatal to give some time to maintainers to
fix their .desktop file after a release of desktop-file-utils
- plug leak
- code cleanups
+ update-desktop-database
- improve MIME type check to make sure that the MIME types are
valid
- improve error messages
- fix format string vulnerability warning
+ misc
- use AM_SILENT_RULES
- improve build system
- Drop desktop-file-utils-LXDE-key.patch: fixed upstream.
- Manually install desktop-entry-mode.el since we don't want to add
a BuildRequires on emacs (that would introduce a build loop), and
recent automake require an installed emacs to install this file.
-------------------------------------------------------------------
Fri Feb 19 13:01:54 CET 2010 - vuntz@opensuse.org
- Make Requires on aaa_base unversioned: there was no reason to
version it, or at least not anymore; and this is needed for the
Moblin merge.
-------------------------------------------------------------------
Sun Dec 13 17:01:01 UTC 2009 - andrea@opensuse.org
- added LXDE patch, since this is now a valide DE
-------------------------------------------------------------------
Thu Aug 20 10:52:02 CEST 2009 - beineri@opensuse.org
- remove KDE3 traces (bnc#531122), will add to kdelibs3 package
-------------------------------------------------------------------
Mon Aug 17 10:57:18 CEST 2009 - vuntz@novell.com
- Remove emacs-nox BuildRequires, and instead pass --with-lispdir
to configure to break a build loop.
- Update description.
-------------------------------------------------------------------
Mon Mar 10 13:23:58 CET 2008 - sbrabec@suse.cz
- Updated to version 0.15:
* make the extension check for Icon key a warning instead of an
error for now
* Fix a crash in update-desktop-database when there's no group
* Fix a crash in the validator happening for very small lines
-------------------------------------------------------------------
Mon Oct 29 12:55:53 CET 2007 - dmueller@suse.de
- update to 0.14:
o make desktop-file-install print an error when trying to install a
non-existing desktop file, or a desktop file that can't be read (Vincent)
o make the validator check the content of the Icon key (Vincent)
o make the validator accept X-Foo as a valid environment (this was added to
the spec) (Stanislav Brabec, Vincent)
o really handle the -m command line argument for desktop-file-install
(Matthias Clasen)
o make desktop-file-install accept as one valid argument multiple
categories/only-show-in/mime-types values. Now --add-category="GNOME;GTK"
works as expected. (Vincent)
o make desktop-file-install validate the created desktop file before removing
the original file, and unlink it if it's not valid (Vincent)
o code cleanups for desktop-file-install (Vincent)
-------------------------------------------------------------------
Wed Sep 12 13:49:14 CEST 2007 - coolo@suse.de
- don't require path names
-------------------------------------------------------------------
Thu Jul 12 17:28:29 CEST 2007 - dmueller@suse.de
- allow X-SUSE in OnlyShowIn
-------------------------------------------------------------------
Tue Jun 5 10:13:26 CEST 2007 - sbrabec@suse.cz
- Updated to version 0.13:
* rewrite validator, and update it for desktop entry specification 1.0.
The validator should be stricter and report more useful messages.
* add --warn-kde and --no-warn-deprecated command line options to
desktop-file-validate
* port desktop-file-install to GKeyFile
* don't require --vendor for desktop-file-install
* some general module cleanup
-------------------------------------------------------------------
Wed May 2 22:10:21 CEST 2007 - dmueller@suse.de
- add patch to validate suse keys
-------------------------------------------------------------------
Fri Apr 27 15:56:11 CEST 2007 - sbrabec@suse.cz
- Fixed invalid error for missing "Encoding" (Freedesktop#10093).
-------------------------------------------------------------------
Thu Apr 19 12:04:11 CEST 2007 - sbrabec@suse.cz
- Correctly initialize XDG_DATA_DIRS in SuSEconfig (#240603).
-------------------------------------------------------------------
Fri Feb 23 14:26:02 CET 2007 - sbrabec@suse.cz
- Updated to version 0.12:
* improves category validation code to not catch false positives
* make category validation code non-fatal
* fix mem leaks and double frees
-------------------------------------------------------------------
Mon Jan 15 18:07:26 CET 2007 - sbrabec@suse.cz
- Spec file cleanup.
- Fixed path in SuSEconfig.desktop-file-utils.
-------------------------------------------------------------------
Mon Jan 8 00:08:19 CET 2007 - ro@suse.de
- GNOME moved to /usr
-------------------------------------------------------------------
Fri Oct 20 14:58:03 CEST 2006 - sbrabec@suse.cz
- Updated to version 0.11:
* Validate desktop file categories.
* Use GKeyFile instead of the old egg code in
update-desktop-database.
* Use GOption instead of popt.
* Fix grammar problem in one of the strings.
* NULL terminate search patch in update-desktop-database.
* Fix language to encoding mapping to match spec.
-------------------------------------------------------------------
Sat Feb 25 14:09:31 CET 2006 - aj@suse.de
- Reduce BuildRequires.
-------------------------------------------------------------------
Wed Jan 25 21:35:26 CET 2006 - mls@suse.de
- converted neededforbuild to BuildRequires
-------------------------------------------------------------------
Thu Mar 17 10:24:17 CET 2005 - sbrabec@suse.cz
- Explicitly require /etc/profile.d/xdg-enviroment.sh.
-------------------------------------------------------------------
Wed Mar 16 12:22:52 CET 2005 - sbrabec@suse.cz
- Ensure, that $XDG_DATA_DIRS is defined in
SuSEconfig.desktop-file-utils (#71978).
-------------------------------------------------------------------
Sun Feb 27 23:00:21 CET 2005 - ro@suse.de
- try to fix postun script
-------------------------------------------------------------------
Fri Feb 25 15:56:31 CET 2005 - sbrabec@suse.cz
- Added SuSEconfig.desktop-file-utils (#66605).
-------------------------------------------------------------------
Thu Jan 06 15:22:57 CET 2005 - sbrabec@suse.cz
- Updated to version 0.10.
-------------------------------------------------------------------
Tue Aug 24 17:33:29 CEST 2004 - sbrabec@suse.cz
- Updated to version 0.7.
-------------------------------------------------------------------
Sun Jan 11 10:18:49 CET 2004 - adrian@suse.de
- build as user
-------------------------------------------------------------------
Thu Aug 07 12:51:48 CEST 2003 - sbrabec@suse.cz
- Updated to actual CVS snapshot.
- Prefix changed to /opt/gnome (now depends on gnome-vfs).
-------------------------------------------------------------------
Tue Jul 29 01:27:05 CEST 2003 - ro@suse.de
- added gnome-filesystem to neededforbuild
-------------------------------------------------------------------
Mon Jun 02 17:41:48 CEST 2003 - sbrabec@suse.cz
- Initial SuSE package.

99
desktop-file-utils.spec Normal file
View File

@ -0,0 +1,99 @@
#
# spec file for package desktop-file-utils
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: desktop-file-utils
Version: 0.27
Release: 0
Summary: Utilities for Manipulating Desktop Files
License: GPL-2.0-or-later
Group: Development/Tools/Other
URL: https://www.freedesktop.org/wiki/Software/desktop-file-utils
Source0: http://www.freedesktop.org/software/desktop-file-utils/releases/%{name}-%{version}.tar.xz
Source1: suse-update-mime-defaults
Source2: macros.desktop-file-utils
Source3: install_man.py
# PATCH-FEATURE-OPENSUSE desktop-file-utils-suse-keys.patch vuntz@opensuse.org -- Handle SUSE-specific keys in validator. This is not strictly necessary, since they are prefixed with X-, but we can verify that the value has the right type.
Patch0: desktop-file-utils-suse-keys.patch
# PATCH-FIX-OPENSUSE install_man_desktop-file-edit_as_symlink.patch -- With Source3 makes manual page "desktop-file-edit.1" a symlink instead of a copy.
Patch1: install_man_desktop-file-edit_as_symlink.patch
BuildRequires: glib2-devel
BuildRequires: meson >= 0.49.0
BuildRequires: pkgconfig
#!BuildIgnore: dbus-1-x11
# We need explicit requirement here, as these are required by
# %%filetriggerin that could be started early during the installation
# process.
Requires: aaa_base
Requires: awk
Requires: coreutils
%description
This packages contains a couple of command line utilities for
working with desktop files.
More information about desktop files can be found at:
http://freedesktop.org/wiki/Specifications/desktop-entry-spec
%prep
%autosetup -p1
cp %{SOURCE3} man/install_man.py
%build
%meson
%meson_build
%install
%meson_install
# Install suse-update-mime-defaults
install -m0755 %{SOURCE1} %{buildroot}%{_bindir}/suse-update-mime-defaults
# Install rpm macros
install -D -m644 %{SOURCE2} %{buildroot}%{_rpmmacrodir}/macros.desktop-file-utils
# Create ghosts based on default $XDG_DATA_DIRS:
mkdir -p %{buildroot}%{_datadir}/applications
touch %{buildroot}%{_datadir}/applications/mimeinfo.cache
%filetriggerin -- %{_datadir}/applications
%{_bindir}/update-desktop-database --quiet %{_datadir}/applications || true
%{_bindir}/suse-update-mime-defaults || true
%filetriggerpostun -- %{_datadir}/applications
if test -x %{_bindir}/update-desktop-database ; then
%{_bindir}/update-desktop-database --quiet %{_datadir}/applications || true
%{_bindir}/suse-update-mime-defaults || true
fi
%files
%license COPYING
%doc AUTHORS ChangeLog NEWS README
%{_bindir}/desktop-file-edit
%{_bindir}/desktop-file-install
%{_bindir}/desktop-file-validate
%{_bindir}/suse-update-mime-defaults
%{_bindir}/update-desktop-database
%ghost %{_datadir}/applications/mimeinfo.cache
%{_mandir}/man1/desktop-file-edit.1%{?ext_man}
%{_mandir}/man1/desktop-file-install.1%{?ext_man}
%{_mandir}/man1/desktop-file-validate.1%{?ext_man}
%{_mandir}/man1/update-desktop-database.1%{?ext_man}
# Own directories to not require emacs installed.
%dir %{_datadir}/emacs
%dir %{_datadir}/emacs/site-lisp
%{_datadir}/emacs/site-lisp/*.el*
%{_rpmmacrodir}/macros.desktop-file-utils
%changelog

8
install_man.py Normal file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env python3
import os
os.symlink(
'desktop-file-install.1',
os.getenv('MESON_INSTALL_DESTDIR_PREFIX') + '/share/man/man1/desktop-file-edit.1'
)

View File

@ -0,0 +1,12 @@
diff -r -U 5 a/man/meson.build b/man/meson.build
--- a/man/meson.build 2020-06-19
+++ b/man/meson.build 2020-06-29
@@ -6,7 +6,7 @@
install_man([
'desktop-file-validate.1',
'desktop-file-install.1',
'update-desktop-database.1',
- desktop_file_edit_man,
])
+meson.add_install_script('install_man.py')

24
macros.desktop-file-utils Normal file
View File

@ -0,0 +1,24 @@
# RPM macros for packages installing desktop files
#
###
#
# When a package installs a desktop file, it should use both macros:
#
# - %desktop_database_post in %post
# - %desktop_database_postun in %postun
#
# Note that these macros can optionally take as argument the directory
# where the desktop file is installed. If no argument is passed, then
# %{_datadir}/applications will be used (which is where applications
# usually install their desktop file).
#
###
# On install, update the desktop database
%desktop_database_post() \
%nil
# On uninstall, update the desktop database. Note: we ignore upgrades (already
# handled in %post of the new package).
%desktop_database_postun() \
%nil

259
suse-update-mime-defaults Normal file
View File

@ -0,0 +1,259 @@
#!/bin/sh
#
# suse-update-mime-defaults - create default application ordering for MIME associations
#
# Copyright (C) 2023 Guido Berhoerster <guido+opensuse@berhoerster.name>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# TORTIOUS ACTION, ARISING OUT OF PERFORMANCE OF THIS SOFTWARE.
#
r=
case $1 in
DESTDIR=*)
r="${1#DESTDIR=}"
;;
esac
# reset XDG_DATA_DIRS so it can be trusted
unset XDG_DATA_DIRS
if [ "${PROFILEREAD}" != "true" ]; then
. "$r/etc/profile"
fi
export LC_ALL=C
# ensure the cache directory structure is in order
mkdir -m 755 -p "$r/var/cache/gio-2.0"
for desktop in gnome xfce lxde pantheon budgie mate; do
awk -vdesktop=${desktop} '
# print a warning to stderr
function warn(msg, cmd) {
cmd = "cat >&2"
print msg | cmd
close(cmd)
}
# print an error message and exit with the given exit status
function err(status, msg)
{
warn(msg)
exit_status = status
exit exit_status
}
# delete all elements of an array
function delete_array(arr, i) {
for (i in arr) {
delete arr[i]
}
}
# find preferred combination of mimetype and category
function find_preferred_category(mimetypes_categories, categories, mimetype,
i) {
for (i = 1; i in categories; i++) {
if (mimetype SUBSEP categories[i] in mimetypes_categories) {
return mimetypes_categories[mimetype,categories[i]]
}
}
}
# sort keys of an array by index (using the awk default comparison)
function asorti2(src, dest, key, len) {
len = 0
delete_array(dest)
for (key in src) {
dest[len++] = key
}
_qsorti(dest, 0, len - 1);
}
function array_swap(arr, i, j, tmp) {
tmp = arr[i]
arr[i] = arr[j]
arr[j] = tmp
}
# Based on Bentley, J. L., 2000. Programming Pearls. 2nd ed. Reading, MA:
# Addison-Wesley Professional.
function _qsorti(dest, l, u, val, i, j) {
if (l >= u) {
return
}
array_swap(dest, l, l + int(rand() * (u - l)))
val = dest[l]
i = l
j = u + 1
while (1) {
do { i++ } while (i <= u && dest[i] < val)
do { j-- } while (dest[j] > val)
if (i > j) {
break
}
array_swap(dest, i, j)
}
array_swap(dest, l, j)
_qsorti(dest, l, j - 1)
_qsorti(dest, j + 1, u)
}
BEGIN {
desktop = desktop != "" ? desktop : "gnome"
if (desktop == "gnome") {
categories_list = "GNOME,GTK"
} else if (desktop == "xfce") {
categories_list = "XFCE,GTK"
} else if (desktop == "lxde") {
categories_list = "GTK"
} else if (desktop == "pantheon") {
categories_list = "GTK"
} else if (desktop == "budgie") {
categories_list = "GTK"
} else if (desktop == "mate") {
categories_list = "MATE,GTK"
}
split(categories_list, categories, /,/)
root = ENVIRON["r"]
defaults_conf = root "/etc/" desktop "_defaults.conf"
# parse desktop defaults preferences
lineno = 0
while ((getline < defaults_conf) > 0) {
lineno++
if (NF == 0 || $1 ~ /^#/) {
# skip comments and empty lines
continue
} else if (NF != 1) {
err(1, "syntax error in " defaults_conf " line " lineno)
} else if (split($1, arr, /=/) == 2) {
# handle MIME type defaults
mimetype_default_apps[arr[1]] = arr[2]
} else if ($1 ~ /^!.+\.desktop$/) {
# handle preferred default applications
preferred_default_apps[substr($1, 2)] = substr($1, 2)
} else if ($1 ~ /^.+\.desktop$/) {
# handle regular default applications
default_apps[$1] = $1
} else {
err(1, "syntax error in " defaults_conf ", line " lineno)
}
}
close(defaults_conf)
# find all desktop files
for (i = split("XDG_DATA_DIRS" in ENVIRON ? ENVIRON["XDG_DATA_DIRS"] : \
"/usr/local/share:/usr/share", xdg_data_dirs, /:/); i > 0; i--) {
# XDG_DATA_DIRS is trusted here because it has been reset
cmd = "find \"" root xdg_data_dirs[i] "/applications/\" -name \"*.desktop\" " \
"2>/dev/null"
while ((cmd | getline desktopfile) > 0) {
l = split(desktopfile, arr, "/")
desktopfiles[arr[l]] = desktopfile
}
close(cmd)
}
# process all desktop files in alphabetical order
asorti2(desktopfiles, desktopfiles_keys)
for (i = 0; i in desktopfiles_keys; i++) {
# parse a desktop file
desktopfile = desktopfiles_keys[i]
delete_array(desktopfile_mimetypes)
delete_array(desktopfile_categories)
lineno = 0
in_desktop_entry = 0
while ((getline < desktopfiles[desktopfile]) > 0) {
lineno++
if (NF == 0 || $1 ~ /^#/) {
# skip comments and empty lines
continue
} else if (in_desktop_entry == 0 && \
$0 ~ /^\[Desktop Entry\][\t ]*$/) {
# desktop entry group
in_desktop_entry = 1
} else if (in_desktop_entry == 1) {
if (in_desktop_entry == 1 && $1 ~ /^\[/) {
# quit when a different group starts, "Desktop Entry" must
# come first
break
} else if ($0 ~ /^MimeType *=/ && split($0, arr, /=/) == 2) {
# handle MimeTypes
gsub(/(^ *|; *$)/, "", arr[2])
split(arr[2], desktopfile_mimetypes, /;/)
} else if ($0 ~ /^Categories *=/ && split($0, arr, /=/) == 2) {
# handle Categories
gsub(/(^ *|; *$)/, "", arr[2])
split(arr[2], desktopfile_categories, /;/)
} else if ($0 ~ /^[A-Za-z0-9\[\]@_-]+ *=/) {
# skip other keys
continue
}
} else {
warn("syntax error in " desktopfiles[desktopfile] ", line " \
lineno)
break
}
}
close(desktopfiles[desktopfile])
# store the results
for (j = 1; j in desktopfile_mimetypes; j++) {
if (desktopfile_mimetypes[j] in mimetype_default_apps && \
mimetype_default_apps[desktopfile_mimetypes[j]] == \
desktopfile) {
mimetype_defaults[desktopfile_mimetypes[j]] = desktopfile
}
if (desktopfile in preferred_default_apps) {
preferred_defaults[desktopfile_mimetypes[j]] = desktopfile
}
if (desktopfile in default_apps) {
defaults[desktopfile_mimetypes[j]] = desktopfile
}
for (k = 1; k in desktopfile_categories; k++) {
mimetypes_categories[desktopfile_mimetypes[j], \
desktopfile_categories[k]] = desktopfile
}
generic_mimetypes[desktopfile_mimetypes[j]] = desktopfile
}
}
# determine default mimetype handlers
for (mimetype in generic_mimetypes) {
if (mimetype in mimetype_defaults) {
defaults_list[mimetype] = mimetype_defaults[mimetype]
} else if (mimetype in preferred_defaults) {
defaults_list[mimetype] = preferred_defaults[mimetype]
} else if (mimetype in defaults) {
defaults_list[mimetype] = defaults[mimetype]
} else if ((desktopfile = \
find_preferred_category(mimetypes_categories, categories, \
mimetype)) != "") {
defaults_list[mimetype] = desktopfile
} else if (mimetype in generic_mimetypes) {
defaults_list[mimetype] = generic_mimetypes[mimetype]
}
}
print "# generated by suse-update-mime-defaults from " defaults_conf
print "[Default Applications]"
asorti2(defaults_list, defaults_list_keys)
for (i = 0; i in defaults_list_keys; i++) {
mimetype = defaults_list_keys[i]
printf("%s=%s\n", mimetype, defaults_list[mimetype])
}
}
' >"$r/var/cache/gio-2.0/${desktop}-mimeapps.list"
done