Accepting request 96846 from X11:common:Factory

- give warning for old options instead of error

- use sed with inline option to avoid leaving temporary files behind

- desktop.attr should be reenabled in rpm again

OBS-URL: https://build.opensuse.org/request/show/96846
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/update-desktop-files?expand=0&rev=82
This commit is contained in:
Stephan Kulow 2011-12-20 13:28:09 +00:00 committed by Git OBS Bridge
commit c578a4da0f
5 changed files with 54 additions and 55 deletions

View File

@ -1,2 +0,0 @@
%__desktop_provides %{_rpmconfigdir}/mimetypes.prov
%__desktop_path .*\\.desktop$

View File

@ -1,19 +0,0 @@
#!/bin/sh
# vim: sw=4 et
# Transform desktop mimetype info into RPM provides
OLD_IFS="$IFS"
while read instfile ; do
case "$instfile" in
*.desktop)
if grep '^Type *= *Application' "$instfile" >/dev/null 2>&1 ; then
mime=$(sed -re '/^MimeType *= *([a-zA-Z0-9. _/;-]*)/!d' $instfile | cut -d'=' -f2)
IFS=';'
for type in $mime ; do
echo 'mimehandler('$type')'
done
fi
;;
esac
done
IFS=$OLD_IFS

View File

@ -121,7 +121,17 @@ while [ "${1:0:1}" = "-" ]; do
GNAME="${1}"
shift
continue;;
*)
--basedir)
echo "WARNING: basedir is no longer supported"
shift
shift
continue;;
--project)
echo "WARNING: project is no longer supported"
shift
shift
continue;;
*)
echo "UNKNOWN OPTION: $1"
usage 1 ;;
esac
@ -275,26 +285,24 @@ done
echo "" >> "${FILE}"
CAT="${CAT#;}"
if grep -q ^Categories= $FILE; then
sed -e '/^\[Desktop Entry\]/,/(\[.*|$)/ s,^Categories=.*,Categories='${CAT}',' "$FILE" > "${FILE}.new" &&
mv "${FILE}.new" "${FILE}"
sed -i -e '/^\[Desktop Entry\]/,/(\[.*|$)/ s,^Categories=.*,Categories='${CAT}',' "$FILE"
else
if [ -n "${CAT%;}" ]; then
sed -e '/^\[Desktop Entry\]/a \
'"Categories=${CAT%;};" $FILE > ${FILE}_ && mv ${FILE}_ $FILE
sed -i -e '/^\[Desktop Entry\]/a \
'"Categories=${CAT%;};" $FILE
fi
fi
if [ "$UNIMPORTANT" = "yes" ]; then
if grep -q ^NoDisplay= $FILE; then
sed -e '/^\[Desktop Entry\]/,/(\[.*|$)/ s,^NoDisplay=.*,NoDisplay=true,' "$FILE" > "${FILE}.new" &&
mv "${FILE}.new" "${FILE}"
sed -i -e '/^\[Desktop Entry\]/,/(\[.*|$)/ s,^NoDisplay=.*,NoDisplay=true,' "$FILE"
else
sed -e '/^\[Desktop Entry\]/a \
NoDisplay=true' $FILE > ${FILE}_ && mv ${FILE}_ $FILE
sed -i -e '/^\[Desktop Entry\]/a \
NoDisplay=true' $FILE
fi
fi
if [ "$DOCID" ]; then
sed -e '/^\[Desktop Entry\]/a \
'"X-SuSE-DocTeamID=$DOCID" $FILE > ${FILE}_ && mv ${FILE}_ $FILE
sed -i -e '/^\[Desktop Entry\]/a \
'"X-SuSE-DocTeamID=$DOCID" $FILE
fi
#
@ -324,8 +332,8 @@ if [ -n "$DOCPATH" ] ; then
mv "${FILE}.new" "${FILE}"
fi
else
sed -e '/^\[Desktop Entry\]/a \
'"DocPath=${DOCPATH}" $FILE > ${FILE}.new && mv ${FILE}.new $FILE
sed -i -e '/^\[Desktop Entry\]/a \
'"DocPath=${DOCPATH}" $FILE
if $DOCPATH_IS_GUESS ; then
echo NOTE: suse_update_desktop_file: Guessing DocPath=$DOCPATH in $FILE
fi
@ -338,41 +346,41 @@ if grep -q ^X-SuSE-translate= $FILE; then
fi
if [ "$NAME" != "no" ]; then
grep -v '^Name\[' $FILE > ${FILE}_
sed -i -e '/^Name\[/d' $FILE
if [ -n "$NAME" ]; then
if ! grep -q ^Name= ${FILE}_; then
sed -e '/^\[Desktop Entry\]/a '"Name=${NAME//,/\,}" ${FILE}_ > $FILE
if ! grep -q ^Name= ${FILE}; then
sed -i -e '/^\[Desktop Entry\]/a '"Name=${NAME//,/\,}" ${FILE}
else
sed -e '/^\[Desktop Entry\]/,/(\[.*|$)/ s,^Name=.*,Name='"${NAME//,/\,}"',' ${FILE}_ > $FILE
sed -i -e '/^\[Desktop Entry\]/,/(\[.*|$)/ s,^Name=.*,Name='"${NAME//,/\,}"',' ${FILE}
fi
else
grep -v "^Name=" ${FILE}_ > $FILE
sed -i -e '/^Name=/d' $FILE
fi
fi
if [ "$GNAME" != "no" ]; then
grep -v '^GenericName\[' $FILE > ${FILE}_
sed -i -e '/^GenericName\[/d' $FILE
if [ -n "$GNAME" ]; then
if ! grep -q ^GenericName= ${FILE}_; then
sed -e '/^\[Desktop Entry\]/a '"GenericName=${GNAME//,/\,}" ${FILE}_ > $FILE
sed -i -e '/^\[Desktop Entry\]/a '"GenericName=${GNAME//,/\,}" ${FILE}
else
sed -e '/^\[Desktop Entry\]/,/(\[.*|$)/ s,^GenericName=.*,GenericName='"${GNAME//,/\,}"',' ${FILE}_ > $FILE
sed -i -e '/^\[Desktop Entry\]/,/(\[.*|$)/ s,^GenericName=.*,GenericName='"${GNAME//,/\,}"',' ${FILE}
fi
else
grep -v "^GenericName=" ${FILE}_ > $FILE
sed -i -e '/^GenericName=/d' $FILE
fi
fi
if [ "$COMMENT" != "no" ]; then
grep -v '^Comment\[' $FILE > ${FILE}_
sed -i -e '/^Comment\[/d' $FILE
if [ -n "$COMMENT" ]; then
if ! grep -q ^Comment= ${FILE}_; then
sed -e '/^\[Desktop Entry\]/a '"Comment=${COMMENT//,/\,}" ${FILE}_ > $FILE
if ! grep -q ^Comment= ${FILE}; then
sed -i -e '/^\[Desktop Entry\]/a '"Comment=${COMMENT//,/\,}" ${FILE}
else
sed -e '/^\[Desktop Entry\]/,/(\[.*|$)/ s,^Comment=.*,Comment='"${COMMENT//,/\,}"',' ${FILE}_ > $FILE
fi
sed -i -e '/^\[Desktop Entry\]/,/(\[.*|$)/ s,^Comment=.*,Comment='"${COMMENT//,/\,}"',' ${FILE}
fi
else
grep -v "^Comment=" ${FILE}_ > $FILE
sed -i -e '/^Comment=/d' $FILE
fi
fi
@ -380,6 +388,6 @@ if [ "$I18N" = "no" ]; then
#
# this file will not get translated
#
sed -e '/^\[Desktop Entry\]/a \
X-SuSE-translate=false' $FILE > ${FILE}_ && mv ${FILE}_ $FILE
sed -i -e '/^\[Desktop Entry\]/a \
X-SuSE-translate=false' $FILE
fi

View File

@ -1,3 +1,18 @@
-------------------------------------------------------------------
Fri Dec 16 10:20:44 UTC 2011 - coolo@suse.com
- give warning for old options instead of error
-------------------------------------------------------------------
Fri Dec 16 09:49:24 UTC 2011 - coolo@suse.com
- use sed with inline option to avoid leaving temporary files behind
-------------------------------------------------------------------
Thu Dec 15 12:44:49 UTC 2011 - coolo@suse.com
- desktop.attr should be reenabled in rpm again
-------------------------------------------------------------------
Fri Dec 9 14:26:41 UTC 2011 - coolo@suse.com

View File

@ -26,9 +26,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build
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
# (since they already have a update-desktop-files BuildRequires).
@ -54,9 +52,8 @@ cd %name
%install
mkdir -p $RPM_BUILD_ROOT%_rpmconfigdir
install -m0755 %SOURCE0 %SOURCE1 %SOURCE100 $RPM_BUILD_ROOT%_rpmconfigdir
install -m0755 %SOURCE0 %SOURCE1 $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
install -m0755 -D %SOURCE4 $RPM_BUILD_ROOT/usr/lib/rpm/brp-suse.d/brp-70-trim-desktopfiles
%files