auto commit
[opensuse:package-lists.git] / gen.sh
1 #!/bin/sh
2
3 . ./options
4
5 GEN_ARCH="i586 x86_64"
6 BASEDIR=`pwd`
7 GEN_URL_i586="$BASEDIR/testtrack/full-$tree-i586"
8 GEN_URL_x86_64="$BASEDIR/testtrack/full-$tree-x86_64"
9 TESTTRACK="`pwd`/testtrack"
10
11 echo -n "processing $1"
12
13 if test -f config.sh; then
14   . config.sh
15 fi
16
17 file=$1
18
19 # multiple setups (dvd5, dvd5-2, etc.)
20 base=${file/-*/}
21 base=`basename $base`
22
23 LOCK=
24 LOCK2=
25
26 if test -n "$2"; then
27   GEN_ARCH=$2
28 fi
29
30 ret=0
31
32 prep_patterns()
33 {
34   mkdir -p $TESTTRACK/CD1/suse/setup/descr/
35   grep -v $1 $TESTTRACK/patterns/$base-*.$arch.pat > $TESTTRACK/CD1/suse/setup/descr/$base.$arch.pat
36   pushd $TESTTRACK/CD1/suse/setup/descr/ > /dev/null
37   : > patterns
38   for i in *; do
39     echo -n "META SHA1 ";
40     sha1sum $i | awk '{ORS=""; print $1}';
41     echo -n " "; basename $i;
42     basename $i >> patterns
43   done >> $TESTTRACK/CD1/content
44   popd > /dev/null
45   rm -f $TESTTRACK/CD1/content.asc
46   gpg  --batch -a -b --sign $TESTTRACK/CD1/content
47
48 }
49
50 cp solver-system.xml output/`dirname $file`
51
52 for i in $GEN_ARCH;
53 do
54   arch=$i
55   echo -n " $arch"
56   eval VAR="\$GEN_URL_${i}"
57   sed -e "s,GEN_ARCH,$i," -e "s,GEN_URL,dir://$TESTTRACK/CD1," $file.xml.in > output/$file.$arch.xml
58   includes=`grep -- "-- INCLUDE" $file.xml.in | sed -e "s,.*INCLUDE *,,; s, .*,,"`
59   for include in $includes; do 
60         if test -f output/$include; then
61            finclude=output/$include
62         else
63            finclude=`dirname $file`/$include
64            if test -f output/$finclude; then
65              finclude=output/$finclude
66            fi
67            if test ! -f $finclude; then
68              echo "MISSING: $finclude"
69              exit 1
70            fi
71         fi
72         sed -i -e "/!-- INCLUDE $include -->/r $finclude" output/$file.$arch.xml 
73   done
74   fgrep -v "!$arch" output/$file.$arch.xml > $file.$arch.xml.new && mv $file.$arch.xml.new output/$file.$arch.xml
75
76   rm -rf /tmp/myrepos /var/cache/zypp
77   rm -rf $TESTTRACK/CD1
78   mkdir -p $TESTTRACK/CD1
79   cp -a $TESTTRACK/content.$arch.small $TESTTRACK/CD1/content
80   cp -a $VAR/suse $TESTTRACK/CD1/
81   cp -a $VAR/media.1 $TESTTRACK/CD1/
82   
83   prep_patterns patterns-openSUSE-
84
85   export ZYPP_LIBSOLV_FULLLOG=1
86   export ZYPP_FULLLOG=1
87   export ZYPP_MODALIAS_SYSFS=/tmp
88   /usr/lib/zypp/testsuite/bin/deptestomatic.multi output/$file.$arch.xml 2> output/$file.$arch.error > output/$file.$arch.output
89   sed -n -e '1,/Other Valid Solution/p' output/$file.$arch.output | grep -v 'install pattern:' | grep -v 'install product:' | grep "> install.*\[tmp\]"  |\
90       sed -e 's,>!> install \(.*\)-[^-]*-[^-]*$,\1,' > output/$file.$arch.list.new
91   if test -s "output/$file.$arch.list.new"; then
92      mv "output/$file.$arch.list.new" "output/$file.$arch.list"
93    
94      # now get the pattern packages too
95      prep_patterns patterns-openSUSE-XX
96      /usr/lib/zypp/testsuite/bin/deptestomatic.multi output/$file.$arch.xml > output/$file-XX.$arch.output 2> /dev/null
97      sed -n -e '1,/Other Valid Solution/p' output/$file-XX.$arch.output | grep "> install patterns-openSUSE.*\[tmp\]"  |\
98       sed -e 's,>!> install \(.*\)-[^-]*-[^-]*$,\1,' >> output/$file.$arch.list
99      LC_ALL=C sort -u -o output/$file.$arch.list output/$file.$arch.list
100   else
101      rm "output/$file.$arch.list.new"
102      grep -C5 Problem: output/$file.$arch.output
103      fgrep "Unknown item" output/$file.$arch.error
104      ret=1
105      echo -n "!"
106   fi
107
108   #rm -rf $TESTTRACK/CD1
109
110   if echo $file | grep -q -- "-default"; then
111      for i in kernel-default powersave suspend OpenOffice_org-icon-themes smartmontools gtk-lang gimp-lang vte-lang icewm-lite yast2-trans-en_US bundle-lang-common-en opensuse-manual_en bundle-lang-kde-en bundle-lang-gnome-en openSUSE-release openSUSE-release-ftp kernel-default-base kernel-default-extra smolt virtualbox-ose-kmp-default ndiswrapper-kmp-default preload-kmp-default tango-icon-theme oxygen-icon-theme mono-core marble-data gnome-packagekit Mesa libqt4-x11 gnome-icon-theme xorg-x11-fonts-core ghostscript gio-branding-upstream grub grub2 grub2-branding-openSUSE; do
112           grep -vx $i output/$file.$arch.list > t && mv t output/$file.$arch.list
113      done
114      grep -v patterns-openSUSE output/$file.$arch.list > t && mv t output/$file.$arch.list
115   fi
116   if test "$file" = "opensuse/x11_cd-initrd"; then
117       grep -vx openSUSE-release-ftp output/$file.$arch.list > t && mv t output/$file.$arch.list
118   fi
119   
120 done
121
122 if test "$ret" = 1; then
123   echo " failed"
124 else
125   echo " done"
126 fi
127
128 rm -rf /tmp/myrepos
129 exit $ret
130