File update-list.sh of Package branding-basedonopensuse
#!/bin/sh
set -e
packs=$(mktemp)
curl -s http://download.opensuse.org/factory/repo/oss/suse/setup/descr/packages.gz | gzip -c -d > $packs
list=$(grep ^=Pkg:.*branding-openSUSE $packs | cut '-d ' -f2 | sort -u | grep -v '^branding-openSUSE$' )
export LC_ALL=C
sed -n -e '1,/^#BRQ-START/p' branding-basedonopensuse.spec > branding-basedonopensuse.spec.new
for i in $list; do
echo "BuildRequires: $i" >> branding-basedonopensuse.spec.new
done
sed -n -e '/^#BRQ-END/,/^#PSTART/p' branding-basedonopensuse.spec >> branding-basedonopensuse.spec.new
for i in $list; do
echo "packages=\"\$packages $i\"" >> branding-basedonopensuse.spec.new
done
sed -n -e '/^#PEND/,$p' branding-basedonopensuse.spec >> branding-basedonopensuse.spec.new
sed -n -e '1,/# TIL HERE/p' branding-basedonopensuse.spec.new > branding-basedonopensuse.spec.new2
mv branding-basedonopensuse.spec.new2 branding-basedonopensuse.spec.new
( for i in $list; do
base=${i/-branding-openSUSE/}
echo "%package -n $base-branding-basedonopensuse"
echo "Summary: Provides $base branding"
echo "Provides: $base-branding"
echo "Requires: branding-basedonopensuse"
echo "Conflicts: otherproviders($base-branding)"
perl -w extract.pl $packs $i Sup | sed -e 's,^,Supplements:,; s,branding-openSUSE,branding-basedonopensuse,'
perl -w extract.pl $packs $i Lic | sed -e 's,^,License:,'
perl -w extract.pl $packs $i Req | grep -v rpmlib | grep -v ^lib | grep -v '^config(' | grep -v /bin/sh | \
sed -e 's,^,Requires:,; s, *>=.*,,; s, *>.*,,; s, *=.*,,; s,branding-openSUSE,branding-basedonopensuse,' | sort -u
echo ""
echo "%description -n $base-branding-basedonopensuse"
echo "Debranded copy of openSUSE branding for $base"
echo ""
echo "%files -f files.$base-branding-openSUSE -n $base-branding-basedonopensuse"
echo ""
if test -f post.$base; then
echo "%post -n $base-branding-basedonopensuse"
cat post.$base
fi
if test -f postun.$base; then
echo "%postun -n $base-branding-basedonopensuse"
cat postun.$base
fi
done ) >> branding-basedonopensuse.spec.new
/usr/lib/obs/service/format_spec_file.files/prepare_spec branding-basedonopensuse.spec.new > branding-basedonopensuse.spec.form
mv branding-basedonopensuse.spec.form branding-basedonopensuse.spec.new
diff -u branding-basedonopensuse.spec branding-basedonopensuse.spec.new || true
mv branding-basedonopensuse.spec.new branding-basedonopensuse.spec
echo $packs
#rm $packs