Hello community, here is the log from the commit of package installation-images for openSUSE:Factory checked in at 2013-08-13 13:04:24 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/installation-images (Old) and /work/SRC/openSUSE:Factory/.installation-images.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "installation-images" Changes: -------- --- /work/SRC/openSUSE:Factory/installation-images/installation-images.changes 2013-08-07 15:58:50.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.installation-images.new/installation-images.changes 2013-08-13 13:04:25.000000000 +0200 @@ -1,0 +2,12 @@ +Mon Aug 12 15:47:36 CEST 2013 - snw...@suse.de + +- convert base image to automatic dependency solving + +------------------------------------------------------------------- +Fri Aug 9 16:03:44 CEST 2013 - snw...@suse.de + +- support automatic dependency solving +- add templates +- fix elsif + +------------------------------------------------------------------- Old: ---- installation-images-14.6.tar.bz2 New: ---- installation-images-14.8.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ installation-images.spec ++++++ --- /var/tmp/diff_new_pack.UGwfvr/_old 2013-08-13 13:04:26.000000000 +0200 +++ /var/tmp/diff_new_pack.UGwfvr/_new 2013-08-13 13:04:26.000000000 +0200 @@ -61,10 +61,12 @@ BuildRequires: dmapi BuildRequires: dmraid BuildRequires: dosfstools +BuildRequires: dummy-release BuildRequires: dump BuildRequires: e2fsprogs BuildRequires: ed BuildRequires: efont-unicode-bitmap-fonts +BuildRequires: elfutils BuildRequires: espeak BuildRequires: ethtool BuildRequires: fbiterm @@ -152,8 +154,11 @@ BuildRequires: perl-XML-Simple BuildRequires: suse-module-tools BuildRequires: systemd +BuildRequires: systemd-presets-branding-basedonopensuse +BuildRequires: tunctl BuildRequires: udev BuildRequires: yast2-ruby-bindings +BuildRequires: zypper %if %with_plymouth BuildRequires: libkms1 BuildRequires: plymouth @@ -371,9 +376,9 @@ Summary: Installation Image Files License: GPL-2.0+ Group: Metapackages -Version: 14.6 +Version: 14.8 Release: 0 -Source: installation-images-14.6.tar.bz2 +Source: installation-images-14.8.tar.bz2 BuildRoot: %{_tmppath}/%{name}-%{version}-build %define _binary_payload w.ufdio ++++++ installation-images-14.6.tar.bz2 -> installation-images-14.8.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/installation-images-14.6/Makefile new/installation-images-14.8/Makefile --- old/installation-images-14.6/Makefile 2013-08-06 16:26:21.000000000 +0200 +++ new/installation-images-14.8/Makefile 2013-08-12 13:09:24.000000000 +0200 @@ -48,7 +48,7 @@ export ARCH THEMES DESTDIR INSTSYS_PARTS BOOT_PARTS WITH_FLOPPY -.PHONY: all dirs base biostest initrd \ +.PHONY: all dirs base fbase biostest initrd \ boot boot-efi root rescue root+rescue gdb bind clean \ boot-themes initrd-themes root-themes install \ install-initrd mini-iso-rmlist debuginfo cd1 @@ -73,6 +73,9 @@ base: dirs @[ -d tmp/base ] || nostrip=1 libdeps=base image=base fs=none bin/mk_image +fbase: dirs + nostrip=1 libdeps=base image=base fs=none bin/mk_image + biostest: base libdeps=initrd,biostest image=biostest src=initrd fs=cpio.gz disjunct=initrd bin/mk_image diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/installation-images-14.6/README new/installation-images-14.8/README --- old/installation-images-14.6/README 2013-08-06 16:25:58.000000000 +0200 +++ new/installation-images-14.8/README 2013-08-09 16:06:04.000000000 +0200 @@ -278,3 +278,37 @@ X <src> <dst> + +Extensions: + + - You can specify templates that are applied to groups of packages + automatically unless there is already some other valid entry for that + package. E.g. + + TEMPLATE rubygem-.*: + /usr/*/ruby/gems/*/gems/*/lib + /usr/*/ruby/gems/*/specifications + + The argument after TEMPLATE is a perl regexp matched agaist package names. If + the regexp is empty the TEMPLATE matches _every_ package. This can be used + to formulate a default action for packages. E.g. + + TEMPLATE: + / + + - You can resolve dependencies and add the missing packages with the + AUTODEPS placeholder. The solver is run only if there is an AUTODEPS entry + somewhere. + Note: if you don't specify any actions in AUTODEPS, templates are appied to + each individual package. E.g. + + AUTODEPS: + + - Listing scripts after the colon (':') is now optional. + + - You can add tags (comma-separated) after the colon. The following tags + are supported: + - requires: create a file <package_name>.requires in the image root + - nodeps: ignore package dependencies when solving + - ignore: ignore package ('BuildIgnore') + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/installation-images-14.6/VERSION new/installation-images-14.8/VERSION --- old/installation-images-14.6/VERSION 2013-08-07 15:57:42.000000000 +0200 +++ new/installation-images-14.8/VERSION 2013-08-12 15:47:32.000000000 +0200 @@ -1 +1 @@ -14.6 +14.8 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/installation-images-14.6/bin/mk_image new/installation-images-14.8/bin/mk_image --- old/installation-images-14.6/bin/mk_image 2013-08-06 16:26:21.000000000 +0200 +++ new/installation-images-14.8/bin/mk_image 2013-08-09 16:06:04.000000000 +0200 @@ -75,7 +75,9 @@ die "$Script: failed to setup image"; if(-f "$tmpdir.rpmlog") { + SUSystem "chmod 777 $tmpdir"; SUSystem "perl -pe 's/\\[(.*?)\\].*/\$1/' $tmpdir.rpmlog | sort -u >$tmpdir/.packages.$fl"; + SUSystem "chmod 755 $tmpdir"; } # print "fix locale...\n"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/installation-images-14.6/changelog new/installation-images-14.8/changelog --- old/installation-images-14.6/changelog 2013-08-07 15:57:44.000000000 +0200 +++ new/installation-images-14.8/changelog 2013-08-12 15:47:35.000000000 +0200 @@ -1,3 +1,11 @@ +2013-08-12: HEAD + - convert base image to automatic dependency solving + +2013-08-09: 14.7 + - support automatic dependency solving + - add templates + - fix elsif + 2013-08-07: 14.6 - add ruby gems in a working way - reenable yast2-nfs-client diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/installation-images-14.6/data/base/base.file_list new/installation-images-14.8/data/base/base.file_list --- old/installation-images-14.6/data/base/base.file_list 2013-08-06 16:26:21.000000000 +0200 +++ new/installation-images-14.8/data/base/base.file_list 2013-08-12 15:43:36.000000000 +0200 @@ -1,3 +1,4 @@ +# some basic directories d bin dev etc lib mnt proc sbin tmp var c 1777 0 0 tmp @@ -33,423 +34,95 @@ b 7 7 /dev/loop7 c 660 0 6 /dev/loop7 -libdbus-1-*: +TEMPLATE: / -libtirpc*: - / - -libgssglue*: - / - -libmount*: - / - -filesystem: - / - -fillup: - / - -grep: - / - -make: - / - -sed: - / - -tar: - / - -bash: - / - -libreadline6: - / - -libgmp*: +AUTODEPS: / +ca-certificates-mozilla: coreutils: - / - -libselinux1: - / - -libexpat1: - / - -libacl*: - / - -libattr*: - / - -libpcre*: - / - -findutils: - / - +cpio: +cracklib-dict-full: +cracklib: +cyrus-sasl: +device-mapper: diffutils: - / - -libgcc_s*: - / - -libstdc++*: - / - -glibc: - /etc/ld.so.conf - /{lib*,sbin} -r /lib*/libdb.so.* -r /lib*/lib{BrokenLocale.so.1,NoVersion.so.1,SegFault.so} - /usr/{lib*,{,s}bin} -r /usr/bin/{db*,glibcbug,rpcgen} - -module-init-tools: - / - -suse-module-tools: - / - -libprocps*: - / - -procps: - /bin/ps - /usr/bin/{free,top,vmstat} - -psmisc: - m /bin/fuser /usr/bin - /usr/bin/killall - /usr/bin/pstree - -procinfo: - /usr/bin/socklist - - -rpm: - /bin - /usr/bin - /{usr,var}/lib/rpm - /usr/lib*/librpm*.so.* -r /usr/lib/rpm/rpm{get,put}text -r /usr/bin/rpmqpack - -libmagic*: - / - +dummy-release: +elfutils: file-magic: - / - file: - / - -libpopt*: - / - -libelf*: - / - -liblua5_1: - / - -libncurses5: - / - -terminfo-base: - /usr/share/terminfo/d/dumb - /usr/share/terminfo/l - /usr/share/terminfo/v/vt10[02] - -libz*: - / - -if arch eq 'i386' || arch eq 'x86_64' - syslinux: - /usr/bin - /usr/share/syslinux - - gfxboot: - /usr/sbin/gfxboot - -endif - -libfreetype*: - / - -libpng*-*: - / - -libXfont*: - / - -mkfontscale: - / - -mkfontdir: - / - -libfontenc*: - / - +filesystem: +fillup: +findutils: fontconfig: - /etc/fonts/fonts.conf - /usr/lib*/libfontconfig.so.* - /usr/bin/fc-cache - -gawk: - / - -liblcms*: - / - -libmng*: - / - -libjpeg*: - / - -perl-base: - /usr/{bin,lib} - -perl: - /usr/{bin,lib} - -perl-HTML-Parser: - /usr/lib - -insserv-compat: - / - -aaa_base: prein,postin -e prein - /etc -r /etc/{csh*,default*,mailcap,mime.types,permissions*} -r /etc/{rc.d.README,runlevel.fallback,zshrc,cron.daily} - /sbin - /usr/sbin -r /etc/init.d/rc?.d/*kerneld -r /etc/init.d/rc?.d/*cron -r /etc/init.d/rc?.d/*pcnfsd -r /etc/init.d/rc?.d/*routed -r /etc/init.d/rc?.d/*nfs -r /etc/init.d/rc?.d/*xdm - /usr/bin -r /usr/bin/ChangeSymlinks - /var/adm/fillup-templates - - # /root/.gnupg/suse_build_key -e postin -r /var/adm/fillup-templates -t /etc/fstab - -libdb-*: - / - -libgdbm*: - / - -gzip: - / - -libbz2-*: - / - -cpio: - / - +fribidi: +gettext-runtime-mini: +?gfxboot: nodeps glibc-i18ndata: - / - glibc-locale: - / - -libustr-*-*: - / - -libsepol*: - / - -libsemanage*: - / - -shadow: - / - -pam: - / - -libaudit*: - / - -libldap-*-*: - / - -libopenssl*: - / - -cyrus-sasl: - / - -libkeyutils*: - / - -libcom_err*: - / - +grep: +gzip: +insserv-compat: krb5: - / - -libnscd*: - / - +make: +mkfontdir: +mkfontscale: +module-init-tools: openslp: - / - -libcrack*: - / - -cracklib: - / - +openssl: +p11-kit-tools: +p11-kit: +pam: +perl-HTML-Parser: +perl: +procinfo: +procps: +psmisc: +rpm: +sed: +shadow: +squashfs: strace: - / - +suse-module-tools: +?syslinux: +systemd-presets-branding-basedonopensuse: +systemd: +tar: +terminfo-base: util-linux: - /usr/bin/mount - /usr/bin/umount - -libblkid*: - / - -libuuid*: - / - -fribidi: - /usr/bin/fribidi - /usr/lib*/libfribidi.so.* - -liblzma*: - / - -libcap*: - / - -liblzo*-*: - / - -squashfs: - /usr/bin/mksquashfs - -yast2-trans-allpacks: requires - x mk_yast2_trans bin/mk_yast2_trans - E mk_yast2_trans yast2-trans-allpacks.requires - -libfuse*: - / - -libudev*: - / - -device-mapper: - / - -gettext-runtime-mini: - / - -openssl: - / ca-certificates: /usr/sbin/update-ca-certificates /usr/lib/ca-certificates/update.d/openssl.run /var/lib/ca-certificates/openssl -ca-certificates-mozilla: - / - -systemd: - / - -libcryptsetup*: - / +aaa_base: + E prein + E postin + t etc/fstab -libgcrypt*: - / - -libgpg-error*: - / - -libkmod*: - / - -libqrencode*: - / - -libwrap*: - / - -libgnutls*: - / - -libtasn*-*: - / - -libgnutls*: - / - -libhogweed*: - / - -libnettle*: - / - -libp11-kit*: - / - -p11-kit: - / - -p11-kit-tools: - / - -libffi*: - / +yast2-trans-allpacks: requires,nodeps + x mk_yast2_trans bin/mk_yast2_trans + E mk_yast2_trans yast2-trans-allpacks.requires : # remove things we don't need r /usr/share/doc /usr/share/info /usr/share/man /var/adm/fillup-templates -# x ../../src/gkv/gkv bin -# E gkv /tmp/linux >tmp/kernel_version - +# add our own scripts x save_cfg bin/save_cfg x restore_cfg bin/restore_cfg x unused_mos bin/unused_mos x mlist3 bin/mlist3 -# run depmod -#E /sbin/depmod -a -F /System.map <kernel_ver> || true -#E cp /lib/modules/<kernel_ver>/modules.dep / -#E cp /lib/modules/<kernel_ver>/modules.pcimap / -#r /lib/modules - # create locale x create_locale /create_locale E /create_locale -# make empty dict -E touch /tmp/xxx -E create-cracklib-dict /tmp/xxx -E rm -f /tmp/xxx - -# +# show certificates E update-ca-certificates -f E ls -lR /var/lib/ca-certificates E ls -lR /etc/ssl + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/installation-images-14.6/lib/AddFiles.pm new/installation-images-14.8/lib/AddFiles.pm --- old/installation-images-14.6/lib/AddFiles.pm 2013-08-06 16:26:21.000000000 +0200 +++ new/installation-images-14.8/lib/AddFiles.pm 2013-08-12 15:04:00.000000000 +0200 @@ -5,7 +5,7 @@ # use AddFiles; # # exported functions: -# AddFiles(dir, file_list, ext_dir, tag); +# AddFiles(dir, file_list, ext_dir); =head1 AddFiles @@ -16,7 +16,7 @@ =item * -C<AddFiles(dir, file_list, ext_dir, tag)> +C<AddFiles(dir, file_list, ext_dir)> =back @@ -30,7 +30,7 @@ =item * -C<AddFiles(dir, file_list, ext_dir, tag)> +C<AddFiles(dir, file_list, ext_dir)> C<AddFiles> extracts the files in C<file_list> and puts them into C<dir>. Files that are not to be taken from rpms are copied from C<ext_dir>. @@ -55,64 +55,55 @@ use strict 'vars'; use integer; +use Data::Dumper; +$Data::Dumper::Sortkeys = 1; +$Data::Dumper::Terse = 1; +$Data::Dumper::Indent = 1; + use ReadConfig; +sub add_pack; +sub _add_pack; +sub find_missing_packs; sub fixup_re; +my $ignore; +my $src_line; +my $templates; + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - sub AddFiles { local $_; - my ($dir, $file_list, $ext_dir, $arch, $if_val, $if_taken, $tag); - my ($rpms, $tdir, $tfile, $p, $r, $rc, $d, $u, $g, $files); - my ($mod_list, @mod_list, %mod_list); - my ($inc_file, $inc_it, $debug, $ifmsg, $ignore); - my ($old_warn, $ver, $i); - my (@scripts, $s, @s, %script); - my (@packs, $sl, $rpm_dir, $rpm_file); - my (@plog, $current_pack, %acc_all_files, %acc_pack_files, $account); - my ($su, @requires); - - $su = "$SUBinary -q 0 " if $SUBinary; - - my $account_size = sub - { - my ($dir, $s, @f); - local $_; - - return if !defined($current_pack) || !$account; - - $dir = shift; - - @f = `${su}find $dir -type f`; - - chomp @f; - - for (@f) { - $acc_pack_files{$current_pack}{$_} = 1 unless exists $acc_all_files{$_}; - $acc_all_files{$_} = 1; - } - }; - ($dir, $file_list, $ext_dir, $tag, $mod_list) = @_; + my ($dir, $file_list, $ext_dir, $arch, $if_val, $if_taken); + my ($inc_file, $inc_it, $debug, $ifmsg, $old_warn); + my ($rpm_dir, $rpm_file); + my ($current_pack); + + my $su = "$SUBinary -q 0 " if $SUBinary; + + ($dir, $file_list, $ext_dir) = @_; $debug = "pkg"; $debug = $ENV{'debug'} if exists $ENV{'debug'}; $ignore = $debug =~ /\bignore\b/ ? 1 : 0; - $account = $debug =~ /\baccount\b/ ? 1 : 0; - $old_warn = $SIG{'__WARN__'}; $SIG{'__WARN__'} = sub { - my $a = shift; + my $x = shift; return if $ignore >= 10; - $a =~ s/<F>/$file_list/; - $a =~ s/<I>/$inc_file/; - if($ignore) { warn $a } else { die $a } + if($src_line ne '') { + $x =~ s/\.\n$//; + $x .= " in $src_line.\n"; + } + + if($ignore) { warn $x } else { die $x } }; $debug .= ',pkg'; @@ -121,8 +112,6 @@ die "$Script: failed to create $dir ($!)" unless mkdir $dir, 0755; } - $tfile = "${TmpBase}.afile"; - # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # now we really start... @@ -131,14 +120,23 @@ $arch = $ConfigData{arch}; $ENV{'___arch'} = $arch; - $tag = "" unless defined $tag; - $if_val = $if_taken = 0; $current_pack = ''; + my $packs; + + # always has at least one element + push @$packs, { name => "" }; + + my $template_cnt = 0; + while(1) { $_ = $inc_it ? <I> : <F>; + + $src_line = $inc_it ? "$inc_file" : "$file_list"; + $src_line .= " line $."; + if(!defined($_)) { if($inc_it) { undef $inc_it; @@ -160,7 +158,7 @@ s/<rpm_file>/$rpm_file/g; s/<(kernel_ver|kernel_mods|kernel_rpm|kernel_img|(suse|sles|sled)_release|theme|splash_theme|yast_theme|product|product_name|update_dir|load_image|min_memory|instsys_build_id|instsys_complain|instsys_complain_root|arch|lib)>/$ConfigData{$1}/g; - for $i (qw( linuxrc lang extramod items )) { + for my $i (qw( linuxrc lang extramod items )) { s/<$i>/$ENV{$i}/g if exists $ENV{$i}; } @@ -195,7 +193,7 @@ die "$Script: syntax error in 'if' statement" unless defined $i; if($eif) { $if_val &= ~1; - $i = 0 if $i == 0 && ($if_taken & 1) == 0; + $i = 1 if $i == 0 && ($if_taken & 1) == 1; } else { $if_val <<= 1; @@ -213,46 +211,72 @@ print "*$ifmsg" if $debug =~ /\bif\b/; - undef $p; - undef $s; - if(/^include\s+(\S+)$/) { die "$Script: recursive include not supported" if $inc_it; $inc_file = $1; die "$Script: no such file list: $inc_file" unless open I, "$ext_dir/$inc_file"; $inc_it = 1; } - elsif((/^(\S*):\s*(\S+)?\s*$/ && ($p = $1, $s = $2, 1)) || !defined($current_pack)) { - undef %script; - undef @scripts; - undef @requires; + elsif( + (/^((\S*)|TEMPLATE([^:]*)):\s*(\S+)?\s*$/ && (my $t = $3, my $p = $2, my $s = $4, 1)) || + !defined($current_pack) + ) { + undef $current_pack; - $account_size->($dir); + if(defined $t) { + $p = ''; + } + elsif($p eq 'TEMPLATE') { + $p = ''; + $t = ''; + } - undef $current_pack; + if(defined $t) { + $t =~ s/^\s*|\s*$//g; + $t = ".*" if $t eq ""; + } + + my $auto_deps = 0; + if($p eq 'AUTODEPS') { + $p = ''; + $auto_deps = 1; + } if($p =~ s/^\?// && !RealRPM($p)) { print "skipping package $p\n"; next; } + next unless defined $p; + + push @$packs, { name => '' }; + if(defined $s) { - @scripts = split /,/, $s; + my @tags = split /,/, $s; + + @tags = grep { /^(requires|nodeps|ignore)$/ } @tags; - @requires = grep { $_ eq 'requires' } @scripts; - @scripts = grep { $_ ne 'requires' } @scripts; + @{$packs->[-1]{tags}}{@tags} = (); } - next unless defined $p; + if(defined $t) { + # is template, not real package + $packs->[-1]{template} = $t; + $packs->[-1]{template_index} = ++$template_cnt; + + print "adding template #$template_cnt >$t<\n"; + } + + if($auto_deps) { + # also not real package + $packs->[-1]{autodeps} = 1; + } if($p eq '') { $current_pack = ''; next; } - undef $rc; - undef $r; - $rpm_dir = ReadRPM $p; next unless $rpm_dir; @@ -261,41 +285,217 @@ $rpm_file =~ s#(/[^/]+)$#/.rpms$1.rpm#; $current_pack = RealRPM($p)->{name}; + $packs->[-1]{name} = $current_pack; - $ver = ReadFile "$rpm_dir/version"; - $ver = "[$ver]"; + my $ver = ReadFile "$rpm_dir/version"; + $packs->[-1]{version} = $ver; - push @plog, "$current_pack $ver\n"; + $ver = "[$ver]"; $_ = ReadFile "$rpm_dir/scripts"; - $ver .= " {$_}" if $_; - - print "adding package $current_pack $ver\n" if $debug =~ /\bpkg\b/; - - push @packs, "$current_pack\n"; - - for $s (@scripts) { - $_ = ReadFile "$rpm_dir/$s"; - if(!$_) { - warn "$Script: no \"$s\" script in $current_pack"; - } - else { - print " got \"$s\" script\n" if $debug =~ /\bscripts\b/; - $script{$s} = $_; - } + if($_ ne "") { + $ver .= " {$_}"; + $packs->[-1]{all_scripts} = $_; + my @scripts = split /,/; + @{$packs->[-1]{scripts}}{@scripts} = (); } - if(@requires) { + print "we " . (exists $packs->[-1]{tags}{ignore} ? "ignore" : "need") . " package $current_pack $ver\n"; + + if(exists $packs->[-1]{tags}{requires}) { $_ = ReadFile "$rpm_dir/requires"; open R, ">$dir/$p.requires"; print R $_; close R; } - $tdir = "$rpm_dir/rpm"; + $packs->[-1]{rpmdir} = $rpm_dir; + } + else { + push @{$packs->[-1]{tasks}}, { src => $src_line, line => $_ }; + } + } + + close F; + + # strip off templates + $templates = [ grep { defined $_->{template} } @$packs ]; + $packs = [ grep { ! defined $_->{template} } @$packs ]; + + # print Dumper $packs; + # print Dumper $templates; + + # apply templates + for my $t (@$templates) { + for my $p (@$packs) { + next if defined $p->{tasks}; + next if $p->{name} eq ''; # don't apply to empty names + if($p->{name} =~ /^($t->{template})$/) { + $p->{tasks} = $t->{tasks}; + for my $tag (keys %{$t->{tags}}) { + $p->{tags}{$tag} = $t->{tags}{$tag}; + } + $p->{from_template} = $t->{template_index}; + } + } + } + + # print Dumper $packs; + + my $auto_deps = (grep { $_->{autodeps} } @$packs)[0]; + + if(defined $auto_deps) { + $auto_deps->{packages} = find_missing_packs $packs; + + open my $f, ">${dir}.autodeps"; + for (sort keys %{$auto_deps->{packages}}) { + print $f "$_ ($auto_deps->{packages}{$_})\n"; } - elsif(!/^[a-zA-Z]\s+/ && /^(.*)$/) { - $files = $1; + close $f; + + + } + + # print Dumper $packs; + + # we're done parsing; now really add packages + for (@$packs) { + add_pack $dir, $ext_dir, $_; + } + + my $tfile = "${TmpBase}.afile"; + SUSystem "rm -f $tfile"; + + open F, ">${dir}.rpms"; + for (@$packs) { + print F "$_->{name}\n" if $_->{name} ne ''; + } + close F; + + open F, ">${dir}.rpmlog"; + for (@$packs) { + print F "$_->{name} [$_->{version}]\n" if $_->{name} ne ''; + } + close F; + + $SIG{'__WARN__'} = $old_warn; + + return 1; +} + + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +sub add_pack +{ + local $_; + my $dir = shift; + my $ext_dir = shift; + my $pack = shift; + + return if exists $pack->{tags}{ignore}; + + if(!defined $pack->{packages}) { + _add_pack $dir, $ext_dir, $pack; + return; + } + + my $packages = $pack->{packages}; + + for my $p (sort keys %$packages) { + my $new_pack = {}; + + $new_pack->{tasks} = $pack->{tasks} if defined $pack->{tasks}; + + for my $tag (keys %{$pack->{tags}}) { + $new_pack->{tags}{$tag} = $pack->{tags}{$tag}; + } + + my $rpm_dir = ReadRPM $p; + + next unless $rpm_dir; + + my $rpm_file = $rpm_dir; + $rpm_file =~ s#(/[^/]+)$#/.rpms$1.rpm#; + + $new_pack->{name} = RealRPM($p)->{name}; + + $new_pack->{version} = ReadFile "$rpm_dir/version"; + + $new_pack->{all_scripts} = ReadFile "$rpm_dir/scripts"; + my @scripts = split /,/, $new_pack->{all_scripts}; + @{$new_pack->{scripts}}{@scripts} = (); + + if(exists $pack->{tags}{requires}) { + $_ = ReadFile "$rpm_dir/requires"; + open R, ">$dir/$p.requires"; + print R $_; + close R; + } + + $new_pack->{rpmdir} = $rpm_dir; + + $new_pack->{needed_by} = $packages->{$p}; + + # print "new = ", Dumper($new_pack); + + # apply templates + if(!defined $new_pack->{tasks}) { + for my $t (@$templates) { + if($new_pack->{name} =~ /^($t->{template})$/) { + $new_pack->{tasks} = $t->{tasks}; + for my $tag (keys %{$t->{tags}}) { + $new_pack->{tags}{$tag} = $t->{tags}{$tag}; + } + $new_pack->{from_template} = $t->{template_index}; + last; + } + } + } + + # print "pack $p = ", Dumper($new_pack); + + _add_pack $dir, $ext_dir, $new_pack; + } +} + + +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +sub _add_pack +{ + local $_; + my $dir = shift; + my $ext_dir = shift; + my $pack = shift; + + return if exists $pack->{tags}{ignore}; + + return if !defined $pack->{tasks}; + + my $tfile = "${TmpBase}.afile"; + + my $tdir = "$pack->{rpmdir}/rpm"; + + my $all_scripts = $pack->{all_scripts}; + $all_scripts = " {$all_scripts}" if $all_scripts ne ""; + + my $t = ""; + $t = " using template #$pack->{from_template}" if defined $pack->{from_template}; + + my $by = ""; + $by = " needed by $pack->{needed_by}" if defined $pack->{needed_by}; + + print "adding package $pack->{name} [$pack->{version}]$all_scripts$by$t\n" if $pack->{name} ne ''; + + for my $t (@{$pack->{tasks}}) { + $_ = $t->{line}; + $src_line = $t->{src}; + + if(!/^[a-zA-Z]\s+/) { + if($pack->{rpmdir} eq "") { + warn "$Script: no package dir"; + next; + } + my $files = $_; $files =~ s.(^|\s)/.$1.g; $files = "." if $files =~ /^\s*$/; SUSystem "sh -c '( cd $tdir; tar --sparse -cf - $files 2>$tfile ) | tar -C $dir -xpf -'" and @@ -310,22 +510,22 @@ } } elsif(/^d\s+(.+)$/) { - $d = $1; $d =~ s.(^|\s)/.$1.g; + my $d = $1; $d =~ s.(^|\s)/.$1.g; SUSystem "sh -c 'cd $dir; mkdir -p $d'" and warn "$Script: failed to create $d"; } elsif(/^t\s+(.+)$/) { - $d = $1; $d =~ s.(^|\s)/.$1.g; + my $d = $1; $d =~ s.(^|\s)/.$1.g; SUSystem "sh -c 'cd $dir; touch $d'" and warn "$Script: failed to touch $d"; } elsif(/^r\s+(.+)$/) { - $d = $1; $d =~ s.(^|\s)/.$1.g; + my $d = $1; $d =~ s.(^|\s)/.$1.g; SUSystem "sh -c 'cd $dir; rm -rf $d'" and warn "$Script: failed to remove $d"; } elsif(/^S\s+(.+)$/) { - $d = $1; $d =~ s.(^|\s)/.$1.g; + my $d = $1; $d =~ s.(^|\s)/.$1.g; SUSystem "sh -c 'cd $dir; strip $d'" and warn "$Script: failed to strip $d"; } @@ -378,7 +578,7 @@ else { for $l (@l) { SUSystem "sh -c '( cd $start_dir; tar -cf - $l 2>$tfile ) | tar -C $dir -xpf -'" and - warn "$Script: failed to copy $files"; + warn "$Script: failed to copy files"; my (@f, $f); @f = `cat $tfile`; @@ -411,8 +611,8 @@ warn "$Script: could not uncompress $1 to $2"; } elsif(/^c\s+(\d+)\s+(\S+)\s+(\S+)\s+(.+)$/) { - $p = $1; $u = $2; $g = $3; - $d = $4; $d =~ s.(^|\s)/.$1.g; + my $p = $1; my $u = $2; my $g = $3; + my $d = $4; $d =~ s.(^|\s)/.$1.g; SUSystem "sh -c 'cd $dir; chown $u:$g $d'" and warn "$Script: failto to change owner of $d to $u:$g"; SUSystem "sh -c 'cd $dir; chmod $p $d'" and @@ -430,39 +630,6 @@ SUSystem "mknod $dir/$1 p" and warn "$Script: failto to make named pipe $1"; } -=head1 - elsif(/^M\s+(\S+)\s+(\S+)$/) { - SUSystem "sh -c \"cp -av $tdir/$1 $dir/$2\" >$tfile" and - print "$Script: $1 not copied to $2 (ignored)\n"; - - my ($f, $g); - for $f (`cat $tfile`) { - if($f =~ /\s->\s$dir\/(.*)\n?$/) { - $g = $1; $g =~ s/^\/*//; - push @mod_list, "$g\n" unless exists $mod_list{$g}; - $mod_list{$g} = 1; - } - elsif($f =~ /\s->\s\`$dir\/(.*)\'\n?$/) { - $g = $1; $g =~ s/^\/*//; - push @mod_list, "$g\n" unless exists $mod_list{$g}; - $mod_list{$g} = 1; - } - } - } -=cut - elsif(/^M\s+(.*)$/) { - my ($ml, @ml); - - $ml = $1; - @ml = split ' ', $ml; - if($ml !~ m#/#) { - @ml = map { $_ = "modules/$_.o\n" } @ml; - } - else { - @ml = map { $_ .= "\n" } @ml; - } - push @mod_list, @ml - } elsif(/^([eE])\s+(.+)$/) { my ($cmd, $xdir, $basedir, $r, $e, $pm, $is_script); @@ -471,7 +638,7 @@ $xdir = $dir; $xdir =~ s#/*$##; $basedir = $1 if $xdir =~ s#(.*)/##; - $is_script = exists $script{$cmd}; + $is_script = exists $pack->{scripts}{$cmd}; $pm = $is_script ? "$cmd script" : "\"$cmd\""; die "internal oops" unless $basedir ne "" && $xdir ne ""; @@ -479,14 +646,13 @@ if($is_script) { SUSystem "sh -c 'mkdir $dir/install && chmod 777 $dir/install'" and die "$Script: failed to create $dir/install"; - die "$Script: unable to create $pm" unless open W, ">$dir/install/inst.sh"; - print W $script{$cmd}; - close W; + system "cp $pack->{rpmdir}/$cmd $dir/install/inst.sh" and die "$Script: unable to create $pm"; $e = 'E' if $xdir eq 'base'; } - print "running $pm\n" if $debug =~ /\bpkg\b/; + print "running $pm\n"; + if($e eq 'e') { SUSystem "mv $dir $basedir/base/xxxx" and die "oops"; if($is_script) { @@ -551,54 +717,38 @@ die "$Script: unknown entry: \"$_\"\n"; } } +} - close F; - - $account_size->($dir); - - SUSystem "rm -f $tfile"; - - open F, ">${dir}.rpms"; - print F @packs; - close F; - open F, ">${dir}.rpmlog"; - print F @plog; - close F; +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +sub find_missing_packs +{ + my $packs = shift; - if(%acc_pack_files) { - open F, ">${dir}.size"; - for $p (sort keys %acc_pack_files) { - # print "$p:\n"; - my $size = 0; - my $s = 0; - for (keys %{$acc_pack_files{$p}}) { - $size += (split ' ', `${su}du -bsk $_ 2>/dev/null`)[0]; - # print "$_: $size\n"; - } - printf F "%-24s %s\n", $p eq '' ? 'no package' : $p, $size; - } - close F; + my $nodeps; + my $ignore; + my $all; + + print "resolving package dependencies...\n"; + + for (@$packs) { + next if $_->{name} eq ''; + $all->{$_->{name}} = 1; + $nodeps->{$_->{name}} = 1 if exists $_->{tags}{nodeps}; + $ignore->{$_->{name}} = 1 if exists $_->{tags}{ignore}; } - if($ENV{'nomods'}) { - for (split /,/, $ENV{'nomods'}) { - push @mod_list, "modules/$_.o\n" - } - } + delete $all->{$_} for (keys %$nodeps, keys %$ignore); - if(@mod_list && $mod_list) { - open F, ">$mod_list"; - print F @mod_list; - close F; - } + my $r = ResolveDeps [ keys %$all ], [ keys %$ignore ]; - $SIG{'__WARN__'} = $old_warn; + print Dumper($r); - return 1; + return $r; } +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - sub fixup_re { local ($_); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/installation-images-14.6/lib/ReadConfig.pm new/installation-images-14.8/lib/ReadConfig.pm --- old/installation-images-14.6/lib/ReadConfig.pm 2013-08-06 16:26:21.000000000 +0200 +++ new/installation-images-14.8/lib/ReadConfig.pm 2013-08-09 16:06:04.000000000 +0200 @@ -166,6 +166,7 @@ @EXPORT = qw ( $Script $BasePath $LibPath $BinPath $CfgPath $ImagePath $DataPath $TmpBase %ConfigData ReadFile RealRPM ReadRPM $SUBinary SUSystem Print2File $MToolsCfg $AutoBuild + ResolveDeps ); use strict 'vars'; @@ -182,6 +183,8 @@ sub get_repo_list; sub read_meta; sub read_packages; +sub resolve_deps_obs; +sub resolve_deps_zypper; sub DebugInfo @@ -205,6 +208,26 @@ } +sub ResolveDeps +{ + local $_; + my $packages = shift; + my $ignore = shift; + + my $p; + + if($ConfigData{obs}) { + $p = resolve_deps_obs $packages, $ignore; + } + else { + die "oops, no zypper" unless $ConfigData{zypper_ok}; + $p = resolve_deps_zypper $packages, $ignore; + } + + return $p; +} + + sub ReadFile { my ($f, $buf); @@ -610,6 +633,85 @@ } +sub resolve_deps_obs +{ + local $_; + my $packages = shift; + my $ignore = shift; + + my $prj = $ConfigData{obs_proj}; + my $repo = $ConfigData{obs_repo}; + + my $t = "$ConfigData{tmp_cache_dir}/.tmp_deps"; + + open my $f, ">$t"; + print $f "#!BuildIgnore: simple_expansion_hack\nName: foo\n"; + print $f "BuildRequires: $_\n" for (@$packages); + print $f "#!BuildIgnore: $_\n" for (@$ignore); + close $f; + + my %p; + my @err; + my %added; + + open $f, "curl -s -T $t -X POST '$ConfigData{obs_server}/build/$prj/$repo/$ConfigData{obs_arch}/_repository/_buildinfo?debug=1' |"; + while(<$f>) { + print $_ if $ENV{debug} =~ /solv/; + $added{$1} = $2 if /^added (\S+) because of (\S+?)(:|$)/; + $p{$1} = "" if /<bdep\s+name=\"([^"]+)\"/; + push @err, $1 if /<error>([^<]+)</; + } + close $f; + + unlink $t; + + delete $p{$_} for (@$packages); + + warn "$Script: $_\n" for (@err); + + $p{$_} = $added{$_} for (keys %p); + + return \%p; +} + + +my $zypper = "zypper --verbose --no-abbrev --non-interactive --disable-system-resolvables install --dry-run --no-recommends --repo instsys -- "; + +sub resolve_deps_zypper +{ + local $_; + my $packages = shift; + my $ignore = shift; + + # FIXME: what about $ignore? + + my %p; + + my $t = "$ConfigData{tmp_cache_dir}/.tmp_zypp"; + + my $cmd = $zypper . join(' ', @$packages) . " 2>&1 >$t"; + + if(system $cmd) { + print ReadFile($t); + warn "$Script: zypper failed"; + return \%p; + } + + open my $f, $t; + while(<$f>) { + chomp; + if((/The following NEW packages are going to be installed/ ... $_ eq "") && /^(\S+)\s*$/) { + $p{$1} = ""; + } + } + close $t; + + delete $p{$_} for (@$packages, @$ignore); + + return \%p; +} + + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # # initialization part @@ -830,6 +932,15 @@ die "No rpm files found (looking for \"$dist\")!\n" unless -d $rpmdir; $ConfigData{suse_base} = $AutoBuild = $rpmdir; + + # if available, setup zypp repo + if(-d "/etc/zypp/repos.d") { + print STDERR "setting up zypp repo...\n"; + if(!-f "/etc/zypp/repos.d/instsys.repo") { + system "zypper addrepo -c dir:$rpmdir instsys && zypper refresh instsys" and die "zypper failed"; + } + $ConfigData{zypper_ok} = 1; + } } elsif($ENV{work} || $ENV{dist}) { my ($work, $base, $xdist); -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org