OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/update-desktop-files?expand=0&rev=56
This commit is contained in:
parent
9bb02b7d0a
commit
feccfb1bc5
@ -1,54 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
test -f update-desktop-files.spec || { "cwd must contain update-desktop-files.spec"; exit 1; }
|
||||
|
||||
if test -d "$MY_LCN_CHECKOUT"; then
|
||||
echo "Updating $MY_LCN_CHECKOUT"
|
||||
svn up $MY_LCN_CHECKOUT
|
||||
else
|
||||
echo "No \$MY_LCN_CHECKOUT set, will checkout temporarly"
|
||||
svn export https://forgesvn1.novell.com/svn/suse-i18n/trunk/lcn
|
||||
export MY_LCN_CHECKOUT=$PWD/lcn
|
||||
fi
|
||||
|
||||
rm -rf po
|
||||
mkdir po
|
||||
for file in $MY_LCN_CHECKOUT/*/po/update-desktop-files*.po; do
|
||||
lang=`echo $file | sed -e "s,/po/up.*,,; s,.*/,,"`
|
||||
echo $file
|
||||
test -d po/$lang || mkdir po/$lang
|
||||
# package valid files only
|
||||
msgfmt -o /dev/null --check $file || {
|
||||
rmdir po/$lang
|
||||
continue
|
||||
}
|
||||
# cp $file po/$lang/entries.po
|
||||
# instead of copying, convert to the old inline format
|
||||
msgattrib -o - --no-obsolete $file | awk '/^msgctxt/ {
|
||||
body = 1
|
||||
ctxt=gensub(/msgctxt \"(.+)\"/, "\\1", "g")
|
||||
next
|
||||
}
|
||||
/^msgid/ && body == 1 {
|
||||
sub(/msgid \"/, "&" ctxt ": ")
|
||||
print
|
||||
next
|
||||
}
|
||||
{print}
|
||||
' > po/$lang/entries.po.new
|
||||
msgfmt po/$lang/entries.po.new -o po/$lang/entries.mo;
|
||||
msgunfmt --no-wrap po/$lang/entries.mo | \
|
||||
grep -v '^"[A-Z][^ ]*: ' | grep '[^\][\]n"' && exit 1
|
||||
rm po/$lang/entries.mo
|
||||
|
||||
if test -f po/$lang/entries.po; then
|
||||
msgcat -o po/$lang/entries.po --use-first po/$lang/entries.po po/$lang/entries.po.new
|
||||
rm po/$lang/entries.po.new
|
||||
else
|
||||
mv po/$lang/entries.po.new po/$lang/entries.po
|
||||
fi
|
||||
|
||||
done
|
||||
rm -f desktop-translations.tar.bz2
|
||||
tar cfj desktop-translations.tar.bz2 po
|
||||
rm -rf po
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:08e9e2685f1cd4afa0739ca7d568d1d08e4df40d642925ba4328efea5f06f6a6
|
||||
size 9477481
|
6
macro
Normal file
6
macro
Normal file
@ -0,0 +1,6 @@
|
||||
# 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 %{?distribution:--project "%distribution"} %{?_project:--project "%_project"} --basedir %_srcrpmdir %{**} || exit 1 \
|
||||
%nil
|
@ -20,6 +20,8 @@ UNIMPORTANT=no
|
||||
NAME=no
|
||||
COMMENT=no
|
||||
GNAME=no
|
||||
BASEDIR=/no
|
||||
PROJECT=
|
||||
while [ "${1:0:1}" = "-" ]; do
|
||||
case ${1} in
|
||||
-u|--unimportant)
|
||||
@ -75,12 +77,31 @@ while [ "${1:0:1}" = "-" ]; do
|
||||
GNAME="${1}"
|
||||
shift
|
||||
continue;;
|
||||
--basedir)
|
||||
shift
|
||||
BASEDIR="${1}"
|
||||
shift
|
||||
continue;;
|
||||
--project)
|
||||
shift
|
||||
PROJECT="${1}"
|
||||
shift
|
||||
continue;;
|
||||
*)
|
||||
echo "UNKNOWN OPTION: $1"
|
||||
exit 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
|
||||
@ -220,7 +241,7 @@ for i in $CATIN; do
|
||||
ret=""
|
||||
mapCategory $i
|
||||
if [ -z "$ret" ]; then
|
||||
echo WARNING: Category \"$i\" is unknown \!
|
||||
echo 'WARNING: Category \"$i\" is unknown \!'
|
||||
echo WARNING: it is ignored, until you registered a Category at adrian@suse.de .
|
||||
else
|
||||
echo "$CAT" | grep -q "[=;]$i;" || CAT="$CAT$ret;"
|
||||
@ -286,9 +307,7 @@ if grep -q ^X-SuSE-translate= $FILE; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$I18N" = "yes" ]; then
|
||||
|
||||
if [ "$NAME" != "no" ]; then
|
||||
if [ "$NAME" != "no" ]; then
|
||||
grep -v '^Name\[' $FILE > ${FILE}_
|
||||
if [ -n "$NAME" ]; then
|
||||
if ! grep -q ^Name= ${FILE}_; then
|
||||
@ -299,9 +318,9 @@ if [ "$I18N" = "yes" ]; then
|
||||
else
|
||||
grep -v "^Name=" ${FILE}_ > $FILE
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$GNAME" != "no" ]; then
|
||||
if [ "$GNAME" != "no" ]; then
|
||||
grep -v '^GenericName\[' $FILE > ${FILE}_
|
||||
if [ -n "$GNAME" ]; then
|
||||
if ! grep -q ^GenericName= ${FILE}_; then
|
||||
@ -312,9 +331,9 @@ if [ "$I18N" = "yes" ]; then
|
||||
else
|
||||
grep -v "^GenericName=" ${FILE}_ > $FILE
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$COMMENT" != "no" ]; then
|
||||
if [ "$COMMENT" != "no" ]; then
|
||||
grep -v '^Comment\[' $FILE > ${FILE}_
|
||||
if [ -n "$COMMENT" ]; then
|
||||
if ! grep -q ^Comment= ${FILE}_; then
|
||||
@ -325,33 +344,29 @@ if [ "$I18N" = "yes" ]; then
|
||||
else
|
||||
grep -v "^Comment=" ${FILE}_ > $FILE
|
||||
fi
|
||||
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"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$TRIM" = "no" ]; then
|
||||
#
|
||||
# Merge translations
|
||||
#
|
||||
cp $FILE ${FILE}.old
|
||||
/usr/bin/suse-desktop-merge $FILE > ${FILE}_ || exit 1
|
||||
perl /usr/share/update-desktop-files/untranslate.pl ${FILE}_ > ${FILE}.new
|
||||
if ! cmp -s ${FILE}.old ${FILE}.new; then
|
||||
echo "UNTRANSLATE DOES NOT WORK"
|
||||
diff -u ${FILE}.old ${FILE}.new
|
||||
exit 1
|
||||
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
|
||||
mv ${FILE}_ $FILE
|
||||
rm -f ${FILE}.old ${FILE}.new
|
||||
else
|
||||
#
|
||||
# Trim translations (desktops will use gettext to find them)
|
||||
#
|
||||
grep -v -E '^Name\[|^GenericName\[|^Comment\[' $FILE > ${FILE}_
|
||||
echo "X-SuSE-translate=true" >> ${FILE}_
|
||||
mv ${FILE}_ $FILE
|
||||
#else - silently do nothing - upstream translations preferred
|
||||
fi
|
||||
else
|
||||
#
|
||||
|
@ -1,84 +0,0 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
my $FILE=$ARGV[0];
|
||||
|
||||
use File::Basename;
|
||||
|
||||
my $group = '';
|
||||
my $overwrite = '';
|
||||
my %added = ();
|
||||
|
||||
open(FILE, "$FILE");
|
||||
while ( <FILE> ) {
|
||||
|
||||
# new group
|
||||
if ($_ =~ /^\[/ )
|
||||
{
|
||||
my $line = $_;
|
||||
chomp $line;
|
||||
$group = $line;
|
||||
}
|
||||
|
||||
if ($_ =~ /^X-SuSE-added=/) {
|
||||
my @translated = ();
|
||||
my $line = $_;
|
||||
chomp $line;
|
||||
$line =~ s,X-SuSE-added=,,;
|
||||
foreach my $tag (split(/;/, $line)) {
|
||||
my $tagname = $tag;
|
||||
$tagname =~ s/,.*//;
|
||||
$tag =~ s/^[^,]*,//;
|
||||
foreach my $lang (split(/,/, $tag)) {
|
||||
push(@translated, "$tagname\\[$lang\\]");
|
||||
}
|
||||
}
|
||||
$added{$group} = \@translated;
|
||||
next;
|
||||
}
|
||||
}
|
||||
|
||||
close(FILE);
|
||||
|
||||
open(FILE, "$FILE");
|
||||
|
||||
my $addedtrans = $added{''};
|
||||
|
||||
while ( <FILE> ) {
|
||||
next if ($_ =~ /X-SuSE-translate=true/ );
|
||||
next if ($_ =~ /X-SuSE-added=/ );
|
||||
|
||||
# new group
|
||||
if ($_ =~ /^\[/ ) {
|
||||
my $line = $_;
|
||||
chomp $line;
|
||||
$group = $line;
|
||||
print $_;
|
||||
$addedtrans = $added{$group};
|
||||
next;
|
||||
}
|
||||
|
||||
if ( $_ =~ /^$overwrite=/ ) {
|
||||
$overwrite = '';
|
||||
next;
|
||||
}
|
||||
|
||||
if ($_ =~ m/^#SUSE-Overwrite/) {
|
||||
$_ =~ s,^#SUSE-Overwrite ,,;
|
||||
my $line = $_;
|
||||
chomp $line;
|
||||
$line =~ s,=.*,,;
|
||||
$overwrite = "$line";
|
||||
$overwrite = quotemeta $overwrite;
|
||||
print $_;
|
||||
next;
|
||||
}
|
||||
|
||||
foreach $tag (@{$addedtrans}) {
|
||||
if ($_ =~ m/^$tag=/ ) {
|
||||
$_ = '';
|
||||
last;
|
||||
}
|
||||
}
|
||||
print $_ if ($_);
|
||||
}
|
||||
|
@ -3,6 +3,11 @@ Fri Oct 24 14:04:22 CEST 2008 - ke@suse.de
|
||||
|
||||
- Update translations.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Oct 24 09:41:58 CEST 2008 - coolo@suse.de
|
||||
|
||||
- make trim more complex and leave out the old way
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sun Oct 12 12:05:49 CEST 2008 - ke@suse.de
|
||||
|
||||
|
@ -20,19 +20,15 @@
|
||||
|
||||
Name: update-desktop-files
|
||||
Version: 11.0
|
||||
Release: 57
|
||||
Release: 58
|
||||
Summary: A Build Tool to Update Desktop Files
|
||||
License: GPL v2 or later
|
||||
Group: Development/Tools/Building
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
Requires: desktop-translations = %{version}
|
||||
Requires: suse-desktop-utils
|
||||
AutoReqProv: on
|
||||
Source: suse_update_desktop_file.sh
|
||||
Source1: map-desktop-category.sh
|
||||
Source4: untranslate.pl
|
||||
Source10: desktop-translations.tar.bz2
|
||||
Source99: PREPARE_PACKAGE
|
||||
Source2: macro
|
||||
Source100: mimetypes.prov
|
||||
BuildArch: noarch
|
||||
|
||||
@ -46,22 +42,6 @@ Authors:
|
||||
--------
|
||||
Stephan Kulow <coolo@suse.de>
|
||||
|
||||
%package -n desktop-translations
|
||||
License: GPL v2 or later
|
||||
Summary: Desktop Files Translation updates
|
||||
Group: System/GUI/Other
|
||||
# we do not need them in all systems, if there is an update, we put it in translate-update-*
|
||||
# Provides: locale(af;ar;bg;bn;bs;ca;cs;cy;da;de;el;en_GB;en_US;es;et;fi;fr;gl;gu;he;hi;hr;hu;id;it;ja;ka;km;ko;lo;lt;mk;mr;nb;nl;pa;pl;pt;ro;ru;si;sk;sl;sr;sr@Latn;sv;ta;tr;uk;vi;wa;xh;zh_CN;zh_TW;zu)
|
||||
|
||||
%description -n desktop-translations
|
||||
This package provides further translations for installed desktop files.
|
||||
|
||||
|
||||
|
||||
Authors:
|
||||
--------
|
||||
Adrian Schroeter <adrian@suse.de>
|
||||
|
||||
%prep
|
||||
%setup -q -n . -D -T 0
|
||||
mkdir %name
|
||||
@ -70,48 +50,24 @@ cd %name
|
||||
%build
|
||||
|
||||
%install
|
||||
pushd %name
|
||||
tar xfj %SOURCE10
|
||||
cd po
|
||||
for lang in *; do
|
||||
if test "$lang" = "nb_no"; then
|
||||
continue
|
||||
fi
|
||||
if test -f $lang; then
|
||||
rm $lang
|
||||
else
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/share/%name/locale/translations/en_US/LC_MESSAGES
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/share/locale/$lang/LC_MESSAGES
|
||||
for f in $lang/*.po; do
|
||||
msgfmt -o $RPM_BUILD_ROOT/usr/share/locale/$lang/LC_MESSAGES/desktop_translations.mo $f
|
||||
msgunfmt --no-wrap $RPM_BUILD_ROOT/usr/share/locale/$lang/LC_MESSAGES/desktop_translations.mo | \
|
||||
grep -v '^"[A-Z][^ ]*: ' | grep '[^\][\]n"' && exit 1
|
||||
ln -s /usr/share/locale/$lang/LC_MESSAGES/desktop_translations.mo \
|
||||
$RPM_BUILD_ROOT/usr/share/%name/locale/translations/en_US/LC_MESSAGES/$lang\_`echo $f | sed -e 's#.*/##; s#\.po#.mo#'`
|
||||
done
|
||||
fi
|
||||
done
|
||||
install -m 755 %SOURCE4 $RPM_BUILD_ROOT/usr/share/%name/
|
||||
mkdir -p $RPM_BUILD_ROOT/usr/lib/rpm
|
||||
install -m 0755 %SOURCE0 %SOURCE1 $RPM_BUILD_ROOT/usr/lib/rpm
|
||||
popd
|
||||
%find_lang desktop_translations
|
||||
install -m0755 %SOURCE100 $RPM_BUILD_ROOT/usr/lib/rpm
|
||||
install -m0644 -D %SOURCE2 $RPM_BUILD_ROOT/etc/rpm/macros.%name
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%lang(en) /usr/share/%name
|
||||
/usr/lib/rpm/*
|
||||
|
||||
%files -f desktop_translations.lang -n desktop-translations
|
||||
%defattr(-,root,root)
|
||||
/etc/rpm/*
|
||||
|
||||
%changelog
|
||||
* 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 02 2008 vuntz@suse.de
|
||||
|
Loading…
Reference in New Issue
Block a user