Hello community, here is the log from the commit of package update-desktop-files for openSUSE:Factory checked in at 2011-12-14 14:35:16 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/update-desktop-files (Old) and /work/SRC/openSUSE:Factory/.update-desktop-files.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "update-desktop-files", Maintainer is "coolo@suse.com" Changes: -------- --- /work/SRC/openSUSE:Factory/update-desktop-files/update-desktop-files.changes 2011-10-02 11:17:21.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.update-desktop-files.new/update-desktop-files.changes 2011-12-14 14:35:18.000000000 +0100 @@ -1,0 +2,6 @@ +Fri Dec 9 14:26:41 UTC 2011 - coolo@suse.com + +- split brp-trim-desktopfiles that installs a brp script to trim all + .desktop files without need of an extra macro + +------------------------------------------------------------------- New: ---- brp-trim-desktop.sh ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ update-desktop-files.spec ++++++ --- /var/tmp/diff_new_pack.V7PGmw/_old 2011-12-14 14:35:19.000000000 +0100 +++ /var/tmp/diff_new_pack.V7PGmw/_new 2011-12-14 14:35:19.000000000 +0100 @@ -15,21 +15,19 @@ # Please submit bugfixes or comments via http://bugs.opensuse.org/ # -# norootforbuild - Name: update-desktop-files Version: 12.1 -Release: 1 +Release: 0 Summary: A Build Tool to Update Desktop Files License: GPL-2.0+ Group: Development/Tools/Building BuildRoot: %{_tmppath}/%{name}-%{version}-build -AutoReqProv: on Source: suse_update_desktop_file.sh Source1: map-desktop-category.sh Source2: macro Source3: desktop.attr +Source4: brp-trim-desktop.sh Source100: mimetypes.prov # 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 @@ -39,7 +37,13 @@ %description This package provides further translations and a shell script to update -desktop files. It is used by the %suse_update_desktop_file rpm macro. +desktop files. It is used by the %%suse_update_desktop_file rpm macro. + +%package -n brp-trim-desktopfiles +Summary: Trim translations from .deskop files + +%description -n brp-trim-desktopfiles +Trim translations from all .deskop files found in build root %prep %setup -q -n . -D -T 0 @@ -53,13 +57,16 @@ install -m0755 %SOURCE0 %SOURCE1 %SOURCE100 $RPM_BUILD_ROOT%_rpmconfigdir install -m0644 -D %SOURCE2 $RPM_BUILD_ROOT/etc/rpm/macros.%name install -m0644 -D %SOURCE3 $RPM_BUILD_ROOT%_rpmconfigdir/fileattrs/desktop.attr - -%clean -rm -rf $RPM_BUILD_ROOT +install -m0755 -D %SOURCE4 $RPM_BUILD_ROOT/usr/lib/rpm/brp-suse.d/brp-70-trim-desktopfiles %files %defattr(-,root,root) %_rpmconfigdir/* +%exclude %_rpmconfigdir/brp-suse.d /etc/rpm/* +%files -n brp-trim-desktopfiles +%defattr(-,root,root) +%_rpmconfigdir/brp-suse.d + %changelog ++++++ brp-trim-desktop.sh ++++++ #! /bin/sh # macro: suse_update_desktop_file # # Used to add easily a category to .desktop files according to XDG # standard. # # # find file # 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 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/etc/xdg/autostart/ -name *.desktop -o -name .directory 2>/dev/null | while read FILE; do if grep -q ^X-SuSE-translate= "$FILE"; then echo "DEBUG: $FILE contains X-SuSE-translate - skipping" >&2 continue fi # save for backup NFILE=${FILE#$RPM_BUILD_ROOT} echo "<<$NFILE>>" >> $BASEDIR/$RPM_PACKAGE_NAME.desktopfiles cat $FILE >> $BASEDIR/$RPM_PACKAGE_NAME.desktopfiles echo "trimmed output to $BASEDIR/$RPM_PACKAGE_NAME.desktopfiles" # # Trim translations (desktops will use gettext to find them) # grep -v -E '^Name\[|^GenericName\[|^Comment\[' $FILE > ${FILE}_ sed -i -e '/^\[Desktop Entry\]/a \ X-SuSE-translate=true' ${FILE}_ mv ${FILE}_ $FILE done ++++++ macro ++++++ --- /var/tmp/diff_new_pack.V7PGmw/_old 2011-12-14 14:35:19.000000000 +0100 +++ /var/tmp/diff_new_pack.V7PGmw/_new 2011-12-14 14:35:19.000000000 +0100 @@ -2,5 +2,5 @@ # Used to add easily a category to .desktop files according to XDG # standard. %suse_update_desktop_file(cinrud:D:N:C:G:) \ - /usr/lib/rpm/suse_update_desktop_file.sh %{?distribution:--project "%distribution"} %{?_project:--project "%_project"} --basedir %_srcrpmdir %{**} || exit 1 \ + /usr/lib/rpm/suse_update_desktop_file.sh %{**} || exit 1 \ %nil ++++++ suse_update_desktop_file.sh ++++++ --- /var/tmp/diff_new_pack.V7PGmw/_old 2011-12-14 14:35:19.000000000 +0100 +++ /var/tmp/diff_new_pack.V7PGmw/_new 2011-12-14 14:35:19.000000000 +0100 @@ -13,15 +13,12 @@ # INSTALL=no I18N=yes -TRIM=no CREATE=no RESET=no UNIMPORTANT=no NAME=no COMMENT=no GNAME=no -BASEDIR=/no -PROJECT= function usage() { local exitcode="$1" @@ -49,8 +46,6 @@ echo " file." echo " -n|--no-i18n : Do not prepare the desktop file for translators (obsoletes -t)." echo " (adds X-SuSE-translate=false to the desktop file)" - echo " -t|--trim-i18n : Trim translations (desktops will use gettext to find them)" - echo " otherwise upstream translations are preferred." echo " -i|--install : Install an existing desktop file in /usr/share/applications/" echo " The to be installed desktop file can be located in:" echo " - RPM_SOURCE_DIR or" @@ -68,8 +63,6 @@ echo " -C|--comment <string> : Use <string> as \"Comment=<string>\" in desktop file." echo " -N|--name <string> : Use <string> as \"Name=<string>\" in desktop file." echo " -G|--genericname <string> : Use <string> as \"GenericName=<string>\" in desktop file." - echo " --basedir <path> : needed only for -t; normally %_srcrpmdir" - echo " --project <string> : set some default values for <string> if any." echo "" exit $exitcode } @@ -87,10 +80,6 @@ I18N=no shift continue;; - -t|--trim-i18n) - TRIM=yes - shift - continue;; -i|--install) INSTALL=yes shift @@ -132,31 +121,12 @@ GNAME="${1}" shift continue;; - --basedir) - shift - BASEDIR="${1}" - shift - continue;; - --project) - shift - PROJECT="${1}" - shift - continue;; *) echo "UNKNOWN OPTION: $1" usage 1 ;; esac done -case "$PROJECT" in - SUSE:*|SuSE:*|openSUSE:*) - TRIM=yes - ;; - home:coolo:test-desktop-files*) - TRIM=yes - ;; -esac - APPLICATION="$1" shift if [ "$CREATE" = "yes" ]; then @@ -406,32 +376,7 @@ fi fi -if [ "$I18N" = "yes" ]; then - - if ! iconv -f utf-8 -t utf-8 $FILE &> /dev/null ; then - echo "ERROR: $FILE is not an UTF-8 file" >&2 - usage 1 - fi - - if [ "$TRIM" = "yes" ]; then - # save for backup - if test -w $BASEDIR && test -f /.buildenv; then - echo "<<$FILE>>" >> $BASEDIR/$RPM_PACKAGE_NAME.desktopfiles - cat $FILE >> $BASEDIR/$RPM_PACKAGE_NAME.desktopfiles - echo "created $BASEDIR/$RPM_PACKAGE_NAME.desktopfiles" - fi - # - # Trim translations (desktops will use gettext to find them) - # - grep -v -E '^Name\[|^GenericName\[|^Comment\[' $FILE > ${FILE}_ - sed -i -e '/^\[Desktop Entry\]/a \ -X-SuSE-translate=true' ${FILE}_ - mv ${FILE}_ $FILE - else # silently do nothing - upstream translations preferred - sed -e '/^\[Desktop Entry\]/a \ -X-SuSE-translate=true' $FILE > ${FILE}_ && mv ${FILE}_ $FILE - fi -else +if [ "$I18N" = "no" ]; then # # this file will not get translated # -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org