- fix whitespace (revert large part of e7cba6)
authorMichael Schroeder <mls@suse.de>
Tue, 8 Dec 2009 16:51:32 +0000 (17:51 +0100)
committerMichael Schroeder <mls@suse.de>
Tue, 8 Dec 2009 16:51:32 +0000 (17:51 +0100)
17 files changed:
Build.pm
Build/Deb.pm
Build/Kiwi.pm
Build/Rpm.pm
Build/Susetags.pm
build
changelog2spec
common_functions
computeblocklists
createrepomddeps
createrpmdeps
debtransform
extractbuild
init_buildsystem
mkbaselibs
substitutedeps
unrpm

index 03be827..99ce6bb 100644 (file)
--- a/Build.pm
+++ b/Build.pm
@@ -158,32 +158,32 @@ sub read_config {
     if ($l0 eq 'macros:') {
       $l =~ s/.*?\n//s;
       if ($l =~ /^!\n/s) {
-        $config->{'rawmacros'} = substr($l, 2);
+       $config->{'rawmacros'} = substr($l, 2);
       } else {
-        $config->{'rawmacros'} .= $l;
+       $config->{'rawmacros'} .= $l;
       }
       next;
     }
     if ($l0 eq 'preinstall:' || $l0 eq 'vminstall:' || $l0 eq 'required:' || $l0 eq 'support:' || $l0 eq 'keep:' || $l0 eq 'prefer:' || $l0 eq 'ignore:' || $l0 eq 'conflict:' || $l0 eq 'runscripts:') {
       my $t = substr($l0, 0, -1);
       for my $l (@l) {
-        if ($l eq '!*') {
-          $config->{$t} = [];
-        } elsif ($l =~ /^!/) {
-          $config->{$t} = [ grep {"!$_" ne $l} @{$config->{$t}} ];
-        } else {
-          push @{$config->{$t}}, $l;
-        }
+       if ($l eq '!*') {
+         $config->{$t} = [];
+       } elsif ($l =~ /^!/) {
+         $config->{$t} = [ grep {"!$_" ne $l} @{$config->{$t}} ];
+       } else {
+         push @{$config->{$t}}, $l;
+       }
       }
     } elsif ($l0 eq 'substitute:') {
       next unless @l;
       $ll = shift @l;
       if ($ll eq '!*') {
-        $config->{'substitute'} = {};
+       $config->{'substitute'} = {};
       } elsif ($ll =~ /^!(.*)$/) {
-        delete $config->{'substitute'}->{$1};
+       delete $config->{'substitute'}->{$1};
       } else {
-        $config->{'substitute'}->{$ll} = [ @l ];
+       $config->{'substitute'}->{$ll} = [ @l ];
       }
     } elsif ($l0 eq 'exportfilter:') {
       next unless @l;
@@ -197,13 +197,13 @@ sub read_config {
       $config->{'optflags'}->{$ll} = join(' ', @l);
     } elsif ($l0 eq 'order:') {
       for my $l (@l) {
-        if ($l eq '!*') {
-          $config->{'order'} = {};
-        } elsif ($l =~ /^!(.*)$/) {
-          delete $config->{'order'}->{$1};
-        } else {
-          $config->{'order'}->{$l} = 1;
-        }
+       if ($l eq '!*') {
+         $config->{'order'} = {};
+       } elsif ($l =~ /^!(.*)$/) {
+         delete $config->{'order'}->{$1};
+       } else {
+         $config->{'order'}->{$l} = 1;
+       }
       }
     } elsif ($l0 eq 'repotype:') { #type of generated repository data
       $config->{'repotype'} = [ @l ];
@@ -244,15 +244,15 @@ sub read_config {
   if ($config->{'rawmacros'} ne '') {
     for my $rm (split("\n", $config->{'rawmacros'})) {
       if (@macros && $macros[-1] =~ /\\$/) {
-        if ($rm =~ /\\$/) {
-          push @macros, '...\\';
-        } else {
-          push @macros, '...';
-        }
+       if ($rm =~ /\\$/) {
+         push @macros, '...\\';
+       } else {
+         push @macros, '...';
+       }
       } elsif ($rm !~ /^%/) {
-        push @macros, $rm;
+       push @macros, $rm;
       } else {
-        push @macros, "%define ".substr($rm, 1);
+       push @macros, "%define ".substr($rm, 1);
       }
     }
   }
@@ -367,8 +367,8 @@ sub readdeps {
   for my $depfile (@depfiles) {
     if (ref($depfile) eq 'HASH') {
       for my $rr (keys %$depfile) {
-        $provides{$rr} = $depfile->{$rr}->{'provides'};
-        $requires{$rr} = $depfile->{$rr}->{'requires'};
+       $provides{$rr} = $depfile->{$rr}->{'provides'};
+       $requires{$rr} = $depfile->{$rr}->{'requires'};
       }
       next;
     }
@@ -379,48 +379,48 @@ sub readdeps {
       my $s = shift @s;
       my @ss;
       while (@s) {
-        if ($s[0] =~ /^\//) {
-          shift @s;
-          next;
-        }
-        if ($s[0] =~ /^rpmlib\(/) {
-            splice(@s, 0, 3);
-            next;
-        }
-        push @ss, shift @s;
-        while (@s) {
-          if ($s[0] =~ /^[\(<=>|]/) {
-            $ss[-1] .= " $s[0] $s[1]";
-            $ss[-1] =~ s/\((.*)\)/$1/;
-            $ss[-1] =~ s/(<|>){2}/$1/;
-            splice(@s, 0, 2);
-          } else {
-            last;
-          }
-        }
+       if ($s[0] =~ /^\//) {
+         shift @s;
+         next;
+       }
+       if ($s[0] =~ /^rpmlib\(/) {
+           splice(@s, 0, 3);
+           next;
+       }
+       push @ss, shift @s;
+       while (@s) {
+         if ($s[0] =~ /^[\(<=>|]/) {
+           $ss[-1] .= " $s[0] $s[1]";
+           $ss[-1] =~ s/\((.*)\)/$1/;
+           $ss[-1] =~ s/(<|>){2}/$1/;
+           splice(@s, 0, 2);
+         } else {
+           last;
+         }
+       }
       }
       my %ss;
       @ss = grep {!$ss{$_}++} @ss;
       if ($s =~ /^(P|R):(.*)\.(.*)-\d+\/\d+\/\d+:$/) {
-        my $pkgid = $2;
-        my $arch = $3;
-        if ($1 eq "R") {
-          $requires{$pkgid} = \@ss;
-          $pkginfo->{$pkgid}->{'requires'} = \@ss if $pkginfo;
-          next;
-        }
-        # handle provides
-        $provides{$pkgid} = \@ss;
-        if ($pkginfo) {
-          # extract ver and rel from self provides
-          my ($v, $r) = map { /\Q$pkgid\E = ([^-]+)(?:-(.+))?$/ } @ss;
-          die("$pkgid: no self provides\n") unless $v;
-          $pkginfo->{$pkgid}->{'name'} = $pkgid;
-          $pkginfo->{$pkgid}->{'version'} = $v;
-          $pkginfo->{$pkgid}->{'release'} = $r if defined($r);
-          $pkginfo->{$pkgid}->{'arch'} = $arch;
-          $pkginfo->{$pkgid}->{'provides'} = \@ss;
-        }
+       my $pkgid = $2;
+       my $arch = $3;
+       if ($1 eq "R") {
+         $requires{$pkgid} = \@ss;
+         $pkginfo->{$pkgid}->{'requires'} = \@ss if $pkginfo;
+         next;
+       }
+       # handle provides
+       $provides{$pkgid} = \@ss;
+       if ($pkginfo) {
+         # extract ver and rel from self provides
+         my ($v, $r) = map { /\Q$pkgid\E = ([^-]+)(?:-(.+))?$/ } @ss;
+         die("$pkgid: no self provides\n") unless $v;
+         $pkginfo->{$pkgid}->{'name'} = $pkgid;
+         $pkginfo->{$pkgid}->{'version'} = $v;
+         $pkginfo->{$pkgid}->{'release'} = $r if defined($r);
+         $pkginfo->{$pkgid}->{'arch'} = $arch;
+         $pkginfo->{$pkgid}->{'provides'} = \@ss;
+       }
       }
     }
     close F;
@@ -480,37 +480,37 @@ sub addproviders {
   for my $rp (@rp) {
     for my $pp (@{$provides->{$rp} || []}) {
       if ($pp eq $rn) {
-        # debian: unversioned provides do not match
-        # kiwi: supports only rpm, so we need to hand it like it
-        next if $config->{'type'} eq 'dsc';
-        push @p, $rp;
-        last;
+       # debian: unversioned provides do not match
+       # kiwi: supports only rpm, so we need to hand it like it
+       next if $config->{'type'} eq 'dsc';
+       push @p, $rp;
+       last;
       }
       next unless $pp =~ /^\Q$rn\E\s*([<=>]{1,2})\s*(.*?)$/;
       my $pv = $2;
       my $pf = $addproviders_fm{$1};
       next unless $pf;
       if ($pf & $rf & 5) {
-        push @p, $rp;
-        last;
+       push @p, $rp;
+       last;
       }
       if ($pv eq $rv) {
-        next unless $pf & $rf & 2;
-        push @p, $rp;
-        last;
+       next unless $pf & $rf & 2;
+       push @p, $rp;
+       last;
       }
       my $rr = $rf == 2 ? $pf : ($rf ^ 5);
       $rr &= 5 unless $pf & 2;
       # verscmp for spec and kiwi types
       my $vv;
       if ($config->{'type'} eq 'dsc') {
-        $vv = Build::Deb::verscmp($pv, $rv, 1);
+       $vv = Build::Deb::verscmp($pv, $rv, 1);
       } else {
-        $vv = Build::Rpm::verscmp($pv, $rv, 1);
+       $vv = Build::Rpm::verscmp($pv, $rv, 1);
       }
       if ($rr & (1 << ($vv + 1))) {
-        push @p, $rp;
-        last;
+       push @p, $rp;
+       last;
       }
     }
   }
@@ -561,64 +561,64 @@ sub expand {
     my @rerror = ();
     for my $p (splice @p) {
       for my $r (@{$requires->{$p} || [$p]}) {
-        my $ri = (split(/[ <=>]/, $r, 2))[0];
-        next if $ignore->{"$p:$ri"} || $xignore{"$p:$ri"};
-        next if $ignore->{$ri} || $xignore{$ri};
-        my @q = @{$whatprovides->{$r} || addproviders($config, $r)};
-        next if grep {$p{$_}} @q;
-        next if grep {$xignore{$_}} @q;
-        next if grep {$ignore->{"$p:$_"} || $xignore{"$p:$_"}} @q;
-        @q = grep {!$aconflicts{$_}} @q;
-        if (!@q) {
-          if ($r eq $p) {
-            push @rerror, "nothing provides $r";
-          } else {
-            push @rerror, "nothing provides $r needed by $p";
-          }
-          next;
-        }
-        if (@q > 1 && !$doamb) {
-          push @pamb, $p unless @pamb && $pamb[-1] eq $p;
-          print "undecided about $p:$r: @q\n" if $expand_dbg;
-          next;
-        }
-        if (@q > 1) {
-          my @pq = grep {!$prefer->{"-$_"} && !$prefer->{"-$p:$_"}} @q;
-          @q = @pq if @pq;
-          @pq = grep {$prefer->{$_} || $prefer->{"$p:$_"}} @q;
-          if (@pq > 1) {
-            my %pq = map {$_ => 1} @pq;
-            @q = (grep {$pq{$_}} @{$config->{'prefer'}})[0];
-          } elsif (@pq == 1) {
-            @q = @pq;
-          }
-        }
-        if (@q > 1 && $r =~ /\|/) {
-            # choice op, implicit prefer of first match...
-            my %pq = map {$_ => 1} @q;
-            for my $rr (split(/\s*\|\s*/, $r)) {
-                next unless $whatprovides->{$rr};
-                my @pq = grep {$pq{$_}} @{$whatprovides->{$rr}};
-                next unless @pq;
-                @q = @pq;
-                last;
-            }
-        }
-        if (@q > 1) {
-          if ($r ne $p) {
-            push @error, "have choice for $r needed by $p: @q";
-          } else {
-            push @error, "have choice for $r: @q";
-          }
-          push @pamb, $p unless @pamb && $pamb[-1] eq $p;
-          next;
-        }
-        push @p, $q[0];
-        print "added $q[0] because of $p:$r\n" if $expand_dbg;
-        $p{$q[0]} = 1;
-        $aconflicts{$_} = 1 for @{$conflicts->{$q[0]} || []};
-        @error = ();
-        $doamb = 0;
+       my $ri = (split(/[ <=>]/, $r, 2))[0];
+       next if $ignore->{"$p:$ri"} || $xignore{"$p:$ri"};
+       next if $ignore->{$ri} || $xignore{$ri};
+       my @q = @{$whatprovides->{$r} || addproviders($config, $r)};
+       next if grep {$p{$_}} @q;
+       next if grep {$xignore{$_}} @q;
+       next if grep {$ignore->{"$p:$_"} || $xignore{"$p:$_"}} @q;
+       @q = grep {!$aconflicts{$_}} @q;
+       if (!@q) {
+         if ($r eq $p) {
+           push @rerror, "nothing provides $r";
+         } else {
+           push @rerror, "nothing provides $r needed by $p";
+         }
+         next;
+       }
+       if (@q > 1 && !$doamb) {
+         push @pamb, $p unless @pamb && $pamb[-1] eq $p;
+         print "undecided about $p:$r: @q\n" if $expand_dbg;
+         next;
+       }
+       if (@q > 1) {
+         my @pq = grep {!$prefer->{"-$_"} && !$prefer->{"-$p:$_"}} @q;
+         @q = @pq if @pq;
+         @pq = grep {$prefer->{$_} || $prefer->{"$p:$_"}} @q;
+         if (@pq > 1) {
+           my %pq = map {$_ => 1} @pq;
+           @q = (grep {$pq{$_}} @{$config->{'prefer'}})[0];
+         } elsif (@pq == 1) {
+           @q = @pq;
+         }
+       }
+       if (@q > 1 && $r =~ /\|/) {
+           # choice op, implicit prefer of first match...
+           my %pq = map {$_ => 1} @q;
+           for my $rr (split(/\s*\|\s*/, $r)) {
+               next unless $whatprovides->{$rr};
+               my @pq = grep {$pq{$_}} @{$whatprovides->{$rr}};
+               next unless @pq;
+               @q = @pq;
+               last;
+           }
+       }
+       if (@q > 1) {
+         if ($r ne $p) {
+           push @error, "have choice for $r needed by $p: @q";
+         } else {
+           push @error, "have choice for $r: @q";
+         }
+         push @pamb, $p unless @pamb && $pamb[-1] eq $p;
+         next;
+       }
+       push @p, $q[0];
+       print "added $q[0] because of $p:$r\n" if $expand_dbg;
+       $p{$q[0]} = 1;
+       $aconflicts{$_} = 1 for @{$conflicts->{$q[0]} || []};
+       @error = ();
+       $doamb = 0;
       }
     }
     return undef, @rerror if @rerror;
@@ -670,7 +670,7 @@ sub order {
       @p = grep {$needed{$_}} @p;
       push @res, @good;
       for my $p (@good) {
-        $needed{$_}-- for @{$rdeps{$p}};
+       $needed{$_}-- for @{$rdeps{$p}};
       }
       next;
     }
@@ -681,46 +681,46 @@ sub order {
     while (@todo) {
       my $v = shift @todo;
       if (ref($v)) {
-        $notdone{$$v} = 0;      # finished this one
-        next;
+       $notdone{$$v} = 0;      # finished this one
+       next;
       }
       my $s = $notdone{$v};
       next unless $s;
       my @e = grep {$notdone{$_}} @{$deps{$v}};
       if (!@e) {
-        $notdone{$v} = 0;       # all deps done, mark as finished
-        next;
+       $notdone{$v} = 0;       # all deps done, mark as finished
+       next;
       }
       if ($s == 1) {
-        $notdone{$v} = 2;       # now under investigation
-        unshift @todo, @e, \$v;
-        next;
+       $notdone{$v} = 2;       # now under investigation
+       unshift @todo, @e, \$v;
+       next;
       }
       # reached visited package, found a cycle!
       my @cyc = ();
       my $cycv = $v;
       # go back till $v is reached again
       while(1) {
-        die unless @todo;
-        $v = shift @todo;
-        next unless ref($v);
-        $v = $$v;
-        $notdone{$v} = 1 if $notdone{$v} == 2;
-        unshift @cyc, $v;
-        last if $v eq $cycv;
+       die unless @todo;
+       $v = shift @todo;
+       next unless ref($v);
+       $v = $$v;
+       $notdone{$v} = 1 if $notdone{$v} == 2;
+       unshift @cyc, $v;
+       last if $v eq $cycv;
       }
       unshift @todo, $cycv;
       print STDERR "cycle: ".join(' -> ', @cyc)."\n";
       my $breakv;
       my @breakv = (@cyc, $cyc[0]);
       while (@breakv > 1) {
-        last if $config->{'order'}->{"$breakv[0]:$breakv[1]"};
-        shift @breakv;
+       last if $config->{'order'}->{"$breakv[0]:$breakv[1]"};
+       shift @breakv;
       }
       if (@breakv > 1) {
-        $breakv = $breakv[0];
+       $breakv = $breakv[0];
       } else {
-        $breakv = (sort {$needed{$a} <=> $needed{$b} || $a cmp $b} @cyc)[-1];
+       $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;
index b44541a..88cd440 100644 (file)
@@ -62,32 +62,32 @@ sub parse {
     } elsif ($tag eq 'BUILD-DEPENDS' || $tag eq 'BUILD-CONFLICTS' || $tag eq 'BUILD-IGNORE' || $tag eq 'BUILD-DEPENDS-INDEP') {
       my @d = split(/,\s*/, $data);
       for my $d (@d) {
-        if ($d =~ /^(.*?)\s*\[(.*)\]$/) {
-          $d = $1;
-          my $isneg = 0;
-          my $bad;
-          for my $q (split('[\s,]', $2)) {
-            $isneg = 1 if $q =~ s/^\!//;
-            $bad = 1 if !defined($bad) && !$isneg;
-            if ($isneg) {
-              if ($q eq $arch || $q eq "$os-$arch") {
-                $bad = 1;
-                last;
-              }
-            } elsif ($q eq $arch || $q eq "$os-$arch") {
-              $bad = 0;
-            }
-          }
-          next if $bad;
-        }
-        $d =~ s/ \(([^\)]*)\)/ $1/g;
-        $d =~ s/>>/>/g;
-        $d =~ s/<</</g;
-        if ($tag eq 'BUILD-DEPENDS' || $tag eq 'BUILD-DEPENDS-INDEP') {
-          push @deps, $d;
-        } else {
-          push @deps, "-$d";
-        }
+       if ($d =~ /^(.*?)\s*\[(.*)\]$/) {
+         $d = $1;
+         my $isneg = 0;
+         my $bad;
+         for my $q (split('[\s,]', $2)) {
+           $isneg = 1 if $q =~ s/^\!//;
+           $bad = 1 if !defined($bad) && !$isneg;
+           if ($isneg) {
+             if ($q eq $arch || $q eq "$os-$arch") {
+               $bad = 1;
+               last;
+             }
+           } elsif ($q eq $arch || $q eq "$os-$arch") {
+             $bad = 0;
+           }
+         }
+         next if $bad;
+       }
+       $d =~ s/ \(([^\)]*)\)/ $1/g;
+       $d =~ s/>>/>/g;
+       $d =~ s/<</</g;
+       if ($tag eq 'BUILD-DEPENDS' || $tag eq 'BUILD-DEPENDS-INDEP') {
+         push @deps, $d;
+       } else {
+         push @deps, "-$d";
+       }
       }
     }
   }
index 81f3802..c0fbea7 100644 (file)
@@ -56,12 +56,12 @@ sub parsexml {
       my $n = {};
       push @{$node->{$tag}}, $n;
       for (sort keys %atts) {
-        $n->{$_} = $atts{$_};
+       $n->{$_} = $atts{$_};
       }
       if ($mode == 0) {
-        push @nodestack, [ $tag, $node, $c ];
-        $c = '';
-        $node = $n;
+       push @nodestack, [ $tag, $node, $c ];
+       $c = '';
+       $node = $n;
       }
     } else {
       die("element '$tag' closes without open\n") unless @nodestack;
@@ -117,17 +117,17 @@ sub kiwiparse {
     push @packages, "kiwi-filesystem:$type->{'filesystem'}" if $type->{'filesystem'};
     if (defined $type->{'boot'}) {
       if ($type->{'boot'} =~ /^obs:\/\/\/?([^\/]+)\/([^\/]+)\/?$/) {
-        next unless $bootcallback;
-        my ($bootxml, $xsrc) = $bootcallback->($1, $2);
-        next unless $bootxml;
-        push @extrasources, $xsrc if $xsrc;
-        my $bret = kiwiparse($bootxml, $arch, $count);
-        push @bootrepos, map {"$_->{'project'}/$_->{'repository'}"} @{$bret->{'path'} || []};
-        push @packages, @{$bret->{'deps'} || []};
-        push @extrasources, @{$bret->{'extrasource'} || []};
+       next unless $bootcallback;
+       my ($bootxml, $xsrc) = $bootcallback->($1, $2);
+       next unless $bootxml;
+       push @extrasources, $xsrc if $xsrc;
+       my $bret = kiwiparse($bootxml, $arch, $count);
+       push @bootrepos, map {"$_->{'project'}/$_->{'repository'}"} @{$bret->{'path'} || []};
+       push @packages, @{$bret->{'deps'} || []};
+       push @extrasources, @{$bret->{'extrasource'} || []};
       } else {
-        die("bad boot reference: $type->{'boot'}\n") unless $type->{'boot'} =~ /^([^\/]+)\/([^\/]+)$/;
-        push @packages, "kiwi-boot:$1";
+       die("bad boot reference: $type->{'boot'}\n") unless $type->{'boot'} =~ /^([^\/]+)\/([^\/]+)$/;
+       push @packages, "kiwi-boot:$1";
       }
     }
   }
@@ -141,24 +141,24 @@ sub kiwiparse {
     }
     for my $repopackages (@{$instsource->{'repopackages'} || []}) {
       for my $repopackage (@{$repopackages->{'repopackage'} || []}) {
-        push @packages, $repopackage->{'name'};
+       push @packages, $repopackage->{'name'};
       }
     }
     if ($instsource->{'metadata'}) {
       for my $repopackage (@{$instsource->{'metadata'}->[0]->{'repopackage'} || []}) {
-        push @packages, $repopackage->{'name'};
+       push @packages, $repopackage->{'name'};
       }
     }
     if ($instsource->{'productoptions'}) {
       my $productoptions = $instsource->{'productoptions'}->[0] || {};
       for my $po (@{$productoptions->{'productvar'} || []}) {
-        $ret->{'version'} = $po->{'_content'} if $po->{'name'} eq 'VERSION';
+       $ret->{'version'} = $po->{'_content'} if $po->{'name'} eq 'VERSION';
       }
     }
     if ($instsource->{'architectures'}) {
       my $a = $instsource->{'architectures'}->[0] || {};
       for my $ra (@{$a->{'requiredarch'} || []}) {
-        push @requiredarch, $ra->{'ref'} if defined($ra->{'ref'});
+       push @requiredarch, $ra->{'ref'} if defined($ra->{'ref'});
       }
     }
   }
@@ -181,11 +181,11 @@ sub kiwiparse {
   for my $packagegroup (@{$kiwi->{'packages'} || []}) {
     for my $package (@{$packagegroup->{'package'} || []}) {
       if ($package->{'arch'}) {
-        my $ma = $arch;
-        $ma =~ s/i[456]86/i386/;
-        my $pa = $package->{'arch'};
-        $pa =~ s/i[456]86/i386/;
-        next if $ma ne $pa;
+       my $ma = $arch;
+       $ma =~ s/i[456]86/i386/;
+       my $pa = $package->{'arch'};
+       $pa =~ s/i[456]86/i386/;
+       next if $ma ne $pa;
       }
       push @packages, $package->{'name'};
     }
index 04b5247..1f3bc56 100644 (file)
@@ -154,10 +154,10 @@ sub parse {
       $line = shift @$specdata;
       ++$lineno;
       if (ref $line) {
-        $line = $line->[0]; # verbatim line
-        push @$xspec, $line if $xspec;
-        $xspec->[-1] = [ $line, undef ] if $xspec && $skip;
-        next;
+       $line = $line->[0]; # verbatim line
+       push @$xspec, $line if $xspec;
+       $xspec->[-1] = [ $line, undef ] if $xspec && $skip;
+       next;
       }
     } else {
       $inspec = 1;
@@ -169,8 +169,8 @@ sub parse {
     push @$xspec, $line if $inspec && $xspec;
     if ($line =~ /^#\s*neededforbuild\s*(\S.*)$/) {
       if (defined $hasnfb) {
-        $xspec->[-1] = [ $xspec->[-1], undef ] if $inspec && $xspec;
-        next;
+       $xspec->[-1] = [ $xspec->[-1], undef ] if $inspec && $xspec;
+       next;
       }
       $hasnfb = $1;
       $nfbline = \$xspec->[-1] if $inspec && $xspec;
@@ -183,77 +183,77 @@ sub parse {
     if (!$skip) {
       my $tries = 0;
       while ($line =~ /^(.*?)%(\{([^\}]+)\}|[\?\!]*[0-9a-zA-Z_]+|%|\()(.*?)$/) {
-        if ($tries++ > 1000) {
-          print STDERR "Warning: spec file parser ",($lineno?" line $lineno":''),": macro too deeply nested\n" if $config->{'warnings'};
-          $line = 'MACRO';
-          last;
-        }
-        $expandedline .= $1;
-        $line = $4;
-        my $macname = defined($3) ? $3 : $2;
-        my $macorig = $2;
-        my $mactest = 0;
-        if ($macname =~ /^\!\?/ || $macname =~ /^\?\!/) {
-          $mactest = -1;
-        } elsif ($macname =~ /^\?/) {
-          $mactest = 1;
-        }
-        $macname =~ s/^[\!\?]+//;
-        $macname =~ s/^([^:\s]*)\s.*/$1/;
-        my $macalt;
-        ($macname, $macalt) = split(':', $macname, 2);
-        if ($macname eq '%') {
-          $expandedline .= '%';
-          next;
-        } elsif ($macname eq '(') {
-          print STDERR "Warning: spec file parser",($lineno?" line $lineno":''),": can't expand %(...)\n" if $config->{'warnings'};
-          $line = 'MACRO';
-          last;
-        } elsif ($macname eq 'define' || $macname eq 'global') {
-          if ($line =~ /^\s*([0-9a-zA-Z_]+)(\([^\)]*\))?\s*(.*?)$/) {
-            my $macname = $1;
-            my $macargs = $2;
-            my $macbody = $3;
-            $macbody = undef if $macargs;
-            $macros{$macname} = $macbody;
-          }
-          $line = '';
-          last;
-        } elsif ($macname eq 'defined' || $macname eq 'with' || $macname eq 'undefined' || $macname eq 'without' || $macname eq 'bcond_with' || $macname eq 'bcond_without') {
-          my @args;
-          if ($macorig =~ /^\{(.*)\}$/) {
-            @args = split(' ', $1);
-            shift @args;
-          } else {
-            @args = split(' ', $line);
-            $line = '';
-          }
-          next unless @args;
-          if ($macname eq 'bcond_with') {
-            $macros{"with_$args[0]"} = 1 if exists $macros{"_with_$args[0]"};
-            next;
-          }
-          if ($macname eq 'bcond_without') {
-            $macros{"with_$args[0]"} = 1 unless exists $macros{"_without_$args[0]"};
-            next;
-          }
-          $args[0] = "with_$args[0]" if $macname eq 'with' || $macname eq 'without';
-          $line = ((exists($macros{$args[0]}) ? 1 : 0) ^ ($macname eq 'undefined' || $macname eq 'without' ? 1 : 0)).$line;
-        } elsif (exists($macros{$macname})) {
-          if (!defined($macros{$macname})) {
-            print STDERR "Warning: spec file parser",($lineno?" line $lineno":''),": can't expand '$macname'\n" if $config->{'warnings'};
-            $line = 'MACRO';
-            last;
-          }
-          $macalt = $macros{$macname} unless defined $macalt;
-          $macalt = '' if $mactest == -1;
-          $line = "$macalt$line";
-        } elsif ($mactest) {
-          $macalt = '' if !defined($macalt) || $mactest == 1;
-          $line = "$macalt$line";
-        } else {
-          $expandedline .= "%$macorig";
-        }
+       if ($tries++ > 1000) {
+         print STDERR "Warning: spec file parser ",($lineno?" line $lineno":''),": macro too deeply nested\n" if $config->{'warnings'};
+         $line = 'MACRO';
+         last;
+       }
+       $expandedline .= $1;
+       $line = $4;
+       my $macname = defined($3) ? $3 : $2;
+       my $macorig = $2;
+       my $mactest = 0;
+       if ($macname =~ /^\!\?/ || $macname =~ /^\?\!/) {
+         $mactest = -1;
+       } elsif ($macname =~ /^\?/) {
+         $mactest = 1;
+       }
+       $macname =~ s/^[\!\?]+//;
+       $macname =~ s/^([^:\s]*)\s.*/$1/;
+       my $macalt;
+       ($macname, $macalt) = split(':', $macname, 2);
+       if ($macname eq '%') {
+         $expandedline .= '%';
+         next;
+       } elsif ($macname eq '(') {
+         print STDERR "Warning: spec file parser",($lineno?" line $lineno":''),": can't expand %(...)\n" if $config->{'warnings'};
+         $line = 'MACRO';
+         last;
+       } elsif ($macname eq 'define' || $macname eq 'global') {
+         if ($line =~ /^\s*([0-9a-zA-Z_]+)(\([^\)]*\))?\s*(.*?)$/) {
+           my $macname = $1;
+           my $macargs = $2;
+           my $macbody = $3;
+           $macbody = undef if $macargs;
+           $macros{$macname} = $macbody;
+         }
+         $line = '';
+         last;
+       } elsif ($macname eq 'defined' || $macname eq 'with' || $macname eq 'undefined' || $macname eq 'without' || $macname eq 'bcond_with' || $macname eq 'bcond_without') {
+         my @args;
+         if ($macorig =~ /^\{(.*)\}$/) {
+           @args = split(' ', $1);
+           shift @args;
+         } else {
+           @args = split(' ', $line);
+           $line = '';
+         }
+         next unless @args;
+         if ($macname eq 'bcond_with') {
+           $macros{"with_$args[0]"} = 1 if exists $macros{"_with_$args[0]"};
+           next;
+         }
+         if ($macname eq 'bcond_without') {
+           $macros{"with_$args[0]"} = 1 unless exists $macros{"_without_$args[0]"};
+           next;
+         }
+         $args[0] = "with_$args[0]" if $macname eq 'with' || $macname eq 'without';
+         $line = ((exists($macros{$args[0]}) ? 1 : 0) ^ ($macname eq 'undefined' || $macname eq 'without' ? 1 : 0)).$line;
+       } elsif (exists($macros{$macname})) {
+         if (!defined($macros{$macname})) {
+           print STDERR "Warning: spec file parser",($lineno?" line $lineno":''),": can't expand '$macname'\n" if $config->{'warnings'};
+           $line = 'MACRO';
+           last;
+         }
+         $macalt = $macros{$macname} unless defined $macalt;
+         $macalt = '' if $mactest == -1;
+         $line = "$macalt$line";
+       } elsif ($mactest) {
+         $macalt = '' if !defined($macalt) || $mactest == 1;
+         $line = "$macalt$line";
+       } else {
+         $expandedline .= "%$macorig";
+       }
       }
     }
     $line = $expandedline . $line;
@@ -311,25 +311,25 @@ sub parse {
     }
     if ($main_preamble) {
       if ($line =~ /^(Name|Version|Disttag|Release)\s*:\s*(\S+)/i) {
-        $ret->{lc $1} = $2;
-        $macros{lc $1} = $2;
+       $ret->{lc $1} = $2;
+       $macros{lc $1} = $2;
       } elsif ($line =~ /^(Source\d*|Patch\d*|Url)\s*:\s*(\S+)/i) {
-        $ret->{lc $1} = $2;
+       $ret->{lc $1} = $2;
       } elsif ($line =~ /^ExclusiveArch\s*:\s*(.*)/i) {
-        $exclarch ||= [];
-        push @$exclarch, split(' ', $1);
+       $exclarch ||= [];
+       push @$exclarch, split(' ', $1);
       } elsif ($line =~ /^ExcludeArch\s*:\s*(.*)/i) {
-        $badarch ||= [];
-        push @$badarch, split(' ', $1);
+       $badarch ||= [];
+       push @$badarch, split(' ', $1);
       }
     }
     if ($line =~ /^(?:Requires\(pre\)|Requires\(post\)|PreReq)\s*:\s*(\S.*)$/i) {
       my $deps = $1;
       my @deps = $deps =~ /([^\s\[,]+)(\s+[<=>]+\s+[^\s\[,]+)?(\s+\[[^\]]+\])?[\s,]*/g;
       while (@deps) {
-        my ($pack, $vers, $qual) = splice(@deps, 0, 3);
-        next if $pack =~ /\//;
-        push @prereqs, $pack unless grep {$_ eq $pack} @prereqs;
+       my ($pack, $vers, $qual) = splice(@deps, 0, 3);
+       next if $pack =~ /\//;
+       push @prereqs, $pack unless grep {$_ eq $pack} @prereqs;
       }
       next;
     }
@@ -341,64 +341,64 @@ sub parse {
       my $replace = 0;
       my @ndeps = ();
       while (@deps) {
-        my ($pack, $vers, $qual) = splice(@deps, 0, 3);
-        if (defined($qual)) {
-          $replace = 1;
-          my $arch = $macros{'_target_cpu'} || '';
-          my $proj = $macros{'_target_project'} || '';
-          $qual =~ s/^\s*\[//;
-          $qual =~ s/\]$//;
-          my $isneg = 0;
-          my $bad;
-          for my $q (split('[\s,]', $qual)) {
-            $isneg = 1 if $q =~ s/^\!//;
-            $bad = 1 if !defined($bad) && !$isneg;
-            if ($isneg) {
-              if ($q eq $arch || $q eq $proj) {
-                $bad = 1;
-                last;
-              }
-            } elsif ($q eq $arch || $q eq $proj) {
-              $bad = 0;
-            }
-          }
-          next if $bad;
-        }
-        $vers = '' unless defined $vers;
-        $vers =~ s/=(>|<)/$1=/;
-        push @ndeps, "$pack$vers";
+       my ($pack, $vers, $qual) = splice(@deps, 0, 3);
+       if (defined($qual)) {
+         $replace = 1;
+         my $arch = $macros{'_target_cpu'} || '';
+         my $proj = $macros{'_target_project'} || '';
+         $qual =~ s/^\s*\[//;
+         $qual =~ s/\]$//;
+         my $isneg = 0;
+         my $bad;
+         for my $q (split('[\s,]', $qual)) {
+           $isneg = 1 if $q =~ s/^\!//;
+           $bad = 1 if !defined($bad) && !$isneg;
+           if ($isneg) {
+             if ($q eq $arch || $q eq $proj) {
+               $bad = 1;
+               last;
+             }
+           } elsif ($q eq $arch || $q eq $proj) {
+             $bad = 0;
+           }
+         }
+         next if $bad;
+       }
+       $vers = '' unless defined $vers;
+       $vers =~ s/=(>|<)/$1=/;
+       push @ndeps, "$pack$vers";
       }
 
       $replace = 1 if grep {/^-/} @ndeps;
       if (lc($what) ne 'buildrequires') {
-        push @packdeps, map {"-$_"} @ndeps;
-        next;
+       push @packdeps, map {"-$_"} @ndeps;
+       next;
       }
       if (defined($hasnfb)) {
-        if ((grep {$_ eq 'glibc' || $_ eq 'rpm' || $_ eq 'gcc' || $_ eq 'bash'} @ndeps) > 2) {
-          # ignore old generated BuildRequire lines.
-          $xspec->[-1] = [ $xspec->[-1], undef ] if $xspec;
-          next;
-        }
+       if ((grep {$_ eq 'glibc' || $_ eq 'rpm' || $_ eq 'gcc' || $_ eq 'bash'} @ndeps) > 2) {
+         # ignore old generated BuildRequire lines.
+         $xspec->[-1] = [ $xspec->[-1], undef ] if $xspec;
+         next;
+       }
       }
       push @packdeps, @ndeps;
       next unless $xspec && $inspec;
       if ($replace) {
-        my @cndeps = grep {!/^-/} @ndeps;
-        if (@cndeps) {
-          $xspec->[-1] = [ $xspec->[-1], "$what:  ".join(' ', @cndeps) ];
-        } else {
-          $xspec->[-1] = [ $xspec->[-1], ''];
-        }
+       my @cndeps = grep {!/^-/} @ndeps;
+       if (@cndeps) {
+         $xspec->[-1] = [ $xspec->[-1], "$what:  ".join(' ', @cndeps) ];
+       } else {
+         $xspec->[-1] = [ $xspec->[-1], ''];
+       }
       }
       next;
     }
 
     if ($line =~ /^\s*%package\s+(-n\s+)?(\S+)/) {
       if ($1) {
-        push @subpacks, $2;
+       push @subpacks, $2;
       } else {
-        push @subpacks, $ret->{'name'}.'-'.$2 if defined $ret->{'name'};
+       push @subpacks, $ret->{'name'}.'-'.$2 if defined $ret->{'name'};
       }
       $preamble = 1;
       $main_preamble = 0;
@@ -571,34 +571,34 @@ sub rpmq {
     $tag = 0+$tag;
     if ($stags{$tag}) {
       eval {
-        my $otag = $stags{$tag};
-        if ($type == 0) {
-          $res{$otag} = [ '' ];
-        } elsif ($type == 1) {
-          $res{$otag} = [ unpack("\@${offset}c$count", $data) ];
-        } elsif ($type == 2) {
-          $res{$otag} = [ unpack("\@${offset}c$count", $data) ];
-        } elsif ($type == 3) {
-          $res{$otag} = [ unpack("\@${offset}n$count", $data) ];
-        } elsif ($type == 4) {
-          $res{$otag} = [ unpack("\@${offset}N$count", $data) ];
-        } elsif ($type == 5) {
-          $res{$otag} = [ undef ];
-        } elsif ($type == 6) {
-          $res{$otag} = [ unpack("\@${offset}Z*", $data) ];
-        } elsif ($type == 7) {
-          $res{$otag} = [ unpack("\@${offset}a$count", $data) ];
-        } elsif ($type == 8 || $type == 9) {
-          my $d = unpack("\@${offset}a*", $data);
-          my @res = split("\0", $d, $count + 1);
-          $res{$otag} = [ splice @res, 0, $count ];
-        } else {
-          $res{$otag} = [ undef ];
-        }
+       my $otag = $stags{$tag};
+       if ($type == 0) {
+         $res{$otag} = [ '' ];
+       } elsif ($type == 1) {
+         $res{$otag} = [ unpack("\@${offset}c$count", $data) ];
+       } elsif ($type == 2) {
+         $res{$otag} = [ unpack("\@${offset}c$count", $data) ];
+       } elsif ($type == 3) {
+         $res{$otag} = [ unpack("\@${offset}n$count", $data) ];
+       } elsif ($type == 4) {
+         $res{$otag} = [ unpack("\@${offset}N$count", $data) ];
+       } elsif ($type == 5) {
+         $res{$otag} = [ undef ];
+       } elsif ($type == 6) {
+         $res{$otag} = [ unpack("\@${offset}Z*", $data) ];
+       } elsif ($type == 7) {
+         $res{$otag} = [ unpack("\@${offset}a$count", $data) ];
+       } elsif ($type == 8 || $type == 9) {
+         my $d = unpack("\@${offset}a*", $data);
+         my @res = split("\0", $d, $count + 1);
+         $res{$otag} = [ splice @res, 0, $count ];
+       } else {
+         $res{$otag} = [ undef ];
+       }
       };
       if ($@) {
-        warn("Bad rpm $rpm: $@\n");
-        return ();
+       warn("Bad rpm $rpm: $@\n");
+       return ();
       }
     }
   }
index 4b82780..98b8a71 100644 (file)
@@ -46,9 +46,9 @@ sub parse {
     my ($multi, $tag, $data) = ($1, $2, $3);
     if ($multi eq '+') {
       while (<F>) {
-        chomp;
-        last if $_ =~ /-$tag/;
-        push @{$cur->{$tmap->{$tag}}}, $_;
+       chomp;
+       last if $_ =~ /-$tag/;
+       push @{$cur->{$tmap->{$tag}}}, $_;
       }
     } elsif ($tag eq 'Pkg') {
       addpkg($pkgs, $cur, $order, $cb, $cbdata, @arches);
diff --git a/build b/build
index 0988b87..8c3cac5 100755 (executable)
--- a/build
+++ b/build
@@ -205,21 +205,21 @@ cleanup_and_exit () {
     trap EXIT
     test -z "$1" && set 0
     if test -n "$RUNNING_IN_VM" ; then
-        cd /
-        if test -n "$VM_SWAP" -a -e "$VM_SWAP" ; then
-            swapoff "$VM_SWAP" 2>/dev/null
-            echo -n "BUILDSTATUS$1" >"$VM_SWAP"
-        fi
-        exec >&0 2>&0        # so that the logging tee finishes
-        sleep 1                # wait till tee terminates
-        kill -9 -1        # goodbye cruel world
-        exec /bin/bash -c 'mount -n -o remount,ro / ; halt -f -p'
-        halt -f -p
+       cd /
+       if test -n "$VM_SWAP" -a -e "$VM_SWAP" ; then
+           swapoff "$VM_SWAP" 2>/dev/null
+           echo -n "BUILDSTATUS$1" >"$VM_SWAP"
+       fi
+       exec >&0 2>&0        # so that the logging tee finishes
+       sleep 1                # wait till tee terminates
+       kill -9 -1        # goodbye cruel world
+       exec /bin/bash -c 'mount -n -o remount,ro / ; halt -f -p'
+       halt -f -p
     else
-        umount -n $BUILD_ROOT/proc 2>/dev/null || true
-        umount -n $BUILD_ROOT/dev/pts 2>/dev/null || true
-        test "$VM_IMAGE" = 1 && VM_IMAGE=
-        [ -n "$VM_IMAGE" ] && umount $BUILD_ROOT 2>/dev/null || true
+       umount -n $BUILD_ROOT/proc 2>/dev/null || true
+       umount -n $BUILD_ROOT/dev/pts 2>/dev/null || true
+       test "$VM_IMAGE" = 1 && VM_IMAGE=
+       [ -n "$VM_IMAGE" ] && umount $BUILD_ROOT 2>/dev/null || true
     fi
     exit $1
 }
@@ -232,11 +232,11 @@ fail_exit()
 shellquote()
 {
     for arg; do
-        arg=${arg/\\/\\\\}
-        arg=${arg/\$/\\\$}
-        arg=${arg/\"/\\\"}
-        arg=${arg/\`/\\\`}
-        echo -n " \"$arg\""
+       arg=${arg/\\/\\\\}
+       arg=${arg/\$/\\\$}
+       arg=${arg/\"/\\\"}
+       arg=${arg/\`/\\\`}
+       echo -n " \"$arg\""
     done
 }
 
@@ -244,58 +244,58 @@ shellquote()
 # through /bin/su -c
 toshellscript()
 {
-        echo "#!/bin/sh -x"
-        echo -n exec
-        shellquote "$@"
-        echo
+       echo "#!/bin/sh -x"
+       echo -n exec
+       shellquote "$@"
+       echo
 }
 
 setupccache()
 {
     if [ "$ccache" = 1 ]; then
-        if mkdir -p $BUILD_ROOT/var/lib/build/ccache/bin; then
-            for i in gcc g++ cc c++; do
+       if mkdir -p $BUILD_ROOT/var/lib/build/ccache/bin; then
+           for i in gcc g++ cc c++; do
 #                ln -sf /usr/bin/ccache $BUILD_ROOT/var/lib/build/ccache/bin/$i
-                rm -f $BUILD_ROOT/var/lib/build/ccache/bin/$i
-                test -e $BUILD_ROOT/usr/bin/$i || continue
-                echo '#! /bin/sh' > $BUILD_ROOT/var/lib/build/ccache/bin/$i
-                echo "test -e /usr/bin/$i || exit 1" >> $BUILD_ROOT/var/lib/build/ccache/bin/$i
-                echo 'export PATH=/opt/icecream/bin:/usr/bin:$PATH' >> $BUILD_ROOT/var/lib/build/ccache/bin/$i
-                echo "ccache $i \"\$@\"" >> $BUILD_ROOT/var/lib/build/ccache/bin/$i
-                chmod 755 $BUILD_ROOT/var/lib/build/ccache/bin/$i
-                echo "Installed ccache wrapper as $BUILD_ROOT/var/lib/build/ccache/bin/$i"
-            done
-        fi
-        mkdir -p "$BUILD_ROOT"/.ccache
-        chroot "$BUILD_ROOT" chown -R "$BUILD_USER" "/.ccache"
-        echo "export CCACHE_DIR=/.ccache" > "$BUILD_ROOT"/etc/profile.d/build_ccache.sh
-        echo 'export PATH=/var/lib/build/ccache/bin:$PATH' >> "$BUILD_ROOT"/etc/profile.d/build_ccache.sh
+               rm -f $BUILD_ROOT/var/lib/build/ccache/bin/$i
+               test -e $BUILD_ROOT/usr/bin/$i || continue
+               echo '#! /bin/sh' > $BUILD_ROOT/var/lib/build/ccache/bin/$i
+               echo "test -e /usr/bin/$i || exit 1" >> $BUILD_ROOT/var/lib/build/ccache/bin/$i
+               echo 'export PATH=/opt/icecream/bin:/usr/bin:$PATH' >> $BUILD_ROOT/var/lib/build/ccache/bin/$i
+               echo "ccache $i \"\$@\"" >> $BUILD_ROOT/var/lib/build/ccache/bin/$i
+               chmod 755 $BUILD_ROOT/var/lib/build/ccache/bin/$i
+               echo "Installed ccache wrapper as $BUILD_ROOT/var/lib/build/ccache/bin/$i"
+           done
+       fi
+       mkdir -p "$BUILD_ROOT"/.ccache
+       chroot "$BUILD_ROOT" chown -R "$BUILD_USER" "/.ccache"
+       echo "export CCACHE_DIR=/.ccache" > "$BUILD_ROOT"/etc/profile.d/build_ccache.sh
+       echo 'export PATH=/var/lib/build/ccache/bin:$PATH' >> "$BUILD_ROOT"/etc/profile.d/build_ccache.sh
     else
-        rm -f "$BUILD_ROOT$builduserhome"/bin/{gcc,g++,cc,c++}
-        rm -f "$BUILD_ROOT"/var/lib/build/ccache/bin/{gcc,g++,cc,c++}
+       rm -f "$BUILD_ROOT$builduserhome"/bin/{gcc,g++,cc,c++}
+       rm -f "$BUILD_ROOT"/var/lib/build/ccache/bin/{gcc,g++,cc,c++}
     fi
 }
 
 setupicecream()
 {
     if [ "$icecream" -eq 0 ]; then
-        rm -rf "$BUILD_ROOT"/var/run/icecream
-        rm -f "$BUILD_ROOT"/etc/profile.d/build_icecream.sh
-        return
+       rm -rf "$BUILD_ROOT"/var/run/icecream
+       rm -f "$BUILD_ROOT"/etc/profile.d/build_icecream.sh
+       return
     fi
 
     if ! chroot "$BUILD_ROOT" rpm -q icecream >/dev/null 2>/dev/null; then
-        echo "*** icecream package not installed ***"
-        false
-        return
+       echo "*** icecream package not installed ***"
+       false
+       return
     fi
 
     echo "using icecream with $icecream jobs"
 
     if [ "$ccache" -ne 1 ]; then
-        echo 'export PATH=/opt/icecream/bin:$PATH' > "$BUILD_ROOT"/etc/profile.d/build_icecream.sh
+       echo 'export PATH=/opt/icecream/bin:$PATH' > "$BUILD_ROOT"/etc/profile.d/build_icecream.sh
     else
-        echo 'export CCACHE_PATH=/opt/icecream/bin' > "$BUILD_ROOT"/etc/profile.d/build_icecream.sh
+       echo 'export CCACHE_PATH=/opt/icecream/bin' > "$BUILD_ROOT"/etc/profile.d/build_icecream.sh
     fi
 
     local icecc_vers=(`shopt -s nullglob; echo $BUILD_ROOT/var/run/icecream/*.tar.{bz2,gz}`)
@@ -304,30 +304,30 @@ setupicecream()
     # XXX use changelog like autobuild does instead?
     # only run create-env if compiler or glibc changed
     if [ -z "$icecc_vers" \
-        -o ! -e "$BUILD_ROOT/$icecc_vers" \
-        -o "$BUILD_ROOT/usr/bin/gcc" -nt "$BUILD_ROOT/$icecc_vers" \
-        -o "$BUILD_ROOT/usr/bin/g++" -nt "$BUILD_ROOT/$icecc_vers" \
-        -o "$BUILD_ROOT/usr/bin/as" -nt "$BUILD_ROOT/$icecc_vers" \
-        -o "$BUILD_ROOT/lib/libc.so.6" -nt "$BUILD_ROOT/$icecc_vers" ]
+       -o ! -e "$BUILD_ROOT/$icecc_vers" \
+       -o "$BUILD_ROOT/usr/bin/gcc" -nt "$BUILD_ROOT/$icecc_vers" \
+       -o "$BUILD_ROOT/usr/bin/g++" -nt "$BUILD_ROOT/$icecc_vers" \
+       -o "$BUILD_ROOT/usr/bin/as" -nt "$BUILD_ROOT/$icecc_vers" \
+       -o "$BUILD_ROOT/lib/libc.so.6" -nt "$BUILD_ROOT/$icecc_vers" ]
     then
-        rm -rf $BUILD_ROOT/var/run/icecream
-        mkdir -p $BUILD_ROOT/var/run/icecream
-        if [ -e "$BUILD_ROOT"/usr/bin/create-env ]; then
-          createenv=/usr/bin/create-env
-        elif [ -e "$BUILD_ROOT"/usr/lib/icecc/icecc-create-env ]; then
-          createenv="/usr/lib/icecc/icecc-create-env /usr/bin/gcc /usr/bin/g++" # XXX
-        elif [ -e "$BUILD_ROOT"/usr/lib64/icecc/icecc-create-env ]; then
-          createenv="/usr/lib64/icecc/icecc-create-env /usr/bin/gcc /usr/bin/g++" # XXX
-        else
-          echo "create-env not found"
-          false
-          return
-        fi
-        chroot $BUILD_ROOT bash -c "cd /var/run/icecream; $createenv" || cleanup_and_exit 1
-        icecc_vers=(`shopt -s nullglob; echo $BUILD_ROOT/var/run/icecream/*.tar.{bz2,gz}`)
-        icecc_vers=${icecc_vers//$BUILD_ROOT/}
+       rm -rf $BUILD_ROOT/var/run/icecream
+       mkdir -p $BUILD_ROOT/var/run/icecream
+       if [ -e "$BUILD_ROOT"/usr/bin/create-env ]; then
+         createenv=/usr/bin/create-env
+       elif [ -e "$BUILD_ROOT"/usr/lib/icecc/icecc-create-env ]; then
+         createenv="/usr/lib/icecc/icecc-create-env /usr/bin/gcc /usr/bin/g++" # XXX
+       elif [ -e "$BUILD_ROOT"/usr/lib64/icecc/icecc-create-env ]; then
+         createenv="/usr/lib64/icecc/icecc-create-env /usr/bin/gcc /usr/bin/g++" # XXX
+       else
+         echo "create-env not found"
+         false
+         return
+       fi
+       chroot $BUILD_ROOT bash -c "cd /var/run/icecream; $createenv" || cleanup_and_exit 1
+       icecc_vers=(`shopt -s nullglob; echo $BUILD_ROOT/var/run/icecream/*.tar.{bz2,gz}`)
+       icecc_vers=${icecc_vers//$BUILD_ROOT/}
     else
-        echo "reusing existing icecream environment $icecc_vers"
+       echo "reusing existing icecream environment $icecc_vers"
     fi
     if [ -n "$icecc_vers" ]; then
       echo "export ICECC_VERSION=$icecc_vers" >> "$BUILD_ROOT"/etc/profile.d/build_icecream.sh
@@ -337,19 +337,19 @@ setupicecream()
 setmemorylimit()
 {
     if [ -n "$VM_IMAGE" -o -n "$RUNNING_IN_VM" ]; then
-        return
+       return
     fi
     local mem
     while read mem; do
-        case "$mem" in
-            MemTotal:*)
-                set -- $mem
-                eval "mem=\$(($2/3*4))"
-                ulimit -v $mem
-                echo "Memory limit set to ${mem}KB"
-                break;
-            ;;
-        esac
+       case "$mem" in
+           MemTotal:*)
+               set -- $mem
+               eval "mem=\$(($2/3*4))"
+               ulimit -v $mem
+               echo "Memory limit set to ${mem}KB"
+               break;
+           ;;
+       esac
     done < <(cat /proc/meminfo) # cat for proc stuff
 }
 
@@ -357,11 +357,11 @@ function create_baselibs {
     echo "... creating baselibs"
     BRPMS=
     for RPM in $BUILD_ROOT$TOPDIR/RPMS/*/*.rpm ; do
-        BRPMS="$BRPMS ${RPM#$BUILD_ROOT}"
+       BRPMS="$BRPMS ${RPM#$BUILD_ROOT}"
     done
     BDEBS=
     for DEB in $BUILD_ROOT$TOPDIR/DEBS/*.deb ; do
-        BDEBS="$BDEBS ${DEB#$BUILD_ROOT}"
+       BDEBS="$BDEBS ${DEB#$BUILD_ROOT}"
     done
     BASELIBS_CFG=
 ## Nb REPO is the name of the project instance
@@ -373,55 +373,55 @@ function create_baselibs {
 #    elif test -e $BUILD_ROOT$TOPDIR/SOURCES/baselibs.conf ; then
 
     if test "$BUILDTYPE" == "dsc" ; then
-        BPKGS=$BDEBS
+       BPKGS=$BDEBS
     else # spec and kiwi
-        if test -e $BUILD_ROOT$TOPDIR/SOURCES/baselibs.conf ; then
-            BASELIBS_CFG="-c $TOPDIR/SOURCES/baselibs.conf"
-        fi
-        if test -e $BUILD_ROOT/usr/lib/build/baselibs_global.conf; then
-            BASELIBS_GLOBAL="-c /usr/lib/build/baselibs_global.conf"
-        fi
-        BPKGS=$BRPMS
+       if test -e $BUILD_ROOT$TOPDIR/SOURCES/baselibs.conf ; then
+           BASELIBS_CFG="-c $TOPDIR/SOURCES/baselibs.conf"
+       fi
+       if test -e $BUILD_ROOT/usr/lib/build/baselibs_global.conf; then
+           BASELIBS_GLOBAL="-c /usr/lib/build/baselibs_global.conf"
+       fi
+       BPKGS=$BRPMS
     fi
     if test -f $BUILD_ROOT/usr/lib/build/mkbaselibs ; then
-        if test -z "$BASELIBS_CFG" -a -e $BUILD_ROOT/usr/lib/build/baselibs.conf ; then
-            BASELIBS_CFG="-c /usr/lib/build/baselibs.conf"
-        fi
-        chroot $BUILD_ROOT /usr/lib/build/mkbaselibs $BASELIBS_GLOBAL $BASELIBS_CFG $BPKGS || cleanup_and_exit 1
+       if test -z "$BASELIBS_CFG" -a -e $BUILD_ROOT/usr/lib/build/baselibs.conf ; then
+           BASELIBS_CFG="-c /usr/lib/build/baselibs.conf"
+       fi
+       chroot $BUILD_ROOT /usr/lib/build/mkbaselibs $BASELIBS_GLOBAL $BASELIBS_CFG $BPKGS || cleanup_and_exit 1
     else
-        # use external version
-        rm -rf $BUILD_ROOT/.mkbaselibs
-        mkdir -p $BUILD_ROOT/.mkbaselibs
-        cp -f $BUILD_DIR/mkbaselibs $BUILD_ROOT/.mkbaselibs/
-        if test "$BUILDTYPE" == "dsc" ; then
-            cp -f $BUILD_DIR/baselibs_global-deb.conf $BUILD_ROOT/.mkbaselibs/baselibs_g.conf
-            cp -f $BUILD_ROOT$TOPDIR/SOURCES/baselibs-deb.conf $BUILD_ROOT/.mkbaselibs/baselibs-deb.conf
-            BASELIBS_CFG="-c /.mkbaselibs/baselibs-deb.conf"
-        else
-            cp -f $BUILD_DIR/baselibs_global.conf $BUILD_ROOT/.mkbaselibs/baselibs_g.conf
-            if test -z "$BASELIBS_CFG" -a -e $BUILD_DIR/baselibs.conf; then
-                cp -f $BUILD_DIR/baselibs.conf $BUILD_ROOT/.mkbaselibs/baselibs.conf
-                BASELIBS_CFG="-c /.mkbaselibs/baselibs.conf"
-            fi
-        fi
-        if test -e $BUILD_ROOT/.mkbaselibs/baselibs_g.conf; then
-            BASELIBS_GLOBAL="-c /.mkbaselibs/baselibs_g.conf"
-        fi
-        chroot $BUILD_ROOT /.mkbaselibs/mkbaselibs $BASELIBS_GLOBAL $BASELIBS_CFG $BPKGS || cleanup_and_exit 1
-        rm -rf $BUILD_ROOT/.mkbaselibs
+       # use external version
+       rm -rf $BUILD_ROOT/.mkbaselibs
+       mkdir -p $BUILD_ROOT/.mkbaselibs
+       cp -f $BUILD_DIR/mkbaselibs $BUILD_ROOT/.mkbaselibs/
+       if test "$BUILDTYPE" == "dsc" ; then
+           cp -f $BUILD_DIR/baselibs_global-deb.conf $BUILD_ROOT/.mkbaselibs/baselibs_g.conf
+           cp -f $BUILD_ROOT$TOPDIR/SOURCES/baselibs-deb.conf $BUILD_ROOT/.mkbaselibs/baselibs-deb.conf
+           BASELIBS_CFG="-c /.mkbaselibs/baselibs-deb.conf"
+       else
+           cp -f $BUILD_DIR/baselibs_global.conf $BUILD_ROOT/.mkbaselibs/baselibs_g.conf
+           if test -z "$BASELIBS_CFG" -a -e $BUILD_DIR/baselibs.conf; then
+               cp -f $BUILD_DIR/baselibs.conf $BUILD_ROOT/.mkbaselibs/baselibs.conf
+               BASELIBS_CFG="-c /.mkbaselibs/baselibs.conf"
+           fi
+       fi
+       if test -e $BUILD_ROOT/.mkbaselibs/baselibs_g.conf; then
+           BASELIBS_GLOBAL="-c /.mkbaselibs/baselibs_g.conf"
+       fi
+       chroot $BUILD_ROOT /.mkbaselibs/mkbaselibs $BASELIBS_GLOBAL $BASELIBS_CFG $BPKGS || cleanup_and_exit 1
+       rm -rf $BUILD_ROOT/.mkbaselibs
     fi
 }
 
 detect_vm_2nd_stage()
 {
     if ! test "$0" = "/.build/build" ; then
-        return 1
+       return 1
     fi
     if test $$ -eq 1 ; then
-        # ignore special init signals if we're init
-        trap '' TERM HUP
-        $0 "$@"
-        cleanup_and_exit 1
+       # ignore special init signals if we're init
+       trap '' TERM HUP
+       $0 "$@"
+       cleanup_and_exit 1
     fi
     trap - TERM HUP
     echo "2nd stage started in virtual machine"
@@ -430,10 +430,10 @@ detect_vm_2nd_stage()
     . $BUILD_DIR/build.data
     echo "machine type: `uname -m`"
     if test "$PERSONALITY" != 0 -a -z "$PERSONALITY_SET" ; then
-        export PERSONALITY_SET=true
-        echo "switching personality to $PERSONALITY..."
-        # this is 32bit perl/glibc, thus the 32bit syscall number
-        exec perl -e 'syscall(136, '$PERSONALITY') == -1 && warn("personality: $!\n");exec "/.build/build" || die("/.build/build: $!\n")'
+       export PERSONALITY_SET=true
+       echo "switching personality to $PERSONALITY..."
+       # this is 32bit perl/glibc, thus the 32bit syscall number
+       exec perl -e 'syscall(136, '$PERSONALITY') == -1 && warn("personality: $!\n");exec "/.build/build" || die("/.build/build: $!\n")'
     fi
     PATH=$BUILD_DIR:$PATH
     RUNNING_IN_VM=true
@@ -445,22 +445,22 @@ detect_vm_2nd_stage()
 #        chmod 0666 /dev/kqemu
 #    fi
     if test -n "$VM_SWAP" ; then
-        for i in 1 2 3 4 5 6 7 8 9 10 ; do
-            test -e "$VM_SWAP" && break
-            test $i = 1 && echo "waiting for $VM_SWAP to appear"
-            echo -n .
-            sleep 1
-        done
-        test $i = 1 || echo
-        # recreate the swap device manually if it didn't exist for some
-        # reason, hardcoded to hda2 atm
-        if ! test -b "$VM_SWAP" ; then
-            rm -f "$VM_SWAP"
-            umask 027
-            mknod "$VM_SWAP" b 3 2
-            umask 022
-        fi
-        swapon -v "$VM_SWAP" || exit 1
+       for i in 1 2 3 4 5 6 7 8 9 10 ; do
+           test -e "$VM_SWAP" && break
+           test $i = 1 && echo "waiting for $VM_SWAP to appear"
+           echo -n .
+           sleep 1
+       done
+       test $i = 1 || echo
+       # recreate the swap device manually if it didn't exist for some
+       # reason, hardcoded to hda2 atm
+       if ! test -b "$VM_SWAP" ; then
+           rm -f "$VM_SWAP"
+           umask 027
+           mknod "$VM_SWAP" b 3 2
+           umask 022
+       fi
+       swapon -v "$VM_SWAP" || exit 1
     fi
     HOST="$MYHOSTNAME"
 
@@ -471,42 +471,42 @@ find_spec_files()
 {
     local spec files
     if [ -z "$SPECFILES" ]; then
-        set -- "`pwd`"
+       set -- "`pwd`"
     else
-        set -- "${SPECFILES[@]}"
+       set -- "${SPECFILES[@]}"
     fi
     SPECFILES=()
     for spec in "$@"; do
-        if [ "$spec" = "${spec#/}" ]; then
-            spec="`pwd`/$spec"
-        fi
-
-        if [ -d "$spec" ]; then
-            specs=("$spec"/*.spec)
-            if [ -n "$specs" ]; then
-                SPECFILES=("${SPECFILES[@]}" "${specs[@]}")
-            else
-                specs=("$spec"/*.spec)
-                if [ -n "$specs" ]; then
-                    SPECFILES=("${SPECFILES[@]}" "${specs[@]}")
-                fi
-            fi
-        else
-            SPECFILES[${#SPECFILES[@]}]="$spec";
-        fi
+       if [ "$spec" = "${spec#/}" ]; then
+           spec="`pwd`/$spec"
+       fi
+
+       if [ -d "$spec" ]; then
+           specs=("$spec"/*.spec)
+           if [ -n "$specs" ]; then
+               SPECFILES=("${SPECFILES[@]}" "${specs[@]}")
+           else
+               specs=("$spec"/*.spec)
+               if [ -n "$specs" ]; then
+                   SPECFILES=("${SPECFILES[@]}" "${specs[@]}")
+               fi
+           fi
+       else
+           SPECFILES[${#SPECFILES[@]}]="$spec";
+       fi
     done
 
     if test -z "$SPECFILES"; then
-        echo no spec files or src rpms found in $@. exit...
-        cleanup_and_exit 1
+       echo no spec files or src rpms found in $@. exit...
+       cleanup_and_exit 1
     fi
 }
 
 become_root_or_fail()
 {
     if [ ! -w /root ]; then
-        echo "You have to be root to use $0" >&2
-        exit 1
+       echo "You have to be root to use $0" >&2
+       exit 1
     fi
     cleanup_and_exit 1
 }
@@ -514,17 +514,17 @@ become_root_or_fail()
 mkdir_build_root()
 {
     if [ -d "$BUILD_ROOT" ]; then
-        # check if it is owned by root
-        if [ -z "$RUNNING_IN_VM" -a \! -O "$BUILD_ROOT" -a "`stat -c %u $BUILD_ROOT`" -ne 0 ]; then
-            echo "BUILD_ROOT=$BUILD_ROOT must be owned by root. Exit..."
-            cleanup_and_exit 1
-        fi
+       # check if it is owned by root
+       if [ -z "$RUNNING_IN_VM" -a \! -O "$BUILD_ROOT" -a "`stat -c %u $BUILD_ROOT`" -ne 0 ]; then
+           echo "BUILD_ROOT=$BUILD_ROOT must be owned by root. Exit..."
+           cleanup_and_exit 1
+       fi
     else
-        test "$BUILD_ROOT" != "${BUILD_ROOT%/*}" && mkdir -p "${BUILD_ROOT%/*}"
-        if ! mkdir $BUILD_ROOT; then
-            echo "can not create BUILD_ROOT=$BUILD_ROOT. Exit..."
-            cleanup_and_exit 1
-        fi
+       test "$BUILD_ROOT" != "${BUILD_ROOT%/*}" && mkdir -p "${BUILD_ROOT%/*}"
+       if ! mkdir $BUILD_ROOT; then
+           echo "can not create BUILD_ROOT=$BUILD_ROOT. Exit..."
+           cleanup_and_exit 1
+       fi
     fi
 
     rm -rf "$BUILD_ROOT"/.build.packages
@@ -532,7 +532,7 @@ mkdir_build_root()
 
 linux64()
 {
-        perl -e 'syscall('$PERSONALITY_SYSCALL', 0); exec(@ARGV) || die("$ARGV[0]: $!\n")' "$@"
+       perl -e 'syscall('$PERSONALITY_SYSCALL', 0); exec(@ARGV) || die("$ARGV[0]: $!\n")' "$@"
 }
 
 #### main ####
@@ -566,185 +566,185 @@ while test -n "$1"; do
   esac
   case $PARAM in
       *-help|-h)
-        echo_help
-        cleanup_and_exit
+       echo_help
+       cleanup_and_exit
       ;;
       *-no*init)
-        DO_INIT=false
+       DO_INIT=false
       ;;
       *-no*checks)
-        DO_CHECKS=false
+       DO_CHECKS=false
       ;;
       *-clean)
-        CLEAN_BUILD='--clean'
+       CLEAN_BUILD='--clean'
       ;;
       *-kill)
-        KILL=true
+       KILL=true
       ;;
       *-rpms)
-        BUILD_RPMS="$ARG"
-        if [ -z "$BUILD_RPMS" ] ; then
-          echo_help
-          cleanup_and_exit
-        fi
-        shift
+       BUILD_RPMS="$ARG"
+       if [ -z "$BUILD_RPMS" ] ; then
+         echo_help
+         cleanup_and_exit
+       fi
+       shift
       ;;
       *-arch)
-        BUILD_ARCH="$ARG"
-        shift
+       BUILD_ARCH="$ARG"
+       shift
       ;;
       *-verify)
-        export VERIFY_BUILD_SYSTEM=true
+       export VERIFY_BUILD_SYSTEM=true
       ;;
       *-target)
-        ABUILD_TARGET_ARCH="$ARG"
-        shift
+       ABUILD_TARGET_ARCH="$ARG"
+       shift
       ;;
       *-jobs)
-        BUILD_JOBS="$ARG"
-        shift
+       BUILD_JOBS="$ARG"
+       shift
       ;;
       *-extra*packs|-X)
-        BUILD_EXTRA_PACKS="$BUILD_EXTRA_PACKS $ARG"
-        shift
+       BUILD_EXTRA_PACKS="$BUILD_EXTRA_PACKS $ARG"
+       shift
       ;;
       *-lint)
-        DO_LINT=true
-        ;;
+       DO_LINT=true
+       ;;
       *-baselibs)
-        CREATE_BASELIBS=true
-        ;;
+       CREATE_BASELIBS=true
+       ;;
       *-baselibs-internal)
-        CREATE_BASELIBS=internal
-        ;;
+       CREATE_BASELIBS=internal
+       ;;
       *-root)
-        BUILD_ROOT="$ARG"
-        shift
+       BUILD_ROOT="$ARG"
+       shift
       ;;
       *-oldpackages)
-        OLD_PACKAGES="$ARG"
-        shift
+       OLD_PACKAGES="$ARG"
+       shift
       ;;
       *-dist)
-        BUILD_DIST="$ARG"
-        export BUILD_DIST
-        shift
+       BUILD_DIST="$ARG"
+       export BUILD_DIST
+       shift
       ;;
       *-xen|*-kvm|--uml|--qemu)
-        VM_TYPE=${PARAM##*-}
-        if [ -n "$ARG" -a "$ARG" = "${ARG#-}" ]; then
-            VM_IMAGE="$ARG"
-            shift
-        else
-            VM_IMAGE=1
-        fi
+       VM_TYPE=${PARAM##*-}
+       if [ -n "$ARG" -a "$ARG" = "${ARG#-}" ]; then
+           VM_IMAGE="$ARG"
+           shift
+       else
+           VM_IMAGE=1
+       fi
       ;;
       *-xenswap|*-swap)
-        VM_SWAP="$ARG"
-        shift
+       VM_SWAP="$ARG"
+       shift
       ;;
       *-xenmemory|*-memory)
-        MEMSIZE="$ARG"
-        shift
+       MEMSIZE="$ARG"
+       shift
       ;;
       *-rpmlist)
-        RPMLIST="--rpmlist $ARG"
-        BUILD_RPMS=
-        shift
+       RPMLIST="--rpmlist $ARG"
+       BUILD_RPMS=
+       shift
       ;;
       *-release)
-        RELEASE="$ARG"
-        shift
+       RELEASE="$ARG"
+       shift
       ;;
       *-logfile)
-        LOGFILE="$ARG"
-        shift
+       LOGFILE="$ARG"
+       shift
       ;;
       *-reason)
-        REASON="$ARG"
-        shift
+       REASON="$ARG"
+       shift
       ;;
       *-norootforbuild)
-        NOROOTFORBUILD=true
+       NOROOTFORBUILD=true
       ;;
       *-stage)
-        BUILD_RPM_BUILD_STAGE="$ARG"
-        shift
+       BUILD_RPM_BUILD_STAGE="$ARG"
+       shift
       ;;
       *-useusedforbuild)
-        USEUSEDFORBUILD="--useusedforbuild"
+       USEUSEDFORBUILD="--useusedforbuild"
       ;;
       *-list*state)
-        LIST_STATE=true
+       LIST_STATE=true
       ;;
       --define|--with|--without)
-        definesnstuff[${#definesnstuff[@]}]="$PARAM";
-        definesnstuff[${#definesnstuff[@]}]="$ARG";
-        shift
+       definesnstuff[${#definesnstuff[@]}]="$PARAM";
+       definesnstuff[${#definesnstuff[@]}]="$ARG";
+       shift
       ;;
       --repository|--repo)
-        if [ -z "$ARG" ] ; then
-          echo_help
-          cleanup_and_exit
-        fi
-        repos[${#repos[@]}]="$PARAM";
-        repos[${#repos[@]}]="$ARG";
-        shift
+       if [ -z "$ARG" ] ; then
+         echo_help
+         cleanup_and_exit
+       fi
+       repos[${#repos[@]}]="$PARAM";
+       repos[${#repos[@]}]="$ARG";
+       shift
       ;;
       --icecream)
-        if [ -z "$ARG" ] ; then
-          echo "--icecream needs an argument" >&2
-          echo_help
-          cleanup_and_exit 1
-        fi
-        icecream="$ARG"
-        if [ "$icecream" -gt 0 ]; then
-                BUILD_JOBS="$ARG"
-        fi
-        shift
+       if [ -z "$ARG" ] ; then
+         echo "--icecream needs an argument" >&2
+         echo_help
+         cleanup_and_exit 1
+       fi
+       icecream="$ARG"
+       if [ "$icecream" -gt 0 ]; then
+               BUILD_JOBS="$ARG"
+       fi
+       shift
       ;;
       --ccache)
-        ccache=1
+       ccache=1
       ;;
       --debug)
-        BUILD_DEBUG=1
+       BUILD_DEBUG=1
       ;;
       --incarnation)
-        INCARNATION=$ARG
-        shift
+       INCARNATION=$ARG
+       shift
       ;;
       --disturl)
-        DISTURL=$ARG
-        shift
+       DISTURL=$ARG
+       shift
       ;;
       --linksources)
-        LINKSOURCES=true
+       LINKSOURCES=true
       ;;
       ----noarg)
-        echo "$ARG does not take an argument"
-        cleanup_and_exit
+       echo "$ARG does not take an argument"
+       cleanup_and_exit
       ;;
       *-changelog)
-        CHANGELOG=true
+       CHANGELOG=true
       ;;
       --overlay)
-        OVERLAY=$ARG
-        shift
+       OVERLAY=$ARG
+       shift
       ;;
       --rsync-src)
-        RSYNCSRC=$ARG
-        shift
+       RSYNCSRC=$ARG
+       shift
       ;;
       --rsync-dest)
-        RSYNCDEST=$ARG
-        shift
+       RSYNCDEST=$ARG
+       shift
       ;;
       -*)
-        echo Unknown Option "$PARAM". Exit.
-        cleanup_and_exit 1
+       echo Unknown Option "$PARAM". Exit.
+       cleanup_and_exit 1
       ;;
       *)
-        SPECFILES[${#SPECFILES[@]}]="$PARAM";
+       SPECFILES[${#SPECFILES[@]}]="$PARAM";
       ;;
     esac
 done
@@ -753,61 +753,61 @@ done
 if test -n "$KILL" ; then
     test -z "$SRCDIR" || usage
     if test -z "$VM_IMAGE" ; then
-        if ! $BUILD_DIR/killchroot -s 9 $BUILD_ROOT ; then
-            echo "could not kill build in $BUILD_ROOT"
-            cleanup_and_exit 1
-        fi
+       if ! $BUILD_DIR/killchroot -s 9 $BUILD_ROOT ; then
+           echo "could not kill build in $BUILD_ROOT"
+           cleanup_and_exit 1
+       fi
     elif test "$VM_TYPE" = 'xen'; then
-        XENID="${VM_IMAGE%/root}"
-        XENID="${XENID%/tmpfs}"
-        XENID="${XENID##*/}"
-        if xm list "build:$XENID" >/dev/null 2>&1 ; then
-            if ! xm destroy "build:$XENID" ; then
-                echo "could not kill xen build $XENID"
-                cleanup_and_exit 1
-            fi
-        fi
+       XENID="${VM_IMAGE%/root}"
+       XENID="${XENID%/tmpfs}"
+       XENID="${XENID##*/}"
+       if xm list "build:$XENID" >/dev/null 2>&1 ; then
+           if ! xm destroy "build:$XENID" ; then
+               echo "could not kill xen build $XENID"
+               cleanup_and_exit 1
+           fi
+       fi
     elif test -n "$VM_TYPE"; then
-        if ! fuser -k -TERM "$VM_IMAGE"; then
-            echo "could not kill build in $VM_IMAGE"
-            cleanup_and_exit 1
-        fi
+       if ! fuser -k -TERM "$VM_IMAGE"; then
+           echo "could not kill build in $VM_IMAGE"
+           cleanup_and_exit 1
+       fi
     else
-        echo "don't know how to kill this build job"
-        cleanup_and_exit 1
+       echo "don't know how to kill this build job"
+       cleanup_and_exit 1
     fi
     cleanup_and_exit 0
 fi
 
 if [ "$VM_TYPE" = 'kvm' ]; then
     if [ ! -r /dev/kvm -o ! -x "$qemu_bin"-kvm ]; then
-        echo ""
+       echo ""
     fi
     qemu_bin="$kvm_bin"
     qemu_kernel="$kvm_kernel"
     qemu_initrd="$kvm_initrd"
     if [ ! -e $qemu_initrd-virtio -o $qemu_kernel -nt $qemu_initrd-virtio ]; then
-        if [ ! -w /root ]; then
-            echo "No initrd that provides virtio support found. virtio accelleration disabled."
-            echo "Run the following command as root to enable virtio:"
-            shellquote "${mkinitrd_virtio_cmd[@]}"
-            echo
-        elif /sbin/modinfo virtio_pci >/dev/null 2>&1; then
-            echo "creating $qemu_initrd-virtio"
-            "${mkinitrd_virtio_cmd[@]}" || cleanup_and_exit 1
-            kvm_virtio=1
-        fi
+       if [ ! -w /root ]; then
+           echo "No initrd that provides virtio support found. virtio accelleration disabled."
+           echo "Run the following command as root to enable virtio:"
+           shellquote "${mkinitrd_virtio_cmd[@]}"
+           echo
+       elif /sbin/modinfo virtio_pci >/dev/null 2>&1; then
+           echo "creating $qemu_initrd-virtio"
+           "${mkinitrd_virtio_cmd[@]}" || cleanup_and_exit 1
+           kvm_virtio=1
+       fi
     else
-        kvm_virtio=1
+       kvm_virtio=1
     fi
 
     if [ "$kvm_virtio" = 1 ]; then
-        qemu_initrd="$qemu_initrd-virtio"
-        VM_SWAPDEV=/dev/vdb
-        qemu_rootdev=/dev/vda
+       qemu_initrd="$qemu_initrd-virtio"
+       VM_SWAPDEV=/dev/vdb
+       qemu_rootdev=/dev/vda
     else
-        VM_SWAPDEV=/dev/sdb
-        qemu_rootdev=/dev/sda
+       VM_SWAPDEV=/dev/sdb
+       qemu_rootdev=/dev/sda
     fi
 fi
 
@@ -818,7 +818,7 @@ fi
 
 if [ -z "$RPMLIST" ]; then
     if [ -z "$repos" -a -z "$BUILD_RPMS" ]; then
-        BUILD_RPMS="/media/dvd/suse"
+       BUILD_RPMS="/media/dvd/suse"
     fi
 else
     repos=()
@@ -840,9 +840,9 @@ if test -n "$LIST_STATE" ; then
        rm -rf $BUILD_ROOT/usr/src/packages
        mkdir -p $BUILD_ROOT/usr/src/packages/SOURCES $BUILD_ROOT/usr/src/packages/SPECS
        rpm -i --nodigest --nosignature --root $BUILD_ROOT $SPECFILE || {
-           echo "could not install $SPECFILE." 2>&1
-           rm -rf $BUILD_ROOT
-           cleanup_and_exit 3
+          echo "could not install $SPECFILE." 2>&1
+          rm -rf $BUILD_ROOT
+          cleanup_and_exit 3
        }
        for SPECFILE in $BUILD_ROOT/usr/src/packages/SPECS/*.spec ; do : ; done
     fi
@@ -854,34 +854,34 @@ fi
 
 if test -z "$RUNNING_IN_VM" ; then
     if test -n "$VM_IMAGE" ; then
-        if test "$VM_IMAGE" = 1 ; then
-            VM_IMAGE="$BUILD_ROOT.img"
-        fi
-        if test ! -e "$VM_IMAGE" ; then
-            echo "you need to create a file system on $VM_IMAGE first"
-            cleanup_and_exit 3
-        fi
+       if test "$VM_IMAGE" = 1 ; then
+           VM_IMAGE="$BUILD_ROOT.img"
+       fi
+       if test ! -e "$VM_IMAGE" ; then
+           echo "you need to create a file system on $VM_IMAGE first"
+           cleanup_and_exit 3
+       fi
     fi
     if test -n "$VM_IMAGE" ; then
-        if test -n "$CLEAN_BUILD" ; then
-            echo "Creating filesystem on $VM_IMAGE"
-            $vm_img_mkfs $VM_IMAGE || cleanup_and_exit 3
-            if test -n "$vm_img_tunefs" ; then
-                $vm_img_tunefs $VM_IMAGE || cleanup_and_exit 3
-            fi
-        fi
-        mkdir_build_root
-        if [ -w /root ]; then
-            mount -o loop $VM_IMAGE $BUILD_ROOT || cleanup_and_exit 3
-        else
-            mount $BUILD_ROOT || cleanup_and_exit 3
-        fi
+       if test -n "$CLEAN_BUILD" ; then
+           echo "Creating filesystem on $VM_IMAGE"
+           $vm_img_mkfs $VM_IMAGE || cleanup_and_exit 3
+           if test -n "$vm_img_tunefs" ; then
+               $vm_img_tunefs $VM_IMAGE || cleanup_and_exit 3
+           fi
+       fi
+       mkdir_build_root
+       if [ -w /root ]; then
+           mount -o loop $VM_IMAGE $BUILD_ROOT || cleanup_and_exit 3
+       else
+           mount $BUILD_ROOT || cleanup_and_exit 3
+       fi
     else
-        test -w /root || become_root_or_fail
+       test -w /root || become_root_or_fail
     fi
     if test -n "$VM_SWAP" ; then
-        dd if=/dev/zero of="$VM_SWAP" bs=12 count=1 conv=notrunc 2>/dev/null
-        mkswap "$VM_SWAP"
+       dd if=/dev/zero of="$VM_SWAP" bs=12 count=1 conv=notrunc 2>/dev/null
+       mkswap "$VM_SWAP"
     fi
 fi
 
@@ -905,9 +905,9 @@ if test -n "$LOGFILE" ; then
     rm -f $LOGFILE
     touch $LOGFILE
     if test -n "$VM_IMAGE" ; then
-        exec 1> >(exec -a 'build logging tee' perl -e 'open(F,">>",$ARGV[0])||die("$ARGV[0]: $!\n");$|=1;select(F);$|=1;while(<STDIN>){print STDOUT;s/^\r//s;s/\r\n/\n/gs;print F}' $LOGFILE) 2>&1
+       exec 1> >(exec -a 'build logging tee' perl -e 'open(F,">>",$ARGV[0])||die("$ARGV[0]: $!\n");$|=1;select(F);$|=1;while(<STDIN>){print STDOUT;s/^\r//s;s/\r\n/\n/gs;print F}' $LOGFILE) 2>&1
     else
-        exec 1> >(exec -a 'build logging tee' tee -a $LOGFILE) 2>&1
+       exec 1> >(exec -a 'build logging tee' tee -a $LOGFILE) 2>&1
     fi
 fi
 
@@ -948,11 +948,11 @@ for SPECFILE in "${SPECFILES[@]}" ; do
     cd "$SRCDIR"
 
     if [ -z "$RUNNING_IN_VM" ]; then
-        echo
-        echo "$HOST started \"build $SPECFILE\" at `date`."
-        echo
-        test -n "$REASON" && echo "$REASON"
-        echo
+       echo
+       echo "$HOST started \"build $SPECFILE\" at `date`."
+       echo
+       test -n "$REASON" && echo "$REASON"
+       echo
     fi
 
     #
@@ -964,30 +964,30 @@ for SPECFILE in "${SPECFILES[@]}" ; do
     }
 
     if test "$SPECFILE" != "${SPECFILE%.src.rpm}" ; then
-        echo processing src rpm $SRCDIR/$SPECFILE ...
-        MYSRCDIR=$BUILD_ROOT/.build-srcdir
-        rm -rf $MYSRCDIR
-        mkdir -p $MYSRCDIR
-        cd $MYSRCDIR || cleanup_and_exit 1
-        $BUILD_DIR/unrpm -q $SRCDIR/$SPECFILE || {
-            echo "could not install $SPECFILE."
-            cleanup_and_exit 1
-        }
-        for SPECFILE in *.spec ; do : ; done
+       echo processing src rpm $SRCDIR/$SPECFILE ...
+       MYSRCDIR=$BUILD_ROOT/.build-srcdir
+       rm -rf $MYSRCDIR
+       mkdir -p $MYSRCDIR
+       cd $MYSRCDIR || cleanup_and_exit 1
+       $BUILD_DIR/unrpm -q $SRCDIR/$SPECFILE || {
+           echo "could not install $SPECFILE."
+           cleanup_and_exit 1
+       }
+       for SPECFILE in *.spec ; do : ; done
     else
-        MYSRCDIR="$SRCDIR"
-        # strip prefix from autogenerated files from OBS.
-        for i in $MYSRCDIR/_service\:*; do
-          mv "$i" "${i##*:}"
-        done
-        SPECFILE="${SPECFILE##*:}"
+       MYSRCDIR="$SRCDIR"
+       # strip prefix from autogenerated files from OBS.
+       for i in $MYSRCDIR/_service\:*; do
+         mv "$i" "${i##*:}"
+       done
+       SPECFILE="${SPECFILE##*:}"
     fi
 
     # FIX to work with baselibs_$PROJ etc
     if test "$BUILDTYPE" == "dsc" -a -e ${SRCDIR}/baselibs-deb.conf ; then
-        # Set CREATE_BASELIBS if not set
-        echo "dsc build and baselibs-deb.conf present: forcing --baselibs to true"
-        CREATE_BASELIBS=true
+       # Set CREATE_BASELIBS if not set
+       echo "dsc build and baselibs-deb.conf present: forcing --baselibs to true"
+       CREATE_BASELIBS=true
     fi
 
 # Currently local osc build does not allow extra .deb packages to be
@@ -1010,230 +1010,230 @@ for SPECFILE in "${SPECFILES[@]}" ; do
     test -n "$DO_LINT" && ADDITIONAL_PACKS="$ADDITIONAL_PACKS rpmlint-Factory"
 
     if test -n "$CHANGELOG" -a -z "$RUNNING_IN_VM" ; then
-        rm -f $BUILD_ROOT/.build-changelog
-        case $SPECFILE in
-          *.dsc) CFFORMAT=debian ;;
-          *) CFFORMAT=rpm ;;
-        esac
-        echo "running changelog2spec --target $CFFORMAT --file $MYSRCDIR/$SPECFILE"
-        if ! $BUILD_DIR/changelog2spec --target $CFFORMAT --file "$MYSRCDIR/$SPECFILE" > $BUILD_ROOT/.build-changelog ; then
-            rm -f $BUILD_ROOT/.build-changelog
-        fi
+       rm -f $BUILD_ROOT/.build-changelog
+       case $SPECFILE in
+         *.dsc) CFFORMAT=debian ;;
+         *) CFFORMAT=rpm ;;
+       esac
+       echo "running changelog2spec --target $CFFORMAT --file $MYSRCDIR/$SPECFILE"
+       if ! $BUILD_DIR/changelog2spec --target $CFFORMAT --file "$MYSRCDIR/$SPECFILE" > $BUILD_ROOT/.build-changelog ; then
+           rm -f $BUILD_ROOT/.build-changelog
+       fi
     fi
 
     if test -n "$VM_TYPE"; then
-        rm -rf $BUILD_ROOT/.build
-        mkdir -p $BUILD_ROOT/.build
-        if test "$DO_INIT" = true ; then
-            # do fist stage of init_buildsystem
-            rm -f $BUILD_ROOT/.build.success
-            set -- init_buildsystem --prepare "${definesnstuff[@]}" "${repos[@]}" $CLEAN_BUILD $USEUSEDFORBUILD $RPMLIST "$MYSRCDIR/$SPECFILE" $ADDITIONAL_PACKS
-            echo "$* ..."
-            "$@" || cleanup_and_exit 1
-            if [ ! -w /root ]; then
-                # remove setuid bit if files belong to user to make e.g. mount work
-                find $BUILD_ROOT/{bin,sbin,usr/bin,usr/sbin} -type f -uid $UID -perm +4000 -print0 | xargs -0 --no-run-if-empty chmod -s
-            fi
-            if [ -d "$OLD_PACKAGES" ]; then
-               rm -rf $BUILD_ROOT/.build.oldpackages
-               cp -a $OLD_PACKAGES $BUILD_ROOT/.build.oldpackages
-            fi
-        fi
-        # start up xen, rerun ourself
-        cp -a $BUILD_DIR/. $BUILD_ROOT/.build
-        if ! test "$MYSRCDIR" = $BUILD_ROOT/.build-srcdir ; then
-            rm -rf $BUILD_ROOT/.build-srcdir
-            mkdir $BUILD_ROOT/.build-srcdir
-            if test "$BUILDTYPE" = kiwi ; then
-                cp -pRL "$MYSRCDIR"/* $BUILD_ROOT/.build-srcdir
-            else
-                cp -p "$MYSRCDIR"/* $BUILD_ROOT/.build-srcdir
-            fi
-            MYSRCDIR=$BUILD_ROOT/.build-srcdir
-        else
-            # cwd is at $BUILD_ROOT/.build-srcdir which we want to
-            # umount later so step aside
-            cd "$SRCDIR"
-        fi
-        Q="'\''"
-        echo "SPECFILE='${SPECFILE//"'"/$Q}'" > $BUILD_ROOT/.build/build.data
-        echo "BUILD_JOBS='${BUILD_JOBS//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data
-        echo "BUILD_ARCH='${BUILD_ARCH//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data
-        echo "BUILD_RPMS='${BUILD_RPMS//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data
-        case $BUILD_DIST in
-            */*)
-                cp $BUILD_DIST $BUILD_ROOT/.build/build.dist
-                BUILD_DIST=/.build/build.dist
-                ;;
-        esac
-        echo "BUILD_DIST='${BUILD_DIST//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data
-        echo "RELEASE='${RELEASE//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data
-        echo "BUILD_DEBUG='${BUILD_DEBUG//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data
-        echo "DO_LINT='${DO_LINT//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data
-        echo "DO_CHECKS='${DO_CHECKS//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data
-        echo "NOROOTFORBUILD='${NOROOTFORBUILD//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data
-        echo "CREATE_BASELIBS='$CREATE_BASELIBS'" >> $BUILD_ROOT/.build/build.data
-        echo "REASON='${REASON//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data
-        echo "CHANGELOG='${CHANGELOG//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data
-        echo "INCARNATION='${INCARNATION//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data
-        echo "DISTURL='${DISTURL//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data
-        # FIXME: this depends on the kernel and vm.
-        # could be hda2, sda2 for xen or hdb/sdb for qemu
-        test -n "$VM_SWAP" && echo "VM_SWAP='${VM_SWAPDEV:-/dev/hda2}'" >> $BUILD_ROOT/.build/build.data
-        PERSONALITY=0
-        test -n "$PERSONALITY_SYSCALL" && PERSONALITY=`perl -e 'print syscall('$PERSONALITY_SYSCALL', 0)."\n"'`
-        echo "OLD_PACKAGES='$OLD_PACKAGES'" >> $BUILD_ROOT/.build/build.data
-        echo "PERSONALITY='$PERSONALITY'" >> $BUILD_ROOT/.build/build.data
-        echo "MYHOSTNAME='`hostname`'" >> $BUILD_ROOT/.build/build.data
-        echo -n "definesnstuff=(" >> $BUILD_ROOT/.build/build.data
-        shellquote "${definesnstuff[@]}" >> $BUILD_ROOT/.build/build.data
-        echo ")" >> $BUILD_ROOT/.build/build.data
-        echo -n "repos=(" >> $BUILD_ROOT/.build/build.data
-        shellquote "${repos[@]}" >> $BUILD_ROOT/.build/build.data
-        echo ")" >> $BUILD_ROOT/.build/build.data
-        umount -n $BUILD_ROOT/proc 2> /dev/null || true
-        umount -n $BUILD_ROOT/dev/pts 2> /dev/null || true
-        umount -n $BUILD_ROOT/mnt 2> /dev/null || true
-
-        # needs to work otherwise we have a corrupted file system
-        umount $BUILD_ROOT || cleanup_and_exit 1
-
-        if [ "$VM_TYPE" = 'xen' ]; then
-                XMROOT=file:$VM_IMAGE
-                XMROOT=${XMROOT/#file:\/dev/phy:/dev}
-                XMROOT="disk=$XMROOT,hda1,w"
-                XMSWAP=
-                if test -n "$VM_SWAP" ; then
-                    XMSWAP=file:$VM_SWAP
-                    XMSWAP=${XMSWAP/#file:\/dev/phy:/dev}
-                    XMSWAP="disk=$XMSWAP,hda2,w"
-                fi
-                XENID="${VM_IMAGE%/root}"
-                XENID="${XENID%/tmpfs}"
-                XENID="${XENID##*/}"
-                CROSS_INIT_SCRIPT="/.build/build"
-                # to run the qemu initialization in the XEN chroot, we need to register it with a statically build shell
-                if [ x"$BUILD_ARCH" == xarmv4l -o x"$BUILD_ARCH" == xarmv5el -o x"$BUILD_ARCH" == xarmv7el -o x"$BUILD_ARCH" == xsh4 -o x"$BUILD_ARCH" == xppc ]; then
-                    if [  -n "$(uname -m | grep '[x3-6]86')" ]; then
-                        if [ -e /bin/bash-static -a -e /bin/mount-static ]; then
-                            CROSS_INIT_SCRIPT="/.build/initscript_qemu_vm"
-                        fi
-                    fi
-                fi
-
-                echo "booting XEN kernel ..."
-                if xm list "build:$XENID" >/dev/null 2>&1 ; then
-                   echo "Instance already exist, something really went wrong..."
-                   echo "Please report to your server admin, there might be multiple services running for same domain"
-                   cleanup_and_exit 3
-                fi
-                set -- xm create -c $BUILD_DIR/xen.conf name="build:$XENID" ${MEMSIZE:+memory=$MEMSIZE} $XMROOT $XMSWAP extra="quiet init="$CROSS_INIT_SCRIPT" panic=1 console=ttyS0"
-                if test "$PERSONALITY" != 0 ; then
-                    # have to switch back to PER_LINUX to make xm work
-                    set -- linux64 "$@"
-                fi
-                echo "$@"
-                "$@" || cleanup_and_exit 3
-        elif [ "$VM_TYPE" = 'uml' ]; then
-                echo "booting UML kernel ..."
-                set -- $uml_kernel initrd=$uml_initrd root=/ubda init=/.build/build panic=1 quiet ubd0=$VM_IMAGE ${MEMSIZE:+mem=$MEMSIZE}
-                echo "$@"
-                "$@"
-        elif [ "$VM_TYPE" = 'qemu' -o "$VM_TYPE" = 'kvm' ]; then
-                echo "booting $VM_TYPE ..."
-                if [ "$kvm_virtio" = 1 ]; then
-                    qemu_disks=(-drive file="$VM_IMAGE",if=virtio -hda "$VM_IMAGE")
-                    if [ -n "$VM_SWAP" ]; then
-                        qemu_disks[${#qemu_disks[@]}]="-drive"
-                        qemu_disks[${#qemu_disks[@]}]="file=$VM_SWAP,if=virtio"
-                    fi
-                else
-                    qemu_disks=(-hda "$VM_IMAGE")
-                    if [ -n "$VM_SWAP" ]; then
-                        qemu_disks[${#qemu_disks[@]}]="-hdb"
-                        qemu_disks[${#qemu_disks[@]}]="$VM_SWAP"
-                    fi
-                fi
-                set -- $qemu_bin -no-reboot -nographic -net none -serial stdio \
-                    -kernel $qemu_kernel \
-                    -initrd $qemu_initrd \
-                    -append "root=$qemu_rootdev panic=1 quiet noapic rw console=ttyS0 init=/.build/build" \
-                    ${MEMSIZE:+-m $MEMSIZE} \
-                    "${qemu_disks[@]}"
-
-                if test "$PERSONALITY" != 0 ; then
-                    # have to switch back to PER_LINUX to make qemu work
-                    set -- linux64 "$@"
-                fi
-                echo "$@"
-                "$@"
-        fi
-        if test -n "$VM_SWAP" ; then
-            BUILDSTATUS=`dd if="$VM_SWAP" bs=12 count=1 2>/dev/null`
-            case $BUILDSTATUS in
-              BUILDSTATUS[02])
-                mkdir -p $BUILD_ROOT/.build.packages
-                cd $BUILD_ROOT/.build.packages || cleanup_and_exit 1
-                echo "build: extracting built packages..."
-                extractbuild --disk "$VM_IMAGE" --input "$VM_SWAP" --skip 512 -v || cleanup_and_exit 3
-                # create same layout as with plain chroot
-                if test "$BUILDTYPE" = spec ; then
-                  mkdir -p SRPMS
-                  for i in *src.rpm; do mv "$i" SRPMS/; done
-                  for i in *.rpm; do
-                    arch=${i%.rpm}
-                    arch=${arch##*\.}
-                    mkdir -p RPMS/$arch
-                    mv "$i" RPMS/$arch/;
-                  done
-                elif test "$BUILDTYPE" = dsc ; then
-                  mkdir -p DEBS
-                  find . -type f | while read i; do mv "$i" DEBS/; done
-                else
-                  mkdir -p KIWI
-                  find . -type f | while read i; do mv "$i" KIWI/; done
-                fi
-                cleanup_and_exit ${BUILDSTATUS#BUILDSTATUS}
-                ;;
-              BUILDSTATUS*)
-                cleanup_and_exit ${BUILDSTATUS#BUILDSTATUS}
-                ;;
-              *)
-                echo "argh, no buildstatus set, assuming bad build host..."
-                cleanup_and_exit 3
-                ;;
-            esac
-            cleanup_and_exit 1
-        fi
-        cleanup_and_exit 0
+       rm -rf $BUILD_ROOT/.build
+       mkdir -p $BUILD_ROOT/.build
+       if test "$DO_INIT" = true ; then
+           # do fist stage of init_buildsystem
+           rm -f $BUILD_ROOT/.build.success
+           set -- init_buildsystem --prepare "${definesnstuff[@]}" "${repos[@]}" $CLEAN_BUILD $USEUSEDFORBUILD $RPMLIST "$MYSRCDIR/$SPECFILE" $ADDITIONAL_PACKS
+           echo "$* ..."
+           "$@" || cleanup_and_exit 1
+           if [ ! -w /root ]; then
+               # remove setuid bit if files belong to user to make e.g. mount work
+               find $BUILD_ROOT/{bin,sbin,usr/bin,usr/sbin} -type f -uid $UID -perm +4000 -print0 | xargs -0 --no-run-if-empty chmod -s
+           fi
+           if [ -d "$OLD_PACKAGES" ]; then
+              rm -rf $BUILD_ROOT/.build.oldpackages
+              cp -a $OLD_PACKAGES $BUILD_ROOT/.build.oldpackages
+           fi
+       fi
+       # start up xen, rerun ourself
+       cp -a $BUILD_DIR/. $BUILD_ROOT/.build
+       if ! test "$MYSRCDIR" = $BUILD_ROOT/.build-srcdir ; then
+           rm -rf $BUILD_ROOT/.build-srcdir
+           mkdir $BUILD_ROOT/.build-srcdir
+           if test "$BUILDTYPE" = kiwi ; then
+               cp -pRL "$MYSRCDIR"/* $BUILD_ROOT/.build-srcdir
+           else
+               cp -p "$MYSRCDIR"/* $BUILD_ROOT/.build-srcdir
+           fi
+           MYSRCDIR=$BUILD_ROOT/.build-srcdir
+       else
+           # cwd is at $BUILD_ROOT/.build-srcdir which we want to
+           # umount later so step aside
+           cd "$SRCDIR"
+       fi
+       Q="'\''"
+       echo "SPECFILE='${SPECFILE//"'"/$Q}'" > $BUILD_ROOT/.build/build.data
+       echo "BUILD_JOBS='${BUILD_JOBS//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data
+       echo "BUILD_ARCH='${BUILD_ARCH//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data
+       echo "BUILD_RPMS='${BUILD_RPMS//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data
+       case $BUILD_DIST in
+           */*)
+               cp $BUILD_DIST $BUILD_ROOT/.build/build.dist
+               BUILD_DIST=/.build/build.dist
+               ;;
+       esac
+       echo "BUILD_DIST='${BUILD_DIST//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data
+       echo "RELEASE='${RELEASE//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data
+       echo "BUILD_DEBUG='${BUILD_DEBUG//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data
+       echo "DO_LINT='${DO_LINT//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data
+       echo "DO_CHECKS='${DO_CHECKS//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data
+       echo "NOROOTFORBUILD='${NOROOTFORBUILD//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data
+       echo "CREATE_BASELIBS='$CREATE_BASELIBS'" >> $BUILD_ROOT/.build/build.data
+       echo "REASON='${REASON//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data
+       echo "CHANGELOG='${CHANGELOG//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data
+       echo "INCARNATION='${INCARNATION//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data
+       echo "DISTURL='${DISTURL//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data
+       # FIXME: this depends on the kernel and vm.
+       # could be hda2, sda2 for xen or hdb/sdb for qemu
+       test -n "$VM_SWAP" && echo "VM_SWAP='${VM_SWAPDEV:-/dev/hda2}'" >> $BUILD_ROOT/.build/build.data
+       PERSONALITY=0
+       test -n "$PERSONALITY_SYSCALL" && PERSONALITY=`perl -e 'print syscall('$PERSONALITY_SYSCALL', 0)."\n"'`
+       echo "OLD_PACKAGES='$OLD_PACKAGES'" >> $BUILD_ROOT/.build/build.data
+       echo "PERSONALITY='$PERSONALITY'" >> $BUILD_ROOT/.build/build.data
+       echo "MYHOSTNAME='`hostname`'" >> $BUILD_ROOT/.build/build.data
+       echo -n "definesnstuff=(" >> $BUILD_ROOT/.build/build.data
+       shellquote "${definesnstuff[@]}" >> $BUILD_ROOT/.build/build.data
+       echo ")" >> $BUILD_ROOT/.build/build.data
+       echo -n "repos=(" >> $BUILD_ROOT/.build/build.data
+       shellquote "${repos[@]}" >> $BUILD_ROOT/.build/build.data
+       echo ")" >> $BUILD_ROOT/.build/build.data
+       umount -n $BUILD_ROOT/proc 2> /dev/null || true
+       umount -n $BUILD_ROOT/dev/pts 2> /dev/null || true
+       umount -n $BUILD_ROOT/mnt 2> /dev/null || true
+
+       # needs to work otherwise we have a corrupted file system
+       umount $BUILD_ROOT || cleanup_and_exit 1
+
+       if [ "$VM_TYPE" = 'xen' ]; then
+               XMROOT=file:$VM_IMAGE
+               XMROOT=${XMROOT/#file:\/dev/phy:/dev}
+               XMROOT="disk=$XMROOT,hda1,w"
+               XMSWAP=
+               if test -n "$VM_SWAP" ; then
+                   XMSWAP=file:$VM_SWAP
+                   XMSWAP=${XMSWAP/#file:\/dev/phy:/dev}
+                   XMSWAP="disk=$XMSWAP,hda2,w"
+               fi
+               XENID="${VM_IMAGE%/root}"
+               XENID="${XENID%/tmpfs}"
+               XENID="${XENID##*/}"
+               CROSS_INIT_SCRIPT="/.build/build"
+               # to run the qemu initialization in the XEN chroot, we need to register it with a statically build shell
+               if [ x"$BUILD_ARCH" == xarmv4l -o x"$BUILD_ARCH" == xarmv5el -o x"$BUILD_ARCH" == xarmv7el -o x"$BUILD_ARCH" == xsh4 -o x"$BUILD_ARCH" == xppc ]; then
+                   if [  -n "$(uname -m | grep '[x3-6]86')" ]; then
+                       if [ -e /bin/bash-static -a -e /bin/mount-static ]; then
+                           CROSS_INIT_SCRIPT="/.build/initscript_qemu_vm"
+                       fi
+                   fi
+               fi
+
+               echo "booting XEN kernel ..."
+               if xm list "build:$XENID" >/dev/null 2>&1 ; then
+                  echo "Instance already exist, something really went wrong..."
+                  echo "Please report to your server admin, there might be multiple services running for same domain"
+                  cleanup_and_exit 3
+               fi
+               set -- xm create -c $BUILD_DIR/xen.conf name="build:$XENID" ${MEMSIZE:+memory=$MEMSIZE} $XMROOT $XMSWAP extra="quiet init="$CROSS_INIT_SCRIPT" panic=1 console=ttyS0"
+               if test "$PERSONALITY" != 0 ; then
+                   # have to switch back to PER_LINUX to make xm work
+                   set -- linux64 "$@"
+               fi
+               echo "$@"
+               "$@" || cleanup_and_exit 3
+       elif [ "$VM_TYPE" = 'uml' ]; then
+               echo "booting UML kernel ..."
+               set -- $uml_kernel initrd=$uml_initrd root=/ubda init=/.build/build panic=1 quiet ubd0=$VM_IMAGE ${MEMSIZE:+mem=$MEMSIZE}
+               echo "$@"
+               "$@"
+       elif [ "$VM_TYPE" = 'qemu' -o "$VM_TYPE" = 'kvm' ]; then
+               echo "booting $VM_TYPE ..."
+               if [ "$kvm_virtio" = 1 ]; then
+                   qemu_disks=(-drive file="$VM_IMAGE",if=virtio -hda "$VM_IMAGE")
+                   if [ -n "$VM_SWAP" ]; then
+                       qemu_disks[${#qemu_disks[@]}]="-drive"
+                       qemu_disks[${#qemu_disks[@]}]="file=$VM_SWAP,if=virtio"
+                   fi
+               else
+                   qemu_disks=(-hda "$VM_IMAGE")
+                   if [ -n "$VM_SWAP" ]; then
+                       qemu_disks[${#qemu_disks[@]}]="-hdb"
+                       qemu_disks[${#qemu_disks[@]}]="$VM_SWAP"
+                   fi
+               fi
+               set -- $qemu_bin -no-reboot -nographic -net none -serial stdio \
+                   -kernel $qemu_kernel \
+                   -initrd $qemu_initrd \
+                   -append "root=$qemu_rootdev panic=1 quiet noapic rw console=ttyS0 init=/.build/build" \
+                   ${MEMSIZE:+-m $MEMSIZE} \
+                   "${qemu_disks[@]}"
+
+               if test "$PERSONALITY" != 0 ; then
+                   # have to switch back to PER_LINUX to make qemu work
+                   set -- linux64 "$@"
+               fi
+               echo "$@"
+               "$@"
+       fi
+       if test -n "$VM_SWAP" ; then
+           BUILDSTATUS=`dd if="$VM_SWAP" bs=12 count=1 2>/dev/null`
+           case $BUILDSTATUS in
+             BUILDSTATUS[02])
+               mkdir -p $BUILD_ROOT/.build.packages
+               cd $BUILD_ROOT/.build.packages || cleanup_and_exit 1
+               echo "build: extracting built packages..."
+               extractbuild --disk "$VM_IMAGE" --input "$VM_SWAP" --skip 512 -v || cleanup_and_exit 3
+               # create same layout as with plain chroot
+               if test "$BUILDTYPE" = spec ; then
+                 mkdir -p SRPMS
+                 for i in *src.rpm; do mv "$i" SRPMS/; done
+                 for i in *.rpm; do
+                   arch=${i%.rpm}
+                   arch=${arch##*\.}
+                   mkdir -p RPMS/$arch
+                   mv "$i" RPMS/$arch/;
+                 done
+               elif test "$BUILDTYPE" = dsc ; then
+                 mkdir -p DEBS
+                 find . -type f | while read i; do mv "$i" DEBS/; done
+               else
+                 mkdir -p KIWI
+                 find . -type f | while read i; do mv "$i" KIWI/; done
+               fi
+               cleanup_and_exit ${BUILDSTATUS#BUILDSTATUS}
+               ;;
+             BUILDSTATUS*)
+               cleanup_and_exit ${BUILDSTATUS#BUILDSTATUS}
+               ;;
+             *)
+               echo "argh, no buildstatus set, assuming bad build host..."
+               cleanup_and_exit 3
+               ;;
+           esac
+           cleanup_and_exit 1
+       fi
+       cleanup_and_exit 0
     fi
 
     if test "$DO_INIT" = true ; then
-        #
-        # create legacy .buildenv file
-        #
-        test -z "$INCARNATION" && INCARNATION=0
-        echo "BUILD_INCARNATION=$INCARNATION" > $BUILD_ROOT/.buildenv
-        CREATE_BUILD_BINARIES=
-        egrep '^#[       ]*needsbinariesforbuild[       ]*$' >/dev/null <$MYSRCDIR/$SPECFILE && CREATE_BUILD_BINARIES=--create-build-binaries
-        set -- init_buildsystem "${definesnstuff[@]}" "${repos[@]}" $CLEAN_BUILD $USEUSEDFORBUILD $CREATE_BUILD_BINARIES $RPMLIST "$MYSRCDIR/$SPECFILE" $ADDITIONAL_PACKS
-        echo "$* ..."
-        "$@" || cleanup_and_exit 1
-        if df $BUILD_ROOT 2>/dev/null | grep -q "100%"; then
-            df -h $BUILD_ROOT
-            echo "build does not work on a completely full filesystem"
-            cleanup_and_exit 1
-        fi
-        mount -n -tproc none $BUILD_ROOT/proc || true
-        mount -n -tdevpts none $BUILD_ROOT/dev/pts
-        if [ -d "$OLD_PACKAGES" ]; then
-           [ -d "$BUILD_ROOT/.build.oldpackages" ] || cp -r $OLD_PACKAGES $BUILD_ROOT/.build.oldpackages
-        fi
+       #
+       # create legacy .buildenv file
+       #
+       test -z "$INCARNATION" && INCARNATION=0
+       echo "BUILD_INCARNATION=$INCARNATION" > $BUILD_ROOT/.buildenv
+       CREATE_BUILD_BINARIES=
+       egrep '^#[       ]*needsbinariesforbuild[       ]*$' >/dev/null <$MYSRCDIR/$SPECFILE && CREATE_BUILD_BINARIES=--create-build-binaries
+       set -- init_buildsystem "${definesnstuff[@]}" "${repos[@]}" $CLEAN_BUILD $USEUSEDFORBUILD $CREATE_BUILD_BINARIES $RPMLIST "$MYSRCDIR/$SPECFILE" $ADDITIONAL_PACKS
+       echo "$* ..."
+       "$@" || cleanup_and_exit 1
+       if df $BUILD_ROOT 2>/dev/null | grep -q "100%"; then
+           df -h $BUILD_ROOT
+           echo "build does not work on a completely full filesystem"
+           cleanup_and_exit 1
+       fi
+       mount -n -tproc none $BUILD_ROOT/proc || true
+       mount -n -tdevpts none $BUILD_ROOT/dev/pts
+       if [ -d "$OLD_PACKAGES" ]; then
+          [ -d "$BUILD_ROOT/.build.oldpackages" ] || cp -r $OLD_PACKAGES $BUILD_ROOT/.build.oldpackages
+       fi
     fi
 
     if test -z "$BUILD_DIST" -a -e "$BUILD_ROOT/.guessed_dist" ; then
-        BUILD_DIST=`cat $BUILD_ROOT/.guessed_dist`
-        echo "assuming dist $BUILD_DIST"
+       BUILD_DIST=`cat $BUILD_ROOT/.guessed_dist`
+       echo "assuming dist $BUILD_DIST"
     fi
 
     #
@@ -1241,8 +1241,8 @@ for SPECFILE in "${SPECFILES[@]}" ; do
     #
     test -f $BUILD_ROOT/usr/lib/rpm/rpmrc_i586 && mv $BUILD_ROOT/usr/lib/rpm/rpmrc_i586 $BUILD_ROOT/usr/lib/rpm/rpmrc
     if test -e $BUILD_ROOT/usr/lib/rpm/rpmrc -a "$BUILD_ARCH" != "${BUILD_ARCH#i686}" ; then
-        mv $BUILD_ROOT/usr/lib/rpm/rpmrc $BUILD_ROOT/usr/lib/rpm/rpmrc_i586
-        sed -e 's/^buildarchtranslate: athlon.*/buildarchtranslate: athlon: i686/' -e 's/^buildarchtranslate: i686.*/buildarchtranslate: i686: i686/' < $BUILD_ROOT/usr/lib/rpm/rpmrc_i586 > $BUILD_ROOT/usr/lib/rpm/rpmrc
+       mv $BUILD_ROOT/usr/lib/rpm/rpmrc $BUILD_ROOT/usr/lib/rpm/rpmrc_i586
+       sed -e 's/^buildarchtranslate: athlon.*/buildarchtranslate: athlon: i686/' -e 's/^buildarchtranslate: i686.*/buildarchtranslate: i686: i686/' < $BUILD_ROOT/usr/lib/rpm/rpmrc_i586 > $BUILD_ROOT/usr/lib/rpm/rpmrc
     fi
 
     #
@@ -1250,57 +1250,57 @@ for SPECFILE in "${SPECFILES[@]}" ; do
     #
     BUILD_USER=abuild
     if test -x $BUILD_ROOT/bin/rpm ; then
-        SUSE_VERSION=`chroot $BUILD_ROOT /bin/rpm --eval '%{?suse_version}' 2>/dev/null`
-        if test -n "$SUSE_VERSION" && test "$SUSE_VERSION" -le 1020 ; then
-            BUILD_USER=root
-        fi
+       SUSE_VERSION=`chroot $BUILD_ROOT /bin/rpm --eval '%{?suse_version}' 2>/dev/null`
+       if test -n "$SUSE_VERSION" && test "$SUSE_VERSION" -le 1020 ; then
+           BUILD_USER=root
+       fi
     fi
     if test "$BUILD_USER" = abuild ; then
-        egrep '^#[       ]*needsrootforbuild[       ]*$' >/dev/null <$SPECFILE && BUILD_USER=root
+       egrep '^#[       ]*needsrootforbuild[       ]*$' >/dev/null <$SPECFILE && BUILD_USER=root
     else
-        egrep '^#[       ]*norootforbuild[       ]*$' >/dev/null <$SPECFILE && BUILD_USER=abuild
+       egrep '^#[       ]*norootforbuild[       ]*$' >/dev/null <$SPECFILE && BUILD_USER=abuild
     fi
     test -n "$NOROOTFORBUILD" && BUILD_USER=abuild
 
     if test $BUILD_USER = abuild ; then
-        if ! egrep '^abuild:' >/dev/null <$BUILD_ROOT/etc/passwd ; then
-            echo 'abuild::399:399:Autobuild:/home/abuild:/bin/bash' >>$BUILD_ROOT/etc/passwd
-            echo 'abuild:*:::::::' >>$BUILD_ROOT/etc/shadow # This is needed on Mandriva 2009
-            echo 'abuild:*::' >>$BUILD_ROOT/etc/gshadow # This is needed on Ubuntu
-            echo 'abuild::399:' >>$BUILD_ROOT/etc/group
-            mkdir -p $BUILD_ROOT/home/abuild
-            chown 399:399 $BUILD_ROOT/home/abuild
-        fi
-        if test -f $BUILD_ROOT/etc/shadow ; then
-            sed -e "s@^root::@root:*:@" < $BUILD_ROOT/etc/shadow > $BUILD_ROOT/etc/shadow.t && mv $BUILD_ROOT/etc/shadow.t $BUILD_ROOT/etc/shadow
-        fi
-        if test -f $BUILD_ROOT/etc/gshadow ; then
-            sed -e "s@^root::@root:*:@" < $BUILD_ROOT/etc/gshadow > $BUILD_ROOT/etc/gshadow.t && mv $BUILD_ROOT/etc/gshadow.t $BUILD_ROOT/etc/gshadow
-        fi
-        BUILD_USER_ABUILD_USED=true
+       if ! egrep '^abuild:' >/dev/null <$BUILD_ROOT/etc/passwd ; then
+           echo 'abuild::399:399:Autobuild:/home/abuild:/bin/bash' >>$BUILD_ROOT/etc/passwd
+           echo 'abuild:*:::::::' >>$BUILD_ROOT/etc/shadow # This is needed on Mandriva 2009
+           echo 'abuild:*::' >>$BUILD_ROOT/etc/gshadow # This is needed on Ubuntu
+           echo 'abuild::399:' >>$BUILD_ROOT/etc/group
+           mkdir -p $BUILD_ROOT/home/abuild
+           chown 399:399 $BUILD_ROOT/home/abuild
+       fi
+       if test -f $BUILD_ROOT/etc/shadow ; then
+           sed -e "s@^root::@root:*:@" < $BUILD_ROOT/etc/shadow > $BUILD_ROOT/etc/shadow.t && mv $BUILD_ROOT/etc/shadow.t $BUILD_ROOT/etc/shadow
+       fi
+       if test -f $BUILD_ROOT/etc/gshadow ; then
+           sed -e "s@^root::@root:*:@" < $BUILD_ROOT/etc/gshadow > $BUILD_ROOT/etc/gshadow.t && mv $BUILD_ROOT/etc/gshadow.t $BUILD_ROOT/etc/gshadow
+       fi
+       BUILD_USER_ABUILD_USED=true
     else
-        if egrep '^abuild:' >/dev/null <$BUILD_ROOT/etc/passwd ; then
-            rm -rf $BUILD_ROOT/home/abuild
-            egrep -v '^abuild:' <$BUILD_ROOT/etc/passwd >$BUILD_ROOT/etc/passwd.new
-            mv $BUILD_ROOT/etc/passwd.new $BUILD_ROOT/etc/passwd
-            egrep -v '^abuild:' <$BUILD_ROOT/etc/group >$BUILD_ROOT/etc/group.new
-            mv $BUILD_ROOT/etc/group.new $BUILD_ROOT/etc/group
-            if test -f $BUILD_ROOT/etc/shadow ; then
-              egrep -v '^abuild:' <$BUILD_ROOT/etc/shadow >$BUILD_ROOT/etc/shadow.new
-              mv $BUILD_ROOT/etc/shadow.new $BUILD_ROOT/etc/shadow
-            fi
-            if test -f $BUILD_ROOT/etc/gshadow ; then
-              egrep -v '^abuild:' <$BUILD_ROOT/etc/gshadow >$BUILD_ROOT/etc/gshadow.new
-              mv $BUILD_ROOT/etc/gshadow.new $BUILD_ROOT/etc/gshadow
-            fi
-        fi
+       if egrep '^abuild:' >/dev/null <$BUILD_ROOT/etc/passwd ; then
+           rm -rf $BUILD_ROOT/home/abuild
+           egrep -v '^abuild:' <$BUILD_ROOT/etc/passwd >$BUILD_ROOT/etc/passwd.new
+           mv $BUILD_ROOT/etc/passwd.new $BUILD_ROOT/etc/passwd
+           egrep -v '^abuild:' <$BUILD_ROOT/etc/group >$BUILD_ROOT/etc/group.new
+           mv $BUILD_ROOT/etc/group.new $BUILD_ROOT/etc/group
+           if test -f $BUILD_ROOT/etc/shadow ; then
+             egrep -v '^abuild:' <$BUILD_ROOT/etc/shadow >$BUILD_ROOT/etc/shadow.new
+             mv $BUILD_ROOT/etc/shadow.new $BUILD_ROOT/etc/shadow
+           fi
+           if test -f $BUILD_ROOT/etc/gshadow ; then
+             egrep -v '^abuild:' <$BUILD_ROOT/etc/gshadow >$BUILD_ROOT/etc/gshadow.new
+             mv $BUILD_ROOT/etc/gshadow.new $BUILD_ROOT/etc/gshadow
+           fi
+       fi
     fi
 
     if test "$BUILDTYPE" = spec ; then
-        TOPDIR=`chroot $BUILD_ROOT su -c "rpm --eval '%_topdir'" - $BUILD_USER`
+       TOPDIR=`chroot $BUILD_ROOT su -c "rpm --eval '%_topdir'" - $BUILD_USER`
     else
-        TOPDIR=/usr/src/packages
-        mkdir -p $BUILD_ROOT$TOPDIR
+       TOPDIR=/usr/src/packages
+       mkdir -p $BUILD_ROOT$TOPDIR
     fi
 
     rm -f $BUILD_ROOT/.build.packages
@@ -1316,7 +1316,7 @@ for SPECFILE in "${SPECFILES[@]}" ; do
     # nasty hack to prevent rpath on known paths
     # FIXME: do this only for suse
     if test -d "$BUILD_ROOT/etc/profile.d" ; then
-        echo "export SUSE_IGNORED_RPATHS=/etc/ld.so.conf" > "$BUILD_ROOT/etc/profile.d/buildsystem.sh"
+       echo "export SUSE_IGNORED_RPATHS=/etc/ld.so.conf" > "$BUILD_ROOT/etc/profile.d/buildsystem.sh"
     fi
 
     #
@@ -1324,45 +1324,45 @@ for SPECFILE in "${SPECFILES[@]}" ; do
     #
     rm -rf $BUILD_ROOT$TOPDIR
     for i in BUILD RPMS/`uname -m` RPMS/i386 RPMS/noarch SOURCES SPECS SRPMS BUILDROOT; do
-        mkdir -p $BUILD_ROOT$TOPDIR/$i
-        test $BUILD_USER = abuild && chown 399:399 $BUILD_ROOT$TOPDIR/$i
+       mkdir -p $BUILD_ROOT$TOPDIR/$i
+       test $BUILD_USER = abuild && chown 399:399 $BUILD_ROOT$TOPDIR/$i
     done
     test -e $BUILD_ROOT/exit && cleanup_and_exit 1
 
     mkdir -p $BUILD_ROOT$TOPDIR/SOURCES
     if test "$BUILDTYPE" = kiwi ; then
-        mkdir -p $BUILD_ROOT$TOPDIR/KIWI
-        if test "$MYSRCDIR" = $BUILD_ROOT/.build-srcdir ; then
-            mv "$MYSRCDIR"/* $BUILD_ROOT$TOPDIR/SOURCES/
-        else
-            if test -z "$LINKSOURCES" ; then
-                cp -dLR "$MYSRCDIR"/* $BUILD_ROOT$TOPDIR/SOURCES/
-            else
-                cp -lR "$MYSRCDIR"/* $BUILD_ROOT$TOPDIR/SOURCES/
-            fi
-            if test "$?" != 0 ; then
-                echo "source copy failed"
-                cleanup_and_exit 1
-            fi
-        fi
+       mkdir -p $BUILD_ROOT$TOPDIR/KIWI
+       if test "$MYSRCDIR" = $BUILD_ROOT/.build-srcdir ; then
+           mv "$MYSRCDIR"/* $BUILD_ROOT$TOPDIR/SOURCES/
+       else
+           if test -z "$LINKSOURCES" ; then
+               cp -dLR "$MYSRCDIR"/* $BUILD_ROOT$TOPDIR/SOURCES/
+           else
+               cp -lR "$MYSRCDIR"/* $BUILD_ROOT$TOPDIR/SOURCES/
+           fi
+           if test "$?" != 0 ; then
+               echo "source copy failed"
+               cleanup_and_exit 1
+           fi
+       fi
     else
-        cp -p "$MYSRCDIR"/* $BUILD_ROOT$TOPDIR/SOURCES/
+       cp -p "$MYSRCDIR"/* $BUILD_ROOT$TOPDIR/SOURCES/
     fi
     test "$MYSRCDIR" = $BUILD_ROOT/.build-srcdir && rm -rf "$MYSRCDIR"
     CHANGELOGARGS=
     test -n "$CHANGELOG" -a -f "$BUILD_ROOT/.build-changelog" && CHANGELOGARGS="--changelog $BUILD_ROOT/.build-changelog"
 
     if test "$BUILDTYPE" = spec ; then
-        # do buildrequires/release substitution
-        args=()
-        if test -n "$RELEASE"; then
-                args=(--release "$RELEASE")
-        fi
-        substitutedeps "${args[@]}" --dist "$BUILD_DIST" --archpath "$BUILD_ARCH" --configdir "$BUILD_DIR/configs" $CHANGELOGARGS "$BUILD_ROOT$TOPDIR/SOURCES/$SPECFILE" "$BUILD_ROOT/.spec.new" || cleanup_and_exit 1
-        # extract macros from configuration
-        getmacros --dist "$BUILD_DIST" --archpath "$BUILD_ARCH" --configdir "$BUILD_DIR/configs" > $BUILD_ROOT/root/.rpmmacros
-        if test -n "$BUILD_DEBUG" ; then
-            echo '
+       # do buildrequires/release substitution
+       args=()
+       if test -n "$RELEASE"; then
+               args=(--release "$RELEASE")
+       fi
+       substitutedeps "${args[@]}" --dist "$BUILD_DIST" --archpath "$BUILD_ARCH" --configdir "$BUILD_DIR/configs" $CHANGELOGARGS "$BUILD_ROOT$TOPDIR/SOURCES/$SPECFILE" "$BUILD_ROOT/.spec.new" || cleanup_and_exit 1
+       # extract macros from configuration
+       getmacros --dist "$BUILD_DIST" --archpath "$BUILD_ARCH" --configdir "$BUILD_DIR/configs" > $BUILD_ROOT/root/.rpmmacros
+       if test -n "$BUILD_DEBUG" ; then
+           echo '
 %prep %?_suse_insert_debug_package%%prep
 %package %?_suse_insert_debug_package%%package
 %suse_insert_debug_package \
@@ -1371,69 +1371,69 @@ for SPECFILE in "${SPECFILES[@]}" ; do
     %%debug_package
 
 ' >> $BUILD_ROOT/root/.rpmmacros
-        fi
-        test $BUILD_USER = abuild && cp -p $BUILD_ROOT/root/.rpmmacros $BUILD_ROOT/home/abuild/.rpmmacros
-        # extract optflags from configuration
-        getoptflags --dist "$BUILD_DIST" --configdir "$BUILD_DIR/configs" --archpath "$BUILD_ARCH" ${BUILD_DEBUG:+--debug} > $BUILD_ROOT/root/.rpmrc
-        test $BUILD_USER = abuild && cp -p $BUILD_ROOT/root/.rpmrc $BUILD_ROOT/home/abuild/.rpmrc
-        # case arm, extract changetarget
-        # this is restricted to arm to make sure it doesn't interfere with x86
-        buildarchtest=$( echo $BUILD_ARCH | grep -i arm )
-        if [ x"$buildarchtest" != x"" ]; then
-            echo "changing targetarch"
-            CHANGETARGET=$(getchangetarget --dist "$BUILD_DIST" --configdir "$BUILD_DIR/configs" --archpath "$BUILD_ARCH" )
-            echo "NEW TARGET: $CHANGETARGET"
-        fi
+       fi
+       test $BUILD_USER = abuild && cp -p $BUILD_ROOT/root/.rpmmacros $BUILD_ROOT/home/abuild/.rpmmacros
+       # extract optflags from configuration
+       getoptflags --dist "$BUILD_DIST" --configdir "$BUILD_DIR/configs" --archpath "$BUILD_ARCH" ${BUILD_DEBUG:+--debug} > $BUILD_ROOT/root/.rpmrc
+       test $BUILD_USER = abuild && cp -p $BUILD_ROOT/root/.rpmrc $BUILD_ROOT/home/abuild/.rpmrc
+       # case arm, extract changetarget
+       # this is restricted to arm to make sure it doesn't interfere with x86
+       buildarchtest=$( echo $BUILD_ARCH | grep -i arm )
+       if [ x"$buildarchtest" != x"" ]; then
+           echo "changing targetarch"
+           CHANGETARGET=$(getchangetarget --dist "$BUILD_DIST" --configdir "$BUILD_DIR/configs" --archpath "$BUILD_ARCH" )
+           echo "NEW TARGET: $CHANGETARGET"
+       fi
     fi
     if test -f $BUILD_ROOT/.spec.new ; then
-        if ! cmp -s $BUILD_ROOT$TOPDIR/SOURCES/$SPECFILE $BUILD_ROOT/.spec.new ; then
-            echo -----------------------------------------------------------------
-            echo I have the following modifications for $SPECFILE:
-            sed -e "/^%changelog/q" $BUILD_ROOT$TOPDIR/SOURCES/$SPECFILE > $BUILD_ROOT/.spec.t1
-            sed -e "/^%changelog/q" $BUILD_ROOT/.spec.new > $BUILD_ROOT/.spec.t2
-            diff $BUILD_ROOT/.spec.t1 $BUILD_ROOT/.spec.t2
-            rm -f $BUILD_ROOT/.spec.t1 $BUILD_ROOT/.spec.t2
-            mv $BUILD_ROOT/.spec.new $BUILD_ROOT$TOPDIR/SOURCES/$SPECFILE
-        else
-            rm -f $BUILD_ROOT/.spec.new
-        fi
+       if ! cmp -s $BUILD_ROOT$TOPDIR/SOURCES/$SPECFILE $BUILD_ROOT/.spec.new ; then
+           echo -----------------------------------------------------------------
+           echo I have the following modifications for $SPECFILE:
+           sed -e "/^%changelog/q" $BUILD_ROOT$TOPDIR/SOURCES/$SPECFILE > $BUILD_ROOT/.spec.t1
+           sed -e "/^%changelog/q" $BUILD_ROOT/.spec.new > $BUILD_ROOT/.spec.t2
+           diff $BUILD_ROOT/.spec.t1 $BUILD_ROOT/.spec.t2
+           rm -f $BUILD_ROOT/.spec.t1 $BUILD_ROOT/.spec.t2
+           mv $BUILD_ROOT/.spec.new $BUILD_ROOT$TOPDIR/SOURCES/$SPECFILE
+       else
+           rm -f $BUILD_ROOT/.spec.new
+       fi
     fi
 
     if test "$BUILDTYPE" = dsc ; then
-        rm -rf $BUILD_ROOT$TOPDIR/BUILD
-        mkdir -p $BUILD_ROOT$TOPDIR/SOURCES.DEB
-        test $BUILD_USER = abuild && chown 399:399 $BUILD_ROOT$TOPDIR
-        DEB_TRANSFORM=
-        DEB_SOURCEDIR=$TOPDIR/SOURCES
-        DEB_DSCFILE=$SPECFILE
-        for f in $BUILD_ROOT$TOPDIR/SOURCES/debian.* ; do
-            test -f $f && DEB_TRANSFORM=true
-        done
-        if test -n "$DEB_TRANSFORM" ; then
-            echo "running debian transformer..."
-            if ! debtransform $CHANGELOGARGS $BUILD_ROOT$TOPDIR/SOURCES $BUILD_ROOT$TOPDIR/SOURCES/$SPECFILE $BUILD_ROOT$TOPDIR/SOURCES.DEB ; then
-                echo "debian transforming failed."
-                cleanup_and_exit 1
-            fi
-            DEB_SOURCEDIR=$TOPDIR/SOURCES.DEB
-            for DEB_DSCFILE in $BUILD_ROOT/$DEB_SOURCEDIR/*.dsc ; do : ; done
-            DEB_DSCFILE="${DEB_DSCFILE##*/}"
-        fi
-        chroot $BUILD_ROOT su -c "dpkg-source -x $DEB_SOURCEDIR/$DEB_DSCFILE $TOPDIR/BUILD" - $BUILD_USER
+       rm -rf $BUILD_ROOT$TOPDIR/BUILD
+       mkdir -p $BUILD_ROOT$TOPDIR/SOURCES.DEB
+       test $BUILD_USER = abuild && chown 399:399 $BUILD_ROOT$TOPDIR
+       DEB_TRANSFORM=
+       DEB_SOURCEDIR=$TOPDIR/SOURCES
+       DEB_DSCFILE=$SPECFILE
+       for f in $BUILD_ROOT$TOPDIR/SOURCES/debian.* ; do
+           test -f $f && DEB_TRANSFORM=true
+       done
+       if test -n "$DEB_TRANSFORM" ; then
+           echo "running debian transformer..."
+           if ! debtransform $CHANGELOGARGS $BUILD_ROOT$TOPDIR/SOURCES $BUILD_ROOT$TOPDIR/SOURCES/$SPECFILE $BUILD_ROOT$TOPDIR/SOURCES.DEB ; then
+               echo "debian transforming failed."
+               cleanup_and_exit 1
+           fi
+           DEB_SOURCEDIR=$TOPDIR/SOURCES.DEB
+           for DEB_DSCFILE in $BUILD_ROOT/$DEB_SOURCEDIR/*.dsc ; do : ; done
+           DEB_DSCFILE="${DEB_DSCFILE##*/}"
+       fi
+       chroot $BUILD_ROOT su -c "dpkg-source -x $DEB_SOURCEDIR/$DEB_DSCFILE $TOPDIR/BUILD" - $BUILD_USER
     fi
 
     if test $BUILD_USER = abuild ; then
-        chown -R 399:399 $BUILD_ROOT$TOPDIR/*
+       chown -R 399:399 $BUILD_ROOT$TOPDIR/*
     else
-        chown -R root:root $BUILD_ROOT$TOPDIR/*
+       chown -R root:root $BUILD_ROOT$TOPDIR/*
     fi
     cd $BUILD_ROOT$TOPDIR/SOURCES || cleanup_and_exit 1
 
     echo -----------------------------------------------------------------
     if test "$BUILD_USER" = root ; then
-        echo ----- building $SPECFILE
+       echo ----- building $SPECFILE
     else
-        echo ----- building $SPECFILE "(user $BUILD_USER)"
+       echo ----- building $SPECFILE "(user $BUILD_USER)"
     fi
     echo -----------------------------------------------------------------
     echo -----------------------------------------------------------------
@@ -1443,178 +1443,178 @@ for SPECFILE in "${SPECFILES[@]}" ; do
     BUILD_SUCCEEDED=false
 
     if test -n "$OVERLAY" ; then
-        if -d "$OVERLAY"; then
-            pushd $OVERLAY
-            echo "Copying overlay to BUILD_ROOT"
-            tar -cpf - . | (cd $BUILD_ROOT ; tar -xvf -)
-            popd
-        else
-            echo "OVERLAY ($OVERLAY) is no directory - skipping"
-        fi
+       if -d "$OVERLAY"; then
+           pushd $OVERLAY
+           echo "Copying overlay to BUILD_ROOT"
+           tar -cpf - . | (cd $BUILD_ROOT ; tar -xvf -)
+           popd
+       else
+           echo "OVERLAY ($OVERLAY) is no directory - skipping"
+       fi
     fi
 
     if test -n "$RSYNCSRC" ; then
-        if test -n "$RSYNCDEST"; then
-            if test -d "$RSYNCSRC"; then
-                if ! test -d "$BUILD_ROOT/$RSYNCDEST"; then
-                    echo "ATTENTION! Creating target directory ($BUILD_ROOT/$RSYNCDEST) as its not there."
-                    mkdir -p $BUILD_ROOT/$RSYNCDEST
-                fi
-                echo "Running rsync ..."
-                rsync -av $RSYNCSRC/* $BUILD_ROOT/$RSYNCDEST/
-                chown -R 399:399 $BUILD_ROOT/$RSYNCDEST
-                RSYNCDONE=true
-                echo "... done"
-            else
-                echo "RSYNCSRC is no directory - skipping"
-            fi
-        else
-            echo "RSYNCSRC given, but not RSYNCDEST - skipping"
-        fi
+       if test -n "$RSYNCDEST"; then
+           if test -d "$RSYNCSRC"; then
+               if ! test -d "$BUILD_ROOT/$RSYNCDEST"; then
+                   echo "ATTENTION! Creating target directory ($BUILD_ROOT/$RSYNCDEST) as its not there."
+                   mkdir -p $BUILD_ROOT/$RSYNCDEST
+               fi
+               echo "Running rsync ..."
+               rsync -av $RSYNCSRC/* $BUILD_ROOT/$RSYNCDEST/
+               chown -R 399:399 $BUILD_ROOT/$RSYNCDEST
+               RSYNCDONE=true
+               echo "... done"
+           else
+               echo "RSYNCSRC is no directory - skipping"
+           fi
+       else
+           echo "RSYNCSRC given, but not RSYNCDEST - skipping"
+       fi
     fi
 
     if test "$BUILDTYPE" = spec ; then
-        test -z "$BUILD_RPM_BUILD_STAGE" && BUILD_RPM_BUILD_STAGE=-ba
-
-        # XXX: move _srcdefattr to macro file?
-        rpmbopts=("$BUILD_RPM_BUILD_STAGE" "--define" "_srcdefattr (-,root,root)")
-        if [ -n "$ABUILD_TARGET_ARCH" ]; then
-                rpmbopts[${#rpmbopts[@]}]="--target=$ABUILD_TARGET_ARCH"
-        fi
-        if [ -n "$BUILD_JOBS" ]; then
-                rpmbopts[${#rpmbopts[@]}]='--define'
-                rpmbopts[${#rpmbopts[@]}]="jobs $BUILD_JOBS"
-        fi
-        if [ -n "$DISTURL" ]; then
-                rpmbopts[${#rpmbopts[@]}]='--define'
-                rpmbopts[${#rpmbopts[@]}]="disturl $DISTURL"
-        fi
-        if test -s "$BUILD_ROOT/usr/lib/rpm/mandriva/macros" ; then
-                rpmbopts[${#rpmbopts[@]}]='--eval'
-                rpmbopts[${#rpmbopts[@]}]="%undefine _enable_debug_packages"
-        fi
-        if [ -n "$BUILD_DEBUG" ]; then
-                rpmbopts[${#rpmbopts[@]}]='--eval'
-                rpmbopts[${#rpmbopts[@]}]="%suse_insert_debug_package"
-        fi
-        if [ -n "$CHANGETARGET" ]; then
-                rpmbopts[${#rpmbopts[@]}]='--target'
-                rpmbopts[${#rpmbopts[@]}]="$CHANGETARGET"
-        fi
-        if [ -n "$RSYNCDONE" ] ; then
-                rpmbopts[${#rpmbopts[@]}]='--define'
-                rpmbopts[${#rpmbopts[@]}]="RSYNCDONE 1"
-        fi
-
-        rpmbuild=rpmbuild
-
-        test -x $BUILD_ROOT/usr/bin/rpmbuild || rpmbuild=rpm
-        # su involves a shell which would require even more
-        # complicated quoting to bypass than this
-        toshellscript $rpmbuild \
-                "${definesnstuff[@]}" \
-                "${rpmbopts[@]}" \
-                "$TOPDIR/SOURCES/$SPECFILE" \
-                > $BUILD_ROOT/.build.command
-        chmod 755 $BUILD_ROOT/.build.command
-        chroot $BUILD_ROOT su -c /.build.command - $BUILD_USER < /dev/null && BUILD_SUCCEEDED=true
+       test -z "$BUILD_RPM_BUILD_STAGE" && BUILD_RPM_BUILD_STAGE=-ba
+
+       # XXX: move _srcdefattr to macro file?
+       rpmbopts=("$BUILD_RPM_BUILD_STAGE" "--define" "_srcdefattr (-,root,root)")
+       if [ -n "$ABUILD_TARGET_ARCH" ]; then
+               rpmbopts[${#rpmbopts[@]}]="--target=$ABUILD_TARGET_ARCH"
+       fi
+       if [ -n "$BUILD_JOBS" ]; then
+               rpmbopts[${#rpmbopts[@]}]='--define'
+               rpmbopts[${#rpmbopts[@]}]="jobs $BUILD_JOBS"
+       fi
+       if [ -n "$DISTURL" ]; then
+               rpmbopts[${#rpmbopts[@]}]='--define'
+               rpmbopts[${#rpmbopts[@]}]="disturl $DISTURL"
+       fi
+       if test -s "$BUILD_ROOT/usr/lib/rpm/mandriva/macros" ; then
+               rpmbopts[${#rpmbopts[@]}]='--eval'
+               rpmbopts[${#rpmbopts[@]}]="%undefine _enable_debug_packages"
+       fi
+       if [ -n "$BUILD_DEBUG" ]; then
+               rpmbopts[${#rpmbopts[@]}]='--eval'
+               rpmbopts[${#rpmbopts[@]}]="%suse_insert_debug_package"
+       fi
+       if [ -n "$CHANGETARGET" ]; then
+               rpmbopts[${#rpmbopts[@]}]='--target'
+               rpmbopts[${#rpmbopts[@]}]="$CHANGETARGET"
+       fi
+       if [ -n "$RSYNCDONE" ] ; then
+               rpmbopts[${#rpmbopts[@]}]='--define'
+               rpmbopts[${#rpmbopts[@]}]="RSYNCDONE 1"
+       fi
+
+       rpmbuild=rpmbuild
+
+       test -x $BUILD_ROOT/usr/bin/rpmbuild || rpmbuild=rpm
+       # su involves a shell which would require even more
+       # complicated quoting to bypass than this
+       toshellscript $rpmbuild \
+               "${definesnstuff[@]}" \
+               "${rpmbopts[@]}" \
+               "$TOPDIR/SOURCES/$SPECFILE" \
+               > $BUILD_ROOT/.build.command
+       chmod 755 $BUILD_ROOT/.build.command
+       chroot $BUILD_ROOT su -c /.build.command - $BUILD_USER < /dev/null && BUILD_SUCCEEDED=true
     fi
 
     if test "$BUILDTYPE" = dsc ; then
-        # Checks to see if a build script should be used
-        # this allows the build environment to be manipulated
-        # and alternate build commands can be used
-        DSC_BUILD_CMD="dpkg-buildpackage -us -uc -rfakeroot-tcp"
-        if test -e $BUILD_ROOT/$TOPDIR/SOURCES/build.script ; then
-            echo "Sourcing build.script to build - it should normally run 'dpkg-buildpackage -us -uc -rfakeroot-tcp'"
-            DSC_BUILD_CMD="source $TOPDIR/SOURCES/build.script"
-            chmod +x $BUILD_ROOT/$TOPDIR/SOURCES/build.script
-        fi
-        chroot $BUILD_ROOT su -c "cd $TOPDIR/BUILD && $DSC_BUILD_CMD" - $BUILD_USER < /dev/null && BUILD_SUCCEEDED=true
-
-        mkdir -p $BUILD_ROOT/$TOPDIR/DEBS
-        for DEB in $BUILD_ROOT/$TOPDIR/*.deb ; do
-            test -e "$DEB" && mv "$DEB" "$BUILD_ROOT/$TOPDIR/DEBS"
-        done
-        # link sources over
-        ln $BUILD_ROOT/$DEB_SOURCEDIR/$DEB_DSCFILE $BUILD_ROOT/$TOPDIR/DEBS/
-        while read f ; do
-            ln $BUILD_ROOT/$DEB_SOURCEDIR/$f $BUILD_ROOT/$TOPDIR/DEBS/
-        done < <(sed -ne '/^Files:/,$s/^ ................................ [0-9][0-9]* //p' < $BUILD_ROOT/$DEB_SOURCEDIR/$DEB_DSCFILE)
+       # Checks to see if a build script should be used
+       # this allows the build environment to be manipulated
+       # and alternate build commands can be used
+       DSC_BUILD_CMD="dpkg-buildpackage -us -uc -rfakeroot-tcp"
+       if test -e $BUILD_ROOT/$TOPDIR/SOURCES/build.script ; then
+           echo "Sourcing build.script to build - it should normally run 'dpkg-buildpackage -us -uc -rfakeroot-tcp'"
+           DSC_BUILD_CMD="source $TOPDIR/SOURCES/build.script"
+           chmod +x $BUILD_ROOT/$TOPDIR/SOURCES/build.script
+       fi
+       chroot $BUILD_ROOT su -c "cd $TOPDIR/BUILD && $DSC_BUILD_CMD" - $BUILD_USER < /dev/null && BUILD_SUCCEEDED=true
+
+       mkdir -p $BUILD_ROOT/$TOPDIR/DEBS
+       for DEB in $BUILD_ROOT/$TOPDIR/*.deb ; do
+           test -e "$DEB" && mv "$DEB" "$BUILD_ROOT/$TOPDIR/DEBS"
+       done
+       # link sources over
+       ln $BUILD_ROOT/$DEB_SOURCEDIR/$DEB_DSCFILE $BUILD_ROOT/$TOPDIR/DEBS/
+       while read f ; do
+           ln $BUILD_ROOT/$DEB_SOURCEDIR/$f $BUILD_ROOT/$TOPDIR/DEBS/
+       done < <(sed -ne '/^Files:/,$s/^ ................................ [0-9][0-9]* //p' < $BUILD_ROOT/$DEB_SOURCEDIR/$DEB_DSCFILE)
     fi
 
     if test "$BUILDTYPE" = kiwi ; then
-        imagetype=$(perl -I$BUILD_DIR -MBuild::Kiwi -e Build::Kiwi::show $BUILD_ROOT/$TOPDIR/SOURCES/$SPECFILE imagetype)
-        imagename=$(perl -I$BUILD_DIR -MBuild::Kiwi -e Build::Kiwi::show $BUILD_ROOT/$TOPDIR/SOURCES/$SPECFILE filename)
-        imageversion=$(perl -I$BUILD_DIR -MBuild::Kiwi -e Build::Kiwi::show $BUILD_ROOT/$TOPDIR/SOURCES/$SPECFILE version)
-        # prepare rpms as source and createrepo on the repositories
-        if test -d $BUILD_ROOT/$TOPDIR/SOURCES/repos ; then
-            (
-            ln -sf $TOPDIR/SOURCES/repos $BUILD_ROOT/repos
-            cd $BUILD_ROOT/$TOPDIR/SOURCES/repos
-            for r in */* ; do
-                test -L $r && continue
-                test -d $r || continue
-                repo="$TOPDIR/SOURCES/repos/$r/"
-                # create compatibility link for old kiwi versions
-                rc="${r//:/:/}"
-                if test "$rc" != "$r" ; then
-                    rl="${rc//[^\/]}"
-                    rl="${rl//?/../}"
-                    mkdir -p "${rc%/*}"
-                    ln -s $rl$r "${rc%/*}/${rc##*/}"
-                    repo="$TOPDIR/SOURCES/repos/${rc%/*}/${rc##*/}/"
-                fi
-                if test "$imagetype" != product ; then
-                    echo "creating repodata for $repo"
-                    chroot $BUILD_ROOT createrepo "$repo"
-                fi
-            done
-            )
-        fi
-        # unpack root tar
-        for t in $BUILD_ROOT/$TOPDIR/SOURCES/root.tar* ; do
-            test -f $t || continue
-            mkdir -p $BUILD_ROOT/$TOPDIR/SOURCES/root
-            chroot $BUILD_ROOT tar -C $TOPDIR/SOURCES/root -xf "$TOPDIR/SOURCES/${t##*/}"
-        done
-        # fix script permissions
-        chmod a+x $BUILD_ROOT/$TOPDIR/SOURCES/*.sh 2>/dev/null
-        # unpack tar files in image directories
-        if test -d $BUILD_ROOT/$TOPDIR/SOURCES/images ; then
-            (
-            cd $BUILD_ROOT/$TOPDIR/SOURCES/images
-            for r in */* ; do
-                test -L $r && continue
-                test -d $r || continue
-                for t in $r/root.tar* ; do
-                    test -f $t || continue
-                    mkdir -p $r/root
-                    chroot $BUILD_ROOT tar -C $TOPDIR/SOURCES/images/$r/root -xf "$TOPDIR/SOURCES/images/$r/${t##*/}"
-                done
-                # fix script permissions
-                chmod a+x $BUILD_ROOT/$TOPDIR/SOURCES/images/$r/*.sh 2>/dev/null
-                # create compatibility link for old kiwi versions
-                rc="${r//:/:/}"
-                if test "$rc" != "$r" ; then
-                    rl="${rc//[^\/]}"
-                    rl="${rl//?/../}"
-                    mkdir -p "${rc%/*}"
-                    ln -s $rl$r "${rc%/*}/${rc##*/}"
-                fi
-            done
-            )
-        fi
-        rm -f $BUILD_ROOT/$TOPDIR/SOURCES/config.xml
-        ln -s $SPECFILE $BUILD_ROOT/$TOPDIR/SOURCES/config.xml
-        chroot $BUILD_ROOT su -c "kiwi --version" -
-        if test "$imagetype" = product ; then
-            echo "running kiwi --create-instsource..."
-            # runs always as abuild user
-            mkdir -p "$BUILD_ROOT/$TOPDIR/KIWIROOT"
-            chroot "$BUILD_ROOT" chown -R abuild.abuild "$TOPDIR"
-            # --instsource-local is only needed for openSUSE 11.1 and SLE 11 SP0 kiwi.
-            chroot "$BUILD_ROOT" su -c "APPID=- LANG=POSIX /usr/sbin/kiwi --root $TOPDIR/KIWIROOT -v -v --logfile terminal -p $TOPDIR/SOURCES --instsource-local --create-instsource $TOPDIR/SOURCES" - abuild < /dev/null && BUILD_SUCCEEDED=true
+       imagetype=$(perl -I$BUILD_DIR -MBuild::Kiwi -e Build::Kiwi::show $BUILD_ROOT/$TOPDIR/SOURCES/$SPECFILE imagetype)
+       imagename=$(perl -I$BUILD_DIR -MBuild::Kiwi -e Build::Kiwi::show $BUILD_ROOT/$TOPDIR/SOURCES/$SPECFILE filename)
+       imageversion=$(perl -I$BUILD_DIR -MBuild::Kiwi -e Build::Kiwi::show $BUILD_ROOT/$TOPDIR/SOURCES/$SPECFILE version)
+       # prepare rpms as source and createrepo on the repositories
+       if test -d $BUILD_ROOT/$TOPDIR/SOURCES/repos ; then
+           (
+           ln -sf $TOPDIR/SOURCES/repos $BUILD_ROOT/repos
+           cd $BUILD_ROOT/$TOPDIR/SOURCES/repos
+           for r in */* ; do
+               test -L $r && continue
+               test -d $r || continue
+               repo="$TOPDIR/SOURCES/repos/$r/"
+               # create compatibility link for old kiwi versions
+               rc="${r//:/:/}"
+               if test "$rc" != "$r" ; then
+                   rl="${rc//[^\/]}"
+                   rl="${rl//?/../}"
+                   mkdir -p "${rc%/*}"
+                   ln -s $rl$r "${rc%/*}/${rc##*/}"
+                   repo="$TOPDIR/SOURCES/repos/${rc%/*}/${rc##*/}/"
+               fi
+               if test "$imagetype" != product ; then
+                   echo "creating repodata for $repo"
+                   chroot $BUILD_ROOT createrepo "$repo"
+               fi
+           done
+           )
+       fi
+       # unpack root tar
+       for t in $BUILD_ROOT/$TOPDIR/SOURCES/root.tar* ; do
+           test -f $t || continue
+           mkdir -p $BUILD_ROOT/$TOPDIR/SOURCES/root
+           chroot $BUILD_ROOT tar -C $TOPDIR/SOURCES/root -xf "$TOPDIR/SOURCES/${t##*/}"
+       done
+       # fix script permissions
+       chmod a+x $BUILD_ROOT/$TOPDIR/SOURCES/*.sh 2>/dev/null
+       # unpack tar files in image directories
+       if test -d $BUILD_ROOT/$TOPDIR/SOURCES/images ; then
+           (
+           cd $BUILD_ROOT/$TOPDIR/SOURCES/images
+           for r in */* ; do
+               test -L $r && continue
+               test -d $r || continue
+               for t in $r/root.tar* ; do
+                   test -f $t || continue
+                   mkdir -p $r/root
+                   chroot $BUILD_ROOT tar -C $TOPDIR/SOURCES/images/$r/root -xf "$TOPDIR/SOURCES/images/$r/${t##*/}"
+               done
+               # fix script permissions
+               chmod a+x $BUILD_ROOT/$TOPDIR/SOURCES/images/$r/*.sh 2>/dev/null
+               # create compatibility link for old kiwi versions
+               rc="${r//:/:/}"
+               if test "$rc" != "$r" ; then
+                   rl="${rc//[^\/]}"
+                   rl="${rl//?/../}"
+                   mkdir -p "${rc%/*}"
+                   ln -s $rl$r "${rc%/*}/${rc##*/}"
+               fi
+           done
+           )
+       fi
+       rm -f $BUILD_ROOT/$TOPDIR/SOURCES/config.xml
+       ln -s $SPECFILE $BUILD_ROOT/$TOPDIR/SOURCES/config.xml
+       chroot $BUILD_ROOT su -c "kiwi --version" -
+       if test "$imagetype" = product ; then
+           echo "running kiwi --create-instsource..."
+           # runs always as abuild user
+           mkdir -p "$BUILD_ROOT/$TOPDIR/KIWIROOT"
+           chroot "$BUILD_ROOT" chown -R abuild.abuild "$TOPDIR"
+           # --instsource-local is only needed for openSUSE 11.1 and SLE 11 SP0 kiwi.
+           chroot "$BUILD_ROOT" su -c "APPID=- LANG=POSIX /usr/sbin/kiwi --root $TOPDIR/KIWIROOT -v -v --logfile terminal -p $TOPDIR/SOURCES --instsource-local --create-instsource $TOPDIR/SOURCES" - abuild < /dev/null && BUILD_SUCCEEDED=true
 ### This block is obsolete with current kiwi versions, only needed for kiwi 3.01 version
 #            for i in $BUILD_ROOT/$TOPDIR/KIWIROOT/main/* ; do
 #                test -d "$i" || continue
@@ -1624,130 +1624,130 @@ for SPECFILE in "${SPECFILES[@]}" ; do
 #                chroot $BUILD_ROOT su -c "suse-isolinux $TOPDIR/KIWIROOT/main/$n $TOPDIR/KIWI/$n.iso" - $BUILD_USER
 #            done
 
-            # move created product to correct destination
-            for i in $BUILD_ROOT/$TOPDIR/KIWIROOT/main/* ; do
-                test -e "$i" || continue
-                f=${i##*/}
-                case $f in
-                    *.iso) mv $i $BUILD_ROOT/$TOPDIR/KIWI/. ;;
-                    scripts) ;;
-                    *0) ;;
-                    *) test -d $i && mv $i $BUILD_ROOT/$TOPDIR/KIWI/. ;;
-                esac
-            done
-        else
-            BUILD_SUCCEEDED=true
-            if [ -z "$RUNNING_IN_VM" ]; then
-                # NOTE: this must be done with the outer system, because it loads the dm-mod kernel modules, which needs to fit to the kernel.
-                echo "starting device mapper for kiwi..."
-                [ -x /etc/init.d/boot.device-mapper ] && /etc/init.d/boot.device-mapper start
-            fi
-            for imgtype in $imagetype ; do
-                echo "running kiwi --prepare for $imgtype..."
-                # Do not use $BUILD_USER here, since we always need root permissions
-                if chroot $BUILD_ROOT su -c "cd $TOPDIR/SOURCES && kiwi --prepare $TOPDIR/SOURCES --logfile terminal --root $TOPDIR/KIWIROOT-$imgtype" - root < /dev/null ; then
-                    echo "running kiwi --create for $imgtype..."
-                    mkdir -p $BUILD_ROOT/$TOPDIR/KIWI-$imgtype
-                    chroot $BUILD_ROOT su -c "cd $TOPDIR/SOURCES && kiwi --create $TOPDIR/KIWIROOT-$imgtype --logfile terminal --type $imgtype -d $TOPDIR/KIWI-$imgtype" - root < /dev/null || cleanup_and_exit 1
-                else
-                    cleanup_and_exit 1
-                fi
-            done
-
-            # create tar.gz of images, in case it makes sense
-            imagearch=`uname -m`
-            buildnum=""
-              if test -n "$RELEASE"; then
-                buildnum="-Build$RELEASE"
-            fi
-            for imgtype in $imagetype ; do
-                case "$imgtype" in
-                    oem)
-                                pushd $BUILD_ROOT/$TOPDIR/KIWI-oem > /dev/null
-                        echo "compressing images... "
-                        tar cvjfS $BUILD_ROOT/$TOPDIR/KIWI/$imagename.$imagearch-$imageversion$buildnum-raw.tar.bz2 \
-                          --exclude=$imagename.$imagearch-$imageversion.iso \
-                          --exclude=$imagename.$imagearch-$imageversion.raw \
-                          * || cleanup_and_exit 1
-                        if [ -e $imagename.$imagearch-$imageversion.iso ]; then
-                          echo "Copy iso file and create md5..."
-                          mv $imagename.$imagearch-$imageversion.iso \
-                             $BUILD_ROOT/$TOPDIR/KIWI/$imagename.$imagearch-$imageversion$buildnum.iso || cleanup_and_exit 1
-                                  pushd $BUILD_ROOT/$TOPDIR/KIWI > /dev/null
-                          md5sum $imagename.$imagearch-$imageversion$buildnum.iso \
-                                 > "$imagename.$imagearch-$imageversion$buildnum.iso.md5" || cleanup_and_exit 1
-                          popd > /dev/null
-                        fi
-                        if [ -e $imagename.$imagearch-$imageversion.raw ]; then
-                          echo "Copy raw file and create md5..."
-                          mv $imagename.$imagearch-$imageversion.raw \
-                             $BUILD_ROOT/$TOPDIR/KIWI/$imagename.$imagearch-$imageversion$buildnum.raw || cleanup_and_exit 1
-                                  pushd $BUILD_ROOT/$TOPDIR/KIWI > /dev/null
-                          bzip2 $imagename.$imagearch-$imageversion$buildnum.raw && \
-                          md5sum $imagename.$imagearch-$imageversion$buildnum.raw.bz2 \
-                                 > "$imagename.$imagearch-$imageversion$buildnum.raw.bz2.md5" || cleanup_and_exit 1
-                          popd > /dev/null
-                        fi
-                        popd > /dev/null
-                        ;;
-                    vmx)
-                        pushd $BUILD_ROOT/$TOPDIR/KIWI-vmx > /dev/null
-                        echo "compressing images... "
-                                if [ -e $imagename.$imagearch-$imageversion.xenconfig ] ; then
-                          tar cvjfS $BUILD_ROOT/$TOPDIR/KIWI/$imagename.$imagearch-$imageversion$buildnum-xenvmx.tar.bz2 \
-                            $imagename.$imagearch-$imageversion.raw \
-                            $imagename.$imagearch-$imageversion.xenconfig || cleanup_and_exit 1
-                        else
-                          tar cvjfS $BUILD_ROOT/$TOPDIR/KIWI/$imagename.$imagearch-$imageversion$buildnum-vmx.tar.bz2 \
-                            $imagename.$imagearch-$imageversion.vmx \
-                            $imagename.$imagearch-$imageversion.vmdk || cleanup_and_exit 1
-                              if [ -e $imagename.$imagearch-$imageversion.ovf ] ; then
-                            tar cvjfS $BUILD_ROOT/$TOPDIR/KIWI/$imagename.$imagearch-$imageversion$buildnum-ovf.tar.bz2 \
-                              $imagename.$imagearch-$imageversion.ovf \
-                              $imagename.$imagearch-$imageversion-disk*.vmdk || cleanup_and_exit 1
-                              fi
-                        fi
-                                popd > /dev/null
-                        ;;
-                    xen)
-                        pushd $BUILD_ROOT/$TOPDIR/KIWI-xen > /dev/null
-                        echo "compressing images... "
-                        tar cvjfS $BUILD_ROOT/$TOPDIR/KIWI/$imagename.$imagearch-$imageversion$buildnum-xen.tar.bz2 \
-                          `grep ^kernel $imagename.$imagearch-$imageversion.xenconfig | cut -d'"'  -f2` \
-                          `grep ^ramdisk $imagename.$imagearch-$imageversion.xenconfig | cut -d'"'  -f2` \
-                          $imagename.$imagearch-$imageversion.xenconfig \
-                          $imagename.$imagearch-$imageversion || cleanup_and_exit 1
-                                popd > /dev/null
-                        ;;
-                    pxe)
-                        pushd $BUILD_ROOT/$TOPDIR/KIWI-pxe > /dev/null
-                        echo "compressing images... "
-                        tar cvjfS $BUILD_ROOT/$TOPDIR/KIWI/$imagename.$imagearch-$imageversion$buildnum-pxe.tar.bz2 \
-                          $imagename.$imagearch-$imageversion* \
-                          initrd-* || cleanup_and_exit 1
-                                popd > /dev/null
-                        ;;
-                    iso)
-                        pushd $BUILD_ROOT/$TOPDIR/KIWI-iso > /dev/null
-                        echo "creating md5 sum for iso images... "
-                            for i in *.iso; do
-                          pushd $BUILD_ROOT/$TOPDIR/KIWI/ > /dev/null
-                                mv $BUILD_ROOT/$TOPDIR/KIWI-iso/$i ${i%.iso}$buildnum.iso || cleanup_and_exit 1
-                                md5sum ${i%.iso}$buildnum.iso > ${i%.iso}$buildnum.iso.md5 || cleanup_and_exit 1
-                                  popd > /dev/null
-                        done
-                                popd > /dev/null
-                        ;;
-                    *)
-                        pushd $BUILD_ROOT/$TOPDIR/KIWI-$imgtype > /dev/null
-                        echo "compressing unkown images... "
-                        tar cvjfS $BUILD_ROOT/$TOPDIR/KIWI/$imagename.$imagearch-$imageversion$buildnum-$imgtype.tar.bz2 \
-                          * || cleanup_and_exit 1
-                                popd > /dev/null
-                        ;;
-                esac
-            done
-        fi
+           # move created product to correct destination
+           for i in $BUILD_ROOT/$TOPDIR/KIWIROOT/main/* ; do
+               test -e "$i" || continue
+               f=${i##*/}
+               case $f in
+                   *.iso) mv $i $BUILD_ROOT/$TOPDIR/KIWI/. ;;
+                   scripts) ;;
+                   *0) ;;
+                   *) test -d $i && mv $i $BUILD_ROOT/$TOPDIR/KIWI/. ;;
+               esac
+           done
+       else
+           BUILD_SUCCEEDED=true
+           if [ -z "$RUNNING_IN_VM" ]; then
+               # NOTE: this must be done with the outer system, because it loads the dm-mod kernel modules, which needs to fit to the kernel.
+               echo "starting device mapper for kiwi..."
+               [ -x /etc/init.d/boot.device-mapper ] && /etc/init.d/boot.device-mapper start
+           fi
+           for imgtype in $imagetype ; do
+               echo "running kiwi --prepare for $imgtype..."
+               # Do not use $BUILD_USER here, since we always need root permissions
+               if chroot $BUILD_ROOT su -c "cd $TOPDIR/SOURCES && kiwi --prepare $TOPDIR/SOURCES --logfile terminal --root $TOPDIR/KIWIROOT-$imgtype" - root < /dev/null ; then
+                   echo "running kiwi --create for $imgtype..."
+                   mkdir -p $BUILD_ROOT/$TOPDIR/KIWI-$imgtype
+                   chroot $BUILD_ROOT su -c "cd $TOPDIR/SOURCES && kiwi --create $TOPDIR/KIWIROOT-$imgtype --logfile terminal --type $imgtype -d $TOPDIR/KIWI-$imgtype" - root < /dev/null || cleanup_and_exit 1
+               else
+                   cleanup_and_exit 1
+               fi
+           done
+
+           # create tar.gz of images, in case it makes sense
+           imagearch=`uname -m`
+           buildnum=""
+             if test -n "$RELEASE"; then
+               buildnum="-Build$RELEASE"
+           fi
+           for imgtype in $imagetype ; do
+               case "$imgtype" in
+                   oem)
+                               pushd $BUILD_ROOT/$TOPDIR/KIWI-oem > /dev/null
+                       echo "compressing images... "
+                       tar cvjfS $BUILD_ROOT/$TOPDIR/KIWI/$imagename.$imagearch-$imageversion$buildnum-raw.tar.bz2 \
+                         --exclude=$imagename.$imagearch-$imageversion.iso \
+                         --exclude=$imagename.$imagearch-$imageversion.raw \
+                         * || cleanup_and_exit 1
+                       if [ -e $imagename.$imagearch-$imageversion.iso ]; then
+                         echo "Copy iso file and create md5..."
+                         mv $imagename.$imagearch-$imageversion.iso \
+                            $BUILD_ROOT/$TOPDIR/KIWI/$imagename.$imagearch-$imageversion$buildnum.iso || cleanup_and_exit 1
+                                 pushd $BUILD_ROOT/$TOPDIR/KIWI > /dev/null
+                         md5sum $imagename.$imagearch-$imageversion$buildnum.iso \
+                                > "$imagename.$imagearch-$imageversion$buildnum.iso.md5" || cleanup_and_exit 1
+                         popd > /dev/null
+                       fi
+                       if [ -e $imagename.$imagearch-$imageversion.raw ]; then
+                         echo "Copy raw file and create md5..."
+                         mv $imagename.$imagearch-$imageversion.raw \
+                            $BUILD_ROOT/$TOPDIR/KIWI/$imagename.$imagearch-$imageversion$buildnum.raw || cleanup_and_exit 1
+                                 pushd $BUILD_ROOT/$TOPDIR/KIWI > /dev/null
+                         bzip2 $imagename.$imagearch-$imageversion$buildnum.raw && \
+                         md5sum $imagename.$imagearch-$imageversion$buildnum.raw.bz2 \
+                                > "$imagename.$imagearch-$imageversion$buildnum.raw.bz2.md5" || cleanup_and_exit 1
+                         popd > /dev/null
+                       fi
+                       popd > /dev/null
+                       ;;
+                   vmx)
+                       pushd $BUILD_ROOT/$TOPDIR/KIWI-vmx > /dev/null
+                       echo "compressing images... "
+                               if [ -e $imagename.$imagearch-$imageversion.xenconfig ] ; then
+                         tar cvjfS $BUILD_ROOT/$TOPDIR/KIWI/$imagename.$imagearch-$imageversion$buildnum-xenvmx.tar.bz2 \
+                           $imagename.$imagearch-$imageversion.raw \
+                           $imagename.$imagearch-$imageversion.xenconfig || cleanup_and_exit 1
+                       else
+                         tar cvjfS $BUILD_ROOT/$TOPDIR/KIWI/$imagename.$imagearch-$imageversion$buildnum-vmx.tar.bz2 \
+                           $imagename.$imagearch-$imageversion.vmx \
+                           $imagename.$imagearch-$imageversion.vmdk || cleanup_and_exit 1
+                             if [ -e $imagename.$imagearch-$imageversion.ovf ] ; then
+                           tar cvjfS $BUILD_ROOT/$TOPDIR/KIWI/$imagename.$imagearch-$imageversion$buildnum-ovf.tar.bz2 \
+                             $imagename.$imagearch-$imageversion.ovf \
+                             $imagename.$imagearch-$imageversion-disk*.vmdk || cleanup_and_exit 1
+                             fi
+                       fi
+                               popd > /dev/null
+                       ;;
+                   xen)
+                       pushd $BUILD_ROOT/$TOPDIR/KIWI-xen > /dev/null
+                       echo "compressing images... "
+                       tar cvjfS $BUILD_ROOT/$TOPDIR/KIWI/$imagename.$imagearch-$imageversion$buildnum-xen.tar.bz2 \
+                         `grep ^kernel $imagename.$imagearch-$imageversion.xenconfig | cut -d'"'  -f2` \
+                         `grep ^ramdisk $imagename.$imagearch-$imageversion.xenconfig | cut -d'"'  -f2` \
+                         $imagename.$imagearch-$imageversion.xenconfig \
+                         $imagename.$imagearch-$imageversion || cleanup_and_exit 1
+                               popd > /dev/null
+                       ;;
+                   pxe)
+                       pushd $BUILD_ROOT/$TOPDIR/KIWI-pxe > /dev/null
+                       echo "compressing images... "
+                       tar cvjfS $BUILD_ROOT/$TOPDIR/KIWI/$imagename.$imagearch-$imageversion$buildnum-pxe.tar.bz2 \
+                         $imagename.$imagearch-$imageversion* \
+                         initrd-* || cleanup_and_exit 1
+                               popd > /dev/null
+                       ;;
+                   iso)
+                       pushd $BUILD_ROOT/$TOPDIR/KIWI-iso > /dev/null
+                       echo "creating md5 sum for iso images... "
+                           for i in *.iso; do
+                         pushd $BUILD_ROOT/$TOPDIR/KIWI/ > /dev/null
+                               mv $BUILD_ROOT/$TOPDIR/KIWI-iso/$i ${i%.iso}$buildnum.iso || cleanup_and_exit 1
+                               md5sum ${i%.iso}$buildnum.iso > ${i%.iso}$buildnum.iso.md5 || cleanup_and_exit 1
+                                 popd > /dev/null
+                       done
+                               popd > /dev/null
+                       ;;
+                   *)
+                       pushd $BUILD_ROOT/$TOPDIR/KIWI-$imgtype > /dev/null
+                       echo "compressing unkown images... "
+                       tar cvjfS $BUILD_ROOT/$TOPDIR/KIWI/$imagename.$imagearch-$imageversion$buildnum-$imgtype.tar.bz2 \
+                         * || cleanup_and_exit 1
+                               popd > /dev/null
+                       ;;
+               esac
+           done
+       fi
     fi
 
     test "$BUILD_SUCCEEDED" = true || cleanup_and_exit 1
@@ -1761,14 +1761,14 @@ if test -n "$RPMS" -a -n "$BUILD_USER_ABUILD_USED" ; then
     echo "... checking for files with abuild user/group"
     BADFILE=
     while read un gn fn ; do
-        if test "$un" = abuild -o "$gn" = abuild -o "$un" = 399 -o "$gn" = 399 ; then
-            echo "  $un $gn $fn"
-            BADFILE=true
-        fi
+       if test "$un" = abuild -o "$gn" = abuild -o "$un" = 399 -o "$gn" = 399 ; then
+           echo "  $un $gn $fn"
+           BADFILE=true
+       fi
     done < <(rpm -qp --qf '[%{FILEUSERNAME} %{FILEGROUPNAME} %{FILENAMES}\n]' $RPMS)
     if test -n "$BADFILE" ; then
-        echo "please fix your filelist (e.g. add defattr)"
-        cleanup_and_exit 1
+       echo "please fix your filelist (e.g. add defattr)"
+       cleanup_and_exit 1
     fi
 fi
 
@@ -1777,21 +1777,21 @@ if test -n "$RPMS" -a -d "$BUILD_ROOT/usr/lib/build/checks" ; then
     export PNAME=""
     export DO_RPM_REMOVE=true
     for SRPM in $BUILD_ROOT/$TOPDIR/SRPMS/*src.rpm ; do
-        test -f "$SRPM" && PNAME=`rpm --nodigest --nosignature -qp --qf "%{NAME}" $SRPM`
+       test -f "$SRPM" && PNAME=`rpm --nodigest --nosignature -qp --qf "%{NAME}" $SRPM`
     done
     for CHECKSCRIPT in $BUILD_ROOT/usr/lib/build/checks/* ; do
-        echo "... running `basename $CHECKSCRIPT`"
-        $CHECKSCRIPT || cleanup_and_exit 1
+       echo "... running `basename $CHECKSCRIPT`"
+       $CHECKSCRIPT || cleanup_and_exit 1
     done
     umount -n $BUILD_ROOT/proc 2> /dev/null
 fi
 
 if test -n "$RPMS" -a "$DO_CHECKS" != "false" -a -x "$BUILD_ROOT/opt/testing/bin/rpmlint" -a -d "$BUILD_ROOT/$TOPDIR/RPMS" ; then
     LINT_RPM_FILE_LIST=($(find $BUILD_ROOT/$TOPDIR/RPMS \
-        \( -name "*-debuginfo-*" -o -name "*-debugsource-*" \
-        -o -name "*-32bit-*" -o -name "*-64bit-*" \
-        -o -name "*-x86-*" -o -name "*-ia32-*" \) -prune \
-        -o -type f -name '*.rpm' -print))
+       \( -name "*-debuginfo-*" -o -name "*-debugsource-*" \
+       -o -name "*-32bit-*" -o -name "*-64bit-*" \
+       -o -name "*-x86-*" -o -name "*-ia32-*" \) -prune \
+       -o -type f -name '*.rpm' -print))
     SRPM_FILE_LIST=($(find $BUILD_ROOT/$TOPDIR/SRPMS -type f -name "*.rpm"))
     echo
     echo "RPMLINT report:"
@@ -1801,9 +1801,9 @@ fi
 
 if test \( -n "$RPMS" -o -n "$DEBS" \) -a -n "$CREATE_BASELIBS" -a \( -d "$BUILD_ROOT/$TOPDIR/RPMS" -o -d "$BUILD_ROOT/$TOPDIR/DEBS" \)  ; then
     if test -f $BUILD_ROOT/usr/lib/build/mkbaselibs -o "$CREATE_BASELIBS" != internal ; then
-        mount -n -tproc none $BUILD_ROOT/proc 2> /dev/null
-        create_baselibs
-        umount -n $BUILD_ROOT/proc 2> /dev/null
+       mount -n -tproc none $BUILD_ROOT/proc 2> /dev/null
+       create_baselibs
+       umount -n $BUILD_ROOT/proc 2> /dev/null
     fi
 fi
 
@@ -1814,15 +1814,15 @@ if test -n "$RUNNING_IN_VM" -a -n "$VM_SWAP"; then
     swapoff "$VM_SWAP"
     args="--padstart 512 --padend 512 -v"
     case "$BUILDTYPE" in
-        spec)
-            computeblocklists $args $TOPDIR/RPMS/*/*.rpm $TOPDIR/SRPMS/* > "$VM_SWAP"
-            ;;
-        dsc)
-            computeblocklists $args $TOPDIR/DEBS/*.deb $TOPDIR/SOURCES.DEB/* > "$VM_SWAP"
-            ;;
-        kiwi)
-            computeblocklists $args $TOPDIR/KIWI/* > "$VM_SWAP"
-            ;;
+       spec)
+           computeblocklists $args $TOPDIR/RPMS/*/*.rpm $TOPDIR/SRPMS/* > "$VM_SWAP"
+           ;;
+       dsc)
+           computeblocklists $args $TOPDIR/DEBS/*.deb $TOPDIR/SOURCES.DEB/* > "$VM_SWAP"
+           ;;
+       kiwi)
+           computeblocklists $args $TOPDIR/KIWI/* > "$VM_SWAP"
+           ;;
     esac || cleanup_and_exit 1
 fi
 
index 2a8771a..818501c 100755 (executable)
@@ -55,8 +55,8 @@ if (@ARGV == 2 && $ARGV[0] eq '--file') {
     while ($file ne '') {
       my @c = grep {/\Q$file\E/} @changes;
       if (@c) {
-        @changes = @c;
-        last;
+       @changes = @c;
+       last;
       }
       last unless $file =~ s/[-.][^-.]*$//;
     }
index cea3aa0..6f0fe9c 100644 (file)
@@ -5,8 +5,8 @@ set_build_arch()
     : ${BUILD_HOST_ARCH:=`uname -m`}
 
     if [ -z "$BUILD_ARCH" ]; then
-        BUILD_ARCH="$BUILD_HOST_ARCH"
-        test i686 != "$BUILD_ARCH" || BUILD_ARCH=i586 # XXX: why?
+       BUILD_ARCH="$BUILD_HOST_ARCH"
+       test i686 != "$BUILD_ARCH" || BUILD_ARCH=i586 # XXX: why?
     fi
 
     case $BUILD_ARCH in
@@ -16,11 +16,11 @@ set_build_arch()
       x86_64) BUILD_ARCH="x86_64:i686:i586:i486:i386" ;;
     esac
     if test "$BUILD_ARCH" != "${BUILD_ARCH#i686}" ; then
-        cpuflags=`grep ^flags /proc/cpuinfo`
-        cpuflags="$cpuflags "
-        test "$cpuflags" = "${cpuflags/ cx8 /}" -o "$cpuflags" = "${cpuflags/ cmov /}" && {
-            echo "Your cpu doesn't support i686 rpms. Exit."
-            exit 1
-        }
+       cpuflags=`grep ^flags /proc/cpuinfo`
+       cpuflags="$cpuflags "
+       test "$cpuflags" = "${cpuflags/ cx8 /}" -o "$cpuflags" = "${cpuflags/ cmov /}" && {
+           echo "Your cpu doesn't support i686 rpms. Exit."
+           exit 1
+       }
     fi
 }
index c93b3cb..ff8cebf 100755 (executable)
@@ -75,16 +75,16 @@ for my $file (@ARGV) {
     } else {
       # blocks are non-contiguous
       if($lastblock+1 != $block) {
-        # check if we skipped some that form a range
-        if($firstblock != $lastblock) {
-          printf "-$lastblock";
-        }
-        print " $block";
-        $firstblock = $block;
+       # check if we skipped some that form a range
+       if($firstblock != $lastblock) {
+         printf "-$lastblock";
+       }
+       print " $block";
+       $firstblock = $block;
       }
       # last block, check if contiguous
       if($b+1==$blocks && $lastblock+1 == $block) {
-        print "-$block";
+       print "-$block";
       }
     }
     $lastblock = $block;
index a1fec28..9258262 100755 (executable)
@@ -29,7 +29,7 @@ my $repomdparser = {
     data => {
       _start => \&repomd_handle_data_start,
       location => {
-        _start => \&repomd_handle_location,
+       _start => \&repomd_handle_location,
       },
     },
   },
@@ -45,17 +45,17 @@ my $primaryparser = {
       version => { _start => \&primary_handle_version },
       'time' => { _start => \&primary_handle_time },
       format => {
-        'rpm:provides' => { 'rpm:entry' => { _start => \&primary_handle_package_provides }, },
-        'rpm:requires' => { 'rpm:entry' => { _start => \&primary_handle_package_requires }, },
-        'rpm:conflicts' => { 'rpm:entry' => { _start => \&primary_handle_package_conflicts }, },
-        'rpm:obsoletes' => { 'rpm:entry' => { _start => \&primary_handle_package_obsoletes }, },
-        'rpm:buildhost' => { _text => \&primary_collect_text, _end => \&primary_store_text },
-        'rpm:sourcerpm' => { _text => \&primary_collect_text, _end => \&primary_store_text },
-        file => {
-          _start => \&primary_handle_file_start,
-          _text => \&primary_collect_text,
-          _end => \&primary_handle_file_end
-        },
+       'rpm:provides' => { 'rpm:entry' => { _start => \&primary_handle_package_provides }, },
+       'rpm:requires' => { 'rpm:entry' => { _start => \&primary_handle_package_requires }, },
+       'rpm:conflicts' => { 'rpm:entry' => { _start => \&primary_handle_package_conflicts }, },
+       'rpm:obsoletes' => { 'rpm:entry' => { _start => \&primary_handle_package_obsoletes }, },
+       'rpm:buildhost' => { _text => \&primary_collect_text, _end => \&primary_store_text },
+       'rpm:sourcerpm' => { _text => \&primary_collect_text, _end => \&primary_store_text },
+       file => {
+         _start => \&primary_handle_file_start,
+         _text => \&primary_collect_text,
+         _end => \&primary_handle_file_end
+       },
       },
       location => { _start => \&primary_handle_package_location },
     },
@@ -186,20 +186,20 @@ sub primary_handle_package_end
     $arch = 'src' if $pkg->{'arch'} eq 'nosrc';
     next if ($arch eq 'src' && $opt_nosrc);
     if(exists($old_seen->{$pkg->{'name'}}->{$arch})) {
-        my $pv = $old_seen->{$pkg->{'name'}}->{$arch}->{'ver'};
-        my $rv = $pkg->{'ver'}.'-'.$pkg->{'rel'};
-        my $vv = Build::Rpm::verscmp($pv, $rv, 0);
-        if($vv < 0)
-        {
+       my $pv = $old_seen->{$pkg->{'name'}}->{$arch}->{'ver'};
+       my $rv = $pkg->{'ver'}.'-'.$pkg->{'rel'};
+       my $vv = Build::Rpm::verscmp($pv, $rv, 0);
+       if($vv < 0)
+       {
       print $old_seen->{$pkg->{'name'}}->{$arch}->{'loc'}."\n";
       $old_seen->{$pkg->{'name'}}->{$arch}->{'ver'} = $pkg->{'ver'}.'-'.$pkg->{'rel'};
       $old_seen->{$pkg->{'name'}}->{$arch}->{'loc'} = $pkg->{'baseurl'} . $pkg->{'location'};
-        } else {
+       } else {
       print $pkg->{'baseurl'} . $pkg->{'location'}."\n";
-        }
+       }
     } else {
-        $old_seen->{$pkg->{'name'}}->{$arch}->{'ver'} = $pkg->{'ver'}.'-'.$pkg->{'rel'};
-        $old_seen->{$pkg->{'name'}}->{$arch}->{'loc'} = $pkg->{'baseurl'} . $pkg->{'location'};
+       $old_seen->{$pkg->{'name'}}->{$arch}->{'ver'} = $pkg->{'ver'}.'-'.$pkg->{'rel'};
+       $old_seen->{$pkg->{'name'}}->{$arch}->{'loc'} = $pkg->{'baseurl'} . $pkg->{'location'};
     }
       }
       shift @packages;
@@ -303,14 +303,14 @@ sub primary_handle_package_provides
 sub deps2string
 {
   return join(' ', map {
-        my $s = $_->{'name'};
-        if(exists $_->{'flags'}) {
-          $s .= ' '.$_->{'flags'}.' ';
-          $s .= $_->{'epoch'}.':' if(exists $_->{'epoch'} && $_->{'epoch'} != 0);
-          $s .= $_->{'ver'};
-          $s .= '-'.$_->{'rel'} if exists $_->{'rel'};
-        }
-        $s
+       my $s = $_->{'name'};
+       if(exists $_->{'flags'}) {
+         $s .= ' '.$_->{'flags'}.' ';
+         $s .= $_->{'epoch'}.':' if(exists $_->{'epoch'} && $_->{'epoch'} != 0);
+         $s .= $_->{'ver'};
+         $s .= '-'.$_->{'rel'} if exists $_->{'rel'};
+       }
+       $s
       } @_);
 }
 
index e41de15..c8c796d 100755 (executable)
@@ -84,55 +84,55 @@ foreach my $dir (@ARGV) {
     for my $known (@todo) {
       my $path = $known2path{$known};
       if ($path =~ /\.rpm$/) {
-        my %res = Build::Rpm::rpmq($path, 1000, 1001, 1002, 1006, 1022, 1047, 1049, 1048, 1050, 1112, 1113);
-        next unless %res;
-        Build::Rpm::add_flagsvers(\%res, 1047, 1112, 1113);
-        Build::Rpm::add_flagsvers(\%res, 1049, 1048, 1050);
-        my $id = $known;
-        $id =~ s/.*-//;
-        if ($known ne "$res{1000}->[0].$res{1022}->[0]-$id") {
-          $known = "$res{1000}->[0].$res{1022}->[0]-$id";
-          if (!$known2path{$known}) {
-            push @known, $known;
-            $known2path{$known} = $path;
-          }
-        }
-        # rpm3 compatibility: retrofit missing self provides
-        my $name = $res{1000}->[0];
-        if (!@{$res{1047} || []} || $res{1047}->[-1] !~ /^\Q$name\E =/) {
-          my $evr = "$res{1001}->[0]-$res{1002}->[0]";
-          $evr = "$res{1003}->[0]:$evr" if $res{1003} && $res{1003}->[0];
-          push @{$res{1047}}, "$name = $evr";
-        }
+       my %res = Build::Rpm::rpmq($path, 1000, 1001, 1002, 1006, 1022, 1047, 1049, 1048, 1050, 1112, 1113);
+       next unless %res;
+       Build::Rpm::add_flagsvers(\%res, 1047, 1112, 1113);
+       Build::Rpm::add_flagsvers(\%res, 1049, 1048, 1050);
+       my $id = $known;
+       $id =~ s/.*-//;
+       if ($known ne "$res{1000}->[0].$res{1022}->[0]-$id") {
+         $known = "$res{1000}->[0].$res{1022}->[0]-$id";
+         if (!$known2path{$known}) {
+           push @known, $known;
+           $known2path{$known} = $path;
+         }
+       }
+       # rpm3 compatibility: retrofit missing self provides
+       my $name = $res{1000}->[0];
+       if (!@{$res{1047} || []} || $res{1047}->[-1] !~ /^\Q$name\E =/) {
+         my $evr = "$res{1001}->[0]-$res{1002}->[0]";
+         $evr = "$res{1003}->[0]:$evr" if $res{1003} && $res{1003}->[0];
+         push @{$res{1047}}, "$name = $evr";
+       }
 
-        $newp{$known} = "P:$known: ".join(' ', @{$res{1047} || []});
-        $newr{$known} = "R:$known: ".join(' ', @{$res{1049} || []});
-        #$tag{$known} = $res{1000}->[0]."-".$res{1001}->[0]."-".$res{1002}->[0]." ".$res{1007}->[0]."-".$res{1006}->[0];
-        $tag{$known} = $res{1000}->[0]."-".$res{1001}->[0]."-".$res{1002}->[0]." ".$res{1006}->[0];
+       $newp{$known} = "P:$known: ".join(' ', @{$res{1047} || []});
+       $newr{$known} = "R:$known: ".join(' ', @{$res{1049} || []});
+       #$tag{$known} = $res{1000}->[0]."-".$res{1001}->[0]."-".$res{1002}->[0]." ".$res{1007}->[0]."-".$res{1006}->[0];
+       $tag{$known} = $res{1000}->[0]."-".$res{1001}->[0]."-".$res{1002}->[0]." ".$res{1006}->[0];
       } else {
-        my %res = Build::Deb::debq($path);
-        next unless %res;
-        my ($dn, $da) = ($res{'PACKAGE'}, $res{'ARCHITECTURE'});
-        $da = 'noarch' if $da eq 'all';
-        my $id = $known;
-        $id =~ s/.*-//;
-        if ($known ne "$dn.$da-$id") {
-          $known = "$dn.$da-$id";
-          if (!$known2path{$known}) {
-            push @known, $known;
-            $known2path{$known} = $path;
-          }
-        }
-        my @provides = split(',\s*', $res{'PROVIDES'} || '');
-        my @depends = split(',\s*', $res{'DEPENDS'} || '');
-        my @predepends = split(',\s*', $res{'PRE-DEPENDS'} || '');
-        s/\s.*// for @provides;   #for now
-        s/\s.*// for @depends;    #for now
-        s/\s.*// for @predepends; #for now
-        push @depends, @predepends;
-        push @provides, $res{'PACKAGE'};
-        $newp{$known} = "P:$known: ".join(' ', @provides);
-        $newr{$known} = "R:$known: ".join(' ', @depends);
+       my %res = Build::Deb::debq($path);
+       next unless %res;
+       my ($dn, $da) = ($res{'PACKAGE'}, $res{'ARCHITECTURE'});
+       $da = 'noarch' if $da eq 'all';
+       my $id = $known;
+       $id =~ s/.*-//;
+       if ($known ne "$dn.$da-$id") {
+         $known = "$dn.$da-$id";
+         if (!$known2path{$known}) {
+           push @known, $known;
+           $known2path{$known} = $path;
+         }
+       }
+       my @provides = split(',\s*', $res{'PROVIDES'} || '');
+       my @depends = split(',\s*', $res{'DEPENDS'} || '');
+       my @predepends = split(',\s*', $res{'PRE-DEPENDS'} || '');
+       s/\s.*// for @provides;   #for now
+       s/\s.*// for @depends;    #for now
+       s/\s.*// for @predepends; #for now
+       push @depends, @predepends;
+       push @provides, $res{'PACKAGE'};
+       $newp{$known} = "P:$known: ".join(' ', @provides);
+       $newr{$known} = "R:$known: ".join(' ', @depends);
       }
     }
   }
index bf86618..44b55b9 100755 (executable)
@@ -128,19 +128,19 @@ sub doseries {
     while(<F>) {
       chomp;
       if ((/^--- ./ || /^\+\+\+ ./) && !/^... \/dev\/null/) {
-        my $start = substr($_, 0, 4);
-        $_ = substr($_, 4);
-        my $l = $level;
-        while ($l > 0) {
-          last unless s/.*?\///;
-          $l--;
-        }
-        if ($start eq '--- ') {
-          print DIFF "$start$tardir.orig/$_\n";
-        } else {
-          print DIFF "$start$tardir/$_\n";
-        }
-        next;
+       my $start = substr($_, 0, 4);
+       $_ = substr($_, 4);
+       my $l = $level;
+       while ($l > 0) {
+         last unless s/.*?\///;
+         $l--;
+       }
+       if ($start eq '--- ') {
+         print DIFF "$start$tardir.orig/$_\n";
+       } else {
+         print DIFF "$start$tardir/$_\n";
+       }
+       next;
       }
       print DIFF "$_\n";
     }
index 6996b0a..5b5da86 100755 (executable)
@@ -77,19 +77,19 @@ while(<S>) {
     while($block <= $end && $filesize) {
       my $size;
       if($end == $block) {
-        $size = $blksize;
-        ++$block;
+       $size = $blksize;
+       ++$block;
       } elsif($maxblocks >= $end-$block) {
-        $size = ($end-$block)*$blksize;
-        $block += $end-$block;
+       $size = ($end-$block)*$blksize;
+       $block += $end-$block;
       } else {
-        $size = $maxblocks*$blksize;
-        $block += $maxblocks;
+       $size = $maxblocks*$blksize;
+       $block += $maxblocks;
       }
       $size = $filesize if $size > $filesize;
       my $buf;
       if((sysread(F, $buf, $size) || 0) != $size) {
-        die "$file: read: $!\n";
+       die "$file: read: $!\n";
       }
       $filesize -= $size;
       print O $buf;
index d9d9144..67b1d6f 100755 (executable)
@@ -42,43 +42,43 @@ CREATE_BUILD_BINARIES=
 
 while test -n "$1" ; do
     case "$1" in
-        --prepare)
-            shift
-            PREPARE_VM=true
-            ;;
-        --create-build-binaries)
-            shift
-            CREATE_BUILD_BINARIES=true
-            ;;
-        --useusedforbuild)
-            shift
-            USEUSEDFORBUILD=--useusedforbuild
-            ;;
-        --list-state)
-            shift
-            LIST_STATE=true
-            ;;
-        --rpmlist)
-            shift
-            RPMLIST=$1
-            shift
-            ;;
-        --define|--with|--without)
-            definesnstuff[${#definesnstuff[@]}]="$1";
-            definesnstuff[${#definesnstuff[@]}]="$2";
-            shift 2
-            ;;
-        --repository|--repo)
-            repos[${#repos[@]}]="$2";
-            shift 2;
-            ;;
-        --clean)
-            CLEAN_BUILD="$1"
-            shift
-        ;;
-        *)
-            break
-            ;;
+       --prepare)
+           shift
+           PREPARE_VM=true
+           ;;
+       --create-build-binaries)
+           shift
+           CREATE_BUILD_BINARIES=true
+           ;;
+       --useusedforbuild)
+           shift
+           USEUSEDFORBUILD=--useusedforbuild
+           ;;
+       --list-state)
+           shift
+           LIST_STATE=true
+           ;;
+       --rpmlist)
+           shift
+           RPMLIST=$1
+           shift
+           ;;
+       --define|--with|--without)
+           definesnstuff[${#definesnstuff[@]}]="$1";
+           definesnstuff[${#definesnstuff[@]}]="$2";
+           shift 2
+           ;;
+       --repository|--repo)
+           repos[${#repos[@]}]="$2";
+           shift 2;
+           ;;
+       --clean)
+           CLEAN_BUILD="$1"
+           shift
+       ;;
+       *)
+           break
+           ;;
     esac
 done
 PKGS=("$@")
@@ -99,106 +99,106 @@ function cleanup_and_exit {
 }
 
 function clean_build_root () {
-        test -n "$BUILD_ROOT" && {
-            umount -n $BUILD_ROOT/proc 2> /dev/null || true
-            umount -n $BUILD_ROOT/dev/pts 2> /dev/null || true
-            umount -n $BUILD_ROOT/mnt 2> /dev/null || true
-            rm -rf -- $BUILD_ROOT/*
-            rm -rf -- $BUILD_ROOT/.build
-            rm -rf -- $BUILD_ROOT/.root
-            rm -rf -- $BUILD_ROOT/.init_b_cache
-            mkdir -p $BUILD_ROOT/proc
-            mkdir -p $BUILD_ROOT/dev/pts
-            if [ "$UID" = '0' ]; then
-                    mount -n -tproc none $BUILD_ROOT/proc
-                    mount -n -tdevpts none $BUILD_ROOT/dev/pts
-            fi
-        }
+       test -n "$BUILD_ROOT" && {
+           umount -n $BUILD_ROOT/proc 2> /dev/null || true
+           umount -n $BUILD_ROOT/dev/pts 2> /dev/null || true
+           umount -n $BUILD_ROOT/mnt 2> /dev/null || true
+           rm -rf -- $BUILD_ROOT/*
+           rm -rf -- $BUILD_ROOT/.build
+           rm -rf -- $BUILD_ROOT/.root
+           rm -rf -- $BUILD_ROOT/.init_b_cache
+           mkdir -p $BUILD_ROOT/proc
+           mkdir -p $BUILD_ROOT/dev/pts
+           if [ "$UID" = '0' ]; then
+                   mount -n -tproc none $BUILD_ROOT/proc
+                   mount -n -tdevpts none $BUILD_ROOT/dev/pts
+           fi
+       }
 }
 
 function preinstall {
     if test -n "$1" ; then
-        echo "preinstalling $1..."
-        cd $BUILD_ROOT || cleanup_and_exit 1
-        CPIO="cpio --extract --unconditional --preserve-modification-time --make-directories --no-absolute-filenames --quiet"
-        if test -e "$BUILD_ROOT/.init_b_cache/rpms/$1.rpm" ; then
-            PAYLOADDECOMPRESS=cat
-            case `rpm -qp --nodigest --nosignature --qf "%{PAYLOADCOMPRESSOR}\n" "$BUILD_ROOT/.init_b_cache/rpms/$1.rpm"` in
-                lzma) rpm --showrc | grep PayloadIsLzma > /dev/null || PAYLOADDECOMPRESS="lzma -d" ;;
-                xz) rpm --showrc | grep PayloadIsXz > /dev/null || PAYLOADDECOMPRESS="xz -d" ;;
-            esac
-            if test "$PAYLOADDECOMPRESS" = "lzma -d" ; then
-                if ! lzma </dev/null >/dev/null 2>&1 ; then
-                    test -f "$BUILD_DIR/lzmadec.sh" && PAYLOADDECOMPRESS="bash $BUILD_DIR/lzmadec.sh"
-                fi
-            fi
-            if test "$PAYLOADDECOMPRESS" = cat ; then
-                rpm2cpio "$BUILD_ROOT/.init_b_cache/rpms/$1.rpm" | $CPIO
-            else
-                rpm2cpio "$BUILD_ROOT/.init_b_cache/rpms/$1.rpm" | $PAYLOADDECOMPRESS | $CPIO
-            fi
-            if test -e .init_b_cache/scripts/$1.run ; then
-                rpm -qp --nodigest --nosignature --qf "%{PREIN}" "$BUILD_ROOT/.init_b_cache/rpms/$1.rpm" > .init_b_cache/scripts/$1.pre
-                rpm -qp --nodigest --nosignature --qf "%{POSTIN}" "$BUILD_ROOT/.init_b_cache/rpms/$1.rpm" > .init_b_cache/scripts/$1.post
-                echo -n '(none)' > .init_b_cache/scripts/.none
-                cmp -s .init_b_cache/scripts/$1.pre .init_b_cache/scripts/.none && rm -f .init_b_cache/scripts/$1.pre
-                cmp -s .init_b_cache/scripts/$1.post .init_b_cache/scripts/.none && rm -f .init_b_cache/scripts/$1.post
-                rm -f .init_b_cache/scripts/.none
-            fi
-        elif test -e "$BUILD_ROOT/.init_b_cache/rpms/$1.deb" ; then
-            ar x "$BUILD_ROOT/.init_b_cache/rpms/$1.deb" control.tar.gz data.tar.gz
-            mkdir -p .init_b_cache/scripts/control
-            tar -C .init_b_cache/scripts/control -xzf control.tar.gz
-            tar xzf data.tar.gz
-            if test -e .init_b_cache/scripts/$1.run ; then
-                test -e .init_b_cache/scripts/control/preinst && mv .init_b_cache/scripts/control/preinst .init_b_cache/scripts/$1.pre
-                test -e .init_b_cache/scripts/control/postinst && mv .init_b_cache/scripts/control/postinst .init_b_cache/scripts/$1.post
-            fi
-            rm -rf .init_b_cache/scripts/control control.tar.gz data.tar.gz
-        else
-            echo "warning: package $1 does not exist"
-        fi
+       echo "preinstalling $1..."
+       cd $BUILD_ROOT || cleanup_and_exit 1
+       CPIO="cpio --extract --unconditional --preserve-modification-time --make-directories --no-absolute-filenames --quiet"
+       if test -e "$BUILD_ROOT/.init_b_cache/rpms/$1.rpm" ; then
+           PAYLOADDECOMPRESS=cat
+           case `rpm -qp --nodigest --nosignature --qf "%{PAYLOADCOMPRESSOR}\n" "$BUILD_ROOT/.init_b_cache/rpms/$1.rpm"` in
+               lzma) rpm --showrc | grep PayloadIsLzma > /dev/null || PAYLOADDECOMPRESS="lzma -d" ;;
+               xz) rpm --showrc | grep PayloadIsXz > /dev/null || PAYLOADDECOMPRESS="xz -d" ;;
+           esac
+           if test "$PAYLOADDECOMPRESS" = "lzma -d" ; then
+               if ! lzma </dev/null >/dev/null 2>&1 ; then
+                   test -f "$BUILD_DIR/lzmadec.sh" && PAYLOADDECOMPRESS="bash $BUILD_DIR/lzmadec.sh"
+               fi
+           fi
+           if test "$PAYLOADDECOMPRESS" = cat ; then
+               rpm2cpio "$BUILD_ROOT/.init_b_cache/rpms/$1.rpm" | $CPIO
+           else
+               rpm2cpio "$BUILD_ROOT/.init_b_cache/rpms/$1.rpm" | $PAYLOADDECOMPRESS | $CPIO
+           fi
+           if test -e .init_b_cache/scripts/$1.run ; then
+               rpm -qp --nodigest --nosignature --qf "%{PREIN}" "$BUILD_ROOT/.init_b_cache/rpms/$1.rpm" > .init_b_cache/scripts/$1.pre
+               rpm -qp --nodigest --nosignature --qf "%{POSTIN}" "$BUILD_ROOT/.init_b_cache/rpms/$1.rpm" > .init_b_cache/scripts/$1.post
+               echo -n '(none)' > .init_b_cache/scripts/.none
+               cmp -s .init_b_cache/scripts/$1.pre .init_b_cache/scripts/.none && rm -f .init_b_cache/scripts/$1.pre
+               cmp -s .init_b_cache/scripts/$1.post .init_b_cache/scripts/.none && rm -f .init_b_cache/scripts/$1.post
+               rm -f .init_b_cache/scripts/.none
+           fi
+       elif test -e "$BUILD_ROOT/.init_b_cache/rpms/$1.deb" ; then
+           ar x "$BUILD_ROOT/.init_b_cache/rpms/$1.deb" control.tar.gz data.tar.gz
+           mkdir -p .init_b_cache/scripts/control
+           tar -C .init_b_cache/scripts/control -xzf control.tar.gz
+           tar xzf data.tar.gz
+           if test -e .init_b_cache/scripts/$1.run ; then
+               test -e .init_b_cache/scripts/control/preinst && mv .init_b_cache/scripts/control/preinst .init_b_cache/scripts/$1.pre
+               test -e .init_b_cache/scripts/control/postinst && mv .init_b_cache/scripts/control/postinst .init_b_cache/scripts/$1.post
+           fi
+           rm -rf .init_b_cache/scripts/control control.tar.gz data.tar.gz
+       else
+           echo "warning: package $1 does not exist"
+       fi
     fi
     if test -n "$2" ; then
-        chroot $BUILD_ROOT /sbin/ldconfig 2>/dev/null
-        for PKG in $PACKAGES_TO_RUNSCRIPTS ; do
-            if test -e "$BUILD_ROOT/.init_b_cache/scripts/$PKG.pre" ; then
-                echo "running $PKG preinstall script"
-                if test -e "$BUILD_ROOT/.init_b_cache/rpms/$PKG.rpm" ; then
-                    chroot $BUILD_ROOT sh ".init_b_cache/scripts/$PKG.pre" 0
-                else
-                    chroot $BUILD_ROOT ".init_b_cache/scripts/$PKG.pre" install < /dev/null
-                fi
-                rm -f "$BUILD_ROOT/.init_b_cache/scripts/$PKG.pre"
-            fi
-            if test -e "$BUILD_ROOT/.init_b_cache/scripts/$PKG.post" ; then
-                echo "running $PKG postinstall script"
-                if test -e "$BUILD_ROOT/.init_b_cache/rpms/$PKG.rpm" ; then
-                    chroot $BUILD_ROOT sh ".init_b_cache/scripts/$PKG.post" 1
-                else
-                    chroot $BUILD_ROOT ".init_b_cache/scripts/$PKG.post" configure '' < /dev/null
-                fi
-                rm -f "$BUILD_ROOT/.init_b_cache/scripts/$PKG.post"
-            fi
-        done
+       chroot $BUILD_ROOT /sbin/ldconfig 2>/dev/null
+       for PKG in $PACKAGES_TO_RUNSCRIPTS ; do
+           if test -e "$BUILD_ROOT/.init_b_cache/scripts/$PKG.pre" ; then
+               echo "running $PKG preinstall script"
+               if test -e "$BUILD_ROOT/.init_b_cache/rpms/$PKG.rpm" ; then
+                   chroot $BUILD_ROOT sh ".init_b_cache/scripts/$PKG.pre" 0
+               else
+                   chroot $BUILD_ROOT ".init_b_cache/scripts/$PKG.pre" install < /dev/null
+               fi
+               rm -f "$BUILD_ROOT/.init_b_cache/scripts/$PKG.pre"
+           fi
+           if test -e "$BUILD_ROOT/.init_b_cache/scripts/$PKG.post" ; then
+               echo "running $PKG postinstall script"
+               if test -e "$BUILD_ROOT/.init_b_cache/rpms/$PKG.rpm" ; then
+                   chroot $BUILD_ROOT sh ".init_b_cache/scripts/$PKG.post" 1
+               else
+                   chroot $BUILD_ROOT ".init_b_cache/scripts/$PKG.post" configure '' < /dev/null
+               fi
+               rm -f "$BUILD_ROOT/.init_b_cache/scripts/$PKG.post"
+           fi
+       done
     fi
 }
 
 function init_db {
     if test $PSUF = rpm ; then
-        echo initializing rpm db...
-        chroot $BUILD_ROOT rpm --initdb || cleanup_and_exit 1
-        # hack: add nofsync to db config to speed up install
-        mkdir -p $BUILD_ROOT/root
-        echo '%__dbi_perms perms=0644 nofsync' > $BUILD_ROOT/.rpmmacros
-        echo '%__dbi_perms perms=0644 nofsync' > $BUILD_ROOT/root/.rpmmacros
+       echo initializing rpm db...
+       chroot $BUILD_ROOT rpm --initdb || cleanup_and_exit 1
+       # hack: add nofsync to db config to speed up install
+       mkdir -p $BUILD_ROOT/root
+       echo '%__dbi_perms perms=0644 nofsync' > $BUILD_ROOT/.rpmmacros
+       echo '%__dbi_perms perms=0644 nofsync' > $BUILD_ROOT/root/.rpmmacros
     else
-        # force dpkg into database to make epoch test work
-        if ! test "$BUILD_ROOT/.init_b_cache/rpms/dpkg.deb" -ef "$BUILD_ROOT/.init_b_cache/dpkg.deb" ; then
-            rm -f $BUILD_ROOT/.init_b_cache/dpkg.deb
-            cp $BUILD_ROOT/.init_b_cache/rpms/dpkg.deb $BUILD_ROOT/.init_b_cache/dpkg.deb || cleanup_and_exit 1
-        fi
-        chroot $BUILD_ROOT dpkg -i --force all .init_b_cache/dpkg.deb >/dev/null 2>&1
+       # force dpkg into database to make epoch test work
+       if ! test "$BUILD_ROOT/.init_b_cache/rpms/dpkg.deb" -ef "$BUILD_ROOT/.init_b_cache/dpkg.deb" ; then
+           rm -f $BUILD_ROOT/.init_b_cache/dpkg.deb
+           cp $BUILD_ROOT/.init_b_cache/rpms/dpkg.deb $BUILD_ROOT/.init_b_cache/dpkg.deb || cleanup_and_exit 1
+       fi
+       chroot $BUILD_ROOT dpkg -i --force all .init_b_cache/dpkg.deb >/dev/null 2>&1
     fi
 }
 
@@ -206,7 +206,7 @@ function reorder {
     test -z "$*" && return
     rm -f $BUILD_ROOT/.init_b_cache/order.manifest
     for PKG in "$@" ; do
-        echo "$PKG" >> $BUILD_ROOT/.init_b_cache/order.manifest
+       echo "$PKG" >> $BUILD_ROOT/.init_b_cache/order.manifest
     done
     $BUILD_DIR/order --dist "$BUILD_DIST" --archpath "$BUILD_ARCH" --configdir $BUILD_DIR/configs --manifest $BUILD_ROOT/.init_b_cache/order.manifest $BUILD_ROOT/.init_b_cache/rpms
     rm -f $BUILD_ROOT/.init_b_cache/order.manifest
@@ -219,28 +219,28 @@ function create_devs {
     test -f $BUILD_ROOT/dev/shm && rm -f $BUILD_ROOT/dev/shm
     mkdir -m 755 -p $BUILD_ROOT/dev/shm
     while read com file mode arg ; do
-        rm -f $BUILD_ROOT/dev/$file
-        if test $com = ln ; then
-            ln -s $arg $BUILD_ROOT/dev/$file
-            continue
-        fi
-        $com -m $mode $BUILD_ROOT/dev/$file $arg
+       rm -f $BUILD_ROOT/dev/$file
+       if test $com = ln ; then
+           ln -s $arg $BUILD_ROOT/dev/$file
+           continue
+       fi
+       $com -m $mode $BUILD_ROOT/dev/$file $arg
     done << DEVLIST
-        mknod null    666 c 1 3
-        mknod zero    666 c 1 5
-        mknod full    622 c 1 7
-        mknod random  666 c 1 8
-        mknod urandom 644 c 1 9
-        mknod tty     666 c 5 0
-        mknod ptmx    666 c 5 2
-        mknod loop0   640 b 7 0
-        mknod loop1   640 b 7 1
-        mknod loop2   640 b 7 2
-        mknod loop3   640 b 7 3
-        ln    fd      777 /proc/self/fd
-        ln    stdin   777 fd/0
-        ln    stdout  777 fd/1
-        ln    stderr  777 fd/2
+       mknod null    666 c 1 3
+       mknod zero    666 c 1 5
+       mknod full    622 c 1 7
+       mknod random  666 c 1 8
+       mknod urandom 644 c 1 9
+       mknod tty     666 c 5 0
+       mknod ptmx    666 c 5 2
+       mknod loop0   640 b 7 0
+       mknod loop1   640 b 7 1
+       mknod loop2   640 b 7 2
+       mknod loop3   640 b 7 3
+       ln    fd      777 /proc/self/fd
+       ln    stdin   777 fd/0
+       ln    stdout  777 fd/1
+       ln    stderr  777 fd/2
 DEVLIST
 }
 
@@ -249,33 +249,33 @@ function validate_cache_file {
     test "${repos[*]} ${BUILD_RPMS//:/ /}" != "$(cat $CACHE_FILE.id 2>/dev/null)" && rm -f $CACHE_FILE.id
     test -f $CACHE_FILE || rm -f $CACHE_FILE.id
     for SRC in "${repos[@]}" ${BUILD_RPMS//:/ /}; do
-        test -z "$SRC" && SRC=.
-        test "$SRC" -nt $CACHE_FILE && rm -f $CACHE_FILE.id
+       test -z "$SRC" && SRC=.
+       test "$SRC" -nt $CACHE_FILE && rm -f $CACHE_FILE.id
     done
     if ! test -f $CACHE_FILE.id ; then
-        test -z "$LIST_STATE" && echo initializing $CACHE_FILE ...
-        for SRC in "${repos[@]}" -- ${BUILD_RPMS//:/ /}; do
-            if test "$SRC" = '--' ; then
-                findonly=1
-                continue
-            fi
-            test -z "$SRC" && SRC=`pwd`
-            if [ ! -e "$SRC" ]; then
-                echo "*** $SRC does not exist" >&2
-                cleanup_and_exit 1
-            elif [ -z "$findonly" -a -e "$SRC"/suse/setup/descr/packages -o -e "$SRC"/suse/setup/descr/packages.gz ]; then
-                set -- $BUILD_DIR/createyastdeps "$SRC"
-            elif [ -z "$findonly" -a -e "$SRC"/repodata/repomd.xml ]; then
-                set -- $BUILD_DIR/createrepomddeps "$SRC"
-            else
-                set -- $BUILD_DIR/createrpmdeps "$SRC"
-            fi
-            echo "$@" >&2
-            "$@" || cleanup_and_exit 1
-        done > $CACHE_FILE.new
-
-        mv $CACHE_FILE.new $CACHE_FILE
-        echo "${repos[*]} ${BUILD_RPMS//:/ /}" > $CACHE_FILE.id
+       test -z "$LIST_STATE" && echo initializing $CACHE_FILE ...
+       for SRC in "${repos[@]}" -- ${BUILD_RPMS//:/ /}; do
+           if test "$SRC" = '--' ; then
+               findonly=1
+               continue
+           fi
+           test -z "$SRC" && SRC=`pwd`
+           if [ ! -e "$SRC" ]; then
+               echo "*** $SRC does not exist" >&2
+               cleanup_and_exit 1
+           elif [ -z "$findonly" -a -e "$SRC"/suse/setup/descr/packages -o -e "$SRC"/suse/setup/descr/packages.gz ]; then
+               set -- $BUILD_DIR/createyastdeps "$SRC"
+           elif [ -z "$findonly" -a -e "$SRC"/repodata/repomd.xml ]; then
+               set -- $BUILD_DIR/createrepomddeps "$SRC"
+           else
+               set -- $BUILD_DIR/createrpmdeps "$SRC"
+           fi
+           echo "$@" >&2
+           "$@" || cleanup_and_exit 1
+       done > $CACHE_FILE.new
+
+       mv $CACHE_FILE.new $CACHE_FILE
+       echo "${repos[*]} ${BUILD_RPMS//:/ /}" > $CACHE_FILE.id
     fi
 }
 
@@ -286,21 +286,21 @@ function register_qemu_user {
 #
 if [ x"$BUILD_ARCH" == xarmv4l -o x"$BUILD_ARCH" == xarmv5el -o x"$BUILD_ARCH" == xarmv7el -o x"$BUILD_ARCH" == xsh4 -o x"$BUILD_ARCH" == xppc ]; then
     if [  -n "$(uname -m | grep '[x3-6]86')" ]; then
-        if [ -e /usr/sbin/qemu-binfmt-conf.sh ]; then
-            (mkdir -p  $BUILD_ROOT/usr/bin $BUILD_ROOT/usr/sbin && set -x && cp /usr/bin/qemu-* $BUILD_ROOT/usr/bin && cp /usr/sbin/qemu-binfmt-conf.sh $BUILD_ROOT/usr/sbin)
-        fi
-        # To initially run the init script, there needs to be also a static bash to register qemu in this chroot and though to start up /.build/build
-        if [ -e /bin/bash-static -a -e /bin/mount-static ]; then
-            (mkdir -p  $BUILD_ROOT/bin && set -x && cp /bin/bash-static $BUILD_ROOT/bin && cp /bin/mount-static $BUILD_ROOT/bin)
-        fi
-        if [ -e /proc/sys/fs/binfmt_misc/arm -o -e /proc/sys/fs/binfmt_misc/armeb -o -e /proc/sys/fs/binfmt_misc/sh4 ]; then
-            echo "qemu-* already registered"
-        else
-            if [ -e /usr/sbin/qemu-binfmt-conf.sh ]; then
-                echo "qemu-* will be registered"
-                (set -x && /usr/sbin/qemu-binfmt-conf.sh)
-            fi
-        fi
+       if [ -e /usr/sbin/qemu-binfmt-conf.sh ]; then
+           (mkdir -p  $BUILD_ROOT/usr/bin $BUILD_ROOT/usr/sbin && set -x && cp /usr/bin/qemu-* $BUILD_ROOT/usr/bin && cp /usr/sbin/qemu-binfmt-conf.sh $BUILD_ROOT/usr/sbin)
+       fi
+       # To initially run the init script, there needs to be also a static bash to register qemu in this chroot and though to start up /.build/build
+       if [ -e /bin/bash-static -a -e /bin/mount-static ]; then
+           (mkdir -p  $BUILD_ROOT/bin && set -x && cp /bin/bash-static $BUILD_ROOT/bin && cp /bin/mount-static $BUILD_ROOT/bin)
+       fi
+       if [ -e /proc/sys/fs/binfmt_misc/arm -o -e /proc/sys/fs/binfmt_misc/armeb -o -e /proc/sys/fs/binfmt_misc/sh4 ]; then
+           echo "qemu-* already registered"
+       else
+           if [ -e /usr/sbin/qemu-binfmt-conf.sh ]; then
+               echo "qemu-* will be registered"
+               (set -x && /usr/sbin/qemu-binfmt-conf.sh)
+           fi
+       fi
     fi
 fi
 }
@@ -341,9 +341,9 @@ if test -e $BUILD_IS_RUNNING ; then
     echo -n "[y/N/c] "
     read ANSWER
     case "$ANSWER" in
-        c|C) rm -f $BUILD_IS_RUNNING ;;
-        y|Y) clean_build_root ;;
-        *) cleanup_and_exit 1 ;;
+       c|C) rm -f $BUILD_IS_RUNNING ;;
+       y|Y) clean_build_root ;;
+       *) cleanup_and_exit 1 ;;
     esac
 fi
 
@@ -366,10 +366,10 @@ if test -e $BUILD_ROOT/.build/init_buildsystem.data ; then
     # vm continuation
     . $BUILD_ROOT/.build/init_buildsystem.data
     if ! test -e $BUILD_ROOT/.init_b_cache/preinstall_finished ; then
-        # finish preinstall
-        preinstall '' true
-        init_db
-        touch $BUILD_ROOT/.init_b_cache/preinstall_finished
+       # finish preinstall
+       preinstall '' true
+       init_db
+       touch $BUILD_ROOT/.init_b_cache/preinstall_finished
     fi
 else
     #
@@ -379,35 +379,35 @@ else
     mkdir -p $BUILD_ROOT/.init_b_cache/scripts
 
     if test -z "$RPMLIST" ; then
-        #
-        # create rpmdeps file
-        #
-        CACHE_FILE=$BUILD_ROOT/.srcfiles.cache
-        validate_cache_file
-
-        #
-        # select and expand packages
-        #
-        RPMLIST=$BUILD_ROOT/.init_b_cache/rpmlist
-        test -z "$LIST_STATE" && echo "expanding package dependencies..."
-        if ! $BUILD_DIR/expanddeps $USEUSEDFORBUILD "${definesnstuff[@]}" --dist "$BUILD_DIST" --depfile "$CACHE_FILE" --archpath "$BUILD_ARCH" --configdir $BUILD_DIR/configs "${PKGS[@]}" > $RPMLIST ; then
-            rm -f $BUILD_IS_RUNNING
-            cleanup_and_exit 1
-        fi
+       #
+       # create rpmdeps file
+       #
+       CACHE_FILE=$BUILD_ROOT/.srcfiles.cache
+       validate_cache_file
+
+       #
+       # select and expand packages
+       #
+       RPMLIST=$BUILD_ROOT/.init_b_cache/rpmlist
+       test -z "$LIST_STATE" && echo "expanding package dependencies..."
+       if ! $BUILD_DIR/expanddeps $USEUSEDFORBUILD "${definesnstuff[@]}" --dist "$BUILD_DIST" --depfile "$CACHE_FILE" --archpath "$BUILD_ARCH" --configdir $BUILD_DIR/configs "${PKGS[@]}" > $RPMLIST ; then
+           rm -f $BUILD_IS_RUNNING
+           cleanup_and_exit 1
+       fi
     fi
 
     if test -n "$LIST_STATE" ; then
-        rm -f $BUILD_IS_RUNNING
-        while read PKG SRC ; do
-           test "$PKG" = "preinstall:" && continue
-           test "$PKG" = "runscripts:" && continue
-           test "$PKG" = "vminstall:" && continue
-           test "$PKG" = "dist:" && continue
-           test "$PKG" = "rpmid:" && continue
-           echo "${SRC##*/}"
-        done < $BUILD_ROOT/.init_b_cache/rpmlist
-        rm -rf $BUILD_ROOT/.init_b_cache
-        cleanup_and_exit 0
+       rm -f $BUILD_IS_RUNNING
+       while read PKG SRC ; do
+          test "$PKG" = "preinstall:" && continue
+          test "$PKG" = "runscripts:" && continue
+          test "$PKG" = "vminstall:" && continue
+          test "$PKG" = "dist:" && continue
+          test "$PKG" = "rpmid:" && continue
+          echo "${SRC##*/}"
+       done < $BUILD_ROOT/.init_b_cache/rpmlist
+       rm -rf $BUILD_ROOT/.init_b_cache
+       cleanup_and_exit 0
     fi
 
     PACKAGES_TO_INSTALL=
@@ -418,29 +418,29 @@ else
     GUESSED_DIST=unknown
     mkdir -p $BUILD_ROOT/.init_b_cache/rpms
     while read PKG SRC ; do
-        if test "$PKG" = "preinstall:" ; then
-            PACKAGES_TO_PREINSTALL=$SRC
-            continue
-        fi
-        if test "$PKG" = "vminstall:" ; then
-            PACKAGES_TO_VMINSTALL=$SRC
-            continue
-        fi
-        if test "$PKG" = "runscripts:" ; then
-            RUNSCRIPTS_SEEN=true
-            PACKAGES_TO_RUNSCRIPTS=$SRC
-            continue
-        fi
-        if test "$PKG" = "dist:" ; then
-            GUESSED_DIST=$SRC
-            continue
-        fi
-        if test "$PKG" = "rpmid:" ; then
-            echo "${SRC#*:}" > $BUILD_ROOT/.init_b_cache/rpms/${SRC%%:*}.id
-            continue
-        fi
-        ln -s "$SRC" "$BUILD_ROOT/.init_b_cache/rpms/$PKG.${SRC##*.}"
-        PACKAGES_TO_INSTALL="$PACKAGES_TO_INSTALL $PKG"
+       if test "$PKG" = "preinstall:" ; then
+           PACKAGES_TO_PREINSTALL=$SRC
+           continue
+       fi
+       if test "$PKG" = "vminstall:" ; then
+           PACKAGES_TO_VMINSTALL=$SRC
+           continue
+       fi
+       if test "$PKG" = "runscripts:" ; then
+           RUNSCRIPTS_SEEN=true
+           PACKAGES_TO_RUNSCRIPTS=$SRC
+           continue
+       fi
+       if test "$PKG" = "dist:" ; then
+           GUESSED_DIST=$SRC
+           continue
+       fi
+       if test "$PKG" = "rpmid:" ; then
+           echo "${SRC#*:}" > $BUILD_ROOT/.init_b_cache/rpms/${SRC%%:*}.id
+           continue
+       fi
+       ln -s "$SRC" "$BUILD_ROOT/.init_b_cache/rpms/$PKG.${SRC##*.}"
+       PACKAGES_TO_INSTALL="$PACKAGES_TO_INSTALL $PKG"
     done < $RPMLIST
 
     # compatibility...
@@ -461,35 +461,35 @@ if test ! -f $BUILD_ROOT/var/lib/rpm/packages.rpm -a ! -f $BUILD_ROOT/var/lib/rp
     mkdir -p $BUILD_ROOT/proc || cleanup_and_exit 1
     test -f $BUILD_ROOT/etc/HOSTNAME || hostname -f > $BUILD_ROOT/etc/HOSTNAME
     if test $PSUF = deb ; then
-        mkdir -p $BUILD_ROOT/var/lib/dpkg
-        mkdir -p $BUILD_ROOT/var/log
-        mkdir -p $BUILD_ROOT/etc/default
-        :> $BUILD_ROOT/var/lib/dpkg/status
-        :> $BUILD_ROOT/var/lib/dpkg/available
-        :> $BUILD_ROOT/var/log/dpkg.log
-        :> $BUILD_ROOT/etc/ld.so.conf
-        :> $BUILD_ROOT/etc/default/rcS
+       mkdir -p $BUILD_ROOT/var/lib/dpkg
+       mkdir -p $BUILD_ROOT/var/log
+       mkdir -p $BUILD_ROOT/etc/default
+       :> $BUILD_ROOT/var/lib/dpkg/status
+       :> $BUILD_ROOT/var/lib/dpkg/available
+       :> $BUILD_ROOT/var/log/dpkg.log
+       :> $BUILD_ROOT/etc/ld.so.conf
+       :> $BUILD_ROOT/etc/default/rcS
     fi
     for PKG in $PACKAGES_TO_RUNSCRIPTS ; do
-        : > $BUILD_ROOT/.init_b_cache/scripts/$PKG.run
+       : > $BUILD_ROOT/.init_b_cache/scripts/$PKG.run
     done
     for PKG in $PACKAGES_TO_PREINSTALL ; do
-        preinstall ${PKG##*/}
+       preinstall ${PKG##*/}
     done
     if test -n "$PREPARE_VM" ; then
-        for PKG in $PACKAGES_TO_VMINSTALL ; do
-            preinstall ${PKG##*/}
-        done
+       for PKG in $PACKAGES_TO_VMINSTALL ; do
+           preinstall ${PKG##*/}
+       done
     fi
     if [ -w /root ]; then
-            test -c $BUILD_ROOT/dev/null || create_devs
+           test -c $BUILD_ROOT/dev/null || create_devs
     fi
     test -e $BUILD_ROOT/etc/fstab || touch $BUILD_ROOT/etc/fstab
     test -e $BUILD_ROOT/etc/ld.so.conf || cp $BUILD_ROOT/etc/ld.so.conf.in $BUILD_ROOT/etc/ld.so.conf
     if test -z "$PREPARE_VM" ; then
-        preinstall '' true
-        init_db
-        touch $BUILD_ROOT/.init_b_cache/preinstall_finished
+       preinstall '' true
+       init_db
+       touch $BUILD_ROOT/.init_b_cache/preinstall_finished
     fi
 fi
 
@@ -497,9 +497,9 @@ if test -n "$PREPARE_VM" ; then
     mkdir -p $BUILD_ROOT/.build
     echo "copying packages..."
     for PKG in $PACKAGES_TO_INSTALL ; do
-        rm -f $BUILD_ROOT/.init_b_cache/$PKG.$PSUF
-        cp $BUILD_ROOT/.init_b_cache/rpms/$PKG.$PSUF $BUILD_ROOT/.init_b_cache/$PKG.$PSUF || cleanup_and_exit 1
-        ln -s -f ../$PKG.$PSUF $BUILD_ROOT/.init_b_cache/rpms/$PKG.$PSUF
+       rm -f $BUILD_ROOT/.init_b_cache/$PKG.$PSUF
+       cp $BUILD_ROOT/.init_b_cache/rpms/$PKG.$PSUF $BUILD_ROOT/.init_b_cache/$PKG.$PSUF || cleanup_and_exit 1
+       ln -s -f ../$PKG.$PSUF $BUILD_ROOT/.init_b_cache/rpms/$PKG.$PSUF
     done
     # alreadyinstalled check will not work, but we have to live with
     # that...
@@ -527,11 +527,11 @@ if test -n "$CREATE_BUILD_BINARIES" ; then
     echo "creating .build.binaries directory..."
     mkdir -p "$BUILD_ROOT/.build.binaries"
     for PKG in $PACKAGES_TO_INSTALL ; do
-        test -L "$BUILD_ROOT/.init_b_cache/rpms/$PKG.$PSUF" || continue
-        LPKG=`readlink -f "$BUILD_ROOT/.init_b_cache/rpms/$PKG.$PSUF"`
-        ln "$LPKG" "$BUILD_ROOT/.build.binaries/$PKG.$PSUF" 2>/dev/null
-        test -f "$BUILD_ROOT/.build.binaries/$PKG.$PSUF" && continue
-        cp "$LPKG" "$BUILD_ROOT/.build.binaries/$PKG.$PSUF"
+       test -L "$BUILD_ROOT/.init_b_cache/rpms/$PKG.$PSUF" || continue
+       LPKG=`readlink -f "$BUILD_ROOT/.init_b_cache/rpms/$PKG.$PSUF"`
+       ln "$LPKG" "$BUILD_ROOT/.build.binaries/$PKG.$PSUF" 2>/dev/null
+       test -f "$BUILD_ROOT/.build.binaries/$PKG.$PSUF" && continue
+       cp "$LPKG" "$BUILD_ROOT/.build.binaries/$PKG.$PSUF"
     done
 fi
 
@@ -541,9 +541,9 @@ fi
 mkdir -p $BUILD_ROOT/.init_b_cache/alreadyinstalled
 if test -f $BUILD_ROOT/var/lib/rpm/packages.rpm -o -f $BUILD_ROOT/var/lib/rpm/Packages ; then
     chroot $BUILD_ROOT rpm -qa --qf "%{NAME} $RPMIDFMT" | (
-        while read pp ii; do
-            echo "$ii" > "$BUILD_ROOT/.init_b_cache/alreadyinstalled/$pp"
-        done
+       while read pp ii; do
+           echo "$ii" > "$BUILD_ROOT/.init_b_cache/alreadyinstalled/$pp"
+       done
     )
 fi
 
@@ -574,7 +574,7 @@ for PKG in $BUILD_ROOT/.init_b_cache/todelete/* ; do
     test "$PKG" = "*" && continue
     echo deleting `sed -e 's/ .*//' < $BUILD_ROOT/.init_b_cache/todelete/$PKG`
     chroot $BUILD_ROOT rpm --nodeps -e $PKG 2>&1 | \
-        grep -v -e "^r.*failed: No such file or directory" -e "^error: failed to stat .*: No such file or directory"
+       grep -v -e "^r.*failed: No such file or directory" -e "^error: failed to stat .*: No such file or directory"
 done
 rm -rf $BUILD_ROOT/.init_b_cache/todelete
 
@@ -598,85 +598,85 @@ for PKG in $PACKAGES_TO_INSTALL_FIRST RUN_LDCONFIG $PACKAGES_TO_INSTALL ; do
 
     case $PKG in
       RUN_LDCONFIG)
-        test -x $BUILD_ROOT/sbin/ldconfig && chroot $BUILD_ROOT /sbin/ldconfig 2>&1
-        continue
+       test -x $BUILD_ROOT/sbin/ldconfig && chroot $BUILD_ROOT /sbin/ldconfig 2>&1
+       continue
       ;;
     esac
 
     test -f $BUILD_ROOT/installed-pkg/$PKG && continue
 
     if test $PSUF = deb ; then
-        # debian world, install deb files
-        test -L $BUILD_ROOT/.init_b_cache/rpms/$PKG.deb || continue
-        if ! test "$BUILD_ROOT/.init_b_cache/rpms/$PKG.deb" -ef "$BUILD_ROOT/.init_b_cache/$PKG.deb" ; then
-            rm -f $BUILD_ROOT/.init_b_cache/$PKG.deb
-            cp $BUILD_ROOT/.init_b_cache/rpms/$PKG.deb $BUILD_ROOT/.init_b_cache/$PKG.deb || cleanup_and_exit 1
-        fi
-        PKGID=`readlink $BUILD_ROOT/.init_b_cache/rpms/$PKG.deb`
-        PKGID="${PKGID##*/}"
-        PKGID="${PKGID%.deb}"
-        echo "installing ${PKGID%_*}"
-        ( chroot $BUILD_ROOT dpkg --install --force all .init_b_cache/$PKG.deb 2>&1 || touch $BUILD_ROOT/exit ) | \
-            perl -ne '$|=1;/^(Configuration file|Installing new config file|Selecting previously deselected|\(Reading database|Unpacking |Setting up|Creating config file|Preparing to replace dpkg)/||/^$/||print'
-        test -e $BUILD_ROOT/exit && cleanup_and_exit 1
-        echo "$PKGID debian" > $BUILD_ROOT/installed-pkg/$PKG
-        continue
+       # debian world, install deb files
+       test -L $BUILD_ROOT/.init_b_cache/rpms/$PKG.deb || continue
+       if ! test "$BUILD_ROOT/.init_b_cache/rpms/$PKG.deb" -ef "$BUILD_ROOT/.init_b_cache/$PKG.deb" ; then
+           rm -f $BUILD_ROOT/.init_b_cache/$PKG.deb
+           cp $BUILD_ROOT/.init_b_cache/rpms/$PKG.deb $BUILD_ROOT/.init_b_cache/$PKG.deb || cleanup_and_exit 1
+       fi
+       PKGID=`readlink $BUILD_ROOT/.init_b_cache/rpms/$PKG.deb`
+       PKGID="${PKGID##*/}"
+       PKGID="${PKGID%.deb}"
+       echo "installing ${PKGID%_*}"
+       ( chroot $BUILD_ROOT dpkg --install --force all .init_b_cache/$PKG.deb 2>&1 || touch $BUILD_ROOT/exit ) | \
+           perl -ne '$|=1;/^(Configuration file|Installing new config file|Selecting previously deselected|\(Reading database|Unpacking |Setting up|Creating config file|Preparing to replace dpkg)/||/^$/||print'
+       test -e $BUILD_ROOT/exit && cleanup_and_exit 1
+       echo "$PKGID debian" > $BUILD_ROOT/installed-pkg/$PKG
+       continue
     fi
 
     test -L $BUILD_ROOT/.init_b_cache/rpms/$PKG.rpm || continue
 
     if test -f $BUILD_ROOT/.init_b_cache/rpms/$PKG.id -a -f $BUILD_ROOT/.init_b_cache/alreadyinstalled/$PKG ; then
-        read PKGID < $BUILD_ROOT/.init_b_cache/rpms/$PKG.id
-        read OLDPKGID < $BUILD_ROOT/.init_b_cache/alreadyinstalled/$PKG
-        if test "$PKGID" = "$OLDPKGID" ; then
-            #echo "keeping ${PKGID%% *}"
-            echo "$PKGID" > $BUILD_ROOT/installed-pkg/$PKG
-            continue
-        fi
+       read PKGID < $BUILD_ROOT/.init_b_cache/rpms/$PKG.id
+       read OLDPKGID < $BUILD_ROOT/.init_b_cache/alreadyinstalled/$PKG
+       if test "$PKGID" = "$OLDPKGID" ; then
+           #echo "keeping ${PKGID%% *}"
+           echo "$PKGID" > $BUILD_ROOT/installed-pkg/$PKG
+           continue
+       fi
     fi
 
     PKGID=`rpm -qp --qf "$RPMIDFMT" $RPMCHECKOPTS_HOST $BUILD_ROOT/.init_b_cache/rpms/$PKG.rpm`
 
     if test -f $BUILD_ROOT/.init_b_cache/alreadyinstalled/$PKG ; then
-        read OLDPKGID < $BUILD_ROOT/.init_b_cache/alreadyinstalled/$PKG
-        if test "$PKGID" != "$OLDPKGID" ; then
-            echo deleting unwanted ${OLDPKGID%% *}
-            chroot $BUILD_ROOT rpm --nodeps -e $PKG 2>&1 | \
-                grep -v -e "^r.*failed: No such file or directory" -e "^error: failed to stat .*: No such file or directory"
-        elif test "$VERIFY_BUILD_SYSTEM" = true ; then
-            chroot $BUILD_ROOT rpm --verify $PKG 2>&1 | tee $TMPFILE
-            if grep ^missing $TMPFILE > /dev/null ; then
-                echo deleting incomplete ${PKGID%% *}
-                chroot $BUILD_ROOT rpm --nodeps -e $PKG 2>&1 | \
-                    grep -v -e "^r.*failed: No such file or directory" -e "^error: failed to stat .*: No such file or directory"
-            else
-                #echo "keeping ${PKGID%% *}"
-                echo "$PKGID" > $BUILD_ROOT/installed-pkg/$PKG
-                continue
-            fi
-        else
-            #echo "keeping ${PKGID%% *}"
-            echo "$PKGID" > $BUILD_ROOT/installed-pkg/$PKG
-            continue
-        fi
-        if test -e "$BUILD_ROOT/.init_b_cache/preinstalls/$PKG" ; then
-            preinstall "$PKG"
-            test rpm = "$PKG" && chroot $BUILD_ROOT rpm --rebuilddb
-        fi
+       read OLDPKGID < $BUILD_ROOT/.init_b_cache/alreadyinstalled/$PKG
+       if test "$PKGID" != "$OLDPKGID" ; then
+           echo deleting unwanted ${OLDPKGID%% *}
+           chroot $BUILD_ROOT rpm --nodeps -e $PKG 2>&1 | \
+               grep -v -e "^r.*failed: No such file or directory" -e "^error: failed to stat .*: No such file or directory"
+       elif test "$VERIFY_BUILD_SYSTEM" = true ; then
+           chroot $BUILD_ROOT rpm --verify $PKG 2>&1 | tee $TMPFILE
+           if grep ^missing $TMPFILE > /dev/null ; then
+               echo deleting incomplete ${PKGID%% *}
+               chroot $BUILD_ROOT rpm --nodeps -e $PKG 2>&1 | \
+                   grep -v -e "^r.*failed: No such file or directory" -e "^error: failed to stat .*: No such file or directory"
+           else
+               #echo "keeping ${PKGID%% *}"
+               echo "$PKGID" > $BUILD_ROOT/installed-pkg/$PKG
+               continue
+           fi
+       else
+           #echo "keeping ${PKGID%% *}"
+           echo "$PKGID" > $BUILD_ROOT/installed-pkg/$PKG
+           continue
+       fi
+       if test -e "$BUILD_ROOT/.init_b_cache/preinstalls/$PKG" ; then
+           preinstall "$PKG"
+           test rpm = "$PKG" && chroot $BUILD_ROOT rpm --rebuilddb
+       fi
     fi
     export ADDITIONAL_PARAMS=
     if test "$USE_FORCE" = true ; then
-        export ADDITIONAL_PARAMS="$ADDITIONAL_PARAMS --force"
+       export ADDITIONAL_PARAMS="$ADDITIONAL_PARAMS --force"
     fi
     echo "installing ${PKGID%% *}"
     if ! test "$BUILD_ROOT/.init_b_cache/rpms/$PKG.rpm" -ef "$BUILD_ROOT/.init_b_cache/$PKG.rpm" ; then
-        rm -f $BUILD_ROOT/.init_b_cache/$PKG.rpm
-        cp $BUILD_ROOT/.init_b_cache/rpms/$PKG.rpm $BUILD_ROOT/.init_b_cache/$PKG.rpm || cleanup_and_exit 1
+       rm -f $BUILD_ROOT/.init_b_cache/$PKG.rpm
+       cp $BUILD_ROOT/.init_b_cache/rpms/$PKG.rpm $BUILD_ROOT/.init_b_cache/$PKG.rpm || cleanup_and_exit 1
     fi
     ( chroot $BUILD_ROOT rpm --ignorearch --nodeps -U --oldpackage --ignoresize $RPMCHECKOPTS \
-                $ADDITIONAL_PARAMS .init_b_cache/$PKG.rpm 2>&1 || \
-          touch $BUILD_ROOT/exit ) | \
-              grep -v "^warning:.*saved as.*rpmorig$"
+               $ADDITIONAL_PARAMS .init_b_cache/$PKG.rpm 2>&1 || \
+         touch $BUILD_ROOT/exit ) | \
+             grep -v "^warning:.*saved as.*rpmorig$"
     # delete link so package is only installed once
     rm -f $BUILD_ROOT/.init_b_cache/$PKG.rpm
     test -e $BUILD_ROOT/exit && cleanup_and_exit 1
@@ -763,15 +763,15 @@ chmod 644 $BUILD_ROOT/etc/mtab
 test -e $BUILD_ROOT/etc/nsswitch.conf && {
     echo removing nis flags from $BUILD_ROOT/etc/nsswitch.conf...
     cat $BUILD_ROOT/etc/nsswitch.conf | sed -e"s:nis::g" > \
-        $BUILD_ROOT/etc/nsswitch.conf.tmp
+       $BUILD_ROOT/etc/nsswitch.conf.tmp
     mv $BUILD_ROOT/etc/nsswitch.conf.tmp $BUILD_ROOT/etc/nsswitch.conf
 }
 
 #
 # creating some default directories
 for DIR in /usr/share/doc/packages \
-           /usr/X11R6/include/X11/pixmaps \
-           /usr/X11R6/include/X11/bitmaps ; do
+          /usr/X11R6/include/X11/pixmaps \
+          /usr/X11R6/include/X11/bitmaps ; do
     mkdir -p $BUILD_ROOT/$DIR
 done
 
@@ -800,9 +800,9 @@ mkdir -p $BUILD_ROOT/var/adm/packages
 touch $BUILD_ROOT/var/adm/packages
 if test -x $BUILD_ROOT/sbin/SuSEconfig ; then
     if grep norestarts $BUILD_ROOT/sbin/SuSEconfig > /dev/null ; then
-        chroot $BUILD_ROOT /sbin/SuSEconfig --norestarts --force
+       chroot $BUILD_ROOT /sbin/SuSEconfig --norestarts --force
     else
-        chroot $BUILD_ROOT /sbin/SuSEconfig --force
+       chroot $BUILD_ROOT /sbin/SuSEconfig --force
     fi
 fi
 
@@ -812,7 +812,7 @@ fi
 
 for PROG in /usr/bin/TeX/texhash /usr/bin/texhash ; do
     test -x $BUILD_ROOT/$PROG && \
-        chroot $BUILD_ROOT bash -c ". /etc/profile ; $PROG"
+       chroot $BUILD_ROOT bash -c ". /etc/profile ; $PROG"
 done
 
 if test -e $BUILD_ROOT/usr/share/zoneinfo/UTC ; then
index 30f6010..04e3692 100755 (executable)
@@ -6,133 +6,133 @@ use strict;
 # See: http://www.rpm.org/max-rpm/s1-rpm-file-format-rpm-file-format.html#S3-RPM-FILE-FORMAT-HEADER-TAG-LISTING
 # cf http://search.cpan.org/~davecross/Parse-RPM-Spec-0.01/lib/Parse/RPM/Spec.pm
 my %STAG = (
-        "NAME"         => 1000,
-        "VERSION"      => 1001,
-        "RELEASE"      => 1002,
-        "EPOCH"                => 1003,
-        "SERIAL"       => 1003,
-        "SUMMARY"      => 1004,
-        "DESCRIPTION"  => 1005,
-        "BUILDTIME"    => 1006,
-        "BUILDHOST"    => 1007,
-        "INSTALLTIME"  => 1008,
-        "SIZE"         => 1009,
-        "DISTRIBUTION" => 1010,
-        "VENDOR"       => 1011,
-        "GIF"          => 1012,
-        "XPM"          => 1013,
-        "LICENSE"      => 1014,
-        "COPYRIGHT"    => 1014,
-        "PACKAGER"     => 1015,
-        "GROUP"                => 1016,
-        "SOURCE"       => 1018,
-        "PATCH"                => 1019,
-        "URL"          => 1020,
-        "OS"           => 1021,
-        "ARCH"         => 1022,
-        "PREIN"                => 1023,
-        "POSTIN"       => 1024,
-        "PREUN"                => 1025,
-        "POSTUN"       => 1026,
-        "OLDFILENAMES" => 1027,
-        "FILESIZES"    => 1028,
-        "FILESTATES"   => 1029,
-        "FILEMODES"    => 1030,
-        "FILERDEVS"    => 1033,
-        "FILEMTIMES"   => 1034,
-        "FILEMD5S"     => 1035,
-        "FILELINKTOS"  => 1036,
-        "FILEFLAGS"    => 1037,
-        "FILEUSERNAME" => 1039,
-        "FILEGROUPNAME"        => 1040,
-        "ICON"         => 1043,
-        "SOURCERPM"    => 1044,
-        "FILEVERIFYFLAGS"      => 1045,
-        "ARCHIVESIZE"  => 1046,
-        "PROVIDENAME"  => 1047,
-        "PROVIDES"     => 1047,
-        "REQUIREFLAGS" => 1048,
-        "REQUIRENAME"  => 1049,
-        "REQUIREVERSION"       => 1050,
-        "NOSOURCE"     => 1051,
-        "NOPATCH"      => 1052,
-        "CONFLICTFLAGS"        => 1053,
-        "CONFLICTNAME" => 1054,
-        "CONFLICTVERSION"      => 1055,
-        "EXCLUDEARCH"  => 1059,
-        "EXCLUDEOS"    => 1060,
-        "EXCLUSIVEARCH"        => 1061,
-        "EXCLUSIVEOS"  => 1062,
-        "RPMVERSION"   => 1064,
-        "TRIGGERSCRIPTS"       => 1065,
-        "TRIGGERNAME"  => 1066,
-        "TRIGGERVERSION"       => 1067,
-        "TRIGGERFLAGS" => 1068,
-        "TRIGGERINDEX" => 1069,
-        "VERIFYSCRIPT" => 1079,
-        "CHANGELOGTIME"        => 1080,
-        "CHANGELOGNAME"        => 1081,
-        "CHANGELOGTEXT"        => 1082,
-        "PREINPROG"    => 1085,
-        "POSTINPROG"   => 1086,
-        "PREUNPROG"    => 1087,
-        "POSTUNPROG"   => 1088,
-        "BUILDARCHS"   => 1089,
-        "OBSOLETENAME" => 1090,
-        "OBSOLETES"    => 1090,
-        "VERIFYSCRIPTPROG"     => 1091,
-        "TRIGGERSCRIPTPROG"    => 1092,
-        "COOKIE"       => 1094,
-        "FILEDEVICES"  => 1095,
-        "FILEINODES"   => 1096,
-        "FILELANGS"    => 1097,
-        "PREFIXES"     => 1098,
-        "INSTPREFIXES" => 1099,
-        "SOURCEPACKAGE"        => 1106,
-        "PROVIDEFLAGS" => 1112,
-        "PROVIDEVERSION"       => 1113,
-        "OBSOLETEFLAGS"        => 1114,
-        "OBSOLETEVERSION"      => 1115,
-        "DIRINDEXES"   => 1116,
-        "BASENAMES"    => 1117,
-        "DIRNAMES"     => 1118,
-        "OPTFLAGS"     => 1122,
-        "DISTURL"      => 1123,
-        "PAYLOADFORMAT"        => 1124,
-        "PAYLOADCOMPRESSOR"    => 1125,
-        "PAYLOADFLAGS" => 1126,
-        "INSTALLCOLOR" => 1127,
-        "INSTALLTID"   => 1128,
-        "REMOVETID"    => 1129,
-        "RHNPLATFORM"  => 1131,
-        "PLATFORM"     => 1132,
-        "PATCHESNAME"  => 1133,
-        "PATCHESFLAGS" => 1134,
-        "PATCHESVERSION"       => 1135,
-        "CACHECTIME"   => 1136,
-        "CACHEPKGPATH" => 1137,
-        "CACHEPKGSIZE" => 1138,
-        "CACHEPKGMTIME"        => 1139,
-        "FILECOLORS"   => 1140,
-        "FILECLASS"    => 1141,
-        "CLASSDICT"    => 1142,
-        "FILEDEPENDSX" => 1143,
-        "FILEDEPENDSN" => 1144,
-        "DEPENDSDICT"  => 1145,
-        "SOURCEPKGID"  => 1146,
-        "PRETRANS"     => 1151,
-        "POSTTRANS"    => 1152,
-        "PRETRANSPROG" => 1153,
-        "POSTTRANSPROG"        => 1154,
-        "DISTTAG"      => 1155,
-        "SUGGESTSNAME" => 1156,
-        "SUGGESTSVERSION"      => 1157,
-        "SUGGESTSFLAGS"        => 1158,
-        "ENHANCESNAME" => 1159,
-        "ENHANCESVERSION"      => 1160,
-        "ENHANCESFLAGS"        => 1161,
-        "PRIORITY"     => 1162,
-        "CVSID"                => 1163,
+       "NAME"          => 1000,
+       "VERSION"       => 1001,
+       "RELEASE"       => 1002,
+       "EPOCH"         => 1003,
+       "SERIAL"        => 1003,
+       "SUMMARY"       => 1004,
+       "DESCRIPTION"   => 1005,
+       "BUILDTIME"     => 1006,
+       "BUILDHOST"     => 1007,
+       "INSTALLTIME"   => 1008,
+       "SIZE"          => 1009,
+       "DISTRIBUTION"  => 1010,
+       "VENDOR"        => 1011,
+       "GIF"           => 1012,
+       "XPM"           => 1013,
+       "LICENSE"       => 1014,
+       "COPYRIGHT"     => 1014,
+       "PACKAGER"      => 1015,
+       "GROUP"         => 1016,
+       "SOURCE"        => 1018,
+       "PATCH"         => 1019,
+       "URL"           => 1020,
+       "OS"            => 1021,
+       "ARCH"          => 1022,
+       "PREIN"         => 1023,
+       "POSTIN"        => 1024,
+       "PREUN"         => 1025,
+       "POSTUN"        => 1026,
+       "OLDFILENAMES"  => 1027,
+       "FILESIZES"     => 1028,
+       "FILESTATES"    => 1029,
+       "FILEMODES"     => 1030,
+       "FILERDEVS"     => 1033,
+       "FILEMTIMES"    => 1034,
+       "FILEMD5S"      => 1035,
+       "FILELINKTOS"   => 1036,
+       "FILEFLAGS"     => 1037,
+       "FILEUSERNAME"  => 1039,
+       "FILEGROUPNAME" => 1040,
+       "ICON"          => 1043,
+       "SOURCERPM"     => 1044,
+       "FILEVERIFYFLAGS"       => 1045,
+       "ARCHIVESIZE"   => 1046,
+       "PROVIDENAME"   => 1047,
+       "PROVIDES"      => 1047,
+       "REQUIREFLAGS"  => 1048,
+       "REQUIRENAME"   => 1049,
+       "REQUIREVERSION"        => 1050,
+       "NOSOURCE"      => 1051,
+       "NOPATCH"       => 1052,
+       "CONFLICTFLAGS" => 1053,
+       "CONFLICTNAME"  => 1054,
+       "CONFLICTVERSION"       => 1055,
+       "EXCLUDEARCH"   => 1059,
+       "EXCLUDEOS"     => 1060,
+       "EXCLUSIVEARCH" => 1061,
+       "EXCLUSIVEOS"   => 1062,
+       "RPMVERSION"    => 1064,
+       "TRIGGERSCRIPTS"        => 1065,
+       "TRIGGERNAME"   => 1066,
+       "TRIGGERVERSION"        => 1067,
+       "TRIGGERFLAGS"  => 1068,
+       "TRIGGERINDEX"  => 1069,
+       "VERIFYSCRIPT"  => 1079,
+       "CHANGELOGTIME" => 1080,
+       "CHANGELOGNAME" => 1081,
+       "CHANGELOGTEXT" => 1082,
+       "PREINPROG"     => 1085,
+       "POSTINPROG"    => 1086,
+       "PREUNPROG"     => 1087,
+       "POSTUNPROG"    => 1088,
+       "BUILDARCHS"    => 1089,
+       "OBSOLETENAME"  => 1090,
+       "OBSOLETES"     => 1090,
+       "VERIFYSCRIPTPROG"      => 1091,
+       "TRIGGERSCRIPTPROG"     => 1092,
+       "COOKIE"        => 1094,
+       "FILEDEVICES"   => 1095,
+       "FILEINODES"    => 1096,
+       "FILELANGS"     => 1097,
+       "PREFIXES"      => 1098,
+       "INSTPREFIXES"  => 1099,
+       "SOURCEPACKAGE" => 1106,
+       "PROVIDEFLAGS"  => 1112,
+       "PROVIDEVERSION"        => 1113,
+       "OBSOLETEFLAGS" => 1114,
+       "OBSOLETEVERSION"       => 1115,
+       "DIRINDEXES"    => 1116,
+       "BASENAMES"     => 1117,
+       "DIRNAMES"      => 1118,
+       "OPTFLAGS"      => 1122,
+       "DISTURL"       => 1123,
+       "PAYLOADFORMAT" => 1124,
+       "PAYLOADCOMPRESSOR"     => 1125,
+       "PAYLOADFLAGS"  => 1126,
+       "INSTALLCOLOR"  => 1127,
+       "INSTALLTID"    => 1128,
+       "REMOVETID"     => 1129,
+       "RHNPLATFORM"   => 1131,
+       "PLATFORM"      => 1132,
+       "PATCHESNAME"   => 1133,
+       "PATCHESFLAGS"  => 1134,
+       "PATCHESVERSION"        => 1135,
+       "CACHECTIME"    => 1136,
+       "CACHEPKGPATH"  => 1137,
+       "CACHEPKGSIZE"  => 1138,
+       "CACHEPKGMTIME" => 1139,
+       "FILECOLORS"    => 1140,
+       "FILECLASS"     => 1141,
+       "CLASSDICT"     => 1142,
+       "FILEDEPENDSX"  => 1143,
+       "FILEDEPENDSN"  => 1144,
+       "DEPENDSDICT"   => 1145,
+       "SOURCEPKGID"   => 1146,
+       "PRETRANS"      => 1151,
+       "POSTTRANS"     => 1152,
+       "PRETRANSPROG"  => 1153,
+       "POSTTRANSPROG" => 1154,
+       "DISTTAG"       => 1155,
+       "SUGGESTSNAME"  => 1156,
+       "SUGGESTSVERSION"       => 1157,
+       "SUGGESTSFLAGS" => 1158,
+       "ENHANCESNAME"  => 1159,
+       "ENHANCESVERSION"       => 1160,
+       "ENHANCESFLAGS" => 1161,
+       "PRIORITY"      => 1162,
+       "CVSID"         => 1163,
 );
 
 # do not mix numeric tags with symbolic tags.
@@ -244,34 +244,34 @@ sub rpmq_many {
     $tag = 0+$tag;
     if ($stags{$tag}) {
       eval {
-        my $otag = $stags{$tag};
-        if ($type == 0) {
-          $res{$otag} = [ '' ];
-        } elsif ($type == 1) {
-          $res{$otag} = [ unpack("\@${offset}c$count", $data) ];
-        } elsif ($type == 2) {
-          $res{$otag} = [ unpack("\@${offset}c$count", $data) ];
-        } elsif ($type == 3) {
-          $res{$otag} = [ unpack("\@${offset}n$count", $data) ];
-        } elsif ($type == 4) {
-          $res{$otag} = [ unpack("\@${offset}N$count", $data) ];
-        } elsif ($type == 5) {
-          $res{$otag} = [ undef ];
-        } elsif ($type == 6) {
-          $res{$otag} = [ unpack("\@${offset}Z*", $data) ];
-        } elsif ($type == 7) {
-          $res{$otag} = [ unpack("\@${offset}a$count", $data) ];
-        } elsif ($type == 8 || $type == 9) {
-          my $d = unpack("\@${offset}a*", $data);
-          my @res = split("\0", $d, $count + 1);
-          $res{$otag} = [ splice @res, 0, $count ];
-        } else {
-          $res{$otag} = [ undef ];
-        }
+       my $otag = $stags{$tag};
+       if ($type == 0) {
+         $res{$otag} = [ '' ];
+       } elsif ($type == 1) {
+         $res{$otag} = [ unpack("\@${offset}c$count", $data) ];
+       } elsif ($type == 2) {
+         $res{$otag} = [ unpack("\@${offset}c$count", $data) ];
+       } elsif ($type == 3) {
+         $res{$otag} = [ unpack("\@${offset}n$count", $data) ];
+       } elsif ($type == 4) {
+         $res{$otag} = [ unpack("\@${offset}N$count", $data) ];
+       } elsif ($type == 5) {
+         $res{$otag} = [ undef ];
+       } elsif ($type == 6) {
+         $res{$otag} = [ unpack("\@${offset}Z*", $data) ];
+       } elsif ($type == 7) {
+         $res{$otag} = [ unpack("\@${offset}a$count", $data) ];
+       } elsif ($type == 8 || $type == 9) {
+         my $d = unpack("\@${offset}a*", $data);
+         my @res = split("\0", $d, $count + 1);
+         $res{$otag} = [ splice @res, 0, $count ];
+       } else {
+         $res{$otag} = [ undef ];
+       }
       };
       if ($@) {
-        warn("Bad rpm $rpm: $@\n");
-        return ();
+       warn("Bad rpm $rpm: $@\n");
+       return ();
       }
     }
   }
@@ -551,40 +551,40 @@ sub handle_rpms {
     for my $r (@baselib) {
       my $rr = substr($r, 1);
       if (substr($r, 0, 1) eq '+') {
-        if ($rr =~ /^(.*?)\s*->\s*(.*?)$/) {
-          if (grep {$_ eq $1} @rpmfiles) {
-            $files{$1} = 1;
-            $moves{$1} = $2;
-          }
-        } else {
-          for (grep {/$rr/} @rpmfiles) {
-            $files{$_} = 1;
-            delete $moves{$_};
-          }
-        }
+       if ($rr =~ /^(.*?)\s*->\s*(.*?)$/) {
+         if (grep {$_ eq $1} @rpmfiles) {
+           $files{$1} = 1;
+           $moves{$1} = $2;
+         }
+       } else {
+         for (grep {/$rr/} @rpmfiles) {
+           $files{$_} = 1;
+           delete $moves{$_};
+         }
+       }
       } elsif (substr($r, 0, 1) eq '-') {
-        delete $files{$_} for grep {/$rr/} keys %files;
+       delete $files{$_} for grep {/$rr/} keys %files;
       } elsif (substr($r, 0, 1) eq '"') {
-        $rr =~ s/\"$//;
-        if ($rr =~ /^(.*?)\s*->\s*(.*?)$/) {
-          $symlinks{$1} = $2;
-        } else {
-          die("bad baselib string rule: $r\n");
-        }
+       $rr =~ s/\"$//;
+       if ($rr =~ /^(.*?)\s*->\s*(.*?)$/) {
+         $symlinks{$1} = $2;
+       } else {
+         die("bad baselib string rule: $r\n");
+       }
       } else {
-        die("bad baselib rule: $r\n");
+       die("bad baselib rule: $r\n");
       }
     }
     if ($configdir) {
       for my $r (@config) {
-        my $rr = substr($r, 1);
-        if (substr($r, 0, 1) eq '+') {
-          $cfiles{$_} = 1 for grep {/$rr/} grep {!$ghosts{$_}} @rpmfiles;
-        } elsif (substr($r, 0, 1) eq '-') {
-          delete $cfiles{$_} for grep {/$rr/} keys %cfiles;
-        } else {
-          die("bad config rule: $r\n");
-        }
+       my $rr = substr($r, 1);
+       if (substr($r, 0, 1) eq '+') {
+         $cfiles{$_} = 1 for grep {/$rr/} grep {!$ghosts{$_}} @rpmfiles;
+       } elsif (substr($r, 0, 1) eq '-') {
+         delete $cfiles{$_} for grep {/$rr/} keys %cfiles;
+       } else {
+         die("bad config rule: $r\n");
+       }
       }
     }
     $files{$_} = 1 for keys %cfiles;
@@ -613,12 +613,12 @@ sub handle_rpms {
       next if $cfiles{$_};
       my $fn = $_;
       if ($moves{$fn}) {
-        $fn = $moves{$fn};
-        next unless $fn =~ s/\/[^\/]+$//;
-        $alldirs{$fn} = 1;
+       $fn = $moves{$fn};
+       next unless $fn =~ s/\/[^\/]+$//;
+       $alldirs{$fn} = 1;
       } else {
-        next unless $fn =~ s/\/[^\/]+$//;
-        $alldirs{"$prefix$fn"} = 1;
+       next unless $fn =~ s/\/[^\/]+$//;
+       $alldirs{"$prefix$fn"} = 1;
       }
     }
     $alldirs{$_} = 1 for keys %symlinks;
@@ -631,9 +631,9 @@ sub handle_rpms {
       next if $cfiles{$_};
       my $fn = $_;
       if ($moves{$fn}) {
-        delete $alldirs{$moves{$fn}};
+       delete $alldirs{$moves{$fn}};
       } else {
-        delete $alldirs{"$prefix$fn"};
+       delete $alldirs{"$prefix$fn"};
       }
     }
     $ad = $prefix;
@@ -651,20 +651,20 @@ sub handle_rpms {
       my $d = $res{$pt}->[0];
       $d =~ s/%/%%/g;
       if ($p eq 'Name') {
-        print SPEC "Name: $sname\n";
-        next;
+       print SPEC "Name: $sname\n";
+       next;
       }
       if ($p eq 'Version') {
-        print SPEC "Version: $sversion\n";
-        next;
+       print SPEC "Version: $sversion\n";
+       next;
       }
       if ($p eq 'Release') {
-        print SPEC "Release: $srelease\n";
-        next;
+       print SPEC "Release: $srelease\n";
+       next;
       }
       if ($p eq 'Disturl') {
-        print SPEC "%define disturl $d\n";
-        next;
+       print SPEC "%define disturl $d\n";
+       next;
       }
       print SPEC "$p: $d\n";
     }
@@ -682,37 +682,37 @@ sub handle_rpms {
       my $d = $res{$pt}->[0];
       $d =~ s/%/%%/g;
       if ($pt eq 'VERSION' && $legacyversion) {
-        $d = $legacyversion;
+       $d = $legacyversion;
       } elsif ($pt eq 'RELEASE' && $legacyversion) {
-        my @bt = localtime($res{'BUILDTIME'}->[0]);
-        $bt[5] += 1900;
-        $bt[4] += 1;
-        $d = sprintf("%04d%02d%02d%02d%02d\n", @bt[5,4,3,2,1]);
+       my @bt = localtime($res{'BUILDTIME'}->[0]);
+       $bt[5] += 1900;
+       $bt[4] += 1;
+       $d = sprintf("%04d%02d%02d%02d%02d\n", @bt[5,4,3,2,1]);
       }
       print SPEC "$p: $d\n";
     }
     print SPEC "Autoreqprov: $autoreqprov\n";
 
     for my $ar ([\@provides, 'provides'],
-                [\@prerequires, 'prereq'],
-                [\@requires, 'requires'],
-                [\@recommends, 'recommends'],
-                [\@supplements, 'supplements'],
-                [\@obsoletes, 'obsoletes'],
-                [\@conflicts, 'conflicts']) {
-        my @a = @{$ar->[0]};
-        my @na = ();
-        for (@a) {
-          if (substr($_, 0, 1) eq '"') {
-            die("bad $ar->[1] rule: $_\n") unless /^\"(.*)\"$/;
-            push @na, $1;
-          } elsif (substr($_, 0, 1) eq '-') {
-            my $ra = substr($_, 1);
-            @na = grep {!/$ra/} @na;
-          } else {
-            die("bad $ar->[1] rule: $_\n");
-          }
-        }
+               [\@prerequires, 'prereq'],
+               [\@requires, 'requires'],
+               [\@recommends, 'recommends'],
+               [\@supplements, 'supplements'],
+               [\@obsoletes, 'obsoletes'],
+               [\@conflicts, 'conflicts']) {
+       my @a = @{$ar->[0]};
+       my @na = ();
+       for (@a) {
+         if (substr($_, 0, 1) eq '"') {
+           die("bad $ar->[1] rule: $_\n") unless /^\"(.*)\"$/;
+           push @na, $1;
+         } elsif (substr($_, 0, 1) eq '-') {
+           my $ra = substr($_, 1);
+           @na = grep {!/$ra/} @na;
+         } else {
+           die("bad $ar->[1] rule: $_\n");
+         }
+       }
       print SPEC ucfirst($ar->[1]).": $_\n" for @na;
     }
     my $cpiopre = '';
@@ -733,8 +733,8 @@ sub handle_rpms {
     my @cfl = grep {!$cfiles{$_} && !$moves{$_}} sort keys %files;
     if (@cfl) {
       if ($prefix ne '') {
-        print SPEC "mkdir -p \$RPM_BUILD_ROOT$prefix\n";
-        print SPEC "pushd \$RPM_BUILD_ROOT$prefix\n";
+       print SPEC "mkdir -p \$RPM_BUILD_ROOT$prefix\n";
+       print SPEC "pushd \$RPM_BUILD_ROOT$prefix\n";
       }
       print SPEC "cat <<EOFL >.filelist\n";
       print SPEC "$_\n" for map {$cpiopre.substr($_, 1)} @cfl;
@@ -743,15 +743,15 @@ sub handle_rpms {
       print SPEC "rpm2cpio $rpm | cpio -i -d -v -E .filelist\n";
       print SPEC "rm .filelist\n";
       if (%ghosts) {
-        for my $fn (grep {$ghosts{$_}} @cfl) {
-          my $fnm = $fn;
-          $fnm = '.' unless $fnm =~ s/\/[^\/]+$//;
-          print SPEC "mkdir -p \$RPM_BUILD_ROOT$prefix$fnm\n";
-          print SPEC "touch \$RPM_BUILD_ROOT$prefix$fn\n";
-        }
+       for my $fn (grep {$ghosts{$_}} @cfl) {
+         my $fnm = $fn;
+         $fnm = '.' unless $fnm =~ s/\/[^\/]+$//;
+         print SPEC "mkdir -p \$RPM_BUILD_ROOT$prefix$fnm\n";
+         print SPEC "touch \$RPM_BUILD_ROOT$prefix$fn\n";
+       }
       }
       if ($prefix ne '') {
-        print SPEC "popd\n";
+       print SPEC "popd\n";
       }
     }
     if (%cfiles || %moves) {
@@ -763,14 +763,14 @@ sub handle_rpms {
       print SPEC "rpm2cpio $rpm | cpio -i -d -v -E .filelist\n";
       print SPEC "popd\n";
       if (%cfiles) {
-        print SPEC "mkdir -p \$RPM_BUILD_ROOT$configdir\n";
-        print SPEC "mv .cfiles$_ \$RPM_BUILD_ROOT$configdir\n" for sort keys %cfiles;
+       print SPEC "mkdir -p \$RPM_BUILD_ROOT$configdir\n";
+       print SPEC "mv .cfiles$_ \$RPM_BUILD_ROOT$configdir\n" for sort keys %cfiles;
       }
       for my $fn (sort keys %moves) {
-        my $fnm = $moves{$fn};
-        $fnm = '.' unless $fnm =~ s/\/[^\/]+$//;
-        print SPEC "mkdir -p \$RPM_BUILD_ROOT$fnm\n";
-        print SPEC "mv .cfiles$fn \$RPM_BUILD_ROOT$moves{$fn}\n";
+       my $fnm = $moves{$fn};
+       $fnm = '.' unless $fnm =~ s/\/[^\/]+$//;
+       print SPEC "mkdir -p \$RPM_BUILD_ROOT$fnm\n";
+       print SPEC "mv .cfiles$fn \$RPM_BUILD_ROOT$moves{$fn}\n";
       }
       print SPEC "rm -rf .cfiles\n";
     }
@@ -789,32 +789,32 @@ sub handle_rpms {
       print SPEC "%pre -n $targetname";
       print SPEC $prein[0] =~ /^\"-p/ ? " " : "\n";
       for (@prein) {
-        die("bad prein rule: $_\n") unless /^\"(.*)\"$/;
-        print SPEC "$1\n";
+       die("bad prein rule: $_\n") unless /^\"(.*)\"$/;
+       print SPEC "$1\n";
       }
     }
     if (@postin) {
       print SPEC "%post -n $targetname";
       print SPEC $postin[0] =~ /^\"-p/ ? " " : "\n";
       for (@postin) {
-        die("bad postin rule: $_\n") unless /^\"(.*)\"$/;
-        print SPEC "$1\n";
+       die("bad postin rule: $_\n") unless /^\"(.*)\"$/;
+       print SPEC "$1\n";
       }
     }
     if (@preun) {
       print SPEC "%preun -n $targetname";
       print SPEC $preun[0] =~ /^\"-p/ ? " " : "\n";
       for (@preun) {
-        die("bad preun rule: $_\n") unless /^\"(.*)\"$/;
-        print SPEC "$1\n";
+       die("bad preun rule: $_\n") unless /^\"(.*)\"$/;
+       print SPEC "$1\n";
       }
     }
     if (@postun) {
       print SPEC "%postun -n $targetname";
       print SPEC $postun[0] =~ /^\"-p/ ? " " : "\n";
       for (@postun) {
-        die("bad postun rule: $_\n") unless /^\"(.*)\"$/;
-        print SPEC "$1\n";
+       die("bad postun rule: $_\n") unless /^\"(.*)\"$/;
+       print SPEC "$1\n";
       }
     }
 
@@ -830,53 +830,53 @@ sub handle_rpms {
       my $fv = $res{'FILEVERIFYFLAGS'}->[$fi];
       my $ff = $res{'FILEFLAGS'}->[$fi];
       if (POSIX::S_ISDIR($fm)) {
-        print SPEC "%dir ";
+       print SPEC "%dir ";
       }
       if ($ff & ((1 << 3) | (1 << 4))) {
-        print SPEC "%config(missingok noreplace) ";
+       print SPEC "%config(missingok noreplace) ";
       } elsif ($ff & (1 << 3)) {
-        print SPEC "%config(missingok) ";
+       print SPEC "%config(missingok) ";
       } elsif ($ff & (1 << 4)) {
-        print SPEC "%config(noreplace) ";
+       print SPEC "%config(noreplace) ";
       } elsif ($ff & (1 << 0)) {
-        print SPEC "%config ";
+       print SPEC "%config ";
       }
       print SPEC "%doc " if $ff & (1 << 1);
       print SPEC "%ghost " if $ff & (1 << 6);
       print SPEC "%license " if $ff & (1 << 7);
       print SPEC "%readme " if $ff & (1 << 8);
       if ($fv != 4294967295) {
-        print SPEC "%verify(";
-        if ($fv & 2147483648) {
-          print SPEC "not ";
-          $fv ^= 4294967295;
-        }
-        print SPEC "md5 " if $fv & (1 << 0);
-        print SPEC "size " if $fv & (1 << 1);
-        print SPEC "link " if $fv & (1 << 2);
-        print SPEC "user " if $fv & (1 << 3);
-        print SPEC "group " if $fv & (1 << 4);
-        print SPEC "mtime " if $fv & (1 << 5);
-        print SPEC "mode " if $fv & (1 << 6);
-        print SPEC "rdev " if $fv & (1 << 7);
-        print SPEC ") ";
+       print SPEC "%verify(";
+       if ($fv & 2147483648) {
+         print SPEC "not ";
+         $fv ^= 4294967295;
+       }
+       print SPEC "md5 " if $fv & (1 << 0);
+       print SPEC "size " if $fv & (1 << 1);
+       print SPEC "link " if $fv & (1 << 2);
+       print SPEC "user " if $fv & (1 << 3);
+       print SPEC "group " if $fv & (1 << 4);
+       print SPEC "mtime " if $fv & (1 << 5);
+       print SPEC "mode " if $fv & (1 << 6);
+       print SPEC "rdev " if $fv & (1 << 7);
+       print SPEC ") ";
       }
       #sigh, no POSIX::S_ISLNK ...
       if (($fm & 0170000) == 0120000) {
-        printf SPEC "%%attr(-,%s,%s) ", $res{'FILEUSERNAME'}->[$fi], $res{'FILEGROUPNAME'}->[$fi];
+       printf SPEC "%%attr(-,%s,%s) ", $res{'FILEUSERNAME'}->[$fi], $res{'FILEGROUPNAME'}->[$fi];
       } else {
-        printf SPEC "%%attr(%03o,%s,%s) ", $fm & 07777, $res{'FILEUSERNAME'}->[$fi], $res{'FILEGROUPNAME'}->[$fi];
+       printf SPEC "%%attr(%03o,%s,%s) ", $fm & 07777, $res{'FILEUSERNAME'}->[$fi], $res{'FILEGROUPNAME'}->[$fi];
       }
       if ($cfiles{$file}) {
-        my $fn = $file;
-        $fn =~ s/.*\///;
-        print SPEC "$configdir/$fn\n";
+       my $fn = $file;
+       $fn =~ s/.*\///;
+       print SPEC "$configdir/$fn\n";
       } else {
-        if ($moves{$file}) {
-          print SPEC "$moves{$file}\n";
-        } else {
-          print SPEC "$prefix$file\n";
-        }
+       if ($moves{$file}) {
+         print SPEC "$moves{$file}\n";
+       } else {
+         print SPEC "$prefix$file\n";
+       }
       }
     }
     for (keys %symlinks) {
@@ -890,14 +890,14 @@ sub handle_rpms {
       my @wdays = qw{Sun Mon Tue Wed Thu Fri Sat};
       my @months = qw{Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec};
       for my $cc (@{$res{'CHANGELOGTEXT'}}) {
-        my @lt = localtime($ct[0]);
-        my $cc2 = $cc;
-        my $cn2 = $cn[0];
-        $cc2 =~ s/%/%%/g;
-        $cn2 =~ s/%/%%/g;
-        printf SPEC "* %s %s %02d %04d %s\n%s\n", $wdays[$lt[6]], $months[$lt[4]], $lt[3], 1900 + $lt[5], $cn2, $cc2;
-        shift @ct;
-        shift @cn;
+       my @lt = localtime($ct[0]);
+       my $cc2 = $cc;
+       my $cn2 = $cn[0];
+       $cc2 =~ s/%/%%/g;
+       $cn2 =~ s/%/%%/g;
+       printf SPEC "* %s %s %02d %04d %s\n%s\n", $wdays[$lt[6]], $months[$lt[4]], $lt[3], 1900 + $lt[5], $cn2, $cc2;
+       shift @ct;
+       shift @cn;
       }
     }
 
@@ -924,8 +924,8 @@ sub handle_debs {
   if ($@){
     print "mkbaselibs needs the perl module Parse::DebControl\n".
       "Error. baselibs-deb.conf specified but mkbaselibs can't run\n".
-        "Please ensure that 'osc meta prjconf' contains the following line:\n".
-          "  Support: libparse-debcontrol-perl\n";
+       "Please ensure that 'osc meta prjconf' contains the following line:\n".
+         "  Support: libparse-debcontrol-perl\n";
     return;
   };
 
@@ -1031,36 +1031,36 @@ sub handle_debs {
       # Tidy up the various control files.
       # the md5sums are regenerated by dpkg-deb when building
       foreach my $c_file qw(conffiles postinst  postrm  preinst  prerm) {
-        unlink "${baseTarget}/DEBIAN/$c_file";
+       unlink "${baseTarget}/DEBIAN/$c_file";
       }
       # Create them if needed
       if (@prein) {
-        map s/^"(.*)"$/$1/, @prein;  # remove leading/trailing "s
-        open(my $SCRIPT, ">${baseTarget}/DEBIAN/preinst");
-        print $SCRIPT join("\n", @prein) ;
-        chmod(0755, $SCRIPT);
-        close($SCRIPT);
+       map s/^"(.*)"$/$1/, @prein;  # remove leading/trailing "s
+       open(my $SCRIPT, ">${baseTarget}/DEBIAN/preinst");
+       print $SCRIPT join("\n", @prein) ;
+       chmod(0755, $SCRIPT);
+       close($SCRIPT);
       }
       if (@postin) {
-        map s/^"(.*)"$/$1/, @postin;
-        open(my $SCRIPT, ">${baseTarget}/DEBIAN/postinst");
-        print $SCRIPT join("\n", @postin) ;
-        chmod(0755, $SCRIPT);
-        close($SCRIPT);
+       map s/^"(.*)"$/$1/, @postin;
+       open(my $SCRIPT, ">${baseTarget}/DEBIAN/postinst");
+       print $SCRIPT join("\n", @postin) ;
+       chmod(0755, $SCRIPT);
+       close($SCRIPT);
       }
       if (@preun) {
-        map s/^"(.*)"$/$1/, @preun;
-        open(my $SCRIPT, ">${baseTarget}/DEBIAN/prerm");
-        print $SCRIPT join("\n", @preun) ;
-        chmod(0755, $SCRIPT);
-        close($SCRIPT);
+       map s/^"(.*)"$/$1/, @preun;
+       open(my $SCRIPT, ">${baseTarget}/DEBIAN/prerm");
+       print $SCRIPT join("\n", @preun) ;
+       chmod(0755, $SCRIPT);
+       close($SCRIPT);
       }
       if (@postun) {
-        map s/^"(.*)"$/$1/, @postun;
-        open(my $SCRIPT, ">${baseTarget}/DEBIAN/postrm");
-        print $SCRIPT join("\n", @postun) ;
-        chmod(0755, $SCRIPT);
-        close($SCRIPT);
+       map s/^"(.*)"$/$1/, @postun;
+       open(my $SCRIPT, ">${baseTarget}/DEBIAN/postrm");
+       print $SCRIPT join("\n", @postun) ;
+       chmod(0755, $SCRIPT);
+       close($SCRIPT);
       }
 
       # Don't forget to rename the package - or it will replace/uninstall the /-based one
index e81654b..2792cd6 100755 (executable)
@@ -117,19 +117,19 @@ for my $l (@$xspec) {
     my $oldl = $l;
     if (defined $release) {
       if (!($l =~ s/<RELEASE\d*>/$release/g)) {
-        if ($l =~ /<(?:CI_CNT|B_CNT)>/) {
-          # XXX: should pass ci_cnt/b_cnt instead
-          if ($release =~ /(\d+)\.(\d+)$/) {
-            my ($ci, $b) = ($1, $2);
-            $l =~ s/<CI_CNT>/$ci/;
-            $l =~ s/<B_CNT>/$b/;
-          } elsif ($release =~ /(\d+)$/) {
-            my $b = $1;
-            $l =~ s/<B_CNT>/$b/ unless $l =~ s/<CI_CNT>/$b/;
-          }
-        } else {
-          $l =~ s/^(Release:\s*).*/$1$release/i;
-        }
+       if ($l =~ /<(?:CI_CNT|B_CNT)>/) {
+         # XXX: should pass ci_cnt/b_cnt instead
+         if ($release =~ /(\d+)\.(\d+)$/) {
+           my ($ci, $b) = ($1, $2);
+           $l =~ s/<CI_CNT>/$ci/;
+           $l =~ s/<B_CNT>/$b/;
+         } elsif ($release =~ /(\d+)$/) {
+           my $b = $1;
+           $l =~ s/<B_CNT>/$b/ unless $l =~ s/<CI_CNT>/$b/;
+         }
+       } else {
+         $l =~ s/^(Release:\s*).*/$1$release/i;
+       }
       }
     }
     # this is to be compatible to legacy autobuild.
@@ -147,56 +147,56 @@ for my $l (@$xspec) {
       my @nl;
       my $interpreter = "/bin/bash";
       if (open(RP, '<', "$specdir$cf->{'releaseprg'}")) {
-        @nl = <RP>;
-        close RP;
-        if (@nl && $nl[0] =~ /^#!\s*(\S*)/) {
-          $interpreter = $1;
-        }
+       @nl = <RP>;
+       close RP;
+       if (@nl && $nl[0] =~ /^#!\s*(\S*)/) {
+         $interpreter = $1;
+       }
       }
       if ($buildroot) {
-        my $sd = $specdir;
-        $sd =~ s/^\Q$buildroot\E//;
-        open(RP, "-|", 'chroot', $buildroot, $interpreter, "$sd$cf->{'releaseprg'}", $project, $newl, $pkg, $arch) || die("$cf->{'releaseprg'}: $!\n");
+       my $sd = $specdir;
+       $sd =~ s/^\Q$buildroot\E//;
+       open(RP, "-|", 'chroot', $buildroot, $interpreter, "$sd$cf->{'releaseprg'}", $project, $newl, $pkg, $arch) || die("$cf->{'releaseprg'}: $!\n");
       } else {
-        open(RP, "-|", $interpreter, "$specdir$cf->{'releaseprg'}", $project, $newl, $pkg, $arch) || die("$cf->{'releaseprg'}: $!\n");
+       open(RP, "-|", $interpreter, "$specdir$cf->{'releaseprg'}", $project, $newl, $pkg, $arch) || die("$cf->{'releaseprg'}: $!\n");
       }
       @nl = grep {$_ ne ''} <RP>;
       if (!close(RP)) {
-        warn("$cf->{'releaseprg'} failed: $?\n");
+       warn("$cf->{'releaseprg'} failed: $?\n");
       }
       # and another compatibility hack: if the prg returns pkg:<package>,
       # the release of the package will be used. yuck...
       if (@nl && $nl[0] =~ s/^pkg://) {
-        my $relpkg = $nl[0];
-        chomp $relpkg;
-        if ($buildroot) {
-          open(RP, "-|", 'chroot', $buildroot, 'rpm', '-q', '--qf', '%{RELEASE}', $relpkg) || die("rpm: $!\n");
-        } else {
-          open(RP, "-|", 'rpm', '-q', '--qf', '%{RELEASE}', $relpkg) || die("rpm: $!\n");
-        }
-        @nl = grep {$_ ne ''} <RP>;
-        if (!close(RP)) {
-          warn("rpm package query of '$relpkg' failed: $?\n");
-        }
+       my $relpkg = $nl[0];
+       chomp $relpkg;
+       if ($buildroot) {
+         open(RP, "-|", 'chroot', $buildroot, 'rpm', '-q', '--qf', '%{RELEASE}', $relpkg) || die("rpm: $!\n");
+       } else {
+         open(RP, "-|", 'rpm', '-q', '--qf', '%{RELEASE}', $relpkg) || die("rpm: $!\n");
+       }
+       @nl = grep {$_ ne ''} <RP>;
+       if (!close(RP)) {
+         warn("rpm package query of '$relpkg' failed: $?\n");
+       }
       }
       if ($nl[0]) {
-        chomp $nl[0];
-        $l =~ s/^(Release:\s*).*/$1$nl[0]/i;
-        if (defined $release) {
-          if (!($l =~ s/<RELEASE\d*>/$release/g)) {
-            if ($l =~ /<(?:CI_CNT|B_CNT)>/) {
-              # XXX: should pass ci_cnt/b_cnt instead
-              if ($release =~ /(\d+)\.(\d+)$/) {
-                my ($ci, $b) = ($1, $2);
-                $l =~ s/<CI_CNT>/$ci/;
-                $l =~ s/<B_CNT>/$b/;
-              } elsif ($release =~ /(\d+)$/) {
-                my $b = $1;
-                $l =~ s/<B_CNT>/$b/ unless $l =~ s/<CI_CNT>/$b/;
-              }
-            }
-          }
-        }
+       chomp $nl[0];
+       $l =~ s/^(Release:\s*).*/$1$nl[0]/i;
+       if (defined $release) {
+         if (!($l =~ s/<RELEASE\d*>/$release/g)) {
+           if ($l =~ /<(?:CI_CNT|B_CNT)>/) {
+             # XXX: should pass ci_cnt/b_cnt instead
+             if ($release =~ /(\d+)\.(\d+)$/) {
+               my ($ci, $b) = ($1, $2);
+               $l =~ s/<CI_CNT>/$ci/;
+               $l =~ s/<B_CNT>/$b/;
+             } elsif ($release =~ /(\d+)$/) {
+               my $b = $1;
+               $l =~ s/<B_CNT>/$b/ unless $l =~ s/<CI_CNT>/$b/;
+             }
+           }
+         }
+       }
       }
     }
     # all compat stuff done. we return to your scheduled program
diff --git a/unrpm b/unrpm
index 43cf73f..e69dafb 100755 (executable)
--- a/unrpm
+++ b/unrpm
@@ -15,14 +15,14 @@ QUIET=false
 for i in $* ; do
     case "$i" in
       -v)
-        VERBOSE=true
-        ;;
+       VERBOSE=true
+       ;;
       -q)
-        QUIET=true
-        ;;
+       QUIET=true
+       ;;
       *)
-        FILES="$FILES $i"
-        ;;
+       FILES="$FILES $i"
+       ;;
     esac
 done
 
@@ -33,7 +33,7 @@ test -z "$FILES" && Usage
 
 for f in $FILES; do
     if test "$QUIET" = "false" ; then
-        echo -ne "$f:\t"
+       echo -ne "$f:\t"
     fi
     rpm2cpio $f | cpio ${CPIO_OPTS}
 done