Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37696106
en ru br
Репозитории ALT

Группа :: Разработка/Прочее
Пакет: rpm-build-suse-compat

 Главная   Изменения   Спек   Патчи   Исходники   Загрузить   Gear   Bugs and FR  Repocop 

pax_global_header00006660000000000000000000000064117024140510014505gustar00rootroot0000000000000052 comment=a9c1a50e6580daa32b857b158036793c5967b38b
rpm-build-suse-compat-0.01/000075500000000000000000000000001170241405100155545ustar00rootroot00000000000000rpm-build-suse-compat-0.01/.gear/000075500000000000000000000000001170241405100165505ustar00rootroot00000000000000rpm-build-suse-compat-0.01/.gear/rules000064400000000000000000000001611170241405100176230ustar00rootroot00000000000000tar: .
diff: .:update-desktop-files upstream:update-desktop-files name=update-desktop-files-alt-@version@.patch

rpm-build-suse-compat-0.01/.gear/tags/000075500000000000000000000000001170241405100175065ustar00rootroot00000000000000rpm-build-suse-compat-0.01/.gear/tags/list000064400000000000000000000000621170241405100204020ustar00rootroot0000000000000002016f7b175d121637854203dbe35464c65a196d upstream
rpm-build-suse-compat-0.01/rpm-build-suse-compat.spec000064400000000000000000000016421170241405100225640ustar00rootroot00000000000000Name: rpm-build-suse-compat
Version: 0.01
Release: alt1
Summary: Compatibility environment to build SuSE rpms
License: GPL2+
Group: Development/Other

Source: %name-%version.tar
Patch: update-desktop-files-alt-%version.patch
BuildArch: noarch
Requires: rpm-macros-suse-compat = %version-%release

%description
%summary

%package -n rpm-macros-suse-compat
Group: Development/Other
Summary: SuSE compatibility macros

%description -n rpm-macros-suse-compat
%summary

%prep
%setup -q

%build

%install
mkdir -p %buildroot%_rpmlibdir
install -m0755 update-desktop-files/suse_update_desktop_file.sh update-desktop-files/map-desktop-category.sh %buildroot%_rpmlibdir/

install -m0644 -D update-desktop-files/macro %buildroot%_rpmmacrosdir/suse-compat

%files
%_rpmlibdir/*.sh

%files -n rpm-macros-suse-compat
%_rpmmacrosdir/suse-compat

%changelog
* Mon Jan 09 2012 Igor Vlasenko <viy@altlinux.ru> 0.01-alt1
- build for Sisyphus

rpm-build-suse-compat-0.01/update-desktop-files/000075500000000000000000000000001170241405100216055ustar00rootroot00000000000000rpm-build-suse-compat-0.01/update-desktop-files/brp-trim-desktop.sh000064400000000000000000000025701170241405100253500ustar00rootroot00000000000000#! /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

rpm-build-suse-compat-0.01/update-desktop-files/macro000064400000000000000000000003541170241405100226330ustar00rootroot00000000000000# macro: %suse_update_desktop_file
# 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 %{**} || exit 1 \
%nil
rpm-build-suse-compat-0.01/update-desktop-files/map-desktop-category.sh000064400000000000000000000115221170241405100262010ustar00rootroot00000000000000#! /bin/sh

function mapCategory() {
ret=""
local in="${1#X-SuSE-}"
case $in in
#old 9.0 Categories
AddressBook)
ret="ContactManagement"
echo WARNING: AddressBook is an outdated Category, mapping it to ContactManagement
;;
Camera)
ret="Photography"
echo WARNING: Camera is an outdated Category, mapping it to Photography
;;
NewsReader)
ret="News"
echo WARNING: NewsReader is an outdated Category, mapping it to News
;;
DialUp)
ret="Dialup"
echo WARNING: DialUp is an outdated Category, mapping it to Dialup
;;
Telephone)
ret="Telephony"
echo WARNING: Telephone is an outdated Category, mapping it to Telephony
;;
MidiPlayer)
ret="Midi"
echo WARNING: MidiPlayer is an outdated Category, mapping it to Midi
;;
AudioMixer)
ret="Mixer"
echo WARNING: AudioMixer is an outdated Category, mapping it to Mixer
;;
SimulationGame)
ret="Simulation"
echo WARNING: SimulationGame is an outdated Category, mapping it to Simulation
;;
RolePlayingGame)
ret="RolePlaying"
echo WARNING: RolePlayingGame is an outdated Category, mapping it to RolePlaying
;;
School)
ret="Teaching"
echo WARNING: School is an outdated Category, mapping it to Teaching
;;


#special cases
Internet)
ret="Network"
echo WARNING: Internet is an illegal Category, mapping it to Network
;;
DevelopmentWWW)
ret="X-SuSE-WebDevelopment"
echo WARNING: DevelopmentWWW is an illegal Category, mapping it to WebDevelopment
;;
Language)
ret="Languages"
echo WARNING: Language is an illegal Category, mapping it to Languages
;;
Burning)
ret="DiscBurning"
echo WARNING: Burning is an illegal Category, mapping it to DiscBurning
;;
AudioVideoRecorder)
ret="Recorder"
echo WARNING: AudioVideoRecorder is an illegal Category, mapping it to Recorder
;;
AudioVideoPlayer)
ret="Player"
echo WARNING: AudioVideoPlayer is an illegal Category, mapping it to Player
;;
Photograph)
ret="Photography"
echo WARNING: Photograph is a mistyped Category, mapping it to Photography
;;
#Office Menu:
Calendar|WordProcessor|Spreadsheet|ProjectManagement|Presentation| \
Database|Dictionary|Finance|FlowChart|ContactManagement|PDFViewer) ret=$in ;;
Warehouse|Addressbook)
ret="X-SuSE-$in";;
#Internet/Network Menu:
P2P|HamRadio|Email|News|Dialup|IRCClient|FileTransfer|InstantMessaging|WebBrowser|WebDevelopment) ret=$in ;;
RSS-News)
ret="X-SuSE-$in";;
#Development Menu:
GUIDesigner|RevisionControl|IDE|Building|Debugger|Profiling|Translation) ret=$in ;;
Design)
ret="X-SuSE-$in";;
#Graphics Menu:
3DGraphics|Photography|Scanning|OCR|VectorGraphics|RasterGraphics|2DGraphics) ret=$in ;;
#Education Menu:
Teaching|Science|Math|Chemistry|Astronomy|Art|Construction|Languages| \
Engineering|Geography) ret=$in ;;
#Multimedia Menu:
AudioVideoEditing|Music|DiscBurning|Mixer|Player|Midi|Sequencer| \
TV|Tuner|Recorder|Video) ret=$in ;;
CD|CDReader|Jukebox)
ret="X-SuSE-$in";;
#System Menu:
Applet|Emulator|Monitor|Screensaver|TerminalEmulator|SystemSetup| \
FileManager|Filesystem|Archiving|PackageManager|TrayIcon| \
Security|RemoteAccess) ret=$in ;;
ServiceConfiguration| \
Backup|YaST|YaST-Hardware|YaST-Misc|YaST-Network|YaST-Virtualization|YaST-Support| \
Feedback|YaST-Net_advanced|YaST-Security|YaST-Software|YaST-System|YaST-AppArmor)
ret="X-SuSE-$in" ;;
#Utility Menu:
Telephony|Accessibility|TextEditor|PDA|Calculator|Clock) ret=$in ;;
DesktopUtility|SyncUtility|PrintingUtility|TimeUtility|WebUtility|Editor)
ret="X-SuSE-$in" ;;
#Game Menu:
3DGame|Amusement|ArcadeGame|CardGame|FirstPersonGame|BoardGame|\
PlatformGame|PuzzleGame|SportsGame|StrategyGame|BlocksGame| \
ActionGame|AdventureGame|KidsGame|LogicGame|Simulation|RolePlaying)
ret=$in ;;
#Control Center Categories:
ControlCenter-Personal|ControlCenter-Hardware|ControlCenter-LookAndFeel|ControlCenter-System)
ret="X-SuSE-$in" ;;
#XFCE Private Categories:
X-Xfce*|X-XFCE*)
ret="$in" ;;
#special tags:
Application|Qt|KDE|GTK|GNOME|Motif|ConsoleOnly|Shell|X-Red-*| \
X-Ximian-*|X-GNOME-*|X-KDE-*|Settings|DesktopSettings|HardwareSettings| \
Office|Network|Game|Graphics|Education|Documentation|Development| \
Viewer|System|Utility|AudioVideo|AdvancedSettings|More) ret=$in ;;
Core-Edutainment|Core-Game|Core-Graphics|Core-Internet| \
Core-Multimedia|Core-Office|Core-Settings|Core-Utility|Core-System| \
Core-Configuration|Core-Development|core)
ret="X-SuSE-$in" ;;
Core)
ret="$in" ;;
*) ret="" ;;
esac
}

rpm-build-suse-compat-0.01/update-desktop-files/suse_update_desktop_file.sh000064400000000000000000000302051170241405100272120ustar00rootroot00000000000000#! /bin/sh

# macro: suse_update_desktop_file
#
# Used to add easily a category to .desktop files according to XDG
# standard.
#

. /usr/lib/rpm/map-desktop-category.sh

#
# parse arguments
#
INSTALL=no
I18N=yes
CREATE=no
RESET=no
UNIMPORTANT=no
NAME=no
COMMENT=no
GNAME=no

function usage() {
local exitcode="$1"
if [ -z "$exitcode" ]; then
exitcode=1
fi
echo
echo "Usage: $(basename $0) [OPTIONS] <APPLICATION> [CATEGORIES]"
echo
echo " Summary:"
echo " Used to add easily a category to .desktop files according to XDG"
echo " standard. More information is available on"
echo " http://en.opensuse.org/SUSE_Package_Conventions/RPM_Macros"
echo " If you have any questions, please use our mailinglist: "
echo " opensuse-packaging@opensuse.org"
echo " Options:"
echo " <APPLICATION> : The name of the desktop file."
echo " Example: use \"qbrew\" to edit qbrew.desktop"
echo " If APPLICATION has multiple desktop files, try the exact path"
echo " to the desktop file."
echo " Example: use \"%suse_update_desktop_file \\"
echo " %{buildroot}%{_datadir}/susehelp/meta/%name/%name.desktop\""
echo " to edit the susehelp desktop entry file instead."
echo " -u|--unimportant : add \"NoDisplay=true\" to the resulting desktop"
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 " -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"
echo " - RPM_BUILD_DIR"
echo " A referenced icon file (ending *.png; *.xpm) is installed in"
echo " /usr/share/pixmaps/ automatically if it is located in one of the "
echo " directories mentioned above (-maxdepth 1)."
echo " -r|--reset : Reset the \"Categories\" line in an existing desktop file."
echo " Normally, categories mentioned in an existing desktop file will be"
echo " obtained. Additional categories from commandline are added."
echo " -d|--docid <string> : Add \"X-SuSE-DocTeamID=<string>\" to the desktop file."
echo " -D|--docpath <path> : Add \"DocPath=<path>\" to the desktop file - do not guess it"
echo " automatically."
echo " -c|--create <name> : Create a new desktop file in /usr/share/applications/<name>.desktop ."
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 ""
exit $exitcode
}


while [ "${1:0:1}" = "-" ]; do
case ${1} in
-h|--help)
usage 0 ;;
-u|--unimportant)
UNIMPORTANT=yes
shift
continue;;
-n|--no-i18n)
I18N=no
shift
continue;;
-i|--install)
INSTALL=yes
shift
continue;;
-r|--reset)
RESET=yes
shift
continue;;
-d|--docid)
shift
DOCID="${1}"
shift
continue;;
-D|--docpath)
shift
DOCPATH="${1}"
if ! [ -r "$RPM_BUILD_ROOT/opt/kde3/share/doc/HTML/en/$DOCPATH/index.docbook" -o -r $RPM_BUILD_ROOT/usr/share/gnome/help/$DOCPATH/C/$DOCPATH.xml -o -r $RPM_BUILD_ROOT/usr/share/gnome/help/${DOCPATH/\///C/} ] ; then
echo WARNING: suse_update_desktop_file: DocPath target $DOCPATH for $FILE does not exist
fi
shift
continue;;
-c|--create)
CREATE=yes
INSTALL=yes
shift
continue;;
-C|--comment)
shift
COMMENT="${1}"
shift
continue;;
-N|--name)
shift
NAME="${1}"
shift
continue;;
-G|--genericname)
shift
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
done

APPLICATION="$1"
shift
if [ "$CREATE" = "yes" ]; then
NAME="$1"
shift
GNAME="$1"
shift
EXEC="$1"
shift
ICON="$1"
shift
if [ -z "$NAME" -o -z "$EXEC" ]; then
echo "ERROR: after --create you should define" >&2
echo " DESKTOP_FILE_NAME NAME GENERICNAME EXECUTABLE \[ ICON CATEGORIES... \]" >&2
usage 1
fi
mkdir -p $RPM_BUILD_ROOT/usr/share/applications/
cat > $RPM_SOURCE_DIR/$APPLICATION.desktop << EOF
[Desktop Entry]
Encoding=UTF-8
Name=$NAME
GenericName=$GNAME
Type=Application
Exec=$EXEC
Icon=$ICON
EOF
NAME=no
GNAME=no
fi
if [ "$INSTALL" = "yes" ]; then
mkdir -p $RPM_BUILD_ROOT/usr/share/applications/
FILE=`find $RPM_SOURCE_DIR $RPM_BUILD_DIR . -name $APPLICATION.desktop| sort -r | head -n 1`
if [ -s "$FILE" ]; then
cp -v "$FILE" $RPM_BUILD_ROOT/usr/share/applications/
icon_file=`sed -n '/^\[Desktop Entry\]/,/(\[.*|$)/ s,Icon=\(.*\),\1,p' "$FILE"`
icon_file=`find $RPM_SOURCE_DIR $RPM_BUILD_DIR -maxdepth 1 -name ${icon_file}.png -o -name ${icon_file}.xpm -o -name $icon_file | sort -r | head -n 1`
if [ -s "$icon_file" ]; then
mkdir -p $RPM_BUILD_ROOT/usr/share/pixmaps/
cp -v "$icon_file" $RPM_BUILD_ROOT/usr/share/pixmaps/
fi
fi
fi
while [ "$1" ]; do
CATEGORIES="$CATEGORIES;$1"
shift
done
CATEGORIES="${CATEGORIES#;}"
if [ -z "$APPLICATION" ]; then
echo "ERROR: suse_update_desktop_file: no application argument given" >&2
echo " Example: use "qbrew" to edit qbrew.desktop" >&2
usage 1
fi

#
# find file
#
for i in /$RPM_BUILD_ROOT/opt/kde3/share/applications/kde/ \
/$RPM_BUILD_ROOT/opt/kde3/share/applnk \
/$RPM_BUILD_ROOT/usr/share/applications/ \
/$RPM_BUILD_ROOT/usr/share/gnome/apps/ \
/$RPM_BUILD_ROOT/etc/xdg/autostart/ ; do
[ -e "$i" ] && DIRS="$DIRS $i"
done
if [ "${APPLICATION:0:1}" == "/" -a -e "$APPLICATION" ]; then
FILE_="$APPLICATION"
else
FILE_=`find $DIRS -name $APPLICATION.desktop`
fi
if [ -z "$FILE_" ]; then
echo "ERROR: suse_update_desktop_file: unable to find $APPLICATION" >&2
usage 1
fi
FILE=""
for i in $FILE_; do
#
# fix old files
#
sed -e 's/\[KDE Desktop Entry\]/[Desktop Entry]/' "$i" > "${i}_" && mv "${i}_" "$i"

# dos2unix for the poor
sed -e 's///' "$i" > "${i}_" && mv "${i}_" "$i"

if [ "$FILE" ]; then
echo "ERROR: suse_update_desktop_file: $APPLICATION has multiple desktop files" >&2
usage 1
fi
FILE=$i
done

#
# move KDE legacy files to XDG path
#
if echo $FILE | grep -q /opt/kde3/share/applnk/ ; then
if ! echo $FILE | grep -q /opt/kde3/share/applnk/.hidden/ ; then
if ! echo $FILE | grep -q /opt/kde3/share/applnk/Settings/ ; then
if ! echo $FILE | grep -q /opt/kde3/share/applnk/System/ScreenSavers/ ; then
echo "WARNING: file is in old KDE legacy path, moving it to XDG path"
mkdir -p $RPM_BUILD_ROOT/opt/kde3/share/applications/kde/
mv "$FILE" $RPM_BUILD_ROOT/opt/kde3/share/applications/kde/
FILE="$RPM_BUILD_ROOT/opt/kde3/share/applications/kde/${FILE##*/}"
fi
fi
fi
fi

#
# validate file
#
if [ ! -r "$FILE" ]; then
echo "ERROR: suse_update_desktop_file: unable to read $FILE" >&2
usage 1
fi
# esp. for susehelp
FILE_DOCPATH=`sed -n -e '/^\[Desktop Entry\]/,/(\[.*|$)/ s,;, ,g' -e 's,^DocPath=\\(.*\\),\\1,p' ${FILE}`
if [ -n "$FILE_DOCPATH" ] ; then
if [ ! -r "$RPM_BUILD_ROOT/opt/kde3/share/doc/HTML/en/$FILE_DOCPATH/index.docbook" ] && [ ! -r "$RPM_BUILD_ROOT/usr/share/gnome/help/$FILE_DOCPATH/C/$FILE_DOCPATH.xml" ] && [ ! -r $RPM_BUILD_ROOT/usr/share/gnome/help/${DOCPATH/\///C/} ] ; then
echo WARNING: suse_update_desktop_file: DocPath target $FILE_DOCPATH for $FILE does not exist
fi
fi

#
# update Categories
#
if [ "$RESET" = "no" ]; then
CATIN=`sed -n -e '/^\[Desktop Entry\]/,/(\[.*|$)/ s,;, ,g' -e 's,^Categories=\\(.*\\),\\1,p' ${FILE}`
fi
CATIN="$CATIN ${CATEGORIES//;/ }"
if [ -z "$CATIN" ]; then
case "${FILE%/*}" in
*/opt/kde3/*) CATIN="Qt KDE" ;;
*/usr/share/gnome*) CATIN="GTK" ;;
esac
fi
unset CAT
unset DCAT
for i in $CATIN; do
ret=""
mapCategory $i
if [ -z "$ret" ]; then
echo "WARNING: Category \"$i\" is unknown \!"
echo WARNING: it is ignored, until you registered a Category at opensuse-packaging@opensuse.org .
else
echo "$CAT" | grep -q "[=;]$i;" || CAT="$CAT$ret;"
fi
done
echo "" >> "${FILE}"
CAT="${CAT#;}"
if grep -q ^Categories= $FILE; then
sed -i -e '/^\[Desktop Entry\]/,/(\[.*|$)/ s,^Categories=.*,Categories='${CAT}',' "$FILE"
else
if [ -n "${CAT%;}" ]; then
sed -i -e '/^\[Desktop Entry\]/a \
'"Categories=${CAT%;};" $FILE
fi
fi
if [ "$UNIMPORTANT" = "yes" ]; then
if grep -q ^NoDisplay= $FILE; then
sed -i -e '/^\[Desktop Entry\]/,/(\[.*|$)/ s,^NoDisplay=.*,NoDisplay=true,' "$FILE"
else
sed -i -e '/^\[Desktop Entry\]/a \
NoDisplay=true' $FILE
fi
fi
if [ "$DOCID" ]; then
sed -i -e '/^\[Desktop Entry\]/a \
'"X-SuSE-DocTeamID=$DOCID" $FILE
fi

#
# check or set DocPath
#
DOCPATH_IS_GUESS=false
if [ -z "$DOCPATH" ] ; then
if [ -f $RPM_BUILD_ROOT/usr/share/gnome/help/$APPLICATION/C/$APPLICATION.xml ] ; then
DOCPATH=$APPLICATION
DOCPATH_IS_GUESS=true
fi
if [ -f $RPM_BUILD_ROOT/opt/kde3/share/doc/HTML/en/$APPLICATION/index.docbook ] ; then
DOCPATH=$APPLICATION
DOCPATH_IS_GUESS=true
fi
# NOTE: Here we can add guess for application/file.xml
fi
if [ -n "$DOCPATH" ] ; then
if [ -n "$FILE_DOCPATH" ] ; then
# DocPath already exists. Update it only from command line, not from guess.
if $DOCPATH_IS_GUESS ; then
if [ "$DOCPATH" != "$FILE_DOCPATH" ] ; then
echo WARNING: suse_update_desktop_file: DocPath target $FILE_DOCPATH differs from guess $DOCPATH for $FILE
fi
else
sed -e '/^\[Desktop Entry\]/,/(\[.*|$)/ s,^DocPath=.*,DocPath='${DOCPATH}',' "$FILE" > "${FILE}.new" &&
mv "${FILE}.new" "${FILE}"
fi
else
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
fi
fi

if grep -q ^X-SuSE-translate= $FILE; then
echo "ERROR: $FILE contains X-SuSE-translate - called the macro twice?" >&2
usage 1
fi

if [ "$NAME" != "no" ]; then
sed -i -e '/^Name\[/d' $FILE
if [ -n "$NAME" ]; then
if ! grep -q ^Name= ${FILE}; then
sed -i -e '/^\[Desktop Entry\]/a '"Name=${NAME//,/\,}" ${FILE}
else
sed -i -e '/^\[Desktop Entry\]/,/(\[.*|$)/ s,^Name=.*,Name='"${NAME//,/\,}"',' ${FILE}
fi
else
sed -i -e '/^Name=/d' $FILE
fi
fi

if [ "$GNAME" != "no" ]; then
sed -i -e '/^GenericName\[/d' $FILE
if [ -n "$GNAME" ]; then
if ! grep -q ^GenericName= ${FILE}_; then
sed -i -e '/^\[Desktop Entry\]/a '"GenericName=${GNAME//,/\,}" ${FILE}
else
sed -i -e '/^\[Desktop Entry\]/,/(\[.*|$)/ s,^GenericName=.*,GenericName='"${GNAME//,/\,}"',' ${FILE}
fi
else
sed -i -e '/^GenericName=/d' $FILE
fi
fi

if [ "$COMMENT" != "no" ]; then
sed -i -e '/^Comment\[/d' $FILE
if [ -n "$COMMENT" ]; then
if ! grep -q ^Comment= ${FILE}; then
sed -i -e '/^\[Desktop Entry\]/a '"Comment=${COMMENT//,/\,}" ${FILE}
else
sed -i -e '/^\[Desktop Entry\]/,/(\[.*|$)/ s,^Comment=.*,Comment='"${COMMENT//,/\,}"',' ${FILE}
fi
else
sed -i -e '/^Comment=/d' $FILE
fi
fi

if [ "$I18N" = "no" ]; then
#
# this file will not get translated
#
sed -i -e '/^\[Desktop Entry\]/a \
X-SuSE-translate=false' $FILE
fi
rpm-build-suse-compat-0.01/update-desktop-files/update-desktop-files.spec000064400000000000000000000467341170241405100265300ustar00rootroot00000000000000#
# spec file for package update-desktop-files
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#


Name: update-desktop-files
Version: 12.1
Release: 14.1
Summary: A Build Tool to Update Desktop Files
License: GPL-2.0+
Group: Development/Tools/Building
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Source: suse_update_desktop_file.sh
Source1: map-desktop-category.sh
Source2: macro
Source4: brp-trim-desktop.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).
Requires: desktop-file-utils
BuildArch: noarch

%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.

%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
mkdir %name
cd %name

%build

%install
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

%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
* Fri Dec 16 2011 coolo@suse.com
- give warning for old options instead of error
* Fri Dec 16 2011 coolo@suse.com
- use sed with inline option to avoid leaving temporary files behind
* Thu Dec 15 2011 coolo@suse.com
- desktop.attr should be reenabled in rpm again
* Fri Dec 9 2011 coolo@suse.com
- split brp-trim-desktopfiles that installs a brp script to trim all
.desktop files without need of an extra macro
* Thu Sep 29 2011 vuntz@opensuse.org
- Update suse_update_desktop_file.sh: when -u is used, do not add
the non-standard X-SuSE-Unimportant=true anymore, but
NoDisplay=true.
* Mon Jun 6 2011 coolo@novell.com
- ship desktop.attr together with the .prov script for rpm
automatic mimehandler provides
* Wed Jan 26 2011 gber@opensuse.org
- also accept X-XFCE* spelling as used by xfce4-settings
* Thu Dec 23 2010 gber@opensuse.org
- do not strip X-Xfce* categories, xfce4-panel and xfce4-settings
rely on them
* Fri Oct 8 2010 vuntz@opensuse.org
- Add a desktop-file-utils Requires: this will make it easy for
everyone to use the RPM macros defined there, that are useful
when there is a .desktop file. After some thoughts, it is more
logical to add the macros in desktop-file-utils and to have a
Requires here (since all packages with .desktop files already
have a update-desktop-files BuildRequires), in my opinion.
* Mon Jun 21 2010 vuntz@opensuse.org
- Re-introduce the X-GNOME-* categories change, post-11.3.
* Mon Jun 21 2010 vuntz@opensuse.org
- Revert my June 7th change about X-GNOME-* categories: it actually
harms more than we'd like right now, since some items appear
twice with it. Since we have no time to fix it for 11.3, it's
simpler to revert.
* Tue Jun 8 2010 dmueller@suse.de
- bump version to 11.3
* Mon Jun 7 2010 vuntz@opensuse.org
- Accept X-GNOME-* categories in map-desktop-category.sh, so we
don't filter out those categories when updating a .desktop file.
* Thu Apr 8 2010 mls@suse.de
- mimetypes.prov: filter bad desktop files, use mimehandler instead
of mimetype
* Tue Nov 3 2009 coolo@novell.com
- map X-SuSE-YaST-Support too (bnc#545323)
* Thu Jul 16 2009 beineri@opensuse.org
- add 'Geography' as accepted category
* Mon Jun 8 2009 lrupp@suse.de
- added first usage()
- fix email
- print errors to stderr
* Wed May 20 2009 cmorve69o@yahoo.es
- fix error message when an unknown category is found
* Sun Nov 2 2008 coolo@suse.de
- mark files as translated even if not trimmed
* Fri Oct 24 2008 ke@suse.de
- Update translations.
* Fri Oct 24 2008 coolo@suse.de
- make trim more complex and leave out the old way
* Sun Oct 12 2008 ke@suse.de
- Update translations.
* Thu Oct 2 2008 vuntz@suse.de
- Add a -t/--trim option to suse_update_desktop_file.sh in order
to trim all translations from a desktop file. The goal is to
have the desktops use gettext to translate data from those files
and to make it easy to update translations by just shipping an
updated mo file. This is for fate#301344.
- This change requires a change in /usr/lib/rpm/suse_macros (rpm
package).
* Thu Oct 2 2008 ke@suse.de
- update translations.
* Tue Sep 30 2008 dmueller@suse.de
- fix mimetype.prov to not break for most KDE packages
* Thu Sep 25 2008 sreeves@suse.de
- add mimetype.prov to generate mime type rpm provides at build time
* Fri Sep 19 2008 ke@suse.de
- update translations.
* Mon Sep 1 2008 ke@suse.de
- update translations.
* Mon Aug 25 2008 ke@suse.de
- update translations.
* Mon Aug 18 2008 ke@suse.de
- update translations.
* Fri Jul 18 2008 ke@suse.de
- update translations.
* Fri Jun 6 2008 ke@suse.de
- update translations.
* Tue May 27 2008 ke@suse.de
- Remove test directory.
- update translations.
* Mon May 26 2008 ro@suse.de
- added directories to filelist to fix build
* Mon May 26 2008 ke@suse.de
- update translations.
* Thu May 22 2008 coolo@suse.de
- reupdate to fix build
* Mon May 19 2008 ke@suse.de
- update translations.
* Fri May 16 2008 ke@suse.de
- update translations.
* Fri May 9 2008 ke@suse.de
- update translations.
* Mon May 5 2008 ke@suse.de
- update translations.
* Sat Apr 26 2008 coolo@suse.de
- reupdate to fix build
* Fri Apr 25 2008 ke@suse.de
- update translations.
* Tue Apr 1 2008 coolo@suse.de
- work with split po files - update from SVN
* Tue Mar 25 2008 ke@suse.de
- Add /etc/xdg/autostart/ for autostarted applications. Provided by
Vincent Untz; bnc#370483.
- Update translations.
* Sun Mar 23 2008 coolo@suse.de
- adding check against additional newlines and updating
from (fixed) SVN
* Thu Mar 20 2008 ke@suse.de
- update translations.
* Tue Feb 12 2008 coolo@suse.de
- don't rely on perl and command line tools, but on fast C++
* Mon Feb 11 2008 ke@suse.de
- update translations.
* Tue Feb 5 2008 coolo@suse.de
- do not install it by default (23MB saved)
* Fri Jan 18 2008 ke@suse.de
- Update translations.
* Fri Jan 11 2008 sbrabec@suse.cz
- Removed broken support for CheckHardware (#255716).
* Thu Jan 10 2008 ke@suse.de
- Update translations.
* Mon Dec 17 2007 ke@suse.de
- Update translations.
* Tue Nov 27 2007 ke@suse.de
- Update translations.
* Wed Sep 19 2007 ke@suse.de
- Provide locale info; reported by Stephan Binner [#326424].
* Thu Sep 13 2007 ke@suse.de
- Update sk entries file; reported by Ladislav Michnovic [#309868].
* Mon Sep 10 2007 ke@suse.de
- Fix German translation (Audacious); reported by Andreas Schwab
[#308965].
* Wed Aug 29 2007 ke@suse.de
- Update translations.
* Mon Aug 27 2007 ke@suse.de
- Update translations.
* Mon Aug 20 2007 ke@suse.de
- Update translations.
* Fri Aug 17 2007 ke@suse.de
- Update translations.
* Wed Aug 15 2007 ke@suse.de
- Update translations.
* Tue Aug 14 2007 ke@suse.de
- Adjust PREPARE_PACKAGE to create the old inline format; debugged by
Stephan Kulow [#299607]
- Update translations.
* Fri Aug 10 2007 ke@suse.de
- Update for 10.3 beta2.
* Mon Aug 6 2007 ke@suse.de
- Update for 10.3 beta1.
* Wed Jul 18 2007 ke@suse.de
- update from desktop translations by running PREPARE_PACKAGE.
* Thu Jul 5 2007 coolo@suse.de
- don't package kappfinder files anymore and let packages provide their
own files
* Tue Jul 3 2007 coolo@suse.de
- adding some debug output to indicate copying templates
* Thu Jun 21 2007 stbinner@suse.de
- fix invalid .desktop files
* Tue May 29 2007 coolo@suse.de
- fix rpmlint problems
* Mon May 28 2007 coolo@suse.de
- remove the requires for desktop-file-validate too
* Mon May 21 2007 coolo@suse.de
- update from SVN to fix a lot of bugs ;(
* Tue May 15 2007 coolo@suse.de
- remove windows line feeds from desktop files
* Mon May 14 2007 coolo@suse.de
- remove the desktop-file-validate call again to avoid loops in
dependency chains
- make sure X-SuSE-Translate isn't already part of the file
* Fri May 11 2007 coolo@suse.de
- add X-SuSE-YaST2-Virtualization (#258600)
* Mon May 7 2007 coolo@suse.de
- add Encoding=UTF-8 to generated .desktop files to keep (older)
desktop-file-validate happy
- fix script error
* Wed May 2 2007 coolo@suse.de
- add support for untranslate (so we can grab upstream translations
reliable)
* Sat Apr 28 2007 ro@suse.de
- ignore return code of validation for now, it causes too much
breakage
* Wed Apr 25 2007 coolo@suse.de
- following suggestion on IRC and call desktop-file-validate
as part of the build check
* Tue Apr 24 2007 coolo@suse.de
- don't look at /usr/share twice
* Tue Apr 24 2007 coolo@suse.de
- flush translations for another translation round
* Tue Apr 24 2007 coolo@suse.de
- move /opt/gnome to /usr
- deprecate GNOME1 support
* Wed Mar 14 2007 dmueller@suse.de
- bump version
* Thu Dec 7 2006 coolo@suse.de
- update from translators
* Mon Nov 20 2006 coolo@suse.de
- update from translators
* Tue Nov 7 2006 coolo@suse.de
- update from desktop translations
* Thu Nov 2 2006 coolo@suse.de
- update from new SVN
* Wed Sep 20 2006 stbinner@suse.de
- add HardwareSettings category to map-desktop-category.sh (#206753)
* Tue Jun 13 2006 coolo@suse.de
- don't ignore NoDisplay .desktop files (#165187 and #180627)
* Mon Jun 12 2006 coolo@suse.de
- bugfixes from vendor
* Fri Jun 9 2006 coolo@suse.de
- another update for desktop translations
* Fri Jun 2 2006 dmueller@suse.de
- updated desktop translations (#175645)
* Wed Apr 26 2006 stbinner@suse.de
- update from SVN, more Italian & Japanese translation format fixes
* Sat Apr 22 2006 stbinner@suse.de
- update (rebuild 107) to fix Italian mess (#168551)
* Tue Apr 18 2006 coolo@suse.de
- another update (rebuild 105)
* Tue Apr 11 2006 sbrabec@suse.cz
- Updated cs translation from LCN SVN.
* Fri Apr 7 2006 stbinner@suse.de
- update translations from SVN
* Wed Apr 5 2006 stbinner@suse.de
- update translations
* Fri Mar 31 2006 stbinner@suse.de
- update translations and remove not-to-be-translated strings parts
* Fri Mar 31 2006 stbinner@suse.de
- own some more locale dirs on PLUS to fix build
* Wed Mar 29 2006 sreeves@suse.de
- Add new X-SuSE-ControlCenter-* categories
* Fri Mar 24 2006 dmueller@suse.de
- update translations from SVN (de,es,fr,it,ja,pt_BR,zh_CN,zh_TW)
* Fri Mar 24 2006 coolo@suse.de
- update translations from SVN
* Fri Mar 17 2006 coolo@suse.de
- update translations from SVN
* Mon Mar 6 2006 coolo@suse.de
- fix sed call (#152224)
* Mon Feb 27 2006 coolo@suse.de
- update translations from SVN
* Mon Feb 27 2006 stbinner@suse.de
- patch map-desktop-category.sh for PLUS distributions
* Wed Feb 22 2006 stbinner@suse.de
- add "km" locale dirs to fix build on PLUS
* Thu Feb 16 2006 sbrabec@suse.cz
- Fix of DocPath warning check (149699#c12).
* Wed Feb 15 2006 coolo@suse.de
- fixed the addition of new tags
* Tue Feb 14 2006 coolo@suse.de
- fixed PREPARE_PACKAGE and used it one more time
* Tue Feb 14 2006 coolo@suse.de
- enhance the script/macro:
* the docpath is guessed now
* allow -D to overwrite guessing of docpaths
* allow -N/-G/-C to overwrite Name/GenericName/Comment
* Mon Feb 13 2006 coolo@suse.de
- update translations from lcn SVN
* Tue Feb 7 2006 coolo@suse.de
- fix the escaping of to translated text
* Mon Feb 6 2006 dmueller@suse.de
- remove duplicate desktop files and add a check
to avoid the same happening in the future
* Mon Feb 6 2006 coolo@suse.de
- let the translations work again (workaround #147685)
* Fri Feb 3 2006 coolo@suse.de
- updated translations received so far
* Fri Jan 27 2006 mls@suse.de
- converted neededforbuild to BuildRequires
* Fri Jan 20 2006 dmueller@suse.de
- split off desktop-translations package. install translations there.
* Wed Jan 18 2006 dmueller@suse.de
- sync kappfinder desktop files/icons with upstream
(fixes lyx failure)
* Mon Jan 9 2006 coolo@suse.de
- print the error to STDERR, so Rudi sees them
* Mon Jan 9 2006 coolo@suse.de
- brp-desktop is a bit picky: fixing format
* Sat Jan 7 2006 coolo@suse.de
- fixing obvious perl knowledge lack
* Thu Jan 5 2006 coolo@suse.de
- fix bug related to groups
* Fri Dec 16 2005 coolo@suse.de
- rework translation applying script
- readding translations
* Thu Nov 3 2005 coolo@suse.de
- reset the translations to prepare a new way of handling them
* Thu Sep 29 2005 stbinner@suse.de
- add "Photograph" -> "Photography" category mapping
* Mon Sep 12 2005 coolo@suse.de
- update translations (mainly hu)
* Mon Sep 5 2005 adrian@suse.de
- add finish translations
* Fri Sep 2 2005 aj@suse.de
- Revert changes to extra-files, kappfinder-* since they cause
build problems.
* Thu Sep 1 2005 adrian@suse.de
- final translation update
* Wed Aug 31 2005 adrian@suse.de
- update translations
* Wed Aug 17 2005 coolo@suse.de
- update translations
* Thu Aug 11 2005 adrian@suse.de
- add X-SuSE-YaST-AppArmor
* Mon May 23 2005 adrian@suse.de
- do only warn about not existing DocPath
* Thu May 19 2005 adrian@suse.de
- validate DocPath target
* Wed Mar 16 2005 adrian@suse.de
- translation updates
* Mon Mar 14 2005 adrian@suse.de
- fixed hu desktop entries by Karl
* Wed Mar 9 2005 adrian@suse.de
- allow RSS-News tag
* Thu Feb 17 2005 adrian@suse.de
- do not move screensaver entries
- prefer .png icons during install
* Wed Feb 16 2005 adrian@suse.de
- auto move desktop files from legacy applnk path to XDG path
* Mon Feb 14 2005 schwab@suse.de
- Use the first icon found.
* Thu Feb 10 2005 adrian@suse.de
- fix german Planner menu entry
- new hungarian translations
* Fri Jan 14 2005 adrian@suse.de
- accept Feedback as Category (#41682)
* Thu Jan 13 2005 adrian@suse.de
- update to current translation state from cvs.
* Wed Nov 17 2004 adrian@suse.de
- honor only [Desktop Entry] section
- allow "Clock" Category
* Tue Nov 16 2004 adrian@suse.de
- package also some icon templates, which can get installed via -i
* Mon Nov 15 2004 adrian@suse.de
- install also icon files with -i
* Thu Oct 28 2004 adrian@suse.de
- add -d/--docid switch to add identifier for documentation team
* Tue Oct 19 2004 adrian@suse.de
- update french and chinese translations
* Tue Oct 5 2004 adrian@suse.de
- add translation for Office Suite to czech (#46833)
* Mon Oct 4 2004 adrian@suse.de
- new translations for el
* Fri Oct 1 2004 adrian@suse.de
- update translations
- do not add Categories line, if empty
* Sun Sep 26 2004 adrian@suse.de
- use current translations from cvs
* Tue Aug 17 2004 coolo@suse.de
- handle packaged CVS dirs for convenience
* Tue Aug 17 2004 coolo@suse.de
- new translation round
* Tue Aug 3 2004 adrian@suse.de
- fix encoding of impress.desktop
- update kappfinder templates to KDE 3.3 state
* Fri Jul 30 2004 coolo@suse.de
- make the warning an error - no one cares for WARNINGS in %%install
sections ;(
* Mon May 17 2004 adrian@suse.de
- update chinese translations
* Sun Apr 4 2004 adrian@suse.de
- mark desktop files to translate with X-SuSE-translate=true
- update translations
* Fri Apr 2 2004 adrian@suse.de
- adding sk and it files
- export direct from cvs
* Wed Mar 31 2004 coolo@suse.de
- adding some more german files
* Tue Mar 30 2004 adrian@suse.de
- add functionality to update explicit given files
(needed for directory files)
- update hungarian translations
* Mon Mar 29 2004 coolo@suse.de
- adding bulgarian
- adding japanish
- adding slowenian
* Wed Mar 24 2004 adrian@suse.de
- auto convert Gnome 1 desktop files to Utf8
(script by Stanislav, #36835)
* Mon Mar 22 2004 coolo@suse.de
- adding dutch
- adding hungarian
* Wed Mar 17 2004 adrian@suse.de
- add spanish translations
- add norwegian translations
* Tue Mar 16 2004 coolo@suse.de
- adding czech translations
* Tue Mar 16 2004 coolo@suse.de
- updating german translations
* Sun Mar 14 2004 coolo@suse.de
- adding translations (#34304)
* Wed Mar 10 2004 adrian@suse.de
- update kappfinder data (from KDE 3.2.1)
* Wed Mar 3 2004 adrian@suse.de
- fix typo in map-desktop-files
* Sun Feb 29 2004 adrian@suse.de
- add WebUtility Category
* Tue Feb 17 2004 adrian@suse.de
- remove Mixer -> AudioMixer mapping
(the other way arround exists and is valid)
- check for double Category entries
- add ContactManagement Category
* Mon Feb 16 2004 adrian@suse.de
- fix build as user
* Mon Feb 16 2004 adrian@suse.de
- Viewer is also an official tag now
- temp. fail on outdated Categories
- introduce "Jukebox"
* Mon Nov 10 2003 adrian@suse.de
- adjust Categories to match the Menu Standard Version 0.8
* Thu Oct 30 2003 adrian@suse.de
- add slovak translations
* Mon Oct 6 2003 adrian@suse.de
- fix tail usage
* Fri Sep 26 2003 adrian@suse.de
- add KDE 3.2 applications path
* Wed Sep 17 2003 adrian@suse.de
- add more transalations
* Wed Sep 17 2003 adrian@suse.de
- fix OO template call (#31130)
* Sat Sep 13 2003 adrian@suse.de
- higher MimeType priorities for OO
- remove version number from OO desktop file templates
* Thu Sep 11 2003 adrian@suse.de
- fix a very stupid bug, we don't have the rpm yet, during the
build .... CheckHardware stuff is working now (#30469)
* Sun Sep 7 2003 adrian@suse.de
- fix: ProjectManagement is an official group
* Fri Sep 5 2003 adrian@suse.de
- implement support for CheckHardware
* Fri Sep 5 2003 adrian@suse.de
- introduce Video group
* Thu Sep 4 2003 adrian@suse.de
- define icons and remove Categories from OO desktop files
- add new possible Categories
* Tue Sep 2 2003 adrian@suse.de
- list all X-SuSE-Core- groups explicit
* Mon Sep 1 2003 adrian@suse.de
- fix conflict between "X-SuSE-Core" and "Core" Category
* Mon Sep 1 2003 adrian@suse.de
- fix usage of multiple switches
* Mon Sep 1 2003 adrian@suse.de
- several mapping fixes
- add -u option to hide entries unimportant entries by default
* Thu Aug 28 2003 adrian@suse.de
- change desktop search path order to install the right files
for OpenOffice.org
* Mon Aug 25 2003 adrian@suse.de
- mapping fixes
* Mon Aug 18 2003 adrian@suse.de
- add template files for OpenOffice
* Sun Aug 17 2003 adrian@suse.de
- fix: map Categories always
- some more mappings
* Sat Aug 16 2003 adrian@suse.de
- add .desktop file templates from kappfinder
* Fri Aug 15 2003 adrian@suse.de
- add /opt/gnome/share/gnome/apps/ path
* Thu Aug 14 2003 adrian@suse.de
- ignore also NoDisplay=true files
* Tue Aug 12 2003 adrian@suse.de
- add DialUp Category
- map Internet -> Network
* Tue Aug 12 2003 adrian@suse.de
- add -r|--reset option
* Mon Aug 11 2003 adrian@suse.de
- add /usr/lib/rpm/map-desktop-category.sh to check Categories
and to set X-SuSE- prefix automagically
* Wed Jul 30 2003 adrian@suse.de
- use $RPM_SOURCE_DIR
* Mon Jul 28 2003 adrian@suse.de
- add --create and --install switches for %%suse_update_desktop_file
* Thu Jul 24 2003 adrian@suse.de
- ignore desktop files with Hidden flag
* Thu Jul 24 2003 adrian@suse.de
- initial package
* provide suse_update_desktop_file.sh script for the
%%suse_update_desktop_file rpm macro
* a first po-file with translations
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin