LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File update-list.sh of Package bundle-lang-common (Project X11:common:Factory)

#!/bin/sh

export LC_ALL=C
PACKAGESFILE=packages.txt

if test -z `which w3m`; then
  echo "w3m is required to run this script."
  exit 1
fi

# first check !extra stuff
giturl=http://gitorious.org/opensuse/package-lists/blobs/raw/master/
curl -s $giturl/output/opensuse/kde4_cd-nobundles.i586.list | grep -- -lang > kde.list
curl -s $giturl/output/opensuse/kde4_cd-nobundles.x86_64.list | grep -- -lang >> kde.list
curl -s $giturl/output/opensuse/gnome_cd-nobundles.i586.list | grep -- -lang > gnome.list
curl -s $giturl/output/opensuse/gnome_cd-nobundles.x86_64.list | grep -- -lang >> gnome.list

grep -v ' kde$' packages.txt | grep -v ' gnome$' | grep -v ' common$' > new && mv new packages.txt
for i in `cat kde.list gnome.list | sort -u`; do
  opt=gnome
  if grep -q -x $i kde.list; then
    opt=kde
    if grep -q -x $i gnome.list; then
      opt=common
    fi
  fi
  grep -v "$i gnome-extra" packages.txt > new && mv new packages.txt
  echo "$i $opt" >> packages.txt
done

LC_ALL=C sort -o packages.txt packages.txt
rm kde.list gnome.list

HANDLED=`grep -E "kde$|common$|gnome$" $PACKAGESFILE | sed "s, .*$,,g"`

grep -v gnome-extras$ $PACKAGESFILE > $PACKAGESFILE.new

factlist=`mktemp`
osc api /build/openSUSE:Factory/standard/i586/_repository | grep -- -lang | grep -v bundle-lang | cut -d\" -f2 | sed 's,\.rpm$,,g;s,-lang-.*$,-lang,g' | sort -u > $factlist

for package in `(osc api /build/GNOME:Factory/openSUSE_Factory/i586/_repository; osc api /build/GNOME:Apps/openSUSE_Factory/i586/_repository) | grep -- -lang | grep -v bundle-lang | cut -d\" -f2 | sed 's,\.rpm$,,g;s,-lang-.*$,-lang,g' | sort -u`; do
  grep -qx $package $factlist || continue
  echo $HANDLED | sed "s, ,\n,g" | grep -q "^$package$"
  if test $? -ne 0; then
    echo "$package gnome-extras" >> $PACKAGESFILE.new
  fi
done

LANG=C sort -u -o $PACKAGESFILE $PACKAGESFILE.new

# always wrong
PACKAGES="konqueror-plugins-lang glade3-lang gtk-vnc2-lang gtkmm2-tutorial-lang pango-module-thai-lang"
# broken upstream (errors when relinking or missing translations)
PACKAGES="$PACKAGES genius-lang glabels-lang gwibber-lang pitivi-lang"
# being added to Factory
PACKAGES="$PACKAGES NetworkManager-strongswan-lang"

# temporaries go here
for pack in $PACKAGES f-spot-lang gnome-do-plugins-lang totem-lang gnome-phone-manager-lang gtkpod-lang rhythmbox-lang the-board-lang libpurple-lang tasks-lang hamster-applet-lang pidgin-lang pidgin-advanced-sound-notification-lang pidgin-birthday-reminder-lang pidgin-guifications-lang ; do
   grep -v "^$pack " $PACKAGESFILE > $PACKAGESFILE.new && mv $PACKAGESFILE.new $PACKAGESFILE
done

rm -f $PACKAGESFILE.new

# tier1
languages="en de es it fr"
# tier2
languages="$languages ja zh nl cs pt pl ca ar"
# tier3
languages="$languages hu ko da sv ru" # ... Hebrew, Indian Languages (TBD), Zulu, Xhosa, Afrikaans, Northern Sotho
# cthiel invented
languages="$languages fi nb"
bundles="kde gnome common gnome-extras"

LC_ALL=C sort -o packages.txt packages.txt
uniq=`cut -d' ' -f1 packages.txt | uniq -d`
if test -n "$uniq"; then
   echo "duplicates: $uniq"
fi

for spec in $bundles; do
  filename=bundle-lang-$spec.spec
  packages=`grep " $spec"'$' packages.txt | cut -d' ' -f1`
  packages=`echo $packages`
  {
    sed -n -e '1,/#LANGUAGES/p' bundle-lang.spec.in
    for lang in $languages; do

      echo "%package $lang"
      echo "License:        License"
      echo "Summary:        summary"
      echo "Group:          group"
      for pack in $packages; do
	echo "Provides:       $pack = %(rpm -q --queryformat '%{VERSION}' $pack)"
	case $pack in
          *-lang)
            echo "Provides:       locale(${pack/-lang/}:$lang)"
            if test "$lang" = "pt"; then
                # special case for bnc#160811
                echo "Provides:       locale(${pack/-lang/}:pt_BR)"
            fi
            ;;
	esac
      done
    echo ""
    echo "%description $lang"
    echo "-"
    echo ""
    done
    sed -n -e '/#LANGUAGES/,$p' bundle-lang.spec.in
  } | {
    sed="s,@TAKEN_LANGUAGES@,$languages,"
    for p in $packages; do
       sed="$sed;s,@BREQUIRES@,@BREQUIRES@\nBuildRequires:  $p,"
       sed="$sed;s,@PACKAGES@,@PACKAGES@\npackages=\"\$packages $p\","
    done
#    sed="$sed;s,@PACKAGES@,$packages,"
    sed="$sed;s,@SPEC@,$spec,g"
    for lang in $languages; do
      sed="$sed;s,#LANGUAGE_FILES,%files $lang -f taken.$lang\n\n#LANGUAGE_FILES,"
    done
    sed -e "$sed"
  } > $filename.new
  perl update_spec.pl $filename.new attributes > $filename
  rm $filename.new
done

for changes in $bundles; do
	if test "$changes" = "common"; then
		continue;
	fi
	cp -lf  bundle-lang-common.changes bundle-lang-$changes.changes
done

osc service localrun format_spec_file

echo "CHECKING"
for spec in bundle-lang-gnome-extras bundle-lang-gnome bundle-lang-kde bundle-lang-common; do
  osc buildinfo openSUSE:Factory $spec standard i586 $spec.spec | grep '<error>'
done