Hello community, here is the log from the commit of package update-desktop-files for openSUSE:Factory checked in at 2017-04-29 10:47:11 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/update-desktop-files (Old) and /work/SRC/openSUSE:Factory/.update-desktop-files.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "update-desktop-files" Sat Apr 29 10:47:11 2017 rev:97 rq:487503 version:12.1 Changes: -------- --- /work/SRC/openSUSE:Factory/update-desktop-files/update-desktop-files.changes 2015-10-28 17:16:39.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.update-desktop-files.new/update-desktop-files.changes 2017-04-29 10:47:12.785723569 +0200 @@ -1,0 +2,9 @@ +Tue Mar 14 16:13:15 UTC 2017 - fv...@suse.com + +- Replace brp-trim-desktopfiles with brp-trim-translations: + * Supports various kinds of source files, not only desktop files + * Generates various tar archives instead of monolithic .desktopfiles file +- Currently trims desktop file translations only, as polkit/mime/appstream + do not support gettext translations yet + +------------------------------------------------------------------- Old: ---- brp-trim-desktop.sh New: ---- brp-trim-translations.sh ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ update-desktop-files.spec ++++++ --- /var/tmp/diff_new_pack.apWIIJ/_old 2017-04-29 10:47:13.641602655 +0200 +++ /var/tmp/diff_new_pack.apWIIJ/_new 2017-04-29 10:47:13.645602090 +0200 @@ -1,7 +1,7 @@ # # spec file for package update-desktop-files # -# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -26,7 +26,7 @@ Source: suse_update_desktop_file.sh Source1: map-desktop-category.sh Source2: macro -Source4: brp-trim-desktop.sh +Source4: brp-trim-translations.sh # This is not true technically, but we do that to make the rpm macros from # desktop-file-utils available to most packages that ship a .desktop file # (since they already have a update-desktop-files BuildRequires). @@ -37,12 +37,16 @@ This package provides further translations and a shell script to update desktop files. It is used by the %%suse_update_desktop_file rpm macro. -%package -n brp-trim-desktopfiles -Summary: Trim translations from .deskop files +%package -n brp-trim-translations +Summary: Trim translations from desktop files, polkit actions, mimetype descriptions and AppStream metainfo Group: Development/Tools/Building - -%description -n brp-trim-desktopfiles -Trim translations from all .deskop files found in build root +Provides: brp-trim-desktop = %{version} +Obsoletes: brp-trim-desktop < %{version} +Requires: libxslt-tools + +%description -n brp-trim-translations +Trim translations from all desktop files, polkit actions, mimetype descriptions +and AppStream metainfo found in build root %prep %setup -q -n . -D -T 0 @@ -55,7 +59,7 @@ mkdir -p $RPM_BUILD_ROOT%_rpmconfigdir install -m0755 %SOURCE0 %SOURCE1 $RPM_BUILD_ROOT%_rpmconfigdir install -m0644 -D %SOURCE2 $RPM_BUILD_ROOT/etc/rpm/macros.%name -install -m0755 -D %SOURCE4 $RPM_BUILD_ROOT/usr/lib/rpm/brp-suse.d/brp-70-trim-desktopfiles +install -m0755 -D %SOURCE4 $RPM_BUILD_ROOT/usr/lib/rpm/brp-suse.d/brp-70-trim-translations %files %defattr(-,root,root) @@ -63,8 +67,9 @@ %exclude %_rpmconfigdir/brp-suse.d /etc/rpm/* -%files -n brp-trim-desktopfiles +%files -n brp-trim-translations %defattr(-,root,root) -%_rpmconfigdir/brp-suse.d +%dir %_rpmconfigdir/brp-suse.d/ +%_rpmconfigdir/brp-suse.d/brp-70-trim-translations %changelog ++++++ brp-trim-translations.sh ++++++ #!/bin/bash # This script goes through all polkit actions, appstream metadata and mimeinfo xml data # and copies the .xml files into a .tar.xz for each kind. Then the xml:lang values are # stripped out. BASEDIR=`dirname $RPM_SOURCE_DIR`/OTHER if ! test -f /.buildenv; then # this looks fishy, skip it echo "WARNING: I better not trim without a /.buildenv around" exit 0 fi if ! test -w $BASEDIR; then echo "WARNING: Can't write to $BASEDIR, skipping" exit 0 fi strip_xml_lang() { type="$1" file="$2" notrim="$3" if grep -q '^<!-- X-SuSE-translate=false -->' "$file"; then return fi nfile="${file#/$RPM_BUILD_ROOT}" mkdir -p "$(dirname "${BASEDIR}/${type}/${nfile}")" cp "${file}" "${BASEDIR}/${type}/${nfile}" if [ -n "${notrim}" ]; then return # Extraction only fi doctype= if [ "$type" = "polkitactions" ]; then doctype='<xsl:output doctype-public="-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN" doctype-system="http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd"/>' elif [ "$type" = "appstream" ]; then doctype='' return # For now elif [ "$type" = "mimetypes" ]; then doctype='' else echo "Unknown type '${type}'!" fi xsltproc --novalid --nonet - "$file" > "${file}_" << EOF <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output indent="yes" encoding="UTF-8" /> $doctype <xsl:strip-space elements="*"/> <!-- Remove nodes with xml:lang attribute --> <xsl:template match="node()[@xml:lang]"/> <!-- Copy everything else recursively --> <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="node()|@*"/> </xsl:copy> </xsl:template> </xsl:stylesheet> EOF if [ $? -ne 0 ]; then echo "XSL processing failed - invalid XML?" else mv -- "${file}_" "${file}" echo "trimmed output to ${BASEDIR}/${type}/${nfile}" fi } strip_desktop_lang() { type="$1" file="$2" if grep -q ^X-SuSE-translate= "${file}"; then return fi nfile="${file#/$RPM_BUILD_ROOT}" mkdir -p "$(dirname "${BASEDIR}/${type}/${nfile}")" cp "${file}" "${BASEDIR}/${type}/${nfile}" echo "trimmed output to ${BASEDIR}/${type}/${nfile}" echo "trimmed output to $BASEDIR/$RPM_PACKAGE_NAME.desktopfiles" sed -e '/^\(Name\[\|GenericName\[\|Comment\[\)/d' -e '/^\[Desktop Entry\]/a \ X-SuSE-translate=true' "${file}" > "${file}_" && mv "${file}_" "${file}" } # Handle polkit actions find "/$RPM_BUILD_ROOT/usr/share/polkit-1/actions/" -type f -name '*.policy' | while read -r file; do strip_xml_lang "polkitactions" "$file" "notrim" done # Handle mimetype info find "/$RPM_BUILD_ROOT/usr/share/mime/" -type f -name '*.xml' | while read -r file; do strip_xml_lang "mimetypes" "$file" "notrim" done # Handle appstream metainfo find "/$RPM_BUILD_ROOT/usr/share/metainfo/" "/$RPM_BUILD_ROOT/usr/share/appdata/" -type f -name '*.xml' | while read -r file; do strip_xml_lang "appstream" "$file" "notrim" done # Handle desktop files find "/$RPM_BUILD_ROOT/opt/kde3/share/applications/kde/" \ "/$RPM_BUILD_ROOT/opt/kde3/share/applnk/" \ "/$RPM_BUILD_ROOT/usr/share/xsessions/" \ "/$RPM_BUILD_ROOT/usr/share/applications/" \ "/$RPM_BUILD_ROOT/usr/share/mimelnk/" \ "/$RPM_BUILD_ROOT/usr/share/gnome/apps/" \ "/$RPM_BUILD_ROOT/usr/share/autostart/" \ "/$RPM_BUILD_ROOT/etc/xdg/autostart/" \ "/$RPM_BUILD_ROOT/usr/share/wallpapers/" \ "/$RPM_BUILD_ROOT/usr/share/autoinstall/" \ -type f \( -name '*.desktop' -o -name '.directory' \) 2>/dev/null | while read -r file; do strip_desktop_lang "desktopfiles" "$file" done # Pack all files into tars for type in desktopfiles polkitactions mimetypes appstream; do [ -d "${BASEDIR}/${type}" ] || continue pushd "${BASEDIR}/${type}" tar -cjf "${BASEDIR}/${RPM_PACKAGE_NAME}-${type}.tar.bz2" * popd rm -rf "${BASEDIR}/${type}" done