diff options
author | Michael Schröder <mls@suse.de> | 2007-07-23 17:04:54 +0000 |
---|---|---|
committer | Michael Schröder <mls@suse.de> | 2007-07-23 17:04:54 +0000 |
commit | 43e0b04ef36abaeadb4cc10daf0636f198143b71 (patch) | |
tree | 40220d3579ab29b369399833e84e3463c8eb21a3 /Build.pm | |
parent | 36d8c05f9e79137eef6e119ab2cf87603c694614 (diff) | |
download | obs-build-43e0b04ef36abaeadb4cc10daf0636f198143b71.tar.gz obs-build-43e0b04ef36abaeadb4cc10daf0636f198143b71.tar.bz2 obs-build-43e0b04ef36abaeadb4cc10daf0636f198143b71.zip |
- fix dependency substitution for deps with '('
- new config parameter: order, enforce package ordering
- make query function support generic options
- support description queries
Diffstat (limited to 'Build.pm')
-rw-r--r-- | Build.pm | 37 |
1 files changed, 29 insertions, 8 deletions
@@ -130,9 +130,11 @@ sub read_config { $config->{'substitute'} = {}; $config->{'substitute_vers'} = {}; $config->{'optflags'} = {}; + $config->{'order'} = {}; $config->{'rawmacros'} = ''; $config->{'release'} = '<CI_CNT>.<B_CNT>'; $config->{'repotype'} = []; + $config->{'patterntype'} = []; for my $l (@spec) { $l = $l->[1] if ref $l; next unless defined $l; @@ -159,20 +161,26 @@ sub read_config { } elsif ($l0 eq 'substitute:') { next unless @l; $ll = shift @l; - push @{$config->{'substitute'}->{$ll}}, @l; + $config->{'substitute'}->{$ll} = [ @l ]; } elsif ($l0 eq 'optflags:') { next unless @l; $ll = shift @l; $config->{'optflags'}->{$ll} = join(' ', @l); + } elsif ($l0 eq 'order:') { + for (@l) { + $config->{'order'}->{$_} = 1; + } } elsif ($l0 eq 'repotype:') { $config->{'repotype'} = [ @l ]; + } elsif ($l0 eq 'patterntype:') { + $config->{'patterntype'} = [ @l ]; } elsif ($l0 eq 'release:') { $config->{'release'} = $l[0]; } elsif ($l0 !~ /^[#%]/) { warn("unknown keyword in config: $l0\n"); } } - for my $l (qw{preinstall vminstall required support keep runscripts repotype}) { + for my $l (qw{preinstall vminstall required support keep runscripts repotype patterntype}) { $config->{$l} = [ unify(@{$config->{$l}}) ]; } for my $l (keys %{$config->{'substitute'}}) { @@ -565,6 +573,9 @@ sub order { my @q = @{$whatprovides->{$r} || addproviders($config, $r)}; push @r, grep {$_ ne $p && $p{$_}} @q; } + if (%{$config->{'order'} || {}}) { + push @r, grep {$_ ne $p && $config->{'order'}->{"$_:$p"}} @p; + } @r = unify(@r); $deps{$p} = \@r; $needed{$p} = @r; @@ -621,11 +632,21 @@ sub order { } unshift @todo, $cycv; print STDERR "cycle: ".join(' -> ', @cyc)."\n"; - my $breakv = (sort {$needed{$a} <=> $needed{$b} || $a cmp $b} @cyc)[-1]; - push @cyc, $cyc[0]; + my $breakv; + my @breakv = (@cyc, $cyc[0]); + while (@breakv > 1) { + last if $config->{'order'}->{"$breakv[0]:$breakv[1]"}; + shift @breakv; + } + if (@breakv > 1) { + $breakv = $breakv[0]; + } else { + $breakv = (sort {$needed{$a} <=> $needed{$b} || $a cmp $b} @cyc)[-1]; + } + push @cyc, $cyc[0]; # make it loop shift @cyc while $cyc[0] ne $breakv; $v = $cyc[1]; - print STDERR " breaking with $breakv -> $v\n"; + print STDERR " breaking dependency $breakv -> $v\n"; $deps{$breakv} = [ grep {$_ ne $v} @{$deps{$breakv}} ]; $rdeps{$v} = [ grep {$_ ne $breakv} @{$rdeps{$v}} ]; $needed{$breakv}--; @@ -659,14 +680,14 @@ sub parse { } sub query { - my ($binname, $withevra, $withfilelist) = @_; + my ($binname, %opts) = @_; my $handle = $binname; if (ref($binname) eq 'ARRAY') { $handle = $binname->[1]; $binname = $binname->[0]; } - return Build::Rpm::query($handle, $withevra, $withfilelist) if $do_rpm && $binname =~ /\.rpm$/; - return Build::Deb::query($handle, $withevra, $withfilelist) if $do_deb && $binname =~ /\.deb$/; + return Build::Rpm::query($handle, %opts) if $do_rpm && $binname =~ /\.rpm$/; + return Build::Deb::query($handle, %opts) if $do_deb && $binname =~ /\.deb$/; return undef; } |