Update to upstream 20160629
authorshuai.fu <shuai01.fu@samsung.com>
Sat, 22 Apr 2017 05:43:02 +0000 (13:43 +0800)
committershuai.fu <shuai01.fu@samsung.com>
Sat, 22 Apr 2017 05:44:05 +0000 (13:44 +0800)
Change-Id: Idc31c269aec94e852b30885dee65a827b318b7a3
Signed-off-by: shuai.fu <shuai01.fu@samsung.com>
76 files changed:
Build.pm
Build/Arch.pm
Build/Archrepo.pm
Build/Collax.pm [new file with mode: 0644]
Build/Deb.pm
Build/Debrepo.pm
Build/Kiwi.pm
Build/Mdkrepo.pm [new file with mode: 0644]
Build/Repo.pm
Build/Rpm.pm
Build/Rpmmd.pm
Build/SimpleXML.pm [new file with mode: 0644]
Build/Snapcraft.pm [new file with mode: 0644]
Build/Susetags.pm
HOWTO.add_another_format [new file with mode: 0644]
Makefile
README
baselibs_global.conf
build
build-pkg-arch
build-pkg-deb
build-pkg-rpm
build-recipe
build-recipe-arch
build-recipe-collax [new file with mode: 0644]
build-recipe-debbuild [new file with mode: 0644]
build-recipe-debootstrap
build-recipe-dsc
build-recipe-kiwi
build-recipe-livebuild
build-recipe-simpleimage [new file with mode: 0644]
build-recipe-snapcraft [new file with mode: 0644]
build-recipe-spec
build-vm
build-vm-docker [new file with mode: 0644]
build-vm-kvm
build-vm-lxc
build-vm-pvm [new file with mode: 0644]
build-vm-zvm
build.1
build_kiwi.sh [deleted file]
common_functions
configs/arch.conf
configs/collax.conf [new file with mode: 0644]
configs/debian.conf
configs/sl13.3.conf [new file with mode: 0644]
configs/sl42.1.conf [new file with mode: 0644]
configs/ubuntu.conf [new file with mode: 0644]
createmdkdeps [new file with mode: 0755]
createrepomddeps
createrpmdeps [deleted file]
debtransform
debtransformxz [new file with mode: 0755]
detect_architecture.sh [deleted file]
download
expanddeps
find-debuginfo.sh [deleted file]
getchangetarget [deleted file]
getmacros [deleted file]
getoptflags [deleted file]
gettype [deleted file]
init_buildsystem
initscript_qemu_vm [deleted file]
initvm.c
lxc.conf
mkbaselibs
mkdrpms
packaging/build.changes
packaging/build.spec
qemu-reg
queryconfig
runservices [new file with mode: 0755]
spec_add_patch
telnet_login_wrapper [new file with mode: 0755]
vc
zvm_functions [deleted file]

index 787b656..d1c39d7 100644 (file)
--- a/Build.pm
+++ b/Build.pm
@@ -24,6 +24,7 @@ use strict;
 use Digest::MD5;
 use Build::Rpm;
 use Data::Dumper;
+use POSIX qw(strftime);
 
 our $expand_dbg;
 
@@ -31,7 +32,9 @@ our $do_rpm;
 our $do_deb;
 our $do_kiwi;
 our $do_arch;
+our $do_collax;
 our $do_livebuild;
+our $do_snapcraft;
 
 sub import {
   for (@_) {
@@ -39,9 +42,11 @@ sub import {
     $do_deb = 1 if $_ eq ':deb';
     $do_kiwi = 1 if $_ eq ':kiwi';
     $do_arch = 1 if $_ eq ':arch';
+    $do_collax = 1 if $_ eq ':collax';
     $do_livebuild = 1 if $_ eq ':livebuild';
+    $do_snapcraft = 1 if $_ eq ':snapcraft';
   }
-  $do_rpm = $do_deb = $do_kiwi = $do_arch = $do_livebuild = 1 if !$do_rpm && !$do_deb && !$do_kiwi && !$do_arch && !$do_livebuild;
+  $do_rpm = $do_deb = $do_kiwi = $do_arch = $do_collax = $do_livebuild = $do_snapcraft = 1 if !$do_rpm && !$do_deb && !$do_kiwi && !$do_arch && !$do_collax && !$do_livebuild && !$do_snapcraft;
   if ($do_deb) {
     require Build::Deb;
   }
@@ -51,9 +56,15 @@ sub import {
   if ($do_arch) {
     require Build::Arch;
   }
+  if ($do_collax) {
+    require Build::Collax;
+  }
   if ($do_livebuild) {
     require Build::LiveBuild;
   }
+  if ($do_snapcraft) {
+    require Build::Snapcraft;
+  }
 }
 
 package Build::Features;
@@ -137,7 +148,7 @@ sub dist_canon($$) {
   } elsif ($rpmdist =~ /suse linux (\d+)\.(\d+)\.[4-9]\d/) {
     # alpha version
     $dist = "$1.".($2 + 1)."-$rpmdista";
-  } elsif ($rpmdist =~ /suse linux (\d+\.\d+)/) {
+  } elsif ($rpmdist =~ /suse linux (?:leap )?(\d+\.\d+)/) {
     $dist = "$1-$rpmdista";
   }
   return $dist;
@@ -174,8 +185,8 @@ sub read_config_dist {
 }
 
 sub get_hostarch {
-       my $hostarch = `uname -m` || 'i586';
-       return $hostarch;
+       my $hostarch = `uname -m` || 'i586';
+       return $hostarch;
 }
 
 sub read_config {
@@ -237,6 +248,7 @@ sub read_config {
   $config->{'constraint'} = [];
   $config->{'expandflags'} = [];
   $config->{'buildflags'} = [];
+  $config->{'singleexport'} = '';
   for my $l (@spec) {
     $l = $l->[1] if ref $l;
     next unless defined $l;
@@ -334,10 +346,12 @@ sub read_config {
       } else {
        push @{$config->{'constraint'}}, $l;
       }
-    } elsif ($l0 eq 'rpmbuildstage:') { # use the rpmbuild --stage option
-      $config->{'rpmbuildstage'} = $l[0];
-    } elsif ($l0 eq 'copylinkedpackages:') { # to enable the RPM compariton tool for prerelease projects
-      # Since it is not used in build package, do nothing.
+       } elsif ($l0 eq 'rpmbuildstage:') { # use the rpmbuild --stage option
+         $config->{'rpmbuildstage'} = $l[0];
+       } elsif ($l0 eq 'rpmbuildstage:') { # use the rpmbuild --stage option
+         $config->{'rpmbuildstage'} = $l[0];
+    } elsif ($l0 eq 'singleexport:') {
+      $config->{'singleexport'} = $l[0]; # avoid to export multiple package container in maintenance_release projects
     } elsif ($l0 !~ /^[#%]/) {
       warn("unknown keyword in config: $l0\n");
     }
@@ -365,7 +379,7 @@ sub read_config {
   }
   if (!$config->{'binarytype'}) {
     $config->{'binarytype'} = 'rpm' if $config->{'type'} eq 'spec' || $config->{'type'} eq 'kiwi';
-    $config->{'binarytype'} = 'deb' if $config->{'type'} eq 'dsc' || $config->{'type'} eq 'livebuild';
+    $config->{'binarytype'} = 'deb' if $config->{'type'} eq 'dsc' || $config->{'type'} eq 'collax' || $config->{'type'} eq 'livebuild';
     $config->{'binarytype'} = 'arch' if $config->{'type'} eq 'arch';
     $config->{'binarytype'} ||= 'UNDEFINED';
   }
@@ -442,28 +456,72 @@ sub do_subst_vers {
   return @res;
 }
 
-sub add_livebuild_packages {
-  my ($config, @deps) = @_;
+my %subst_defaults = (
+  # defaults live-build package dependencies base on 4.0~a26 gathered with:
+  # grep Check_package -r /usr/lib/live/build
+  'build-packages:livebuild' => [
+    'apt-utils', 'dctrl-tools', 'debconf', 'dosfstools', 'e2fsprogs', 'grub',
+    'librsvg2-bin', 'live-boot', 'live-config', 'mtd-tools', 'parted',
+    'squashfs-tools', 'syslinux', 'syslinux-common', 'wget', 'xorriso', 'zsync',
+  ],
+  'system-packages:livebuild' => [
+    'apt-utils', 'cpio', 'dpkg-dev', 'live-build', 'lsb-release', 'tar',
+  ],
+  'system-packages:mock' => [
+    'mock', 'createrepo',
+  ],
+  'system-packages:debootstrap' => [
+    'debootstrap', 'lsb-release',
+  ],
+  'system-packages:kiwi-image' => [
+    'kiwi', 'createrepo', 'tar',
+  ],
+  'system-packages:kiwi-product' => [
+    'kiwi',
+  ],
+  'system-packages:deltarpm' => [
+    'deltarpm',
+  ],
+);
 
-  if ($config->{'substitute'}->{'build-packages:livebuild'}) {
-    push @deps, @{$config->{'substitute'}->{'build-packages:livebuild'}};
-  } else {
-    # defaults live-build package dependencies base on 4.0~a26 gathered with:
-    # grep Check_package -r /usr/lib/live/build
-    push @deps, (
-      'apt-utils', 'dctrl-tools', 'debconf', 'dosfstools', 'e2fsprogs', 'grub',
-      'librsvg2-bin', 'live-boot', 'live-config', 'mtd-tools', 'parted',
-      'squashfs-tools', 'syslinux', 'syslinux-common', 'wget', 'xorriso',
-      'zsync' );
+# expand the preinstalls/vminstalls
+sub expandpreinstalls {
+  my ($config) = @_;
+  return if !$config->{'expandflags:preinstallexpand'} || $config->{'preinstallisexpanded'};
+  my (@pre, @vm);
+  if (@{$config->{'preinstall'} || []}) {
+    @pre = expand($config, @{$config->{'preinstall'} || []});
+    return "preinstalls: $pre[0]" unless shift @pre;
+    @pre = sort(@pre);
   }
-  return @deps;
+  if (@{$config->{'vminstall'} || []}) {
+    my %pre = map {$_ => 1} @pre;
+    my %vmx = map {+"-$_" => 1} @{$config->{'vminstall'} || []};
+    my @pren = grep {/^-/ && !$vmx{$_}} @{$config->{'preinstall'} || []};
+    @vm = expand($config, @pre, @pren, @{$config->{'vminstall'} || []});
+    return "vminstalls: $vm[0]" unless shift @vm;
+    @vm = sort(grep {!$pre{$_}} @vm);
+  }
+  $config->{'preinstall'} = \@pre;
+  $config->{'vminstall'} = \@vm;
+  #print STDERR "pre: @pre\n";
+  #print STDERR "vm: @vm\n";
+  $config->{'preinstallisexpanded'} = 1;
+  return '';
 }
 
 # Delivers all packages which get used for building
 sub get_build {
   my ($config, $subpacks, @deps) = @_;
 
-  @deps = add_livebuild_packages($config, @deps) if $config->{'type'} eq 'livebuild';
+  if ($config->{'expandflags:preinstallexpand'} && !$config->{'preinstallisexpanded'}) {
+    my $err = expandpreinstalls($config);
+    return (undef, $err) if $err;
+  }
+  if ($config->{'type'} eq 'livebuild') {
+    push @deps, @{$config->{'substitute'}->{'build-packages:livebuild'}
+                 || $subst_defaults{'build-packages:livebuild'} || []};
+  }
   my @ndeps = grep {/^-/} @deps;
   my %ndeps = map {$_ => 1} @ndeps;
   my @directdepsend;
@@ -507,23 +565,48 @@ sub get_build {
 # an empty result means that the packages from get_build should
 # be used instead.
 sub get_sysbuild {
-  my ($config, $buildtype) = @_;
+  my ($config, $buildtype, $extradeps) = @_;
   my $engine = $config->{'buildengine'} || '';
   $buildtype ||= $config->{'type'} || '';
   my @sysdeps;
-  if ($engine eq 'mock' && $buildtype ne 'kiwi') {
+  if ($engine eq 'mock' && $buildtype eq 'spec') {
     @sysdeps = @{$config->{'substitute'}->{'system-packages:mock'} || []};
-    @sysdeps = ('mock', 'createrepo') unless @sysdeps;
-  } elsif ($engine eq 'debootstrap' && $buildtype ne 'kiwi') {
+    @sysdeps = @{$subst_defaults{'system-packages:mock'} || []} unless @sysdeps;
+  } elsif ($engine eq 'debootstrap' && $buildtype eq 'dsc') {
     @sysdeps = @{$config->{'substitute'}->{'system-packages:debootstrap'} || []};
-    @sysdeps = ('debootstrap', 'lsb-release') unless @sysdeps;
+    @sysdeps = @{$subst_defaults{'system-packages:debootstrap'} || []} unless @sysdeps;
   } elsif ($buildtype eq 'livebuild') {
     # packages used for build environment setup (build-recipe-livebuild deps)
     @sysdeps = @{$config->{'substitute'}->{'system-packages:livebuild'} || []};
-    @sysdeps = ('apt-utils', 'cpio', 'dpkg-dev', 'live-build', 'lsb-release', 'tar') unless @sysdeps;
+    @sysdeps = @{$subst_defaults{'system-packages:livebuild'} || []} unless @sysdeps;
+  } elsif ($buildtype eq 'kiwi-image') {
+    @sysdeps = @{$config->{'substitute'}->{'system-packages:kiwi-image'} || []};
+    @sysdeps = @{$config->{'substitute'}->{'kiwi-setup:image'} || []} unless @sysdeps;
+    @sysdeps = @{$subst_defaults{'system-packages:kiwi-image'} || []} unless @sysdeps;
+    push @sysdeps, @$extradeps if $extradeps;
+  } elsif ($buildtype eq 'kiwi-product') {
+    @sysdeps = @{$config->{'substitute'}->{'system-packages:kiwi-product'} || []};
+    @sysdeps = @{$config->{'substitute'}->{'kiwi-setup:product'} || []} unless @sysdeps;
+    @sysdeps = @{$subst_defaults{'system-packages:kiwi-product'} || []} unless @sysdeps;
+    push @sysdeps, @$extradeps if $extradeps;
+  } elsif ($buildtype eq 'deltarpm') {
+    @sysdeps = @{$config->{'substitute'}->{'system-packages:deltarpm'} || []};
+    @sysdeps = @{$subst_defaults{'system-packages:deltarpm'} || []} unless @sysdeps;
   }
   return () unless @sysdeps;
-  @sysdeps = Build::get_build($config, [], @sysdeps);
+  if ($config->{'expandflags:preinstallexpand'} && !$config->{'preinstallisexpanded'}) {
+    my $err = expandpreinstalls($config);
+    return (undef, $err) if $err;
+  }
+  my @ndeps = grep {/^-/} @sysdeps;
+  my %ndeps = map {$_ => 1} @ndeps;
+  @sysdeps = grep {!$ndeps{$_}} @sysdeps;
+  push @sysdeps, @{$config->{'preinstall'}}, @{$config->{'required'}};
+  push @sysdeps, @{$config->{'support'}} if $buildtype eq 'kiwi-image' || $buildtype eq 'kiwi-product';        # compat to old versions
+  @sysdeps = do_subst($config, @sysdeps);
+  @sysdeps = grep {!$ndeps{$_}} @sysdeps;
+  my $configtmp = $config;
+  @sysdeps = expand($configtmp, @sysdeps, @ndeps);
   return @sysdeps unless $sysdeps[0];
   shift @sysdeps;
   @sysdeps = unify(@sysdeps, get_preinstalls($config));
@@ -533,6 +616,10 @@ sub get_sysbuild {
 # Delivers all packages which shall have an influence to other package builds (get_build reduced by support packages)
 sub get_deps {
   my ($config, $subpacks, @deps) = @_;
+  if ($config->{'expandflags:preinstallexpand'} && !$config->{'preinstallisexpanded'}) {
+    my $err = expandpreinstalls($config);
+    return (undef, $err) if $err;
+  }
   my @ndeps = grep {/^-/} @deps;
   my @extra = @{$config->{'required'}};
   if (@{$config->{'keep'} || []}) {
@@ -564,11 +651,19 @@ sub get_deps {
 
 sub get_preinstalls {
   my ($config) = @_;
+  if ($config->{'expandflags:preinstallexpand'} && !$config->{'preinstallisexpanded'}) {
+    my $err = expandpreinstalls($config);
+    return ('expandpreinstalls_error') if $err;
+  }
   return @{$config->{'preinstall'}};
 }
 
 sub get_vminstalls {
   my ($config) = @_;
+  if ($config->{'expandflags:preinstallexpand'} && !$config->{'preinstallisexpanded'}) {
+    my $err = expandpreinstalls($config);
+    return ('expandpreinstalls_error') if $err;
+  }
   return @{$config->{'vminstall'}};
 }
 
@@ -578,8 +673,8 @@ sub get_runscripts {
 }
 
 ### just for API compability
-sub get_cbpreinstalls { return @{[]}; }
-sub get_cbinstalls { return @{[]}; }
+sub get_cbpreinstalls { return (); }
+sub get_cbinstalls { return (); }
 
 ###########################################################################
 
@@ -670,17 +765,17 @@ sub readdeps {
          $pkginfo->{$pkgid}->{'obsoletes'} = \@ss if $pkginfo;
          next;
        }
-       if ($1 eq "r") {
-         $recommends{$pkgid} = \@ss;
-         $pkginfo->{$pkgid}->{'recommends'} = \@ss if $pkginfo;
-         next;
-       }
-       if ($1 eq "s") {
-         $supplements{$pkgid} = \@ss;
-         $pkginfo->{$pkgid}->{'supplements'} = \@ss if $pkginfo;
-         next;
-       }
-      }
+     if ($1 eq "r") {
+       $recommends{$pkgid} = \@ss;
+       $pkginfo->{$pkgid}->{'recommends'} = \@ss if $pkginfo;
+       next;
+       }
+         if ($1 eq "s") {
+           $supplements{$pkgid} = \@ss;
+           $pkginfo->{$pkgid}->{'supplements'} = \@ss if $pkginfo;
+           next;
+         }
+     }
     }
     close F;
   }
@@ -787,6 +882,7 @@ sub addproviders {
   my @p;
   my $whatprovides = $config->{'whatprovidesh'};
   $whatprovides->{$r} = \@p;
+  my $binarytype = $config->{'binarytype'};
   if ($r =~ /\|/) {
     for my $or (split(/\s*\|\s*/, $r)) {
       push @p, @{$whatprovides->{$or} || addproviders($config, $or)};
@@ -794,19 +890,22 @@ sub addproviders {
     @p = unify(@p) if @p > 1;
     return \@p;
   }
-  return \@p if $r !~ /^(.*?)\s*([<=>]{1,2})\s*(.*?)$/;
+  if ($r !~ /^(.*?)\s*([<=>]{1,2})\s*(.*?)$/) {
+    @p = @{$whatprovides->{$r} || addproviders($config, $r)} if $binarytype eq 'deb' && $r =~ s/:any$//;
+    return \@p;
+  }
   my $rn = $1;
   my $rv = $3;
   my $rf = $addproviders_fm{$2};
   return \@p unless $rf;
+  $rn =~ s/:any$// if $binarytype eq 'deb';
   my $provides = $config->{'providesh'};
   my @rp = @{$whatprovides->{$rn} || []};
   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->{'binarytype'} eq 'deb';
+       next if $binarytype eq 'deb';
        push @p, $rp;
        last;
       }
@@ -827,7 +926,7 @@ sub addproviders {
       $rr &= 5 unless $pf & 2;
       # verscmp for spec and kiwi types
       my $vv;
-      if ($config->{'binarytype'} eq 'deb') {
+      if ($binarytype eq 'deb') {
        $vv = Build::Deb::verscmp($pv, $rv, 1);
       } else {
        $vv = Build::Rpm::verscmp($pv, $rv, 1);
@@ -901,6 +1000,7 @@ sub expand {
   my $requires = $config->{'requiresh'};
 
   my %xignore = map {substr($_, 1) => 1} grep {/^-/} @p;
+  $ignore = {} if $xignore{'-ignoreignore--'};
   my @directdepsend;
   if ($xignore{'-directdepsend--'}) {
     delete $xignore{'-directdepsend--'};
@@ -912,7 +1012,6 @@ sub expand {
     @directdepsend = grep {!/^-/} splice(@directdepsend, @p + 1);
   }
   @p = grep {!/^-/} @p;
-
   my %aconflicts;      # packages we are conflicting with
   for (grep {/^!/} @p) {
     my $r = /^!!/ ? substr($_, 2) : substr($_, 1);
@@ -920,8 +1019,6 @@ sub expand {
     @q = nevrmatch($config, $r, @q) if /^!!/;
     $aconflicts{$_} = "is in BuildConflicts" for @q;
   }
-  my %recommended;     # recommended by installed packages
-  my @rec_todo;                # installed todo
 
   @p = grep {!/^[-!]/} @p;
   my %p;               # expanded packages
@@ -940,6 +1037,7 @@ sub expand {
       push @p, $p;
       next;
     }
+    next if $p{$q[0]};
     return (undef, "$q[0] $aconflicts{$q[0]}") if $aconflicts{$q[0]};
     print "added $q[0] because of $p (direct dep)\n" if $expand_dbg;
     push @p, $q[0];
@@ -953,7 +1051,7 @@ sub expand {
        $aconflicts{$_} = "is obsoleted by installed $q[0]" for nevrmatch($config, $r, @{$whatprovides->{$r} || addproviders($config, $r)});
       }
     }
-    push @rec_todo, $q[0] if $userecommendsforchoices;
+       push @rec_todo, $q[0] if $userecommendsforchoices;
   }
   push @p, @directdepsend;
 
@@ -965,12 +1063,16 @@ sub expand {
     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};
+       if (!$ignoreignore) {
+         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;
+       if (!$ignoreignore) {
+         next if grep {$xignore{$_}} @q;
+         next if grep {$ignore->{"$p:$_"} || $xignore{"$p:$_"}} @q;
+       }
        my @eq = map {"provider $_ $aconflicts{$_}"} grep {$aconflicts{$_}} @q;
        @q = grep {!$aconflicts{$_}} @q;
        if (!$ignoreconflicts) {
@@ -1024,7 +1126,7 @@ sub expand {
          my @pq = grep {$recommended{$_}} @q;
          print "recommended [@pq] among [@q]\n" if $expand_dbg;
          @q = @pq if @pq;
-       }
+         }
        if (@q > 1) {
          if ($r ne $p) {
            push @error, "have choice for $r needed by $p: @q";
@@ -1058,9 +1160,9 @@ sub expand {
     if (@pamb && ($doamb == 0 || $doamb == 1)) {
       @p = @pamb;
       @pamb = ();
-      todo2recommended($config, \%recommended, \@rec_todo) if @rec_todo;
-      $doamb = %recommended ? 2 : 3;
-      print "now doing undecided dependencies, $doamb = $doamb\n" if $expand_dbg;
+         todo2recommended($config, \%recommended, \@rec_todo) if @rec_todo;
+         $doamb = %recommended ? 2 : 3;
+         print "now doing undecided dependencies, $doamb = $doamb\n" if $expand_dbg;
       next;
     }
     return undef, @error if @error;
@@ -1186,11 +1288,15 @@ sub add_all_providers {
 
 sub recipe2buildtype {
   my ($recipe) = @_;
+  return undef unless defined $recipe;
   return $1 if $recipe =~ /\.(spec|dsc|kiwi|livebuild)$/;
   $recipe =~ s/.*\///;
   $recipe =~ s/^_service:.*://;
   return 'arch' if $recipe eq 'PKGBUILD';
+  return 'collax' if $recipe eq 'build.collax';
+  return 'snapcraft' if $recipe eq 'snapcraft.yaml';
   return 'preinstallimage' if $recipe eq '_preinstallimage';
+  return 'simpleimage' if $recipe eq 'simpleimage';
   return undef;
 }
 
@@ -1201,6 +1307,7 @@ sub show {
   my $d = Build::parse($cf, $fn);
   die("$d->{'error'}\n") if $d->{'error'};
   $d->{'sources'} = [ map {ref($d->{$_}) ? @{$d->{$_}} : $d->{$_}} grep {/^source/} sort keys %$d ];
+  $d->{'patches'} = [ map {ref($d->{$_}) ? @{$d->{$_}} : $d->{$_}} grep {/^patch/} sort keys %$d ];
   my $x = $d->{$field};
   $x = [ $x ] unless ref $x;
   print "$_\n" for @$x;
@@ -1213,6 +1320,17 @@ sub parse_preinstallimage {
   return $d;
 }
 
+sub parse_simpleimage {
+  return undef unless $do_rpm;
+  my $d = Build::Rpm::parse(@_);
+  $d->{'name'} ||= 'simpleimage';
+  if (!defined($d->{'version'})) {
+    my @s = stat($_[1]);
+    $d->{'version'} = strftime "%Y.%m.%d-%H.%M.%S", gmtime($s[9] || time);
+  }
+  return $d;
+}
+
 sub parse {
   my ($cf, $fn, @args) = @_;
   return Build::Rpm::parse($cf, $fn, @args) if $do_rpm && $fn =~ /\.spec$/;
@@ -1224,7 +1342,10 @@ sub parse {
   $fnx =~ s/.*\///;
   $fnx =~ s/^[0-9a-f]{32,}-//; # hack for OBS srcrep implementation
   $fnx =~ s/^_service:.*://;
+  return parse_simpleimage($cf, $fn, @args) if $fnx eq 'simpleimage';
+  return Build::Snapcraft::parse($cf, $fn, @args) if $do_snapcraft && $fnx eq 'snapcraft.yaml';
   return Build::Arch::parse($cf, $fn, @args) if $do_arch && $fnx eq 'PKGBUILD';
+  return Build::Collax::parse($cf, $fn, @args) if $do_collax && $fnx eq 'build.collax';
   return parse_preinstallimage($cf, $fn, @args) if $fnx eq '_preinstallimage';
   return undef;
 }
@@ -1236,7 +1357,10 @@ sub parse_typed {
   return Build::Deb::parse($cf, $fn, @args) if $do_deb && $buildtype eq 'dsc';
   return Build::Kiwi::parse($cf, $fn, @args) if $do_kiwi && $buildtype eq 'kiwi';
   return Build::LiveBuild::parse($cf, $fn, @args) if $do_livebuild && $buildtype eq 'livebuild';
+  return Build::Snapcraft::parse($cf, $fn, @args) if $do_snapcraft && $buildtype eq 'snapcraft';
+  return parse_simpleimage($cf, $fn, @args) if $buildtype eq 'simpleimage';
   return Build::Arch::parse($cf, $fn, @args) if $do_arch && $buildtype eq 'arch';
+  return Build::Collax::parse($cf, $fn, @args) if $do_collax && $buildtype eq 'collax';
   return parse_preinstallimage($cf, $fn, @args) if $buildtype eq 'preinstallimage';
   return undef;
 }
@@ -1248,7 +1372,7 @@ sub query {
     $handle = $binname->[1];
     $binname = $binname->[0];
   }
-  return Build::Rpm::query($handle, %opts) if $do_rpm && $binname =~ /\.rpm$/;
+  return Build::Rpm::query($handle, %opts) if $do_rpm && $binname =~ /\.d?rpm$/;
   return Build::Deb::query($handle, %opts) if $do_deb && $binname =~ /\.deb$/;
   return Build::Kiwi::queryiso($handle, %opts) if $do_kiwi && $binname =~ /\.iso$/;
   return Build::Arch::query($handle, %opts) if $do_arch && $binname =~ /\.pkg\.tar(?:\.gz|\.xz)?$/;
@@ -1276,7 +1400,7 @@ sub showquery {
 
 sub queryhdrmd5 {
   my ($binname) = @_;
-  return Build::Rpm::queryhdrmd5(@_) if $do_rpm && $binname =~ /\.rpm$/;
+  return Build::Rpm::queryhdrmd5(@_) if $do_rpm && $binname =~ /\.d?rpm$/;
   return Build::Deb::queryhdrmd5(@_) if $do_deb && $binname =~ /\.deb$/;
   return Build::Kiwi::queryhdrmd5(@_) if $do_kiwi && $binname =~ /\.iso$/;
   return Build::Kiwi::queryhdrmd5(@_) if $do_kiwi && $binname =~ /\.raw$/;
index e685a24..a100d9f 100644 (file)
@@ -91,6 +91,9 @@ sub parse {
   push @{$ret->{'deps'}}, @{$vars{'checkdepends'} || []};
   push @{$ret->{'deps'}}, @{$vars{'depends'} || []};
   $ret->{'source'} = $vars{'source'} if $vars{'source'};
+  # Maintain architecture-specific sources for officially supported architectures
+  $ret->{'source_x86_64'} = $vars{'source_x86_64'} if $vars{'source_x86_64'};
+  $ret->{'source_i686'} = $vars{'source_i686'} if $vars{'source_i686'};
   return $ret;
 }
 
@@ -249,6 +252,10 @@ sub parserepodata {
       push @{$d->{'conflicts'}}, @p;
     } elsif ($p eq '%REPLACES%') {
       push @{$d->{'obsoletes'}}, @p;
+    } elsif ($p eq '%MD5SUM%') {
+      $d->{'checksum_md5'} = $p[0];
+    } elsif ($p eq '%SHA256SUM%') {
+      $d->{'checksum_sha256'} = $p[0];
     }
   }
   return $d;
index b2b0ee4..23819d6 100644 (file)
@@ -24,7 +24,21 @@ use strict;
 use Build::Arch;
 
 eval { require Archive::Tar; };
-*Archive::Tar::new = sub {die("Archive::Tar is not available\n")} unless defined &Archive::Tar::new;
+if (!defined &Archive::Tar::iter) {
+  *Archive::Tar::iter = sub {
+    my ($class, $filename) = @_;
+    die("Archive::Tar is not available\n") unless defined &Archive::Tar::new;
+    my $handle = $class->_get_handle($filename, 1, 'rb') or return undef;
+    my @data;
+    return sub {
+      return shift(@data) if !$handle || @data; 
+      my $files = $class->_read_tar($handle, { limit => 1 });
+      @data = @$files if (ref($files) || '') eq 'ARRAY';
+      undef $handle unless @data;
+      return shift @data;
+    };
+  };
+}
 
 sub addpkg {
   my ($res, $data, $options) = @_;
@@ -40,6 +54,14 @@ sub addpkg {
     $data->{'release'} = $1 if $data->{'version'} =~ s/-([^-]*)$//s;
   }
   $data->{'location'} = delete($data->{'filename'}) if exists $data->{'filename'};
+  if ($options->{'withchecksum'}) {
+    for (qw {md5 sha1 sha256}) {
+      my $c = delete($data->{"checksum_$_"});
+      $data->{'checksum'} = "$_:$c" if $c;
+    }     
+  } else {
+    delete $data->{"checksum_$_"} for qw {md5 sha1 sha256};
+  }
   if (ref($res) eq 'CODE') {
     $res->($data);
   } else {
diff --git a/Build/Collax.pm b/Build/Collax.pm
new file mode 100644 (file)
index 0000000..2fc332c
--- /dev/null
@@ -0,0 +1,64 @@
+#
+# Copyright 2015  Zarafa B.V. and its licensors
+#
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+package Build::Collax;
+
+use strict;
+
+sub parse {
+       my($buildconf, $fn) = @_;
+       my @bscript;
+
+       if (ref($fn) eq "ARRAY") {
+               @bscript = @$fn;
+               $fn = undef;
+       } elsif (ref($fn) ne "") {
+               die "Unhandled ref type in collax";
+       } else {
+               local *FH;
+               if (!open(FH, "<", $fn)) {
+                       return {"error" => "$fn: $!"};
+               }
+               @bscript = <FH>;
+               chomp(@bscript);
+               close(FH);
+       }
+
+       my $ret = {"deps" => []};
+       for (my $i = 0; $i <= $#bscript; ++$i) {
+               next unless $bscript[$i] =~ m{^\w+=};
+               my $key = lc(substr($&, 0, -1));
+               my $value = $';
+               if ($value =~ m{^([\'\"])}) {
+                       $value = substr($value, 1);
+                       while ($value !~ m{[\'\"]}) {
+                               my @cut = splice(@bscript, $i + 1, 1);
+                               $value .= $cut[0];
+                       }
+                       $value =~ s{[\'\"]}{}s;
+                       $value =~ s{\n}{ }gs;
+               }
+               if ($key eq "package") {
+                       $ret->{"name"} = $value;
+               } elsif ($key eq "version") {
+                       $ret->{$key} = $value;
+               } elsif ($key eq "builddepends" || $key eq "extradepends") {
+                       $value =~ s{^\s+}{}gs;
+                       $value =~ s{\s+$}{}gs;
+                       $value =~ s{,}{ }gs;
+                       push(@{$ret->{"deps"}}, split(/\s+/, $value));
+               }
+       }
+       return $ret;
+}
+
+1;
index f7c9958..e723b58 100644 (file)
@@ -39,8 +39,10 @@ my %obs2debian = (
   "armv4l"  => "armel",
   "armv5l"  => "armel",
   "armv6l"  => "armel",
-  "armv7l"  => "armel",
-  "armv7hl" => "armhf"
+  "armv7el" => "armel",
+  "armv7l"  => "armhf",
+  "armv7hl" => "armhf",
+  "aarch64" => "arm64",
 );
 
 sub basearch {
@@ -102,7 +104,7 @@ sub parse {
       $version =~ s/-[^-]+$//;
     } elsif ($tag eq 'ARCHITECTURE') {
       my @archs = split('\s+', $data);
-      map { s/$os-//; s/any-// } @archs;
+      map { s/\Q$os\E-//; s/any-// } @archs;
       next if grep { $_ eq "any" || $_ eq "all" } @archs;
       @exclarch = map { obsarch($_) } @archs;
       # unify
@@ -116,6 +118,25 @@ sub parse {
         my @alts = split('\s*\|\s*', $d);
         my @needed;
         for my $c (@alts) {
+          if ($c =~ /\s+<[^>]+>$/) {
+            my @build_profiles;  # Empty for now
+            my $bad = 1;
+            while ($c =~ s/\s+<([^>]+)>$//) {
+              next if (!$bad);
+              my $list_valid = 1;
+              for my $term (split(/\s+/, $1)) {
+                my $isneg = ($term =~ s/^\!//);
+                my $profile_match = grep(/^$term$/, @build_profiles);
+                if (( $profile_match &&  $isneg) ||
+                    (!$profile_match && !$isneg)) {
+                  $list_valid = 0;
+                  last;
+                }
+              }
+              $bad = 0 if ($list_valid);
+            }
+            next if ($bad);
+          }
           if ($c =~ /^(.*?)\s*\[(.*)\]$/) {
             $c = $1;
             my $isneg = 0;
@@ -132,10 +153,10 @@ sub parse {
                 $bad = 0;
               }
             }
-            push @needed, $c unless $bad;
-          } else {
-            push @needed, $c;
+            next if ($bad);
           }
+          $c =~ s/^([^:\s]*):(any|native)(.*)$/$1$3/;
+          push @needed, $c;
         }
         next unless @needed;
         $d = join(' | ', @needed);
@@ -210,11 +231,12 @@ sub debq {
   my $data = '';
   sysread(DEBF, $data, 4096);
   if (length($data) < 8+60) {
-    warn("$fn: not a debian package\n");
+    warn("$fn: not a debian package - header too short\n");
     close DEBF unless ref $fn;
     return ();
   }
-  if (substr($data, 0, 8+16) ne "!<arch>\ndebian-binary   ") {
+  if (substr($data, 0, 8+16) ne "!<arch>\ndebian-binary   " &&
+      substr($data, 0, 8+16) ne "!<arch>\ndebian-binary/  ") {
     close DEBF unless ref $fn;
     return ();
   }
@@ -230,7 +252,8 @@ sub debq {
     }
   }
   $data = substr($data, 8 + 60 + $len);
-  if (substr($data, 0, 16) ne 'control.tar.gz  ') {
+  if (substr($data, 0, 16) ne 'control.tar.gz  ' &&
+      substr($data, 0, 16) ne 'control.tar.gz/ ') {
     warn("$fn: control.tar.gz is not second ar entry\n");
     close DEBF unless ref $fn;
     return ();
@@ -266,7 +289,7 @@ sub debq {
       warn("$fn: corrupt control.tar.gz file\n");
       return ();
     }
-    if ($n eq './control') {
+    if ($n eq './control' || $n eq "control") {
       $control = substr($data, 512, $len);
       last;
     }
@@ -342,12 +365,13 @@ sub queryhdrmd5 {
   my $data = '';
   sysread(F, $data, 4096);
   if (length($data) < 8+60) {
-    warn("$bin: not a debian package\n");
+    warn("$bin: not a debian package - header too short\n");
     close F;
     return undef;
   }
-  if (substr($data, 0, 8+16) ne "!<arch>\ndebian-binary   ") {
-    warn("$bin: not a debian package\n");
+  if (substr($data, 0, 8+16) ne "!<arch>\ndebian-binary   " &&
+      substr($data, 0, 8+16) ne "!<arch>\ndebian-binary/  ") {
+    warn("$bin: not a debian package - no \"debian-binary\" entry\n");
     close F;
     return undef;
   }
@@ -363,7 +387,8 @@ sub queryhdrmd5 {
     }
   }
   $data = substr($data, 8 + 60 + $len);
-  if (substr($data, 0, 16) ne 'control.tar.gz  ') {
+  if (substr($data, 0, 16) ne 'control.tar.gz  ' &&
+      substr($data, 0, 16) ne 'control.tar.gz/ ') {
     warn("$bin: control.tar.gz is not second ar entry\n");
     close F;
     return undef;
index 2f30dfd..328fd79 100644 (file)
@@ -48,6 +48,12 @@ sub addpkg {
     $selfprovides = "$data->{'name'} $selfprovides";
     push @{$data->{'provides'}}, $selfprovides  unless @{$data->{'provides'} || []} && $data->{'provides'}->[-1] eq $selfprovides;
   }
+  if ($options->{'withchecksum'}) {
+    for (qw {md5 sha1 sha256}) {
+      my $c = delete($data->{"checksum_$_"});
+      $data->{'checksum'} = "$_:$c" if $c;
+    }
+  }
   if (ref($res) eq 'CODE') {
     $res->($data);
   } else {
@@ -71,6 +77,12 @@ my %tmap = (
   'source' => 'source',
 );
 
+my %tmap_checksums = (
+  'md5sum' => 'checksum_md5',
+  'sha1'   => 'checksum_sha1',
+  'sha256' => 'checksum_sha256',
+);
+
 sub parse {
   my ($in, $res, %options) = @_;
   $res ||= [];
@@ -86,6 +98,8 @@ sub parse {
   }
   my $pkg = {};
   my $tag;
+  my %ltmap = %tmap;
+  %ltmap = (%ltmap, %tmap_checksums) if $options{'withchecksum'};
   while (<$fd>) {
     chomp;
     if ($_ eq '') {
index 5d730d7..90e0db7 100644 (file)
 package Build::Kiwi;
 
 use strict;
+use Build::SimpleXML;
 
 our $bootcallback;
-
-# worst xml parser ever, just good enough to parse those kiwi files...
-# can't use standard XML parsers, unfortunatelly, as the build script
-# must not rely on external libraries
-#
-sub parsexml {
-  my ($xml) = @_;
-
-  my @nodestack;
-  my $node = {};
-  my $c = '';
-  $xml =~ s/^\s*\<\?.*?\?\>//s;
-  while ($xml =~ /^(.*?)\</s) {
-    if ($1 ne '') {
-      $c .= $1;
-      $xml = substr($xml, length($1));
-    }
-    if (substr($xml, 0, 4) eq '<!--') {
-      $xml =~ s/.*?-->//s;
-      next;
-    }
-    die("bad xml\n") unless $xml =~ /(.*?\>)/s;
-    my $tag = $1;
-    $xml = substr($xml, length($tag));
-    my $mode = 0;
-    if ($tag =~ s/^\<\///s) {
-      chop $tag;
-      $mode = 1;       # end
-    } elsif ($tag =~ s/\/\>$//s) {
-      $mode = 2;       # start & end
-      $tag = substr($tag, 1);
-    } else {
-      $tag = substr($tag, 1);
-      chop $tag;
-    }
-    my @tag = split(/(=(?:\"[^\"]*\"|\'[^\']*\'|[^\"\s]*))?\s+/, "$tag ");
-    $tag = shift @tag;
-    shift @tag;
-    push @tag, undef if @tag & 1;
-    my %atts = @tag;
-    for (values %atts) {
-      next unless defined $_;
-      s/^=\"([^\"]*)\"$/=$1/s or s/^=\'([^\']*)\'$/=$1/s;
-      s/^=//s;
-      s/&lt;/</g;
-      s/&gt;/>/g;
-      s/&amp;/&/g;
-      s/&apos;/\'/g;
-      s/&quot;/\"/g;
-    }
-    if ($mode == 0 || $mode == 2) {
-      my $n = {};
-      push @{$node->{$tag}}, $n;
-      for (sort keys %atts) {
-       $n->{$_} = $atts{$_};
-      }
-      if ($mode == 0) {
-       push @nodestack, [ $tag, $node, $c ];
-       $c = '';
-       $node = $n;
-      }
-    } else {
-      die("element '$tag' closes without open\n") unless @nodestack;
-      die("element '$tag' closes, but I expected '$nodestack[-1]->[0]'\n") unless $nodestack[-1]->[0] eq $tag;
-      $c =~ s/^\s*//s;
-      $c =~ s/\s*$//s;
-      $node->{'_content'} = $c if $c ne '';
-      $node = $nodestack[-1]->[1];
-      $c = $nodestack[-1]->[2];
-      pop @nodestack;
-    }
-  }
-  $c .= $xml;
-  $c =~ s/^\s*//s;
-  $c =~ s/\s*$//s;
-  $node->{'_content'} = $c if $c ne '';
-  return $node;
-}
+our $urlmapper;
 
 sub unify {
   my %h = map {$_ => 1} @_;
@@ -147,7 +71,7 @@ sub kiwiparse {
   my @requiredarch;
   my $schemaversion = 0;
   my $schemaversion56 = versionstring("5.6");
-  my $kiwi = parsexml($xml);
+  my $kiwi = Build::SimpleXML::parse($xml);
   die("not a kiwi config\n") unless $kiwi && $kiwi->{'image'};
   $kiwi = $kiwi->{'image'}->[0];
   $schemaversion = versionstring($kiwi->{'schemaversion'}) if $kiwi->{'schemaversion'}; 
@@ -200,8 +124,14 @@ sub kiwiparse {
          push @repos, '_obsrepositories';
          next;
       }
-      die("bad instsource path: $kiwisource->{'path'}\n") unless $kiwisource->{'path'} =~ /^obs:\/\/\/?([^\/]+)\/([^\/]+)\/?$/;
-      push @repos, "$1/$2";
+      if ($kiwisource->{'path'} =~ /^obs:\/\/\/?([^\/]+)\/([^\/]+)\/?$/) {
+        push @repos, "$1/$2";
+      } else {
+       my $prp;
+       $prp = $urlmapper->($kiwisource->{'path'}) if $urlmapper;
+       die("instsource repo url not using obs:/ scheme: $kiwisource->{'path'}\n") unless $prp;
+       push @repos, $prp;
+      }
     }
     $ret->{'sourcemedium'} = -1;
     $ret->{'debugmedium'} = -1;
@@ -243,14 +173,23 @@ sub kiwiparse {
     if ($kiwisource->{'path'} eq 'obsrepositories:/') {
       push @repos, '_obsrepositories';
       next;
-    };
-    die("bad path using not obs:/ URL: $kiwisource->{'path'}\n") unless $kiwisource->{'path'} =~ /^obs:\/\/\/?([^\/]+)\/([^\/]+)\/?$/;
-    push @repos, "$1/$2";
+    }
+    if ($kiwisource->{'path'} =~ /^obs:\/\/\/?([^\/]+)\/([^\/]+)\/?$/) {
+      push @repos, "$1/$2";
+    } else {
+      my $prp;
+      $prp = $urlmapper->($kiwisource->{'path'}) if $urlmapper;
+      die("repo url not using obs:/ scheme: $kiwisource->{'path'}\n") unless $prp;
+      push @repos, $prp;
+    }
   }
 
   # Find packages and possible additional required architectures
   my @additionalarchs;
   my @pkgs;
+  for my $pattern (@{$kiwi->{'opensusePatterns'}}) {
+    push @pkgs, @{"pattern:$pattern->{'package'}"} if $pattern->{'package'};
+  }
   for my $packages (@{$kiwi->{'packages'}}) {
     next if $packages->{'type'} and $packages->{'type'} ne 'image' and $packages->{'type'} ne 'bootstrap';
     push @pkgs, @{$packages->{'package'}} if $packages->{'package'};
@@ -289,6 +228,10 @@ sub kiwiparse {
        push @packages, "-".$package->{'name'};
        next;
     }
+    # handle replaces as buildignore
+    if ($package->{'replaces'}) {
+       push @packages, "-".$package->{'replaces'};
+    }
 
     # we need this package
     push @packages, $package->{'name'};
@@ -353,6 +296,7 @@ sub parse {
 
 sub show {
   my ($fn, $field, $arch) = @ARGV;
+  local $urlmapper = sub { return $_[0] };
   my $cf = {'arch' => $arch};
   my $d = parse($cf, $fn);
   die("$d->{'error'}\n") if $d->{'error'};
diff --git a/Build/Mdkrepo.pm b/Build/Mdkrepo.pm
new file mode 100644 (file)
index 0000000..2ea669a
--- /dev/null
@@ -0,0 +1,121 @@
+################################################################
+#
+# Copyright (c) 2015 SUSE Linux Products GmbH
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 or 3 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program (see the file COPYING); if not, write to the
+# Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+#
+################################################################
+
+package Build::Mdkrepo;
+
+use strict;
+use Data::Dumper;
+
+sub addpkg {
+  my ($res, $data, $options) = @_;
+  if ($options->{'addselfprovides'} && defined($data->{'name'}) && defined($data->{'version'})) {
+    if (($data->{'arch'} || '') ne 'src' && ($data->{'arch'} || '') ne 'nosrc') {
+      my $evr = $data->{'version'};
+      $evr = "$data->{'epoch'}:$evr" if $data->{'epoch'};
+      $evr = "$evr-$data->{'release'}" if defined $data->{'release'};
+      my $s = "$data->{'name'} = $evr";
+      push @{$data->{'provides'}}, $s unless grep {$_ eq $s} @{$data->{'provides'} || []};
+    }
+  }
+  if (ref($res) eq 'CODE') {
+    $res->($data);
+  } else {
+    push @$res, $data;
+  }
+
+}
+
+sub parsedeps {
+  my ($d) = @_;
+  my @d = split('@', $d);
+  for (@d) {
+    s/\[\*\]//s;
+    s/\[(.*)\]$/ $1/s;
+    s/ == / = /;
+  }
+  return \@d;
+}
+
+sub parse {
+  my ($in, $res, %options) = @_;
+  $res ||= [];
+  my $fd;
+  if (ref($in)) {
+    $fd = $in;
+  } else {
+    if ($in =~ /\.[gc]z$/) {
+      # we need to probe, as mageia uses xz for compression
+      open($fd, '<', $in) || die("$in: $!\n");
+      my $probe;
+      sysread($fd, $probe, 5);
+      close($fd);
+      if ($probe && $probe eq "\xFD7zXZ") {
+        open($fd, '-|', "xzdec", "-dc", $in) || die("$in: $!\n");
+      } else {
+        open($fd, '-|', "gzip", "-dc", $in) || die("$in: $!\n");
+      }
+    } else {
+      open($fd, '<', $in) || die("$in: $!\n");
+    }
+  }
+  my $s = {};
+  while (<$fd>) {
+    chomp;
+    if (/^\@summary\@/) {
+      $s->{'summary'} = substr($_, 9);
+    } elsif (/^\@provides\@/) {
+      $s->{'provides'} = parsedeps(substr($_, 10));
+    } elsif (/^\@requires\@/) {
+      $s->{'requires'} = parsedeps(substr($_, 10));
+    } elsif (/^\@suggests\@/) {
+      $s->{'suggests'} = parsedeps(substr($_, 10));
+    } elsif (/^\@recommends\@/) {
+      $s->{'recommends'} = parsedeps(substr($_, 12));
+    } elsif (/^\@obsoletes\@/) {
+      $s->{'obsoletes'} = parsedeps(substr($_, 11));
+    } elsif (/^\@conflicts\@/) {
+      $s->{'conflicts'} = parsedeps(substr($_, 11));
+    } elsif (/^\@info\@/) {
+      $s ||= {};
+      my @s = split('@', substr($_, 6));
+      $s->{'location'} = "$s[0].rpm";
+      my $arch;
+      if ($s[0] =~ /\.([^\.]+)$/) {
+       $arch = $1;
+       $s[0] =~ s/\.[^\.]+$//;
+      }
+      $s->{'epoch'} = $s[1] if $s[1];
+      $s[0] =~ s/-\Q$s[4]\E[^-]*$//s if defined($s[4]) && $s[4] ne ''; # strip disttag
+      $s[0] .= ":$s[5]" if defined($s[5]) && $s[5] ne '';      # add distepoch
+      $s->{'arch'} = $arch || 'noarch';
+      if ($s[0] =~ /^(.*)-([^-]+)-([^-]+)$/s) {
+       ($s->{'name'}, $s->{'version'}, $s->{'release'}) = ($1, $2, $3);
+       # fake source entry for now...
+       $s->{'source'} = $s->{'name'} if $s->{'arch'} ne 'src' && $s->{'arch'} ne 'nosrc';
+        addpkg($res, $s, \%options);
+      }
+      $s = {};
+    }
+  }
+  return $res;
+}
+
+1;
+
index 7cd495f..002f4ab 100644 (file)
@@ -26,6 +26,7 @@ our $do_rpmmd;
 our $do_deb;
 our $do_arch;
 our $do_susetags;
+our $do_mdk;
 
 sub import {
   for (@_) {
@@ -33,8 +34,9 @@ sub import {
     $do_deb = 1 if $_ eq ':deb';
     $do_arch = 1 if $_ eq ':arch';
     $do_susetags = 1 if $_ eq ':susetags';
+    $do_mdk = 1 if $_ eq ':mdk';
   }
-  $do_rpmmd = $do_deb = $do_arch = $do_susetags = 1 unless $do_rpmmd || $do_deb || $do_arch || $do_susetags;
+  $do_rpmmd = $do_deb = $do_arch = $do_susetags = $do_mdk = 1 unless $do_rpmmd || $do_deb || $do_arch || $do_susetags || $do_mdk;
   if ($do_rpmmd) {
     require Build::Rpmmd;
   }
@@ -47,6 +49,9 @@ sub import {
   if ($do_arch) {
     require Build::Archrepo;
   }
+  if ($do_mdk) {
+    require Build::Mdkrepo;
+  }
 }
 
 sub parse {
@@ -55,6 +60,7 @@ sub parse {
   return Build::Susetags::parse(@args) if $do_susetags && $type eq 'susetags';
   return Build::Debrepo::parse(@args) if $do_deb && $type eq 'deb';
   return Build::Archrepo::parse(@args) if $do_arch && $type eq 'arch';
+  return Build::Mdkrepo::parse(@args) if $do_arch && $type eq 'mdk';
   die("parse repo: unknown type '$type'\n");
 }
 
index 47cb9e7..25a8e9c 100644 (file)
@@ -21,6 +21,7 @@
 package Build::Rpm;
 
 our $unfilteredprereqs = 0;
+our $conflictdeps = 0;
 
 use strict;
 
@@ -39,13 +40,13 @@ sub expr {
     return undef unless defined $v;
     return undef unless $expr =~ s/^\)//;
   } elsif ($t eq '!') {
-    ($v, $expr) = expr(substr($expr, 1), 0);
+    ($v, $expr) = expr(substr($expr, 1), 5);
     return undef unless defined $v;
     $v = 0 if $v && $v eq '\"\"';
     $v =~ s/^0+/0/ if $v;
     $v = !$v;
   } elsif ($t eq '-') {
-    ($v, $expr) = expr(substr($expr, 1), 0);
+    ($v, $expr) = expr(substr($expr, 1), 5);
     return undef unless defined $v;
     $v = -$v;
   } elsif ($expr =~ /^([0-9]+)(.*?)$/) {
@@ -60,6 +61,7 @@ sub expr {
   } else {
     return;
   }
+  return ($v, $expr) if $lev >= 5;
   while (1) {
     $expr =~ s/^\s+//;
     if ($expr =~ /^&&/) {
@@ -257,7 +259,7 @@ sub parse {
       next;
     }
     if ($line =~ /^\s*#/) {
-      next unless $line =~ /^#!BuildIgnore/;
+      next unless $line =~ /^#!Build(?:Ignore|Conflicts)\s*:/i;
     }
     my $expandedline = '';
     if (!$skip && ($line =~ /%/)) {
@@ -360,9 +362,9 @@ reexpand:
          if (defined($macros_args{$macname})) {
            # macro with args!
            if (!defined($macdata)) {
-             $line =~ /^\s*([^\n]*).*?$/;
+             $line =~ /^\s*([^\n]*).*$/;
              $macdata = $1;
-             $line = $2;
+             $line = '';
            }
            push @expandstack, ($expandedline, $line, $optmacros);
            $optmacros = adaptmacros(\%macros, $optmacros, grabargs($macname, $macros_args{$macname}, split(' ', $macdata)));
@@ -418,7 +420,7 @@ reexpand:
 
     if ($skip) {
       $xspec->[-1] = [ $xspec->[-1], undef ] if $xspec;
-      $ifdeps = 1 if $line =~ /^(BuildRequires|BuildPrereq|BuildConflicts|\#\!BuildIgnore)\s*:\s*(\S.*)$/i;
+      $ifdeps = 1 if $line =~ /^(BuildRequires|BuildPrereq|BuildConflicts|\#\!BuildIgnore|\#\!BuildConflicts)\s*:\s*(\S.*)$/i;
       next;
     }
 
@@ -436,20 +438,20 @@ reexpand:
       $hasif = 1;
       next;
     }
-    if ($line =~ /^\s*%ifhostarch(.*)$/) {
-      my $hostarch = $macros{'hostarch'} || 'unknown';
-      my @hostarchs = grep {$_ eq $hostarch} split(/\s+/, $1);
-      $skip = 1 if !@hostarchs;
-      $hasif = 1;
-      next;
-    }
-    if ($line =~ /^\s*%ifnhostarch(.*)$/) {
-      my $hostarch = $macros{'hostarch'} || 'unknown';
-      my @hostarchs = grep {$_ eq $hostarch} split(/\s+/, $1);
-      $skip = 1 if @hostarchs;
-      $hasif = 1;
-      next;
-    }
+       if ($line =~ /^\s*%ifhostarch(.*)$/) {
+         my $hostarch = $macros{'hostarch'} || 'unknown';
+         my @hostarchs = grep {$_ eq $hostarch} split(/\s+/, $1);
+         $skip = 1 if !@hostarchs;
+         $hasif = 1;
+         next;
+       }
+       if ($line =~ /^\s*%ifnhostarch(.*)$/) {
+         my $hostarch = $macros{'hostarch'} || 'unknown';
+         my @hostarchs = grep {$_ eq $hostarch} split(/\s+/, $1);
+         $skip = 1 if @hostarchs;
+         $hasif = 1;
+         next;
+       }
     if ($line =~ /^\s*%ifos(.*)$/) {
       my $os = $macros{'_target_os'} || 'unknown';
       my @oss = grep {$_ eq $os} split(/\s+/, $1);
@@ -502,7 +504,7 @@ reexpand:
       }
       next;
     }
-    if ($preamble && ($line =~ /^(BuildRequires|BuildPrereq|BuildConflicts|\#\!BuildIgnore)\s*:\s*(\S.*)$/i)) {
+    if ($preamble && ($line =~ /^(BuildRequires|BuildPrereq|BuildConflicts|\#\!BuildIgnore|\#\!BuildConflicts)\s*:\s*(\S.*)$/i)) {
       my $what = $1;
       my $deps = $2;
       $ifdeps = 1 if $hasif;
@@ -544,6 +546,10 @@ reexpand:
 
       $replace = 1 if grep {/^-/} @ndeps;
       if (lc($what) ne 'buildrequires' && lc($what) ne 'buildprereq') {
+        if ($conflictdeps && $what =~ /conflict/i) {
+         push @packdeps, map {"!$_"} @ndeps;
+         next;
+       }
        push @packdeps, map {"-$_"} @ndeps;
        next;
       }
@@ -608,8 +614,10 @@ reexpand:
 ###########################################################################
 
 my %rpmstag = (
-  "SIGTAG_SIZE"    => 1000,     # /*!< internal Header+Payload size in bytes. */
-  "SIGTAG_MD5"     => 1004,     # /*!< internal MD5 signature. */
+  "SIGTAG_SIZE"    => 1000,     # Header+Payload size in bytes. */
+  "SIGTAG_PGP"     => 1002,     # RSA signature over Header+Payload
+  "SIGTAG_MD5"     => 1004,     # MD5 hash over Header+Payload
+  "SIGTAG_GPG"     => 1005,     # DSA signature over Header+Payload
   "NAME"           => 1000,
   "VERSION"        => 1001,
   "RELEASE"        => 1002,
@@ -1076,7 +1084,7 @@ sub queryinstalled {
 
   $root = '' if !defined($root) || $root eq '/';
   local *F;
-  my $dochroot = $root ne '' && !$opts{'nochroot'} && !$< ? 1 : 0;
+  my $dochroot = $root ne '' && !$opts{'nochroot'} && !$< && (-x "$root/usr/bin/rpm" || -x "$root/bin/rpm") ? 1 : 0;
   my $pid = open(F, '-|');
   die("fork: $!\n") unless defined $pid;
   if (!$pid) {
@@ -1115,4 +1123,45 @@ sub queryinstalled {
   return \@pkgs;
 }
 
+# return (lead, sighdr, hdr [, hdrmd5]) of a rpm
+sub getrpmheaders {
+  my ($path, $withhdrmd5) = @_;
+
+  my $hdrmd5;
+  local *F;
+  open(F, '<', $path) || die("$path: $!\n");
+  my $buf = '';
+  my $l;
+  while (length($buf) < 96 + 16) {
+    $l = sysread(F, $buf, 4096, length($buf));
+    die("$path: read error\n") unless $l;
+  }
+  die("$path: not a rpm\n") unless unpack('N', $buf) == 0xedabeedb && unpack('@78n', $buf) == 5;
+  my ($headmagic, $cnt, $cntdata) = unpack('@96N@104NN', $buf);
+  die("$path: not a rpm (bad sig header)\n") unless $headmagic == 0x8eade801 && $cnt < 16384 && $cntdata < 1048576;
+  my $hlen = 96 + 16 + $cnt * 16 + $cntdata;
+  $hlen = ($hlen + 7) & ~7;
+  while (length($buf) < $hlen + 16) {
+    $l = sysread(F, $buf, 4096, length($buf));
+    die("$path: read error\n") unless $l;
+  }
+  if ($withhdrmd5) {
+    my $idxarea = substr($buf, 96 + 16, $cnt * 16);
+    die("$path: no md5 signature header\n") unless $idxarea =~ /\A(?:.{16})*\000\000\003\354\000\000\000\007(....)\000\000\000\020/s;
+    my $md5off = unpack('N', $1);
+    die("$path: bad md5 offset\n") unless $md5off;
+    $md5off += 96 + 16 + $cnt * 16; 
+    $hdrmd5 = unpack("\@${md5off}H32", $buf);
+  }
+  ($headmagic, $cnt, $cntdata) = unpack('N@8NN', substr($buf, $hlen));
+  die("$path: not a rpm (bad header)\n") unless $headmagic == 0x8eade801 && $cnt < 1048576 && $cntdata < 33554432;
+  my $hlen2 = $hlen + 16 + $cnt * 16 + $cntdata;
+  while (length($buf) < $hlen2) {
+    $l = sysread(F, $buf, 4096, length($buf));
+    die("$path: read error\n") unless $l;
+  }
+  close F;
+  return (substr($buf, 0, 96), substr($buf, 96, $hlen - 96), substr($buf, $hlen, $hlen2 - $hlen), $hdrmd5);
+}
+
 1;
index fa81b00..c8ab2fb 100644 (file)
@@ -98,6 +98,7 @@ my $repomdparser = {
       _tag => 'type',
       _end => \&generic_add_result,
       location => { _start => \&generic_store_attr, _attr => 'href', _tag => 'location'},
+      checksum => { _start => \&generic_store_attr, _attr => 'type', _tag => 'checksum', _text => 1, _end => \&primary_handle_checksum },
       size => { _text => 1, _end => \&generic_store_text, _tag => 'size'},
     },
   },
@@ -113,6 +114,7 @@ my $primaryparser = {
       name => { _text => 1, _end => \&generic_store_text, _tag => 'name' },
       arch => { _text => 1, _end => \&generic_store_text, _tag => 'arch' },
       version => { _start => \&primary_handle_version },
+      checksum => { _start => \&generic_store_attr, _attr => 'type', _tag => 'checksum', _text => 1, _end => \&primary_handle_checksum },
       'time' => { _start => \&primary_handle_time },
       format => {
         'rpm:provides' =>    { 'rpm:entry' => { _start => \&primary_handle_dep , _tag => 'provides' }, },
@@ -156,6 +158,16 @@ sub primary_handle_time {
   $data->{'buildtime'} = $attr{'build'} if $attr{'build'};
 }
 
+sub primary_handle_checksum {
+  my ($h, $c, $p, $el) = @_;
+  my $data = $c->[0]->[4];
+  my $type = lc(delete($data->{$h->{'_tag'}}) || '');
+  $type = 'sha1' if $type eq 'sha';
+  if ($type eq 'md5' || $type eq 'sha1' || $type eq 'sha256' || $type eq 'sha512') {
+    $data->{$h->{'_tag'}} = "$type:$c->[-1]->[2]" if defined $c->[-1]->[2];
+  }
+}
+
 sub primary_handle_file_end {
   my ($h, $c, $p, $el) = @_;
   primary_handle_dep($h, $c, $p, $el, 'name', $c->[-1]->[2]);
@@ -191,6 +203,7 @@ sub primary_add_result {
       push @{$data->{'provides'}}, $s unless grep {$_ eq $s} @{$data->{'provides'} || []};
     }
   }
+  delete $data->{'checksum'} unless $options->{'withchecksum'};
   return generic_add_result(@_);
 }
 
diff --git a/Build/SimpleXML.pm b/Build/SimpleXML.pm
new file mode 100644 (file)
index 0000000..5bd3f91
--- /dev/null
@@ -0,0 +1,83 @@
+package Build::SimpleXML;
+
+use strict;
+
+# very simple xml parser, just good enough to parse kiwi and _service files...
+# can't use standard XML parsers, unfortunatelly, as the build script
+# must not rely on external libraries
+#
+sub parse {
+  my ($xml) = @_;
+
+  my @nodestack;
+  my $node = {};
+  my $c = '';
+  $xml =~ s/^\s*\<\?.*?\?\>//s;
+  while ($xml =~ /^(.*?)\</s) {
+    if ($1 ne '') {
+      $c .= $1;
+      $xml = substr($xml, length($1));
+    }
+    if (substr($xml, 0, 4) eq '<!--') {
+      $xml =~ s/.*?-->//s;
+      next;
+    }
+    die("bad xml\n") unless $xml =~ /(.*?\>)/s;
+    my $tag = $1;
+    $xml = substr($xml, length($tag));
+    my $mode = 0;
+    if ($tag =~ s/^\<\///s) {
+      chop $tag;
+      $mode = 1;       # end
+    } elsif ($tag =~ s/\/\>$//s) {
+      $mode = 2;       # start & end
+      $tag = substr($tag, 1);
+    } else {
+      $tag = substr($tag, 1);
+      chop $tag;
+    }
+    my @tag = split(/(=(?:\"[^\"]*\"|\'[^\']*\'|[^\"\s]*))?\s+/, "$tag ");
+    $tag = shift @tag;
+    shift @tag;
+    push @tag, undef if @tag & 1;
+    my %atts = @tag;
+    for (values %atts) {
+      next unless defined $_;
+      s/^=\"([^\"]*)\"$/=$1/s or s/^=\'([^\']*)\'$/=$1/s;
+      s/^=//s;
+      s/&lt;/</g;
+      s/&gt;/>/g;
+      s/&amp;/&/g;
+      s/&apos;/\'/g;
+      s/&quot;/\"/g;
+    }
+    if ($mode == 0 || $mode == 2) {
+      my $n = {};
+      push @{$node->{$tag}}, $n;
+      for (sort keys %atts) {
+       $n->{$_} = $atts{$_};
+      }
+      if ($mode == 0) {
+       push @nodestack, [ $tag, $node, $c ];
+       $c = '';
+       $node = $n;
+      }
+    } else {
+      die("element '$tag' closes without open\n") unless @nodestack;
+      die("element '$tag' closes, but I expected '$nodestack[-1]->[0]'\n") unless $nodestack[-1]->[0] eq $tag;
+      $c =~ s/^\s*//s;
+      $c =~ s/\s*$//s;
+      $node->{'_content'} = $c if $c ne '';
+      $node = $nodestack[-1]->[1];
+      $c = $nodestack[-1]->[2];
+      pop @nodestack;
+    }
+  }
+  $c .= $xml;
+  $c =~ s/^\s*//s;
+  $c =~ s/\s*$//s;
+  $node->{'_content'} = $c if $c ne '';
+  return $node;
+}
+
+1;
diff --git a/Build/Snapcraft.pm b/Build/Snapcraft.pm
new file mode 100644 (file)
index 0000000..73875b2
--- /dev/null
@@ -0,0 +1,70 @@
+################################################################
+#
+# Copyright (c) 1995-2014 SUSE Linux Products GmbH
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 or 3 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program (see the file COPYING); if not, write to the
+# Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+#
+################################################################
+
+package Build::Snapcraft;
+
+use strict;
+use Build::Deb;
+
+eval { require YAML::XS; };
+*YAML::XS::LoadFile = sub {die("YAML::XS is not available\n")} unless defined &YAML::XS::LoadFile;
+
+sub parse {
+  my ($cf, $fn) = @_;
+
+  my ($yaml) = YAML::XS::LoadFile($fn);
+  return {'error' => "Failed to parse yaml file"} unless $yaml;
+
+  my $ret = {};
+  $ret->{'name'} = $yaml->{'name'};
+  $ret->{'version'} = $yaml->{'version'};
+  $ret->{'epoch'} = $yaml->{'epoch'} if $yaml->{'epoch'};
+
+  # how should we report the built apps?
+
+  my @packdeps;
+  for my $key (sort keys(%{$yaml->{'parts'} || {}})) {
+    my $part = $yaml->{'parts'}->{$key};
+    push @packdeps, "snapcraft-plugin:$part->{plugin}" if defined $part->{plugin};
+    for my $p (@{$part->{'stage-packages'} || []}) {
+      push @packdeps, $p;
+    }
+    for my $p (@{$part->{'build-packages'} || []}) {
+      push @packdeps, $p;
+    }
+  }
+
+  my %exclarchs;
+  for my $arch (@{$yaml->{architectures} || []}) {
+    my @obsarchs = Build::Deb::obsarch($arch);
+    push @obsarchs, $arch unless @obsarchs;
+    $exclarchs{$_} = 1 for @obsarchs;
+  }
+
+  $ret->{'exclarch'} = [ sort keys %exclarchs ] if %exclarchs;
+#  $ret->{'badarch'} = $badarch if defined $badarch;
+  $ret->{'deps'} = \@packdeps;
+#  $ret->{'prereqs'} = \@prereqs if @prereqs;
+#  $ret->{'configdependent'} = 1 if $ifdeps;
+
+  return $ret;
+}
+
+1;
index c1836de..034f6d8 100644 (file)
@@ -54,6 +54,7 @@ my %tmap = (
   'Sup' => 'supplements',
   'Enh' => 'enhances',
   'Tim' => 'buildtime',
+  'Cks' => 'checksum',
 );
 
 sub addpkg {
@@ -74,6 +75,11 @@ sub addpkg {
       push @{$data->{'provides'}}, $s unless grep {$_ eq $s} @{$data->{'provides'} || []};
     }
   }
+  if ($options->{'withchecksum'} && $data->{'checksum'}) {
+    my ($ctype, $csum) = split(' ', delete($data->{'checksum'}));
+    $ctype = lc($ctype || '');
+    $data->{'checksum'} = "$ctype:$csum" if $csum && ($ctype eq 'md5' || $ctype eq 'sha1' || $ctype eq 'sha256' || $ctype eq 'sha512');
+  }
   if (ref($res) eq 'CODE') {
     $res->($data);
   } else {
@@ -96,7 +102,9 @@ sub parse {
     }
   }
   my $cur;
-  my $r = join('|', sort keys %tmap);
+  my @tmap = sort keys %tmap;
+  @tmap = grep {$_ ne 'Cks'} @tmap unless $options{'withchecksum'};
+  my $r = join('|', @tmap);
   $r = qr/^([\+=])($r):\s*(.*)/;
   while (<$fd>) {
     chomp;
diff --git a/HOWTO.add_another_format b/HOWTO.add_another_format
new file mode 100644 (file)
index 0000000..a4dbccc
--- /dev/null
@@ -0,0 +1,99 @@
+
+How to add another build format
+===============================
+
+To support yet another package format to be used with standalone build
+script and Open Build Service you need to follow these steps:
+
+Let's call the new format "XYZ" here.
+
+General notes about the implementations. There are two areas:
+
+SAFE implementations:
+ Some code runs outside of protected environments like KVM. Therefore
+this code must be implemented with security in mind. Special crafted
+build descriptions or binary files must not be able to exploit this code.
+What makes it even more interessting is that this code can also run
+on all kind of old or obscure systems. So any external dependency should
+be avoided as well. 
+This means in short:
+ - code must be as simple as possible.
+ - code must not allow to execute random commands or to access random files.
+ - avoid external dependencies. When you look for a simple XML parser
+   check the kiwi support for this.
+ - code must stay compatible for all versions
+
+Build code running inside of environment.
+ - using any tool is fine here. However, the tool must be installed
+   somehow into the build system. In best case via some dependency.
+ - Incompatible changes can be implemented inside of these packages
+   pulled into the build environment.
+ - network is not possible here.
+
+
+1) Implement the parse() function into Build/XYZ.pm
+
+   parse() extracts the build dependecies from the build specification.
+   For RPM this would be the <package>.spec file for example.
+
+   Must be a SAFE implementation.
+
+2) Add a query() function to Build/XYZ.pm
+
+   query() extracts information from built packages. In the rpm world
+   these are the .rpm files.
+   query returns a hash containing:
+       name, epoch, version, release, arch, description,
+       provides, requires, hdrmd5
+
+   hdrmd5 is some unique identifier of the package built, it might be 
+   just a md5 over the entire file.
+
+   Must be a SAFE implementation.
+
+3) Add a queryhdrmd5() function
+
+   this functions is a specialized version of query(), it just returns
+   the hdrmd5
+
+   Must be a SAFE implementation.
+
+4) Add a verscmp() function
+
+   verscmp() compares two package version strings. For rpms, a version has
+   the form [epoch:]version-release
+
+   Must be a SAFE implementation.
+
+5) Implement build-pkg-xyz functions
+
+   Those functions are used to setup the build environment. I.e. they
+   need to install/unpack the packages
+
+   Must be a SAFE implementation for the pre-installation part. Afterwards
+   it is fine to use any tool to install the packages (like rpm itself).
+
+6) Implement build-recipe-xyz functions
+
+   This functions are called to create the build result
+
+7) For standalone build support (actually not needed for OBS integration, but
+   it makes development easier) we need a "createxyzdeps" helper script.
+   For xyz://<...> repos it needs to download the repository metadata
+   and convert it to build's representation. See createyastdeps and createrepomddeps.
+
+
+Special notes for non-OSS systems
+=================================
+
+Systems like MS-Windows, MacOSX or SunOS could be support as well. However, these
+systems can not be installed by packages from scratch. So using preinstallimages
+would be mandatory here. Support for that exists in general already inside of 
+the code.
+
+Special notes for image formats
+===============================
+
+Image formats can usually skip 2) 3) and 4) from the items above. At least as long
+as they do not want to build new images based on former created ones.
+
index 346a908..bf83231 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -44,6 +44,7 @@ install:
            substitutedeps \
            debtransform \
            debtransformbz2 \
+           debtransformxz \
            debtransformzip \
            mkbaselibs \
            mkdrpms \
@@ -56,10 +57,12 @@ install:
            changelog2spec \
            spec2changelog \
            download \
+           runservices \
            spec_add_patch \
            spectool \
            signdummy \
            unrpm \
+           telnet_login_wrapper \
            $(DESTDIR)$(pkglibdir)
        install -m755 emulator/emulator.sh $(DESTDIR)$(pkglibdir)/emulator/
        install -m644 Build/*.pm $(DESTDIR)$(pkglibdir)/Build
diff --git a/README b/README
index b328e72..204ee57 100644 (file)
--- a/README
+++ b/README
@@ -1,5 +1,5 @@
 
-This is a tool to build binary packages in a safe and reproducible
+This   is a tool to build binary packages in a safe and reproducible
 way. The default is to build in a chroot sandbox, but it also
 supports building in a virtual machine for better security.
 
index 23c4937..3bc500a 100644 (file)
@@ -9,6 +9,8 @@ arch sparcv9    targets sparc64:32bit
 arch sparcv9v  targets sparc64v:32bit
 arch sparc64   targets sparcv9:64bit
 arch sparc64v  targets sparcv9v:64bit
+arch aarch64   targets aarch64_ilp32:64bit
+arch aarch64_ilp32     targets aarch64:32bit
 
 configdir /usr/lib/baselibs-<targettype>/bin
 
@@ -20,9 +22,9 @@ targettype 64bit extension 64
 
 targetname <name>-<targettype>
 
-+.*/lib(64)?/.*\.(so\..*|so|o|a|la)$
++.*/lib(64|ilp32)?/.*\.(so\..*|so|o|a|la)$
 
-targettype 64bit -^(/usr)?/lib/lib
+targettype 64bit -^(/usr)?/lib(ilp32)?/lib
 targettype 32bit -/lib64/
 targettype x86   -/lib64/
 
@@ -39,5 +41,5 @@ package /.(?<!-devel)$/
 post "/sbin/ldconfig"
 
 package /(.*)-debuginfo$/
-+/usr/lib(64)?/debug/.*/lib(64)?/.*\.(so\..*|so|o|a|la)\.debug$
-+/usr/lib(64)?/debug/.build-id/.*
++/usr/lib(64|ilp32)?/debug/.*/lib(64|ilp32)?/.*\.(so\..*|so|o|a|la)\.debug$
++/usr/lib(64|ilp32)?/debug/.build-id/.*
diff --git a/build b/build
index b1478fd..b154838 100755 (executable)
--- a/build
+++ b/build
@@ -61,6 +61,7 @@ ABUILD_GID=399
 
 DO_INIT=true
 DO_BUILD=true
+DO_INIT_TOPDIR=true
 DO_LINT=
 DO_CHECKS=true
 SHORT_CIRCUIT=false
@@ -99,7 +100,6 @@ DLNOSIGNATURE=
 CACHE_DIR=/var/cache/build
 USEHIGHERDEPS=
 
-
 # This is for insserv
 export YAST_IS_RUNNING=instsys
 
@@ -288,7 +288,7 @@ Known Parameters:
 
   --vm-type TYPE
               Use virtual machine instead of chroot
-              TYPE is one of xen|kvm|uml|qemu|lxc|zvm|openstack|ec2
+              TYPE is one of xen|kvm|uml|qemu|lxc|zvm|openstack|ec2|docker|pvm
 
   --vm-worker GUEST
               GUEST is a z/VM build worker controlled by the controlling
@@ -328,6 +328,23 @@ Known Parameters:
   --vm-initrd FILE
               Kernel and initrd to use for VM (kvm and qemu only)
 
+  --vm-user   USERNAME
+              User name to run qemu/kvm process
+
+  --vm-telnet PORT
+              Is forwarding PORT to a telnet session inside of the VM.
+              Specify also needed extra packages via -x parameter, usually:
+                 --vm-telnet 1234 -x telnet-server -x net-tools
+              And connect from the host via
+                 telnet 1234
+              NOTE: The telnet server gets started after all packages got installed.
+
+  --vm-net OPTION
+  --vm-netdev OPTION
+  --vm-device OPTION
+              KVM only: Attach kvm option
+              Available options are -net, -netdev, -device
+             (This options in kvm can not guarantee reproducible builds)
   --debug
               Enable creation of a debuginfo package
 
@@ -352,11 +369,18 @@ usage () {
 cleanup_and_exit () {
     trap EXIT
     test -z "$1" && set 0
-    rm -f $BUILD_ROOT/.repo.config
+       rm -f $BUILD_ROOT/.repo.config
     rm -f $BUILD_ROOT/exit
     if test "$1" -eq 1 -a -x /bin/df ; then
+        echo
+        echo "$HOST failed \"build $RECIPEFILE\" at `date --utc`."
+        echo
         # okay, it failed, but maybe because disk space?
        if df $BUILD_ROOT 2>/dev/null | grep -q "100%"; then
+            df $BUILD_ROOT 2>/dev/null
+            echo
+            echo "$HOST ran out of disk space. Please try again."
+            echo
            set 3
         fi
     fi
@@ -367,14 +391,13 @@ cleanup_and_exit () {
     else
        umount -n $BUILD_ROOT/proc/sys/fs/binfmt_misc 2> /dev/null || true
        umount -n $BUILD_ROOT/proc 2>/dev/null || true
-       while true
-       do
-               umount -n $BUILD_ROOT/dev/pts 2>/dev/null
-               if test $? -ne 0; then
-                       break
-               fi
-       done
-
+    while true
+    do
+            umount -n $BUILD_ROOT/dev/pts 2>/dev/null
+            if test $? -ne 0; then
+                    break
+            fi
+    done
        umount -n $BUILD_ROOT/dev/shm 2>/dev/null || true
        umount -n $BUILD_ROOT/sys 2>/dev/null || true
        test -n "$VM_IMAGE" -a "$VM_IMAGE" != 1 && umount $BUILD_ROOT 2>/dev/null || true
@@ -430,13 +453,12 @@ setupccache() {
     fi
 }
 
-setupicecream()
-{
-    local icecreamdir="/var/run/icecream"
-    if test `readlink "$BUILD_ROOT/var/run"` = '/run' ; then
-        icecreamdir="/run/icecream"
+setupicecream() {
+    local icecreamdir=/var/run/icecream
+    if test "$(readlink "$BUILD_ROOT/var/run")" = /run ; then
+       icecreamdir=/run/icecream
     fi
-    if [ "$icecream" -eq 0 ]; then
+    if test "$icecream" -eq 0 ; then
        rm -rf "$BUILD_ROOT$icecreamdir"
        rm -f "$BUILD_ROOT/etc/profile.d/build_icecream.sh"
        return 0
@@ -469,12 +491,12 @@ setupicecream()
     then
        rm -rf "$BUILD_ROOT$icecreamdir"
        mkdir -p "$BUILD_ROOT$icecreamdir"
-       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
+       if test -e "$BUILD_ROOT"/usr/bin/create-env ; then
+           createenv=/usr/bin/create-env
+       elif test -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 test -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"
            return 1
@@ -502,11 +524,11 @@ setmemorylimit() {
        case "$mem" in
            MemTotal:*)
                set -- $mem
-               eval "limit=\$(($2/3*4))"
+               eval "limit=\$(($2/3*2))"
            ;;
            SwapTotal:*)
                set -- $mem
-               eval "limit=\$(($2/3*4+$limit))"
+               eval "limit=\$(($2/3*2+$limit))"
            ;;
        esac
     done < <(cat /proc/meminfo) # cat for proc stuff
@@ -521,7 +543,7 @@ create_baselibs() {
 
     BASELIBS_CFG=
 
-    if test "$BUILDTYPE" == arch ; then
+    if test "$BUILDTYPE" == arch || test "$BUILDTYPE" = collax ; then
        return
     fi
     if test "$BUILDTYPE" == dsc ; then
@@ -691,7 +713,6 @@ hide_passwords()
     echo ${repos[@]}
 }
 
-
 #### main ####
 
 trap fail_exit EXIT
@@ -734,10 +755,11 @@ while test -n "$1"; do
        cleanup_and_exit
       ;;
       -noinit|-no-init)
+       test "$DO_INIT" = false && DO_INIT_TOPDIR=false
        DO_INIT=false
       ;;
       -no-build)
-       DO_BUILD=false
+    DO_BUILD=false
       ;;
       -nochecks|-no-checks)
        DO_CHECKS=false
@@ -790,9 +812,9 @@ while test -n "$1"; do
       -baselibs-internal)
        CREATE_BASELIBS=internal
        ;;
-      -keep-packs)
-        KEEP_PACKS="--keep-packs"
-        ;;
+       --keep-packs)
+        KEEP_PACKS="--keep-packs"
+       ;;
       -root)
        needarg
        BUILD_ROOT="$ARG"
@@ -832,10 +854,10 @@ while test -n "$1"; do
        NOROOTFORBUILD=true
       ;;
       -short-circuit)
-        SHORT_CIRCUIT=true
+    SHORT_CIRCUIT=true
       ;;
       -no-topdir-cleanup)
-        NO_TOPDIR_CLEANUP=true
+    NO_TOPDIR_CLEANUP=true
       ;;
       -useusedforbuild)
        USEUSEDFORBUILD="--useusedforbuild"
@@ -938,9 +960,9 @@ while test -n "$1"; do
        echo "$ARG does not take an argument"
        cleanup_and_exit
       ;;
-      -use-higher-deps)
-        USEHIGHERDEPS="--use-higher-deps"
-      ;;
+         -use-higher-deps)
+       USEHIGHERDEPS="--use-higher-deps"
+         ;;
       -*)
        if vm_parse_options "$@" ; then
            set -- "${nextargs[@]}"
@@ -984,6 +1006,7 @@ fi
 
 if test -n "$CLEAN_BUILD" ; then
     DO_INIT=true
+    DO_INIT_TOPDIR=true
 fi
 
 if test -n "$VM_TYPE" -a -z "$RUNNING_IN_VM" ; then
@@ -1024,7 +1047,6 @@ fi
 
 mkdir_build_root
 hide_passwords
-
 if test "$BUILD_ROOT" = / ; then
     browner="$(stat -c %u /)"
 fi
@@ -1040,7 +1062,18 @@ if test -w /root ; then
 fi
 
 if test -z "$VM_IMAGE" -a -z "$LOGFILE" ; then
-    LOGFILE="$BUILD_ROOT/.build.log"
+    if test -z "$RUNNING_IN_VM"; then
+        LOGFILE="$BUILD_ROOT/.build.log"
+    else
+        # lxc and docker are special cases: vm shares logfile with host
+        case "$VM_TYPE" in
+        lxc|docker)
+            ;;
+        *)
+            LOGFILE="$BUILD_ROOT/.build.log"
+            ;;
+        esac
+    fi
 fi
 
 if test -n "$LOGFILE" -a -z "$RUN_SHELL" ; then
@@ -1151,6 +1184,7 @@ for RECIPEFILE in "${RECIPEFILES[@]}" ; do
        test "$BUILDTYPE" = mock && CREATE_BUILD_BINARIES=--create-build-binaries
        test "$BUILDTYPE" = debootstrap && CREATE_BUILD_BINARIES=--create-build-binaries
        test "$BUILDTYPE" = livebuild && CREATE_BUILD_BINARIES=--create-build-binaries
+       test "$BUILDTYPE" = snapcraft && CREATE_BUILD_BINARIES=--create-build-binaries
        set -- init_buildsystem --configdir "$CONFIG_DIR" --cachedir "$CACHE_DIR" "${definesnstuff[@]}" "${repos[@]}" $CLEAN_BUILD $DLNOSIGNATURE $KEEP_PACKS $USEHIGHERDEPS $USEUSEDFORBUILD $CREATE_BUILD_BINARIES $RPMLIST "$MYSRCDIR/$RECIPEFILE" $ADDITIONAL_PACKS
        echo "$* ..."
         start_time=`date +%s`
@@ -1225,11 +1259,11 @@ for RECIPEFILE in "${RECIPEFILES[@]}" ; do
            chown "$ABUILD_UID:$ABUILD_GID" $BUILD_ROOT/home/abuild
        else
            if ! egrep "^abuild:x?:${ABUILD_UID}:${ABUILD_GID}" >/dev/null <$BUILD_ROOT/etc/passwd ; then
-                sed -i '/^abuild:/d' $BUILD_ROOT/etc/passwd
-                sed -i '/^abuild:/d' $BUILD_ROOT/etc/group
-                echo "abuild:x:${ABUILD_UID}:${ABUILD_GID}:Autobuild:/home/abuild:/bin/bash" >>$BUILD_ROOT/etc/passwd
-                echo "abuild:x:${ABUILD_GID}:" >>$BUILD_ROOT/etc/group
-                chown "$ABUILD_UID:$ABUILD_GID" $BUILD_ROOT/home/abuild -R
+                   sed -i '/^abuild:/d' $BUILD_ROOT/etc/passwd
+                   sed -i '/^abuild:/d' $BUILD_ROOT/etc/group
+                   echo "abuild:x:${ABUILD_UID}:${ABUILD_GID}:Autobuild:/home/abuild:/bin/bash" >>$BUILD_ROOT/etc/passwd
+                   echo "abuild:x:${ABUILD_GID}:" >>$BUILD_ROOT/etc/group
+                   chown "$ABUILD_UID:$ABUILD_GID" $BUILD_ROOT/home/abuild -R
            fi
        fi
        if test -f $BUILD_ROOT/etc/shadow ; then
@@ -1264,17 +1298,47 @@ for RECIPEFILE in "${RECIPEFILES[@]}" ; do
     mount -n -ttmpfs none $BUILD_ROOT/dev/shm 2> /dev/null
 
     if test -n "$RUNNING_IN_VM" ; then
-       if test -x /sbin/ip ; then
-           ip addr add 127.0.0.1/8 dev lo
-           ip addr add ::1/128 dev lo
-           ip link set lo up
-       else
-           ifconfig lo 127.0.0.1 up
-           ifconfig lo add ::1/128
-       fi
+        if test -x /sbin/ip ; then
+            ip addr add 127.0.0.1/8 dev lo
+            ip addr add ::1/128 dev lo
+            ip link set lo up
+        else
+            ifconfig lo 127.0.0.1 up
+            ifconfig lo add ::1/128
+        fi
+        if test -n "$VM_TELNET"; then
+            VM_TELNET_DEVICE=$( cd /sys/class/net/; echo * )
+            VM_TELNET_DEVICE=${VM_TELNET_DEVICE#lo }
+            VM_TELNET_DEVICE=${VM_TELNET_DEVICE%% *}
+           if test -z "$VM_TELNET_DEVICE"; then
+                  echo "ERROR: no network device found for telnet server"
+                   cleanup_and_exit 1
+            fi
+            if test -x /sbin/ip ; then
+                   ip addr add 10.0.2.15/8 dev ${VM_TELNET_DEVICE}
+                   ip addr add ::1/24 dev ${VM_TELNET_DEVICE}
+                   ip link set ${VM_TELNET_DEVICE} up
+            else
+                  if ! test -x /sbin/ifconfig ; then
+                     echo "ERROR: /usr/sbin/in.telnetd is not running, please specify right package via -x option"
+                      cleanup_and_exit 1
+                   fi
+                   ifconfig ${VM_TELNET_DEVICE} 10.0.2.15 up
+                   ifconfig ${VM_TELNET_DEVICE} add ::1/24
+            fi  
+        fi
        if test -n "$MYHOSTNAME" ; then
            hostname "$MYHOSTNAME"
        fi
+       if test -n "$VM_TELNET"; then
+           echo WARNING: telnet option used, setting up telnet server ${VM_TELNET_DEVICE}
+           if test -x /usr/sbin/in.telnetd; then
+              ( /usr/sbin/in.telnetd -L /.build/telnet_login_wrapper -debug 23 & )
+           else
+               echo "ERROR: /usr/sbin/in.telnetd is not running, please specify right package via -x option"
+                cleanup_and_exit 1
+           fi
+       fi
     fi
 
     setupicecream
@@ -1299,6 +1363,28 @@ for RECIPEFILE in "${RECIPEFILES[@]}" ; do
        echo "export SUSE_IGNORED_RPATHS=/etc/ld.so.conf" > "$BUILD_ROOT/etc/profile.d/buildsystem.sh"
     fi
 
+    cd $BUILD_ROOT$TOPDIR/SOURCES || cleanup_and_exit 1
+    for i in *.obscpio ; do
+       test -e "$i" || continue
+       echo "Unpacking $i ..."
+       echo "#!/bin/sh -e" > $BUILD_ROOT/.unpack.command
+       shellquote cd "$TOPDIR/SOURCES" >> $BUILD_ROOT/.unpack.command
+       echo >> $BUILD_ROOT/.unpack.command
+       echo -n 'cpio --extract --owner="'$BUILD_USER'" --unconditional --preserve-modification-time --make-directories <' >> $BUILD_ROOT/.unpack.command
+       shellquote "$i" >> $BUILD_ROOT/.unpack.command
+       echo >> $BUILD_ROOT/.unpack.command
+       shellquote rm -f "$i" >> $BUILD_ROOT/.unpack.command
+       echo >> $BUILD_ROOT/.unpack.command
+       chmod 0755 $BUILD_ROOT/.unpack.command
+       chroot $BUILD_ROOT su -c /.unpack.command - $BUILD_USER
+       rm -f $BUILD_ROOT/.unpack.command
+    done
+
+    if  test -e _service; then
+       echo "Running build time source services..."
+       $BUILD_DIR/runservices --buildroot "$BUILD_ROOT" || cleanup_and_exit 1
+    fi
+
     # get rid of old src dir, it is no longer needed and just wastes space
     test "$MYSRCDIR" = $BUILD_ROOT/.build-srcdir && rm -rf "$MYSRCDIR"
 
@@ -1308,8 +1394,6 @@ for RECIPEFILE in "${RECIPEFILES[@]}" ; do
     # hmmm
     chown -R "$ABUILD_UID:$ABUILD_GID" "$BUILD_ROOT$TOPDIR"
 
-    cd $BUILD_ROOT$TOPDIR/SOURCES || cleanup_and_exit 1
-
     echo -----------------------------------------------------------------
     if test "$BUILD_USER" = root ; then
        echo ----- building $RECIPEFILE
index eadab2b..2dc321d 100644 (file)
@@ -46,9 +46,12 @@ pkg_cumulate_arch() {
 }
 
 pkg_install_arch() {
+    # Pacman can't handle chroot
+    # https://bbs.archlinux.org/viewtopic.php?id=129661
+    (cd $BUILD_ROOT/etc && sed -i "s/^CheckSpace/#CheckSpace/g" pacman.conf)
     # -d -d disables deps checking
     ( cd $BUILD_ROOT && chroot $BUILD_ROOT pacman -U --force -d -d --noconfirm .init_b_cache/$PKG.$PSUF 2>&1 || touch $BUILD_ROOT/exit ) | \
-       perl -ne '$|=1;/^(warning: could not get filesystem information for |loading packages|looking for inter-conflicts|Targets |Total Installed Size: |Net Upgrade Size: |Proceed with installation|checking package integrity|loading package files|checking for file conflicts|checking keyring|Packages \(\d+\):|:: Proceed with installation|checking available disk space|installing |upgrading |warning:.*is up to date -- reinstalling|Optional dependencies for|    )/||/^$/||print'
+       perl -ne '$|=1;/^(warning: could not get filesystem information for |loading packages|looking for inter-conflicts|looking for conflicting packages|Targets |Total Installed Size: |Net Upgrade Size: |Proceed with installation|checking package integrity|loading package files|checking for file conflicts|checking keyring|Packages \(\d+\)|:: Proceed with installation|:: Processing package changes|checking available disk space|installing |upgrading |warning:.*is up to date -- reinstalling|Optional dependencies for|    )/||/^$/||print'
 }
 
 pkg_finalize_arch() {
index 83a4afe..2465204 100644 (file)
 #
 ################################################################
 
+#
+# A wrapper around chroot to set the environment correctly for dpkg and
+# pre/postinst scripts.
+#
+deb_chroot ()
+{
+    #
+    # to workaround some version of fileutils that doesn't do a 'chdir /'
+    # when doing a 'chroot /' call lets subshell and change dir manually
+    #
+    (
+       cd $1 &&
+           DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical \
+                          DEBCONF_NONINTERACTIVE_SEEN=true \
+                          LC_ALL=C LANGUAGE=C LANG=C \
+                          chroot $*
+    )
+}
+
 deb_setup() {
     mkdir -p $BUILD_ROOT/var/lib/dpkg
     mkdir -p $BUILD_ROOT/var/log
@@ -39,7 +58,7 @@ pkg_initdb_deb() {
        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
+    deb_chroot $BUILD_ROOT dpkg --install --force-depends .init_b_cache/dpkg.deb >/dev/null 2>&1
 }
 
 pkg_prepare_deb() {
@@ -47,9 +66,7 @@ pkg_prepare_deb() {
 }
 
 pkg_install_deb() {
-    export DEBIAN_FRONTEND=noninteractive
-    export DEBIAN_PRIORITY=critical
-    ( cd $BUILD_ROOT && chroot $BUILD_ROOT dpkg --install --force all .init_b_cache/$PKG.deb 2>&1 || touch $BUILD_ROOT/exit ) | \
+    ( deb_chroot $BUILD_ROOT dpkg --install --force-depends .init_b_cache/$PKG.deb 2>&1 || touch $BUILD_ROOT/exit ) | \
        perl -ne '$|=1;/^(Configuration file|Installing new config file|Selecting previously deselected|Selecting previously unselected|\(Reading database|Unpacking |Setting up|Creating config file|Preparing to replace dpkg|Preparing to unpack )/||/^$/||print'
     # ugly workaround for upstart system. some packages (procps) try
     # to start a service in their configure phase. As we don't have
@@ -66,10 +83,22 @@ pkg_install_deb() {
 }
 
 pkg_erase_deb() {
-    export DEBIAN_FRONTEND=noninteractive
-    export DEBIAN_PRIORITY=critical
-    ( cd $BUILD_ROOT && chroot $BUILD_ROOT dpkg --purge --force all $PKG 2>&1 || touch $BUILD_ROOT/exit ) | \
-       perl -ne '$|=1;/^(\(Reading database|Removing |Purging configuration files for )/||/^$/||print'
+    deb_chroot $BUILD_ROOT dpkg --purge --force-depends $PKG 2>&1 | {
+      local retry
+      while read line; do
+          case "$line" in
+              subprocess\ installed\ *script\ returned\ error\ exit\ status*)
+                 chroot $BUILD_ROOT rm -f /var/lib/dpkg/info/$PKG.{pre,post}rm
+                 retry=1
+              ;;
+              *) echo "$line" ;;
+          esac
+      done
+      if test -n "$retry"; then
+          echo "re-try deleting $PKG without post/pre remove scripts"
+          deb_chroot $BUILD_ROOT dpkg --purge --force-depends $PKG 2>&1 || touch $BUILD_ROOT/exit
+      fi
+    } | perl -ne '$|=1;/^(\(Reading database|Removing |Purging configuration files for )/||/^$/||print'
 }
 
 pkg_cumulate_deb() {
@@ -85,9 +114,9 @@ pkg_finalize_deb() {
     # configure all packages after complete installation, not for each package like rpm does
     # We need to run this twice, because of cyclic dependencies as it does not succeed on most
     # debian based distros in the first attempt.
-    if ! chroot $BUILD_ROOT dpkg --configure --pending  2>&1; then
+    if ! deb_chroot $BUILD_ROOT dpkg --configure --pending  2>&1; then
          echo "first configure attempt failed, trying again..."
-         chroot $BUILD_ROOT dpkg --configure --pending  2>&1 || cleanup_and_exit 1
+         deb_chroot $BUILD_ROOT dpkg --configure --pending  2>&1 || cleanup_and_exit 1
     fi
 }
 
@@ -113,12 +142,18 @@ pkg_runscripts_deb() {
     fi
     if test -e "$BUILD_ROOT/.init_b_cache/scripts/$PKG.pre" ; then
        echo "running $PKG preinstall script"
-       (cd $BUILD_ROOT && chroot $BUILD_ROOT ".init_b_cache/scripts/$PKG.pre" install < /dev/null )
+       deb_chroot $BUILD_ROOT ".init_b_cache/scripts/$PKG.pre" install \
+                  < /dev/null
        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"
-       (cd $BUILD_ROOT && chroot $BUILD_ROOT ".init_b_cache/scripts/$PKG.post" configure '' < /dev/null )
+       deb_chroot $BUILD_ROOT ".init_b_cache/scripts/$PKG.post" configure '' \
+                  < /dev/null
        rm -f "$BUILD_ROOT/.init_b_cache/scripts/$PKG.post"
     fi
 }
+
+# Local Variables:
+# mode: Shell-script
+# End:
index c0f9653..fc6a421 100644 (file)
@@ -109,7 +109,17 @@ pkg_cumulate_rpm() {
 }
 
 pkg_install_rpm() {
-    ( chroot $BUILD_ROOT rpm --ignorearch --nodeps -U --oldpackage --ignoresize $RPMCHECKOPTS \
+    export ADDITIONAL_PARAMS=
+    if test "$USE_FORCE" = true ; then
+       export ADDITIONAL_PARAMS="$ADDITIONAL_PARAMS --force"
+    fi
+    # work around for cross-build installs, we must not overwrite the running rpm
+    if test "$PKG" = rpm ; then
+       for i in $BUILD_ROOT/.init_b_cache/preinstalls/rpm-x86-* ; do
+           test -e "$i" && ADDITIONAL_PARAMS="$ADDITIONAL_PARAMS --justdb"
+       done
+    fi
+    ( cd $BUILD_ROOT && 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$"
@@ -125,8 +135,8 @@ pkg_finalize_rpm() {
            rm -f $BUILD_ROOT/${CUMULATED_LIST[$num]}
            cp $BUILD_ROOT/.init_b_cache/rpms/$PKG $BUILD_ROOT/${CUMULATED_LIST[$num]} || cleanup_and_exit 1
        done > $BUILD_ROOT/.init_b_cache/manifest
-       chroot $BUILD_ROOT rpm --ignorearch --nodeps -Uh --oldpackage --ignoresize --verbose $RPMCHECKOPTS \
-               $ADDITIONAL_PARAMS .init_b_cache/manifest 2>&1 || touch $BUILD_ROOT/exit
+       ( cd $BUILD_ROOT && chroot $BUILD_ROOT rpm --ignorearch --nodeps -Uh --oldpackage --ignoresize --verbose $RPMCHECKOPTS \
+               $ADDITIONAL_PARAMS .init_b_cache/manifest 2>&1 || touch $BUILD_ROOT/exit )
        for ((num=0; num<=cumulate; num++)) ; do
            rm -f $BUILD_ROOT/${CUMULATED_LIST[$num]}
        done
@@ -182,12 +192,12 @@ pkg_preinstall_rpm() {
 pkg_runscripts_rpm() {
     if test -e "$BUILD_ROOT/.init_b_cache/scripts/$PKG.pre" ; then
        echo "running $PKG preinstall script"
-       chroot $BUILD_ROOT sh ".init_b_cache/scripts/$PKG.pre" 0
+       (cd $BUILD_ROOT && chroot $BUILD_ROOT sh ".init_b_cache/scripts/$PKG.pre" 0)
        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"
-       chroot $BUILD_ROOT sh ".init_b_cache/scripts/$PKG.post" 1
+       (cd $BUILD_ROOT && chroot $BUILD_ROOT sh ".init_b_cache/scripts/$PKG.post" 1)
        rm -f "$BUILD_ROOT/.init_b_cache/scripts/$PKG.post"
     fi
 }
index 4d9674a..d1c1afb 100644 (file)
@@ -24,7 +24,7 @@
 
 KIWI_PARAMETERS=
 
-for i in spec dsc kiwi arch preinstallimage mock livebuild debootstrap; do
+for i in spec dsc kiwi arch collax preinstallimage simpleimage mock livebuild snapcraft debootstrap debbuild; do
     . "$BUILD_DIR/build-recipe-$i"
 done
 
@@ -72,7 +72,10 @@ recipe_set_buildtype() {
         *.dsc) BUILDTYPE=dsc ;;
         *.kiwi) BUILDTYPE=kiwi ;;
         PKGBUILD) BUILDTYPE=arch ;;
+        snapcraft.yaml) BUILDTYPE=snapcraft ;;
+        build.collax) BUILDTYPE=collax ;;
         _preinstallimage) BUILDTYPE=preinstallimage ;;
+        simpleimage) BUILDTYPE=simpleimage ;;
         *.livebuild) BUILDTYPE=livebuild ;;
     esac
     if test -z "$BUILDTYPE" ; then
@@ -93,6 +96,9 @@ recipe_set_buildtype() {
     if test "$BUILDENGINE" = debootstrap -a "$BUILDTYPE" = dsc ; then
        BUILDTYPE=debootstrap
     fi
+    if test "$BUILDENGINE" = debbuild -a "$BUILDTYPE" = spec ; then
+       BUILDTYPE=debbuild
+    fi
 }
 
 # expands all directories into files
@@ -115,10 +121,12 @@ expand_recipe_directories() {
                        dsc) types=".dsc" ;;
                        kiwi) types=".kiwi" ;;
                        arch) types="PKGBUILD" ;;
+                       collax) types="build.collax" ;;
                        livebuild) types=".livebuild" ;;
+                       snapcraft) types="snapcraft.yaml" ;;
                    esac
                fi
-               types="$types .spec .dsc PKGBUILD .kiwi .src.rpm .nosrc.rpm"
+               types="$types .spec .dsc PKGBUILD build.collax .kiwi .src.rpm .nosrc.rpm simpleimage snapcraft.yaml"
            fi
            for t in $types ; do
                found=
index 2fe6159..5a00114 100644 (file)
@@ -23,7 +23,7 @@
 
 recipe_setup_arch() {
     TOPDIR=/usr/src/packages
-    rm -rf "$BUILD_ROOT$TOPDIR"
+    test "$DO_INIT_TOPDIR" = false || rm -rf "$BUILD_ROOT$TOPDIR"
     mkdir -p "$BUILD_ROOT$TOPDIR"
     mkdir -p "$BUILD_ROOT$TOPDIR/OTHER"
     mkdir -p "$BUILD_ROOT$TOPDIR/SOURCES"
@@ -41,7 +41,10 @@ recipe_setup_arch() {
 
 recipe_prepare_arch() {
     echo "Preparing sources..."
-    _arch_recipe_makepkg -so "2>&1" ">/dev/null"
+    if ! _arch_recipe_makepkg -so "2>&1" ">/dev/null" ; then
+       echo "failed to prepare sources"
+       cleanup_and_exit 1
+    fi
 }
 
 recipe_build_arch() {
diff --git a/build-recipe-collax b/build-recipe-collax
new file mode 100644 (file)
index 0000000..783e5d7
--- /dev/null
@@ -0,0 +1,53 @@
+#!/bin/sh
+
+recipe_setup_collax()
+{
+       TOPDIR="/usr/src/packages"
+       test "$DO_INIT_TOPDIR" != false && rm -Rf "$BUILD_ROOT/$TOPDIR"
+       mkdir -p "$BUILD_ROOT/$TOPDIR"/{SOURCES,SOURCES.DEB,DEBS,OTHER}
+       cp -p "$MYSRCDIR"/* "$BUILD_ROOT/$TOPDIR/SOURCES/"
+       chown -R "$ABUILD_UID:$ABUILD_GID" "$BUILD_ROOT/$TOPDIR"
+}
+
+recipe_prepare_collax()
+{
+       DEB_SOURCEDIR="$TOPDIR/SOURCES"
+       DEB_DSCFILE="$RECIPEFILE"
+       chmod -v +x "$BUILD_ROOT/$DEB_SOURCEDIR/build.collax"
+       ln -fsv build.collax "$BUILD_ROOT/$DEB_SOURCEDIR/build"
+}
+
+collax_build()
+{
+       local buildroot="$1"
+
+       if test -n "$RUN_SHELL"; then
+               chroot "$buildroot" su -
+               ret=$?
+       else
+               chroot "$buildroot" su - $BUILD_USER -c \
+                       "cd $TOPDIR/SOURCES && ./build"
+               ret=$?
+       fi
+       if test "$ret" = 0; then
+               BUILD_SUCCEEDED=true
+       fi
+}
+
+collax_move_build_result()
+{
+       for f in "$BUILD_ROOT/$DEB_SOURCEDIR"/*.{deb,changes}; do
+               test -f "$f" && mv -v "$f" "$BUILD_ROOT/$TOPDIR/DEBS/"
+       done
+}
+
+recipe_build_collax()
+{
+       collax_build "$BUILD_ROOT"
+       collax_move_build_result
+}
+
+recipe_resultdirs_collax()
+{
+       echo DEBS
+}
diff --git a/build-recipe-debbuild b/build-recipe-debbuild
new file mode 100644 (file)
index 0000000..6065fd2
--- /dev/null
@@ -0,0 +1,53 @@
+#
+# debbuild specific functions.
+#
+################################################################
+#
+# Copyright (c) 2015 SUSE Linux GmbH
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 or 3 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program (see the file COPYING); if not, write to the
+# Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+#
+################################################################
+
+recipe_setup_debbuild() {
+    TOPDIR=`chroot $BUILD_ROOT su -c "debbuild --eval '%_topdir'" - $BUILD_USER`
+    if test -z "$TOPDIR"; then
+       echo "Error: TOPDIR empty"
+       cleanup_and_exit 1
+    fi
+    test "$DO_INIT_TOPDIR" = false || rm -rf "$BUILD_ROOT$TOPDIR"
+    mkdir -p "$BUILD_ROOT$TOPDIR"
+    mkdir -p "$BUILD_ROOT$TOPDIR/OTHER"
+    mkdir -p "$BUILD_ROOT$TOPDIR/SOURCES"
+    mkdir -p "$BUILD_ROOT$TOPDIR/DEBS"
+    mkdir -p "$BUILD_ROOT$TOPDIR/SDEBS"
+    mkdir -p "$BUILD_ROOT$TOPDIR/BUILD"
+    test -e "$BUILD_ROOT$TOPDIR/SPECS" || ln -s SOURCES "$BUILD_ROOT$TOPDIR/SPECS"
+    chown -R "$ABUILD_UID:$ABUILD_GID" "$BUILD_ROOT$TOPDIR"
+    cp -p "$MYSRCDIR"/* $BUILD_ROOT$TOPDIR/SOURCES/
+}
+
+recipe_prepare_debbuild() {
+    recipe_prepare_spec "$@"
+}
+
+recipe_build_debbuild() {
+    recipe_build_spec "$@"
+}
+
+recipe_resultdirs_debbuild() {
+    echo DEBS SDEBS
+}
+
index 265b6e2..62ab7d5 100644 (file)
@@ -45,9 +45,14 @@ recipe_build_debootstrap() {
     done
     FULL_PKG_LIST="${FULL_PKG_LIST#,}"
     rm -rf "$BUILD_ROOT/$myroot"
-    set -- chroot $BUILD_ROOT debootstrap --no-check-gpg --variant=buildd --arch="${arch}" --include="$FULL_PKG_LIST" "$dist" "$myroot" file:///.build.binaries
+    set -- chroot $BUILD_ROOT debootstrap --keep-debootstrap-dir --no-check-gpg --variant=buildd --arch="${arch}" --include="$FULL_PKG_LIST" "$dist" "$myroot" file:///.build.binaries
     echo "running debootstrap..."
-    "$@"
+    if ! "$@" || ! chroot $BUILD_ROOT dpkg --configure -a; then
+        cat $BUILD_ROOT/debootstrap/debootstrap.log
+        echo "Failed to setup debootstrap chroot"
+        cleanup_and_exit 1
+    fi
+
     # adapt passwd
     if test $BUILD_USER = abuild ; then
        echo "abuild:x:${ABUILD_UID}:${ABUILD_GID}:Autobuild:/home/abuild:/bin/bash" >>$BUILD_ROOT/$myroot/etc/passwd
@@ -56,34 +61,18 @@ recipe_build_debootstrap() {
        mkdir -p $BUILD_ROOT/$myroot/home/abuild
        chown "$ABUILD_UID:$ABUILD_GID" $BUILD_ROOT/$myroot/home/abuild
     fi
+
     # move topdir over
     mv "$BUILD_ROOT/$TOPDIR" "$BUILD_ROOT/$myroot/${TOPDIR%/*}"
+
     # do the build
-    DSC_BUILD_OPTIONS=
-    test -n "$BUILD_JOBS" && DSC_BUILD_OPTIONS="parallel=${BUILD_JOBS}"
-    DSC_BUILD_CMD="$(queryconfig --dist "$BUILD_DIST" --archpath "$BUILD_ARCH" --configdir "$CONFIG_DIR" substitute dsc:build_cmd)"
-    test -z "$DSC_BUILD_CMD" && DSC_BUILD_CMD="dpkg-buildpackage -us -uc"
-    if test -e $BUILD_ROOT/$myroot/$TOPDIR/SOURCES/build.script ; then
-        echo "Sourcing build.script to build - it should normally run 'dpkg-buildpackage -us -uc'"
-        DSC_BUILD_CMD="source $TOPDIR/SOURCES/build.script"
-        chmod +x $BUILD_ROOT/$myroot/$TOPDIR/SOURCES/build.script
-    fi
-    chroot "$BUILD_ROOT/$myroot" su -c "export DEB_BUILD_OPTIONS=${DSC_BUILD_OPTIONS} ; cd $TOPDIR/BUILD && $DSC_BUILD_CMD" - $BUILD_USER < /dev/null && BUILD_SUCCEEDED=true
-    # run lintian
-    if test "$BUILD_SUCCEEDED" = true -a "$DO_CHECKS" != "false"; then
-       DEB_CHANGESFILE=${RECIPEFILE%.dsc}_"$(chroot "$BUILD_ROOT/$myroot" su -c 'dpkg-architecture -qDEB_BUILD_ARCH')".changes
-       chroot $BUILD_ROOT/$myroot su -c "which lintian > /dev/null && cd $TOPDIR && echo Running lintian && (set -x && lintian -i $DEB_SOURCEDIR/$DEB_DSCFILE)" - $BUILD_USER < /dev/null
-    fi
+    dsc_build "$BUILD_ROOT/$myroot"
+
     # move topdir back
     mv "$BUILD_ROOT/$myroot/$TOPDIR" "$BUILD_ROOT/${TOPDIR%/*}"
-    for DEB in $BUILD_ROOT/$TOPDIR/*.deb ; do
-        test -e "$DEB" && mv "$DEB" "$BUILD_ROOT/$TOPDIR/DEBS"
-    done
-    # link used sources over to DEB directory
-    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)
+
+    # move result
+    dsc_move_build_result
 }
 
 recipe_resultdirs_debootstrap() {
index 9b3ca33..4da713c 100644 (file)
@@ -23,7 +23,7 @@
 
 recipe_setup_dsc() {
     TOPDIR=/usr/src/packages
-    rm -rf "$BUILD_ROOT$TOPDIR"
+    test "$DO_INIT_TOPDIR" = false || rm -rf "$BUILD_ROOT$TOPDIR"
     mkdir -p "$BUILD_ROOT$TOPDIR"
     mkdir -p "$BUILD_ROOT$TOPDIR/OTHER"
     mkdir -p "$BUILD_ROOT$TOPDIR/SOURCES"
@@ -47,14 +47,16 @@ recipe_prepare_dsc() {
     for f in $BUILD_ROOT$TOPDIR/SOURCES/debian.* ; do 
        test -f $f && DEB_TRANSFORM=true
     done
+    # remove rpm macros (everything after "%")
+    # they are not evaluated by the Debian build process
+    DEB_RELEASE=`sed 's/%.*$//' <<< $RELEASE`
+    OBS_DCH_RELEASE=""
+
     if test -n "$DEB_TRANSFORM" ; then 
        CHANGELOGARGS=
        test -n "$CHANGELOG" -a -f "$BUILD_ROOT/.build-changelog" && CHANGELOGARGS="--changelog $BUILD_ROOT/.build-changelog"
-       echo "running debian transformer..."
+       echo "Found files matching debian.*, running debian transformer..."
         if [ "$RELEASE" ]; then
-          # remove rpm macros (everything after "%")
-          # they are not evaluated by the Debian build process
-          DEB_RELEASE=`sed 's/%.*$//' <<< $RELEASE`
           echo "release: ($RELEASE), release (DEB) ($DEB_RELEASE)"
                  RELEASEARGS="--release $DEB_RELEASE"
         fi
@@ -67,9 +69,25 @@ recipe_prepare_dsc() {
        DEB_DSCFILE="${DEB_DSCFILE##*/}"
     fi
     chroot $BUILD_ROOT su -c "dpkg-source -x $DEB_SOURCEDIR/$DEB_DSCFILE $TOPDIR/BUILD" - $BUILD_USER
+
+    # Alternative to debtransform: apply OBS release number if tag OBS-DCH-RELEASE is set.
+    if test -z "$DEB_TRANSFORM" && grep -Eq '^OBS-DCH-RELEASE: 1' $BUILD_ROOT$TOPDIR/SOURCES/$RECIPEFILE; then
+        OBS_DCH_RELEASE="+$DEB_RELEASE"
+        chroot $BUILD_ROOT su -c /bin/sh <<EOF
+cd $TOPDIR/BUILD
+[ ! -f debian/changelog ] && exit 0
+# avoid devscripts dependency and mimic dch
+PACKAGE=\$(dpkg-parsechangelog 2> /dev/null | grep -E '^Source:'  | awk '{ print \$NF }')
+VERSION=\$(dpkg-parsechangelog 2> /dev/null | grep -E '^Version:' | awk '{ print \$NF }')
+sed -i "s/\${PACKAGE} (\${VERSION})/\${PACKAGE} (\${VERSION}$OBS_DCH_RELEASE)/" debian/changelog
+EOF
+    fi
+
 }
 
-recipe_build_dsc() {
+dsc_build() {
+    local buildroot=$1
+
     DSC_BUILD_OPTIONS=
     if test -n "$BUILD_JOBS" ; then
        DSC_BUILD_OPTIONS="parallel=${BUILD_JOBS}"
@@ -79,23 +97,25 @@ recipe_build_dsc() {
     # and alternate build commands can be used
     DSC_BUILD_CMD="$(queryconfig --dist "$BUILD_DIST" --archpath "$BUILD_ARCH" --configdir "$CONFIG_DIR" substitute dsc:build_cmd)"
     test -z "$DSC_BUILD_CMD" && DSC_BUILD_CMD="dpkg-buildpackage -us -uc"
-    if test -e $BUILD_ROOT/$TOPDIR/SOURCES/build.script ; then
+    if test -e $buildroot/$TOPDIR/SOURCES/build.script ; then
        echo "Sourcing build.script to build - it should normally run 'dpkg-buildpackage -us -uc'"
        DSC_BUILD_CMD="source $TOPDIR/SOURCES/build.script"
-       chmod +x $BUILD_ROOT/$TOPDIR/SOURCES/build.script
+       chmod +x $buildroot/$TOPDIR/SOURCES/build.script
     fi
 
     if test -n "$RUN_SHELL"; then
-       chroot $BUILD_ROOT su -
+       chroot $buildroot su -
     else
-       chroot $BUILD_ROOT su -c "export DEB_BUILD_OPTIONS=${DSC_BUILD_OPTIONS} ; cd $TOPDIR/BUILD && $DSC_BUILD_CMD" - $BUILD_USER < /dev/null && BUILD_SUCCEEDED=true
-       if test "$BUILD_SUCCEEDED" = true -a "$DO_CHECKS" != "false"; then
-          DEB_CHANGESFILE=${RECIPEFILE%.dsc}_"$(chroot $BUILD_ROOT su -c 'dpkg-architecture -qDEB_BUILD_ARCH')".changes
-          chroot $BUILD_ROOT su -c "which lintian > /dev/null && cd $TOPDIR && echo Running lintian && (set -x && lintian -i $DEB_SOURCEDIR/$DEB_DSCFILE)" - $BUILD_USER < /dev/null
+       chroot $buildroot su -c "export DEB_BUILD_OPTIONS=${DSC_BUILD_OPTIONS} ; cd $TOPDIR/BUILD && $DSC_BUILD_CMD" - $BUILD_USER < /dev/null && BUILD_SUCCEEDED=true
+       if test "$BUILD_SUCCEEDED" = true -a "$DO_CHECKS" != "false" && ( chroot $buildroot su -c "which lintian > /dev/null" - $BUILD_USER < /dev/null ); then
+          DEB_CHANGESFILE=${DEB_DSCFILE%.dsc}$OBS_DCH_RELEASE"_"$(chroot $buildroot su -c 'dpkg-architecture -qDEB_BUILD_ARCH')".changes"
+          chroot $buildroot su -c "cd $TOPDIR && echo Running lintian && (set -x && lintian -i $TOPDIR/$DEB_CHANGESFILE)" - $BUILD_USER < /dev/null || BUILD_SUCCEEDED=false
        fi
     fi
+}
 
-    for DEB in $BUILD_ROOT/$TOPDIR/*.deb ; do
+dsc_move_build_result() {
+    for DEB in $BUILD_ROOT/$TOPDIR/*.{deb,changes} ; do
        test -e "$DEB" && mv "$DEB" "$BUILD_ROOT/$TOPDIR/DEBS"
     done
 
@@ -106,6 +126,12 @@ recipe_build_dsc() {
     done < <(sed -ne '/^Files:/,$s/^ ................................ [0-9][0-9]* //p' < $BUILD_ROOT/$DEB_SOURCEDIR/$DEB_DSCFILE)
 }
 
+
+recipe_build_dsc() {
+    dsc_build "$BUILD_ROOT"
+    dsc_move_build_result
+}
+
 recipe_resultdirs_dsc() {
     echo DEBS
 }
index 6f8e6a1..206dc94 100644 (file)
@@ -259,10 +259,16 @@ kiwi_post_unknown() {
 
 recipe_setup_kiwi() {
     TOPDIR=/usr/src/packages
+    test "$DO_INIT_TOPDIR" = false || rm -rf "$BUILD_ROOT$TOPDIR"
     mkdir -p "$BUILD_ROOT$TOPDIR"
     mkdir -p "$BUILD_ROOT$TOPDIR/OTHER"
     mkdir -p "$BUILD_ROOT$TOPDIR/SOURCES"
     mkdir -p "$BUILD_ROOT$TOPDIR/KIWI"
+    # compat, older build versions did not clean TOPDIR ...
+    mkdir -p "$BUILD_ROOT$TOPDIR/BUILD"
+    mkdir -p "$BUILD_ROOT$TOPDIR/RPMS"
+    mkdir -p "$BUILD_ROOT$TOPDIR/SRPMS"
+    
     chown -R "$ABUILD_UID:$ABUILD_GID" "$BUILD_ROOT$TOPDIR"
     if test "$MYSRCDIR" = $BUILD_ROOT/.build-srcdir ; then 
        mv "$MYSRCDIR"/* $BUILD_ROOT$TOPDIR/SOURCES/
@@ -319,10 +325,10 @@ build_kiwi_product() {
     fi
 
     # move created product to correct destination
-    for i in $BUILD_ROOT/$TOPDIR/KIWIROOT/main/* ; do
+    pushd $BUILD_ROOT/$TOPDIR/KIWIROOT/main
+    for i in * ; do
        test -e "$i" || continue
-       f=${i##*/}
-       case $f in
+       case $i in
            *.iso) if [ -x /usr/bin/sha256sum ]; then
                        /usr/bin/sha256sum "$i" > "$i.sha256"
                        mv "$i.sha256" $BUILD_ROOT/$TOPDIR/KIWI/.
@@ -335,26 +341,115 @@ build_kiwi_product() {
            *) test -d $i -a "$drop_repo" != true  && mv $i $BUILD_ROOT/$TOPDIR/KIWI/. ;;
        esac
     done
+    popd
+}
+
+perform_image_build() {
+    local imgtype=$1
+    local legacy=$2
+    local prepare_call
+    local create_call
+    # When people test mixed build with legacy and new kiwi version
+    # The zypper cache was used in different ways. Therefore this
+    # needs a cleanup before the build starts
+    echo "Cleanup zypper image build cache"
+    if [ -d "$BUILD_ROOT/var/cache/kiwi/zypper" ];then
+        rm -rf $BUILD_ROOT/var/cache/kiwi/zypper
+    fi
+    echo "running kiwi --prepare for $imgtype..."
+    # Do not use $BUILD_USER here, since we always need root permissions
+    prepare_call="cd $TOPDIR/SOURCES && rm -rf $TOPDIR/KIWIROOT-$imgtype"
+    if [ "$legacy" = "true" ]; then
+        prepare_call="$prepare_call && /usr/sbin/kiwi --logfile terminal"
+    else
+        prepare_call="$prepare_call && LANG=en_US.UTF-8 /usr/bin/kiwi"
+        prepare_call="$prepare_call --compat -- --debug"
+    fi
+    prepare_call="$prepare_call --prepare $TOPDIR/SOURCES"
+    prepare_call="$prepare_call --root $TOPDIR/KIWIROOT-$imgtype"
+    prepare_call="$prepare_call $KIWI_PARAMETERS"
+    chroot $BUILD_ROOT \
+        su -c "$prepare_call" - root < /dev/null || cleanup_and_exit 1
+
+    echo "running kiwi --create for $imgtype..."
+    mkdir -p $BUILD_ROOT/$TOPDIR/KIWI-$imgtype
+    create_call="cd $TOPDIR/SOURCES"
+    if [ "$legacy" = "true" ]; then
+        create_call="$create_call && LANG=en_US.UTF-8 /usr/sbin/kiwi"
+        create_call="$create_call --logfile terminal"
+    else
+        create_call="$create_call && /usr/bin/kiwi --compat -- --debug"
+    fi
+    create_call="$create_call --create $TOPDIR/KIWIROOT-$imgtype"
+    create_call="$create_call --type $imgtype"
+    create_call="$create_call -d $TOPDIR/KIWI-$imgtype"
+    create_call="$create_call $KIWI_PARAMETERS"
+    chroot $BUILD_ROOT \
+        su -c "$create_call" - root < /dev/null || cleanup_and_exit 1
+
+    rm -rf "/$TOPDIR/KIWI.bundle"
+}
+
+perform_image_bundle() {
+    local imgtype=$1
+    local legacy=$2
+    local bundle_call
+    if [ "$legacy" = "true" ]; then
+        bundle_call="/usr/sbin/kiwi --bundle-build $TOPDIR/KIWI-$imgtype"
+        bundle_call="$bundle_call -d /$TOPDIR/KIWI.bundle/"
+        bundle_call="$bundle_call --bundle-id Build$RELEASE"
+    else
+        bundle_call="LANG=en_US.UTF-8 /usr/bin/kiwi result bundle"
+        bundle_call="$bundle_call --target-dir $TOPDIR/KIWI-$imgtype"
+        bundle_call="$bundle_call --id Build$RELEASE"
+        bundle_call="$bundle_call --bundle-dir /$TOPDIR/KIWI.bundle/"
+    fi
+    if chroot $BUILD_ROOT su -c "$bundle_call" - root < /dev/null; then
+        mv "$BUILD_ROOT/$TOPDIR/KIWI.bundle/"* \
+            "$BUILD_ROOT/$TOPDIR/KIWI/" || cleanup_and_exit 1
+        rmdir "$BUILD_ROOT/$TOPDIR/KIWI.bundle"
+        # success
+        return 0
+    fi
+    # need another way to bundle
+    return 1
+}
+
+is_legacy_kiwi() {
+    if [ -L "$BUILD_ROOT/usr/bin/kiwi" ];then
+        # The next generation of kiwi is installed to /usr/bin
+        # If this file is found we expect the new kiwi to be
+        # installed
+        return 1
+    fi
+    # in any other case stick to the legacy kiwi
+    return 0
 }
 
 build_kiwi_appliance() {
     if test -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..."
-       test -x /etc/init.d/boot.device-mapper && /etc/init.d/boot.device-mapper start
+        # 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..."
+        test -x /etc/init.d/boot.device-mapper && \
+            /etc/init.d/boot.device-mapper start
+    fi
+    KIWI_PROFILE=$(queryconfig \
+        --dist "$BUILD_DIST" --configdir "$CONFIG_DIR" \
+        --archpath "$BUILD_ARCH" buildflags kiwiprofile
+    )
+    if test -n "$KIWI_PROFILE"; then
+        KIWI_PARAMETERS="$KIWI_PARAMETERS --add-profile $KIWI_PROFILE"
+    fi
+    local legacy=false
+    if is_legacy_kiwi; then
+        legacy=true
     fi
     RUN_BUNDLE="true"
     for imgtype in $imagetype ; do
-       echo "running kiwi --prepare for $imgtype..."
-       # Do not use $BUILD_USER here, since we always need root permissions
-       chroot $BUILD_ROOT su -c "cd $TOPDIR/SOURCES && rm -rf $TOPDIR/KIWIROOT-$imgtype && kiwi --prepare $TOPDIR/SOURCES --logfile terminal --root $TOPDIR/KIWIROOT-$imgtype $KIWI_PARAMETERS" - root < /dev/null || cleanup_and_exit 1
-       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 $KIWI_PARAMETERS" - root < /dev/null || cleanup_and_exit 1
-        rm -rf "/$TOPDIR/KIWI.bundle"
-        if chroot $BUILD_ROOT su -c "kiwi --bundle-build $TOPDIR/KIWI-$imgtype -d /$TOPDIR/KIWI.bundle/ --bundle-id Build$RELEASE" - root < /dev/null; then
-            mv "$BUILD_ROOT/$TOPDIR/KIWI.bundle/"* "$BUILD_ROOT/$TOPDIR/KIWI/" || cleanup_and_exit 1
-            rmdir "$BUILD_ROOT/$TOPDIR/KIWI.bundle"
+        perform_image_build $imagetype $legacy
+        if perform_image_bundle $imagetype $legacy; then
+            # bundling successful, skip alternative bundlers
             unset RUN_BUNDLE
         fi
     done
@@ -415,18 +510,18 @@ recipe_build_kiwi() {
     # prepare rpms as source and createrepo on the repositories
     ln -sf $TOPDIR/SOURCES/repos $BUILD_ROOT/repos
     cd $BUILD_ROOT/$TOPDIR/SOURCES/repos
-    for r in */* ; do
+    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##*/}/"
+           rl="${rc//[^\/]}"
+           rl="${rl//?/../}"
+           mkdir -p "${rc%/*}"
+           ln -s $rl$r "${rc%/*}/${rc##*/}"
+           repo="$TOPDIR/SOURCES/repos/${rc%/*}/${rc##*/}/"
         fi
         if test "$imagetype" != product -a "$DO_INIT" != "false" ; then
            echo "creating repodata for $repo"
index c9d3566..c22bee5 100644 (file)
@@ -23,9 +23,8 @@
 #################################################################
 
 recipe_setup_livebuild() {
-
     TOPDIR=/usr/src/packages
-    rm -rf "$BUILD_ROOT$TOPDIR"
+    test "$DO_INIT_TOPDIR" = false || rm -rf "$BUILD_ROOT$TOPDIR"
     for i in OTHER SOURCES LIVEBUILD_ROOT ; do
        mkdir -p "$BUILD_ROOT$TOPDIR/$i"
     done
@@ -149,6 +148,7 @@ recipe_build_livebuild() {
        LB_MIRROR_BINARY_SECURITY="file:/.build.binaries/"
        LB_MIRROR_DEBIAN_INSTALLER="file:/.build.binaries/"
        LB_APT_SECURE="false"
+       LIVE_IMAGE_NAME="${RECIPEFILE%.livebuild}"
        EOF
 
     # Expand live-build configuration to $TOPDIR/$LIVEBUILD_ROOT
@@ -170,15 +170,19 @@ recipe_build_livebuild() {
 
     # Sanity check to not configure archives inside configuration
     files=($BUILD_ROOT/$TOPDIR/$LIVEBUILD_ROOT/config/archives/*)
-    [ ${#files[@]} -gt 0 ] && cleanup_and_exit 1
+    if [ ${#files[@]} -gt 0 ]; then
+        echo "E: No configuration in config/archives/* allowed"
+        cleanup_and_exit 1
+    fi
 
     # TODO: Add the repository public key
     # cp ... $BUILD_ROOT/$TOPDIR/$LIVEBUILD_ROOT/config/archives/debian.key
 
     if [ -x $BUILD_ROOT/usr/lib/build/livebuild_pre_run ] ; then
        echo "Running OBS build livebuild_pre_run hook"
-       chroot $BUILD_ROOT su -c "/usr/lib/build/livebuild_pre_run" - root \
-           < /dev/null || cleanup_and_exit 1
+       chroot $BUILD_ROOT su -c \
+        "export RECIPEFILE=${RECIPEFILE}; /usr/lib/build/livebuild_pre_run" \
+        - root < /dev/null || cleanup_and_exit 1
     fi
 
     # TODO: this might move to lb auto/config file
@@ -187,32 +191,54 @@ recipe_build_livebuild() {
            $BUILD_ROOT/.build.livebuild_pre_run
        chmod +x $BUILD_ROOT/.build.livebuild_pre_run
        echo "Running package livebuild_pre_run hook"
-       chroot $BUILD_ROOT su -c "/.build.livebuild_pre_run" - root \
-           < /dev/null || cleanup_and_exit 1
+       chroot $BUILD_ROOT su -c \
+        "export RECIPEFILE=${RECIPEFILE}; /.build.livebuild_pre_run" \
+        - root < /dev/null || cleanup_and_exit 1
     fi
 
     chroot $BUILD_ROOT su -c "cd $TOPDIR/$LIVEBUILD_ROOT && lb build" - root \
        < /dev/null || cleanup_and_exit 1
 
-    # Move created product to destination
+    # extract build result basenames
+    local build_results=""
     for i in $BUILD_ROOT/$TOPDIR/$LIVEBUILD_ROOT/* ; do
        test -f "$i" || continue
        case "${i##*/}" in
+           *.hybrid.iso)
+               build_results="${build_results}\n${i%%.hybrid.iso}"
+               ;;
            *.iso)
-               # all created files share the same name without suffix
-               mv ${i%%.iso}.* $BUILD_ROOT/$TOPDIR/OTHER/.
-               BUILD_SUCCEEDED=true
+               build_results="${build_results}\n${i%%.iso}"
+               ;;
+           *.img)
+               build_results="${build_results}\n${i%%.img}"
+               ;;
+           *.netboot.tar*)
+               build_results="${build_results}\n${i%%.netboot.tar*}"
+               ;;
+           *.tar*)
+               build_results="${build_results}\n${i%%.tar*}"
                ;;
            *)
                ;;
        esac
     done
 
-    # Fail the build if no ISO was created
-    if [ -z "$(ls $BUILD_ROOT/$TOPDIR/OTHER/*.iso)" ] ; then
-       echo "No ISO image found"
+    # Fail the build if no build results are found
+    if [ -z "${build_results}" ] ; then
+       echo "No live-build result found"
        cleanup_and_exit 1
     fi
+
+    # move created products (and their metadata files) to destination
+    local buildnum="${RELEASE:+-Build${RELEASE}}"
+    for prefix in $(echo -e ${build_results} | sort | uniq) ; do
+       for f in ${prefix}.* ; do
+           mv ${f} \
+               $BUILD_ROOT/$TOPDIR/OTHER/${prefix##*/}${buildnum}${f#${prefix}}
+           BUILD_SUCCEEDED=true
+       done
+    done
 }
 
 recipe_resultdirs_livebuild() {
diff --git a/build-recipe-simpleimage b/build-recipe-simpleimage
new file mode 100644 (file)
index 0000000..fea6fdb
--- /dev/null
@@ -0,0 +1,88 @@
+recipe_setup_simpleimage() {
+    TOPDIR=/usr/src/packages
+    rm -rf "$BUILD_ROOT$TOPDIR"
+    for i in OTHER SOURCES LIVEBUILD_ROOT ; do
+        mkdir -p "$BUILD_ROOT$TOPDIR/$i"
+    done
+    chown -R "$ABUILD_UID:$ABUILD_GID" "$BUILD_ROOT$TOPDIR"
+    if test "$MYSRCDIR" = $BUILD_ROOT/.build-srcdir ; then
+        mv "$MYSRCDIR"/* $BUILD_ROOT$TOPDIR/SOURCES/
+    else
+        cp -p "$MYSRCDIR"/* $BUILD_ROOT$TOPDIR/SOURCES/
+    fi
+}
+
+recipe_prepare_simpleimage() {
+    BUILD_USER="root"
+}
+
+recipe_build_simpleimage() {
+    TOPDIR=/usr/src/packages
+
+    echo "creating simple image..."
+    cd $BUILD_ROOT || cleanup_and_exit 1
+    export SRCDIR="$TOPDIR/SOURCES"
+
+    NAME="`sed -n 's|Name:[[:blank:]]*||p' $BUILD_ROOT$TOPDIR/SOURCES/simpleimage`"
+    [ -n "$NAME" ] || NAME="simpleimage"
+    VERSION="`sed -n 's|Version:[[:blank:]]*||p' $BUILD_ROOT$TOPDIR/SOURCES/simpleimage`"
+    [ -n "$VERSION" ] || VERSION="`date -u +%y.%m.%d-%H.%M.%S`"
+
+    SHELL="/bin/sh"
+    [ -x $BUILD_ROOT/bin/bash ] && SHELL="/bin/bash"
+    if [ "`grep '^%build$' $BUILD_ROOT$TOPDIR/SOURCES/simpleimage`" ]; then
+      echo "Running integration script..."
+      sed -n '/%build/,$ p' $BUILD_ROOT$TOPDIR/SOURCES/simpleimage | tail -n +2 | chroot $BUILD_ROOT $SHELL -x || cleanup_and_exit 1
+      echo "Integration script finished."
+    fi
+
+    echo "Compresing the final image, this can take a while..."
+    echo
+    TAR="tar"
+    if test -x /usr/bin/bsdtar; then
+       TAR="/usr/bin/bsdtar --format gnutar --chroot"
+    fi
+    TOPDIRS=
+    for DIR  in .* * ; do
+      case "$DIR" in
+       .|..) continue ;;
+       .build*) continue ;;
+       .simpleimage*) continue ;;
+       .srcfiles*) continue ;;
+       .pkgs) continue ;;
+       .rpm-cache) continue ;;
+       .tmp) continue ;;
+       installed-pkg) continue ;;
+       proc|sys) continue ;;
+      esac
+      TOPDIRS="$TOPDIRS $DIR"
+    done
+       rm -rf "$BUILD_ROOT$TOPDIR"
+    mkdir -p .tmp/{proc,sys}
+    if ! $TAR -cvzf .simpleimage.tar.gz --one-file-system $TOPDIRS -C .tmp proc sys; then
+      cleanup_and_exit 1
+    fi
+    if [ -x "`which mksquashfs 2> /dev/null`" ]; then
+      echo
+      echo "Tarball done, creating squashfs image as well"
+      echo
+      mksquashfs $TOPDIRS .tmp/proc .tmp/sys .simpleimage.squashfs -info -keep-as-directory -no-progress || cleanup_and_exit 1
+    fi
+    echo "simple image created."
+
+    DEST="$BUILD_ROOT$TOPDIR/OTHER"
+    mkdir -p "$DEST"
+    mv $BUILD_ROOT/.simpleimage.tar.gz $DEST/$NAME-${VERSION}_${BUILD_ARCH%%:*}.tar.gz
+    if [ -r .simpleimage.squashfs ]; then
+      mv $BUILD_ROOT/.simpleimage.squashfs $DEST/$NAME-${VERSION}_${BUILD_ARCH%%:*}.squashfs
+    fi
+    rm -f $BUILD_ROOT/.build.packages
+    ln -s ${TOPDIR#/} $BUILD_ROOT/.build.packages
+    test -d "$SRCDIR" && cd "$SRCDIR"
+    cleanup_and_exit 0
+}
+
+recipe_resultdirs_simpleimage() {
+    :
+}
+
diff --git a/build-recipe-snapcraft b/build-recipe-snapcraft
new file mode 100644 (file)
index 0000000..ae27c12
--- /dev/null
@@ -0,0 +1,173 @@
+#################################################################
+#
+# Debian live-build specific functions.
+#
+# Author: Adrian Schroeter <adrian@suse.de>
+#
+# This file is part of build.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 or 3 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program (see the file COPYING); if not, write to the
+# Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+#
+#################################################################
+
+recipe_setup_snapcraft() {
+    TOPDIR=/usr/src/packages
+    test "$DO_INIT_TOPDIR" = false || rm -rf "$BUILD_ROOT$TOPDIR"
+    for i in OTHER SOURCES SNAPCRAFT_ROOT ; do
+       mkdir -p "$BUILD_ROOT$TOPDIR/$i"
+    done
+    chown -R "$ABUILD_UID:$ABUILD_GID" "$BUILD_ROOT$TOPDIR"
+    if test "$MYSRCDIR" = $BUILD_ROOT/.build-srcdir ; then
+       mv "$MYSRCDIR"/* $BUILD_ROOT$TOPDIR/SOURCES/
+    else
+       cp -p "$MYSRCDIR"/* $BUILD_ROOT$TOPDIR/SOURCES/
+    fi
+}
+
+recipe_prepare_snapcraft() {
+    :
+}
+
+createrepo_debian() {
+    local DIR=${1}
+    local ARCH=${2}
+    local DIST=${3}
+
+    if [ -z "${DIR}" -o ! -d ${DIR} -o ${DIR} = ${DIR##${BUILD_ROOT}} ] ; then
+        return
+    fi
+
+    pushd ${DIR} >/dev/null
+
+    # cleanup existing repository files
+    rm -f Packages Packages.gz Release
+    rm -fr dists
+
+    mkdir -p dists/${DIST}
+    # Suite is symlinked to Codename
+    ln -s ${DIST} dists/stable
+
+    # create Packages and Sources files
+    mkdir -p dists/${DIST}/main/binary-${ARCH}
+    mkdir -p dists/${DIST}/main/source
+    cat > ${BUILD_ROOT}/.createrepo_debian.tmp.sh <<-EOF
+       cd /.build.binaries || exit 1
+       dpkg-scanpackages -m . > dists/${DIST}/main/binary-${ARCH}/Packages
+       gzip -c9 < dists/${DIST}/main/binary-${ARCH}/Packages \
+           > dists/${DIST}/main/binary-${ARCH}/Packages.gz
+       dpkg-scansources . > dists/${DIST}/main/source/Sources
+       gzip -c9 dists/${DIST}/main/source/Sources \
+           > dists/${DIST}/main/source/Sources.gz
+       EOF
+    chroot $BUILD_ROOT su -c "sh /.createrepo_debian.tmp.sh" - root
+    local RESULT=$?
+    rm -f $BUILD_ROOT/.createrepo_debian.tmp.sh
+    [ "${RESULT}" != 0 ] && return
+
+    # create Release file
+    pushd dists/${DIST} >/dev/null
+    cat > Release <<-EOF
+       Origin: Debian
+       Label: Debian
+       Suite: stable
+       Version: 7.1
+       Codename: ${DIST}
+       Date: Sat, 15 Jun 2013 10:55:26 UTC
+       Description: Debian repository created by build-recipe-livebuild
+       Components: main
+       EOF
+    echo "SHA256:" >> Release
+    for file in main/binary-${ARCH}/Packages* ; do
+        local SUM=( $(sha256sum ${file}) )
+        local SIZE=$(stat -c '%s' ${file})
+        echo " ${SUM} ${SIZE} ${file}" >> Release
+    done
+    for file in main/source/Sources* ; do
+        local SUM=( $(sha256sum ${file}) )
+        local SIZE=$(stat -c '%s' ${file})
+        echo " ${SUM} ${SIZE} ${file}" >> Release
+    done
+    popd >/dev/null
+
+    # TODO: this is missing the signature with the private key
+
+    popd >/dev/null
+}
+
+# This script expects that the $BUILD_ROOT is a Debian installation with
+# snapcraft already installed!
+#
+# Variables:
+# $BUILD_ROOT the Debian chroot
+# $TOPDIR/SOURCES includes the snapcraft sources
+# $TOPDIR/$SNAPCRAFT_ROOT where snapcraft will be called
+# $RECIPEFILE the name of the snapcraft.yaml config file
+
+recipe_build_snapcraft() {
+    local ARCH=$(chroot $BUILD_ROOT su -c "dpkg-architecture -qDEB_BUILD_ARCH")
+#    local DIST=$(chroot $BUILD_ROOT su -c "lsb_release --codename" | awk '{ print $2 }')
+    local SNAPCRAFT_ROOT="SNAPCRAFT_ROOT"
+
+#    [ -z "${ARCH}" -o -z "${DIST}" ] && cleanup_and_exit 1
+
+    test -d $BUILD_ROOT/.build.binaries || cleanup_and_exit 1
+    if test "$DO_INIT" = true -o ! -d "$BUILD_ROOT/.build.binaries/dists" ; then
+       echo "creating repository metadata..."
+        createrepo_debian $BUILD_ROOT/.build.binaries ${ARCH} ${DIST}
+    fi
+
+    chroot $BUILD_ROOT su -c "cd $TOPDIR/SOURCES && snapcraft build" - root \
+       || cleanup_and_exit 1
+    chroot $BUILD_ROOT su -c "cd $TOPDIR/SOURCES && snapcraft snap" - root \
+       || cleanup_and_exit 1
+
+    # extract build result basenames
+    local build_results=""
+    for i in $BUILD_ROOT/$TOPDIR/SOURCES/* ; do
+       test -f "$i" || continue
+       case "${i##*/}" in
+           *.snap)
+               build_results="${build_results}\n${i%%.snap}"
+               ;;
+           *)
+               ;;
+       esac
+    done
+
+    # Fail the build if no build results are found
+    if [ -z "${build_results}" ] ; then
+       echo "No live-build result found"
+       cleanup_and_exit 1
+    fi
+
+    # move created products (and their metadata files) to destination
+    local buildnum="${RELEASE:+-Build${RELEASE}}"
+    for prefix in $(echo -e ${build_results} | sort | uniq) ; do
+       for f in ${prefix}.* ; do
+           mv ${f} \
+               $BUILD_ROOT/$TOPDIR/OTHER/${prefix##*/}${buildnum}${f#${prefix}}
+           BUILD_SUCCEEDED=true
+       done
+    done
+}
+
+recipe_resultdirs_snapcraft() {
+    # our results are already in OTHER
+    :
+}
+
+# Local Variables:
+# mode: Shell-script
+# End:
index c9a948c..c42c71a 100644 (file)
@@ -27,13 +27,10 @@ recipe_setup_spec() {
        echo "Error: TOPDIR empty"
        cleanup_and_exit 1
     fi
-    if [ "$NO_TOPDIR_CLEANUP" = false ]; then
-        rm -rf "$BUILD_ROOT$TOPDIR"
-        for i in BUILD RPMS/`uname -m` RPMS/i386 RPMS/noarch SOURCES SPECS SRPMS BUILDROOT OTHER ; do
-            mkdir -p $BUILD_ROOT$TOPDIR/$i
-        done
-    fi
-
+    test "$DO_INIT_TOPDIR" = false || rm -rf "$BUILD_ROOT$TOPDIR"
+    for i in BUILD RPMS/`uname -m` RPMS/i386 RPMS/noarch SOURCES SPECS SRPMS BUILDROOT OTHER ; do
+       mkdir -p $BUILD_ROOT$TOPDIR/$i
+    done
     chown -R "$ABUILD_UID:$ABUILD_GID" "$BUILD_ROOT$TOPDIR"
     mkdir -p $BUILD_ROOT$TOPDIR/SOURCES
     cp -p "$MYSRCDIR"/* $BUILD_ROOT$TOPDIR/SOURCES/
@@ -45,6 +42,9 @@ recipe_prepare_spec() {
        args=(--release "$RELEASE")
     fi
 
+    rawcfgmacros=.rpmmacros
+    test "$BUILDTYPE" = debbuild && rawcfgmacros=.debmacros
+
     # fixup specfile
     CHANGELOGARGS=
     test -n "$CHANGELOG" -a -f "$BUILD_ROOT/.build-changelog" && CHANGELOGARGS="--changelog $BUILD_ROOT/.build-changelog"
@@ -56,13 +56,10 @@ recipe_prepare_spec() {
        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
-    if test "$DO_BUILD" = false ; then
-        cleanup_and_exit 0
-    fi
 
     # extract macros from configuration
-    queryconfig rawmacros --dist "$BUILD_DIST" --archpath "$BUILD_ARCH" --configdir "$CONFIG_DIR" > $BUILD_ROOT/root/.rpmmacros
-    if test -n "$BUILD_DEBUG" ; then
+    queryconfig rawmacros --dist "$BUILD_DIST" --archpath "$BUILD_ARCH" --configdir "$CONFIG_DIR" > $BUILD_ROOT/root/$rawcfgmacros
+    if test -n "$BUILD_DEBUG" && test "$BUILDTYPE" != debbuild ; then
        echo '
 %prep %{?!__debug_package:%{?_build_create_debug:%?_build_insert_debug_package}}%%prep
 %package %{?!__debug_package:%{?_build_create_debug:%?_build_insert_debug_package}}%%package
@@ -71,16 +68,16 @@ recipe_prepare_spec() {
 %undefine _enable_debug_packages \
 %debug_package
 
-' >> $BUILD_ROOT/root/.rpmmacros
+' >> $BUILD_ROOT/root/$rawcfgmacros
     fi
 
     if test -n "$BUILD_JOBS" ; then
-       cat >> $BUILD_ROOT/root/.rpmmacros <<-EOF
+       cat >> $BUILD_ROOT/root/$rawcfgmacros <<-EOF
                %jobs $BUILD_JOBS
                %_smp_mflags -j$BUILD_JOBS
                EOF
     fi
-    test $BUILD_USER = abuild && cp -p $BUILD_ROOT/root/.rpmmacros $BUILD_ROOT/home/abuild/.rpmmacros
+    test $BUILD_USER = abuild && cp -p $BUILD_ROOT/root/$rawcfgmacros $BUILD_ROOT/home/abuild/$rawcfgmacros
 
     # extract optflags from configuration
     queryconfig --dist "$BUILD_DIST" --configdir "$CONFIG_DIR" --archpath "$BUILD_ARCH" optflags ${BUILD_DEBUG:+debug} > $BUILD_ROOT/root/.rpmrc
@@ -112,11 +109,16 @@ recipe_build_spec() {
 
     rpmbuild=rpmbuild
     test -x $BUILD_ROOT/usr/bin/rpmbuild || rpmbuild=rpm
+    test "$BUILDTYPE" = debbuild && rpmbuild=debbuild
 
     # XXX: move _srcdefattr to macro file?
-    rpmbopts=("--define" "_srcdefattr (-,root,root)")
+    rpmbopts=("$BUILD_RPM_BUILD_STAGE" "--define" "_srcdefattr (-,root,root)")
     if test "$DO_CHECKS" != true ; then
-       rpmbopts[${#rpmbopts[@]}]="--nocheck"
+       if chroot "$BUILD_ROOT" "$rpmbuild" --nocheck --help >/dev/null 2>&1; then
+           rpmbopts[${#rpmbopts[@]}]="--nocheck"
+       else
+           echo "warning: --nocheck is not supported by this $rpmbuild version"
+       fi
     fi
     if test "$rpmbuild" == "rpmbuild" ; then
            # use only --nosignature for rpm v4
@@ -140,31 +142,11 @@ recipe_build_spec() {
 
     # su involves a shell which would require even more
     # complicated quoting to bypass than this
-    if test "$SHORT_CIRCUIT" = false ; then
-        rpmbopts[${#rpmbopts[@]}]="$BUILD_RPM_BUILD_STAGE"
-        toshellscript $rpmbuild \
-                "${definesnstuff[@]}" \
-                "${rpmbopts[@]}" \
-                "$TOPDIR/SOURCES/$RECIPEFILE" \
-                > $BUILD_ROOT/.build.command
-    else
-        rpmbopts[${#rpmbopts[@]}]='--short-circuit'
-        buildopts="-bc -bi -bb -bs"
-        cmds=""
-        echo "#!/bin/sh -x" >$BUILD_ROOT/.build.command
-        echo "set -e" >>$BUILD_ROOT/.build.command
-        for opt in $buildopts
-        do
-            shellquote $rpmbuild  \
-                    "${definesnstuff[@]}" \
-                    "${rpmbopts[@]}" $opt \
-                    "$TOPDIR/SOURCES/$RECIPEFILE" \
-                    >> $BUILD_ROOT/.build.command
-            echo >>$BUILD_ROOT/.build.command
-            [ "$opt" == "$BUILD_RPM_BUILD_STAGE" ] && break
-        done
-    fi
-
+    toshellscript $rpmbuild \
+           "${definesnstuff[@]}" \
+           "${rpmbopts[@]}" \
+           "$TOPDIR/SOURCES/$RECIPEFILE" \
+           > $BUILD_ROOT/.build.command
     chmod 755 $BUILD_ROOT/.build.command
     check_exit
     if test -n "$RUN_SHELL"; then
@@ -227,8 +209,7 @@ recipe_run_rpmlint() {
     mount -n -tproc none $BUILD_ROOT/proc 2> /dev/null
     chroot $BUILD_ROOT su -s /opt/testing/bin/rpmlint "$BUILD_USER" -- \
            --info ${LINT_RPM_FILE_LIST[*]#$BUILD_ROOT} \
-           ${SRPM_FILE_LIST[*]#$BUILD_ROOT} > "$BUILD_ROOT$rpmlint_logfile" || ret=1
-    cat "$BUILD_ROOT$rpmlint_logfile"
+           ${SRPM_FILE_LIST[*]#$BUILD_ROOT} > >(tee "$BUILD_ROOT$rpmlint_logfile") 2>&1 || ret=1
     echo
     umount -n $BUILD_ROOT/proc 2>/dev/null || true 
     if test "$ret" = 1 ; then 
index e88721c..543f69f 100644 (file)
--- a/build-vm
+++ b/build-vm
@@ -45,6 +45,11 @@ VM_INITRD=
 VM_WORKER=
 VM_SERVER=
 VM_MEMSIZE=
+VM_NETOPT=()
+VM_NETDEVOPT=()
+VM_DEVICEOPT=()
+VM_TELNET=
+VM_CONSOLE_INPUT=
 VMDISK_ROOTSIZE=4096
 VMDISK_SWAPSIZE=1024
 VMDISK_FILESYSTEM=
@@ -60,7 +65,7 @@ HUGETLBFSPATH=
 # emulator specific?
 EMULATOR_SCRIPT=
 
-for i in ec2 emulator kvm lxc openstack qemu uml xen zvm ; do
+for i in ec2 emulator kvm lxc openstack qemu uml xen zvm docker pvm; do
     . "$BUILD_DIR/build-vm-$i"
 done
 
@@ -132,8 +137,8 @@ vm_parse_options() {
        needarg
        VM_TYPE="$ARG"
        case "$VM_TYPE" in
-           lxc) ;;
-           ec2|xen|kvm|uml|qemu|emulator|openstack|zvm)
+           lxc|docker) ;;
+           ec2|xen|kvm|uml|qemu|emulator|openstack|zvm|pvm)
                test -z "$VM_IMAGE" && VM_IMAGE=1
            ;;
            none|chroot) VM_TYPE= ;;
@@ -227,6 +232,34 @@ vm_parse_options() {
       -vm-watchdog)
        VM_WATCHDOG=true
       ;;
+      -vm-user)
+        needarg
+        VM_USER="$ARG"
+        shift
+      ;;
+      -vm-enable-console)
+        VM_CONSOLE_INPUT=true
+      ;;
+      -vm-telnet)
+        needarg
+        VM_TELNET="$ARG"
+        shift
+      ;;
+      -vm-net)
+        needarg
+        VM_NETOPT=("${VM_NETOPT[@]}" "$ARG")
+        shift
+      ;;
+      -vm-netdev)
+        needarg
+        VM_NETDEVOPT=("${VM_NETDEVOPT[@]}" "$ARG")
+        shift
+      ;;
+      -vm-device)
+        needarg
+        VM_DEVICEOPT=("${VM_DEVICEOPT[@]}" "$ARG")
+        shift
+      ;;
       -*)
        return 1
       ;;
@@ -249,7 +282,7 @@ vm_shutdown() {
     fi
     exec >&0 2>&0      # so that the logging tee finishes
     sleep 1            # wait till tee terminates
-    test "$VM_TYPE" = lxc && exit $1
+    test "$VM_TYPE" = lxc -o "$VM_TYPE" = docker && exit $1
     kill -9 -1        # goodbye cruel world
     if ! test -x /sbin/halt ; then
        test -e /proc/sysrq-trigger || mount -n -tproc none /proc
@@ -273,18 +306,31 @@ vm_img_create() {
     local img="$1"
     local size="$2"
 
-    echo "Creating $img (${size}M)"
-    mkdir -p "${img%/*}" || cleanup_and_exit 3
+    if test -e "${img}" ; then
+       local origsize=$(cat "${img}.size" 2> /dev/null)
+       if test -z "$origsize" -o "$origsize" != "$size" ; then
+           echo "Resizing $img (${size}M)"
+       fi
+    else
+       echo "Creating $img (${size}M)"
+       rm -f "${img}.size"
+    fi
 
-    # prefer fallocate, which avoids fragmentation
-    r=1
+    mkdir -p "${img%/*}" || cleanup_and_exit 3
+    # truncate file to the desired size
+    dd if=/dev/zero of="$img" bs=1M count=0 seek="$size" || cleanup_and_exit 3
+    echo "$size" > "${img}.size"
+    # allocate blocks
     if type -p fallocate > /dev/null ; then
-        fallocate -l "${size}M" "$img"
-        r=$?
-    fi
-    # fall back to dd method if fallocate is not supported
-    if test "$r" -gt 0 ; then
-        dd if=/dev/zero of="$img" bs=1M count=0 seek="$size" || cleanup_and_exit 3
+        fallocate -p -l "${size}M" "$img" 2> /dev/null
+        errout=$( fallocate -l "${size}M" "$img" 2>&1 )
+        if test $? != 0; then
+            echo $errout
+            if test "${errout/Operation not supported/}" = "$errout"; then
+                # Do not fail on not support file systems, eg ext2 or ext3
+                cleanup_and_exit 3
+            fi
+        fi
     fi
 }
 
@@ -432,14 +478,17 @@ vm_detect_2nd_stage() {
     fi
     RUNNING_IN_VM=true
     test -e /proc/version || mount -orw -n -tproc none /proc
-    if test "$VM_TYPE" != lxc ; then
+    if test "$VM_TYPE" != lxc -a "$VM_TYPE" != docker ; then
        mount -n ${VMDISK_MOUNT_OPTIONS},remount,rw /
     fi
     umount /run >/dev/null 2>&1
     # mount /sys
     if ! test -e /sys/block; then
-       mkdir -p /sys
-       mount -orw -n -tsysfs sysfs /sys
+       mkdir -p /sys
+       mount -orw -n -tsysfs sysfs /sys
+        # Docker already has sysfs mounted ro elsewhere,
+        # need to remount rw explicitly.
+        mount -o remount,rw sysfs /sys
     fi
 # qemu inside of xen does not work, check again with kvm later before enabling this
 #    if test -e /dev/kqemu ; then
@@ -469,6 +518,10 @@ vm_detect_2nd_stage() {
     fi
     HOST="$MYHOSTNAME"
 
+    # repair dracut damage, see bsc#922676
+    test -L /var/run -a ! -e /var/run && rm -f /var/run
+    test -L /var/lock -a ! -e /var/lock && rm -f /var/lock
+
     # fork a process monitoring max filesystem usage during build
     if test "$DO_STATISTICS" = 1 ; then
        rm -f /.build/_statistics.exit
@@ -546,13 +599,11 @@ vm_setup() {
            rm -rf "$VM_SWAP"
        fi
     fi
-    if test ! -e "$VM_IMAGE" ; then
-       vm_img_create "$VM_IMAGE" "$VMDISK_ROOTSIZE"
-       if test -z "$CLEAN_BUILD" ; then
-           vm_img_mkfs "$VMDISK_FILESYSTEM" "$VM_IMAGE"
-       fi
+    test -b "$VM_IMAGE" || vm_img_create "$VM_IMAGE" "$VMDISK_ROOTSIZE"
+    if test -z "$CLEAN_BUILD" ; then
+        vm_img_mkfs "$VMDISK_FILESYSTEM" "$VM_IMAGE"
     fi
-    if test -n "$VM_SWAP" -a ! -e "$VM_SWAP" -a ! -b "$VM_SWAP" ; then
+    if test -n "$VM_SWAP" -a ! -b "$VM_SWAP" ; then
        vm_img_create "$VM_SWAP" "$VMDISK_SWAPSIZE"
     fi
     if test ! -e "$VM_IMAGE" ; then
@@ -587,6 +638,32 @@ vm_setup() {
     fi
 }
 
+vm_update_hostarch() {
+    local kernel="$vm_kernel"
+    local hostarchfile
+    local newhostarch
+    if test -z "$VM_KERNEL" -a -e "$BUILD_ROOT/.build.kernel.$VM_TYPE" ; then
+       kernel="$BUILD_ROOT/.build.kernel.$VM_TYPE"
+       hostarchfile="$BUILD_ROOT/.build.hostarch.$VM_TYPE"
+    elif test -n "$kernel" -a -e "$kernel" -a -e "$kernel.hostarch" ; then
+       hostarchfile="$kernel.hostarch"
+    fi
+    if test -n "$hostarchfile" -a -e "$hostarchfile"; then
+       newhostarch=`cat "$hostarchfile"`
+    elif test -n "$kernel" -a -e "$kernel" ; then
+       case `objdump -f "$kernel" | sed -ne 's/.*file format //p'` in
+           elf64-powerpcle) newhostarch=ppc64le ;;
+           elf64-powerpc) newhostarch=ppc64 ;;
+       esac
+    fi
+    if test -n "$newhostarch" -a "$newhostarch" != "$BUILD_HOST_ARCH" ; then
+       echo "setting hostarch to $newhostarch"
+       BUILD_HOST_ARCH="$newhostarch"
+       # update BUILD_INITVM_ARCH
+       build_host_arch
+    fi
+}
+
 #
 # prepare for vm startup
 #
@@ -632,6 +709,11 @@ vm_first_stage() {
     # do vm specific fixups
     vm_fixup
 
+    # update the hostarch
+    if test -n "$VM_IMAGE" ; then
+       vm_update_hostarch
+    fi
+
     # the watchdog needs a log file
     test -n "$LOGFILE" || VM_WATCHDOG=
     # put our config into .build/build.data
@@ -659,7 +741,10 @@ vm_first_stage() {
     echo "INCARNATION='${INCARNATION//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data
     echo "DISTURL='${DISTURL//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data
     echo "DO_INIT='${DO_INIT//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data
+    echo "DO_INIT_TOPDIR='${DO_INIT_TOPDIR//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data
     echo "KIWI_PARAMETERS='${KIWI_PARAMETERS//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data
+    echo "VM_TELNET='${VM_TELNET//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data
+    echo "VM_CONSOLE_INPUT='${VM_CONSOLE_INPUT//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data
     test -n "$VM_SWAP" && echo "VM_SWAP='${VM_SWAPDEV//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data
     test -n "$VMDISK_MOUNT_OPTIONS" && echo "VMDISK_MOUNT_OPTIONS='${VMDISK_MOUNT_OPTIONS//"'"/$Q}'" >> $BUILD_ROOT/.build/build.data
     PERSONALITY=0
@@ -667,9 +752,9 @@ vm_first_stage() {
     test "$PERSONALITY" = -1 && PERSONALITY=0  # syscall failed?
     case $(uname -m) in
        ppc|ppcle|s390) PERSONALITY=8 ;;        # ppc/s390 kernel never tells us if a 32bit personality is active, assume we run on 64bit
-       aarch64) test "$BUILD_ARCH" != "${BUILD_ARCH#armv}" && PERSONALITY=8 ;; # workaround, to be removed
+       aarch64) test "$BUILD_ARCH" != "${BUILD_ARCH#armv[567]}" && PERSONALITY=8 ;; # workaround, to be removed
     esac
-    test "$VM_TYPE" = lxc && PERSONALITY=0
+    test "$VM_TYPE" = lxc -o "$VM_TYPE" = docker && PERSONALITY=0
     echo "PERSONALITY='$PERSONALITY'" >> $BUILD_ROOT/.build/build.data
     echo "MYHOSTNAME='`hostname`'" >> $BUILD_ROOT/.build/build.data
     echo -n "definesnstuff=(" >> $BUILD_ROOT/.build/build.data
@@ -686,14 +771,15 @@ vm_first_stage() {
     echo "BUILDENGINE='$BUILDENGINE'" >> $BUILD_ROOT/.build/build.data
     echo "CCACHE='$CCACHE'" >> $BUILD_ROOT/.build/build.data
     echo "ABUILD_TARGET='$ABUILD_TARGET'" >> $BUILD_ROOT/.build/build.data
-    # use the rpmbuild --stage option
-    if [ ! -z $BUILD_RPM_BUILD_STAGE ]; then
-        if [[ "$BUILD_RPM_BUILD_STAGE" =~ ^- ]]; then
-            echo "BUILD_RPM_BUILD_STAGE='$BUILD_RPM_BUILD_STAGE'" >> $BUILD_ROOT/.build/build.data
-        else
-            echo "BUILD_RPM_BUILD_STAGE='-$BUILD_RPM_BUILD_STAGE'" >> $BUILD_ROOT/.build/build.data
-        fi
-    fi
+       # use the rpmbuild --stage option
+     if [ ! -z $BUILD_RPM_BUILD_STAGE ]; then
+               if [[ "$BUILD_RPM_BUILD_STAGE" =~ ^- ]]; then
+                       echo "BUILD_RPM_BUILD_STAGE='$BUILD_RPM_BUILD_STAGE'" >> $BUILD_ROOT/.build/build.data
+               else
+                       echo "BUILD_RPM_BUILD_STAGE='-$BUILD_RPM_BUILD_STAGE'" >> $BUILD_ROOT/.build/build.data
+               fi
+       fi
+
     # fallback time for broken hosts
     date '+@%s' > $BUILD_ROOT/.build/.date
     # we're done with the root file system, unmount
diff --git a/build-vm-docker b/build-vm-docker
new file mode 100644 (file)
index 0000000..db3a4eb
--- /dev/null
@@ -0,0 +1,69 @@
+#
+# Docker specific functions
+#
+################################################################
+#
+# Copyright (c) 2015 Oleg Girko
+# Copyright (c) 2015 SUSE Linux Products GmbH
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 or 3 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program (see the file COPYING); if not, write to the
+# Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+#
+################################################################
+
+vm_verify_options_docker() {
+    VM_IMAGE=
+    VM_SWAP=
+}
+
+vm_startup_docker() {
+    local name="obsbuild.${BUILD_ROOT##*/}"
+    docker rm "$name" >/dev/null 2>&1 || true
+    docker run \
+        --rm --name "$name" --cap-add=sys_admin --net=none \
+        -v "$BUILD_ROOT:/mnt" busybox /bin/chroot /mnt "$vm_init_script"
+    BUILDSTATUS="$?"
+    test "$BUILDSTATUS" != 255 || BUILDSTATUS=3
+    cleanup_and_exit "$BUILDSTATUS"
+}
+
+vm_kill_docker() {
+    local name="obsbuild.${BUILD_ROOT##*/}"
+    docker stop -t 2 "$name" || true
+}
+
+vm_fixup_docker() {
+    :
+}
+
+vm_attach_root_docker() {
+    :
+}
+
+vm_attach_swap_docker() {
+    :
+}
+
+vm_detach_root_docker() {
+    :
+}
+
+vm_detach_swap_docker() {
+    :
+}
+
+vm_cleanup_docker() {
+    :
+}
+
index 455ecc1..641bc4d 100644 (file)
@@ -26,8 +26,17 @@ kvm_console=ttyS0
 
 # assume virtio support by default
 kvm_device=virtio-blk-pci
+kvm_serial_device=
+kvm_rng_device=virtio-rng-pci
 kvm_options=
 
+function complain()
+{
+    local ex=$1; shift
+    printf "Error: %s\n" "$@" >&2
+    cleanup_and_exit $ex
+}
+
 kvm_check_ppc970() {
     if ! grep -q -E '(kvm_rma_count.*kvm_hpt_count)|(kvm_hpt_count.*kvm_rma_count)' /proc/cmdline ; then 
        echo "put kvm_rma_count=<VM number> or kvm_hpt_count=<> to your boot options"
@@ -64,23 +73,40 @@ vm_verify_options_kvm() {
        armv7l)
            kvm_bin="/usr/bin/qemu-system-arm"
            kvm_console=ttyAMA0
-           kvm_options="-enable-kvm -M vexpress-a15 -dtb /boot/a15-guest.dtb -cpu cortex-a15"
+           kvm_options="-enable-kvm -M virt -cpu host"
            vm_kernel=/boot/zImage
            vm_initrd=/boot/initrd
            # prefer the guest kernel/initrd
            test -e /boot/zImage.guest && vm_kernel=/boot/zImage.guest
            test -e /boot/initrd.guest && vm_initrd=/boot/initrd.guest
            kvm_device=virtio-blk-device
+           kvm_rng_device=virtio-rng-device
            ;;
-       aarch64)
+       armv8l|aarch64)
            kvm_bin="/usr/bin/qemu-system-aarch64"
            kvm_console=ttyAMA0
-           kvm_options="-enable-kvm -M virt -cpu host"
            vm_kernel=/boot/Image
            vm_initrd=/boot/initrd
-           # prefer the guest kernel/initrd
-           test -e /boot/Image.guest && vm_kernel=/boot/Image.guest
-           test -e /boot/initrd.guest && vm_initrd=/boot/initrd.guest
+            if test "${BUILD_ARCH#aarch}" != "$BUILD_ARCH" -o "${BUILD_ARCH#armv8}" != "$BUILD_ARCH"; then
+               kvm_options="-enable-kvm -cpu host "
+               test -e /boot/Image.guest && vm_kernel=/boot/Image.guest
+               test -e /boot/initrd.guest && vm_initrd=/boot/initrd.guest
+           else
+               # Running an armv7 kernel on aarch64
+               kvm_options="-enable-kvm -cpu host,aarch64=off "
+               # prefer the guest kernel/initrd
+               test -e /boot/Image.guest32 && vm_kernel=/boot/Image.guest32
+               test -e /boot/initrd.guest32 && vm_initrd=/boot/initrd.guest32
+           fi
+           # This option only exists with QEMU 2.5 or newer
+           if $kvm_bin -machine 'virt,?' 2>&1 | grep -q gic-version ; then
+               # We want to use the host gic version in order to make use
+               # of all available features (e.g. more than 8 CPUs) and avoid
+               # the emulation overhead of vGICv2 on a GICv3 host.
+               kvm_options+="-M virt,gic-version=host"
+           else
+               kvm_options+="-M virt"
+           fi
            kvm_device=virtio-blk-device
            ;;
        ppc|ppcle|ppc64|ppc64le)
@@ -104,6 +130,8 @@ vm_verify_options_kvm() {
            vm_kernel=/boot/image
            vm_initrd=/boot/initrd
            kvm_device=virtio-blk-ccw
+           kvm_serial_device=virtio-serial-ccw
+           kvm_rng_device=virtio-rng-ccw
            ;;
     esac
 
@@ -152,13 +180,59 @@ vm_verify_options_kvm() {
            VM_SWAPDEV=/dev/sdb
            ;;
     esac
+
+    if test -n "$VM_NETOPT" -o -n "$VM_NETDEVOPT" ; then
+        if test -n "$VM_NETOPT" ; then
+           for item in "${VM_NETOPT[@]}" ; do
+              kvm_options="$kvm_options -net $item"
+           done
+        fi
+        if test -n "$VM_NETDEVOPT" ; then
+           for item in "${VM_NETDEVOPT[@]}" ; do
+              kvm_options="$kvm_options -netdev $item"
+           done
+        fi
+    fi
+
+    if test -n "$VM_DEVICEOPT" ; then
+        for item in "${VM_DEVICEOPT[@]}" ; do
+            kvm_options="$kvm_options -device $item"
+        done
+    fi
+
+    if test -n "$kvm_rng_device" ; then
+        if test -c /dev/hwrng &&
+           test -f /sys/class/misc/hw_random/rng_current &&
+           test "$(cat /sys/class/misc/hw_random/rng_current)" != none; then
+            rng_dev="/dev/hwrng"
+        else
+            rng_dev="/dev/random"
+        fi
+        kvm_options="$kvm_options -object rng-random,filename=$rng_dev,id=rng0 -device $kvm_rng_device,rng=rng0"
+    fi
 }
 
 vm_startup_kvm() {
     qemu_bin="$kvm_bin"
-    qemu_args=(-drive file="$VM_IMAGE",if=none,id=disk,serial=0,cache=unsafe -device "$kvm_device",drive=disk)
+    qemu_args=(-drive file="$VM_IMAGE",format=raw,if=none,id=disk,serial=0,cache=unsafe -device "$kvm_device",drive=disk)
+    if [ -n "$VM_USER" ] ; then
+       getent passwd "$VM_USER" > /dev/null || complain 22 "cannot find KVM user '$VM_USER'"
+    else
+       # use qemu user by default if available
+       getent passwd qemu >/dev/null && VM_USER=qemu
+    fi
+    [ -n "$VM_USER" ] && kvm_options="$kvm_options -runas $VM_USER"
     if test -n "$VM_SWAP" ; then
-       qemu_args=("${qemu_args[@]}" -drive file="$VM_SWAP",if=none,id=swap,serial=1,cache=unsafe -device "$kvm_device",drive=swap)
+       qemu_args=("${qemu_args[@]}" -drive file="$VM_SWAP",format=raw,if=none,id=swap,serial=1,cache=unsafe -device "$kvm_device",drive=swap)
+    fi
+    # the serial console device needs to be compiled into the target kernel
+    # which is why we can not use virtio-serial on other platforms
+    if test -n "$kvm_serial_device" ; then
+       qemu_args=("${qemu_args[@]}" -device "$kvm_serial_device" -device virtconsole,chardev=virtiocon0 -chardev stdio,id=virtiocon0)
+    elif test -n "$VM_CONSOLE_INPUT" ; then
+       qemu_args=("${qemu_args[@]}" -serial mon:stdio)
+    else
+       qemu_args=("${qemu_args[@]}" -serial stdio)
     fi
 
     if test -n "$BUILD_JOBS" -a "$icecream" = 0 -a -z "$BUILD_THREADS" ; then
@@ -170,10 +244,24 @@ vm_startup_kvm() {
        test "$kvm_console" != ttyAMA0 && kvm_options="$kvm_options -cpu host"
        test -n "$HUGETLBFSPATH" && kvm_options="$kvm_options -mem-prealloc -mem-path $HUGETLBFSPATH"
     fi
-    set -- $qemu_bin -no-reboot -nographic -vga none -net none $kvm_options \
+    qemu_rootfstype=""
+    if test -n "$VMDISK_FILESYSTEM" ; then
+        qemu_rootfstype="rootfstype=$VMDISK_FILESYSTEM"
+    fi
+    qemu_rootflags=""
+    if test -n "$VMDISK_MOUNT_OPTIONS" ; then
+        qemu_rootflags="rootflags=${VMDISK_MOUNT_OPTIONS#-o }"
+    fi
+    if test -z "$VM_NETOPT" -a -z "$VM_NETDEVOPT"; then
+        kvm_options="$kvm_options -net none"
+    fi
+    if test -n "$VM_TELNET"; then
+        kvm_options="$kvm_options -netdev user,id=telnet,hostfwd=tcp:127.0.0.1:$VM_TELNET-:23 -device e1000,netdev=telnet"
+    fi
+    set -- $qemu_bin -nodefaults -no-reboot -nographic -vga none $kvm_options \
        -kernel $vm_kernel \
        -initrd $vm_initrd \
-       -append "root=$qemu_rootdev panic=1 quiet no-kvmclock nmi_watchdog=0 rw rd.driver.pre=binfmt_misc elevator=noop console=$kvm_console init=$vm_init_script" \
+       -append "root=$qemu_rootdev $qemu_rootfstype $qemu_rootflags panic=1 quiet no-kvmclock nmi_watchdog=0 rw rd.driver.pre=binfmt_misc elevator=noop console=$kvm_console init=$vm_init_script" \
        ${VM_MEMSIZE:+-m $VM_MEMSIZE} \
        "${qemu_args[@]}"
 
index 6d9ef20..322299b 100644 (file)
 #
 ################################################################
 
+lxc_get_id() {
+    LXCID="obsbuild:${BUILD_ROOT##*/}"
+}
+
 vm_verify_options_lxc() {
     VM_IMAGE=
     VM_SWAP=
 }
 
 vm_startup_lxc() {
+    lxc_get_id
+    LXCDIR="`lxc-config lxc.lxcpath`/$LXCID"
+    LXCROOTFS="$LXCDIR/rootfs"
+    LXCHOOK="$LXCDIR/pre-mount.hook"
     LXCCONF="$BUILD_ROOT/.build.lxc.conf"
     rm -f "$LXCCONF"
     cat $BUILD_DIR/lxc.conf > "$LXCCONF"
     cat >> "$LXCCONF" <<-EOF
-       lxc.rootfs = $BUILD_ROOT
+       lxc.rootfs = $LXCROOTFS
+       lxc.hook.pre-mount = $LXCHOOK
        EOF
     # XXX: do this always instead of leaking the hosts' one?
     echo "rootfs / rootfs rw 0 0" > $BUILD_ROOT/etc/mtab
-    LXCID=${BUILD_ROOT##*/}
     lxc-destroy -n "$LXCID" >/dev/null 2>&1 || true
-    lxc-create -n "$LXCID" -f "$LXCCONF" || cleanup_and_exit 1
-    lxc-start -n "$LXCID" "$vm_init_script"
+    mkdir -p "$LXCROOTFS"
+    cat > "$LXCHOOK" <<-EOF
+       #!/bin/sh
+       mount --bind "$BUILD_ROOT" "$LXCROOTFS"
+       EOF
+    chmod a+x "$LXCHOOK"
+    case "$(lxc-create --version)" in
+        1.0.8|1.1.*)
+           lxc-create -n "$LXCID" -f "$LXCCONF" -t none || cleanup_and_exit 1
+           lxc-start -n "$LXCID" -F "$vm_init_script"
+           ;;
+        1.0.*)
+           lxc-create -n "$LXCID" -f "$LXCCONF" || cleanup_and_exit 1
+           lxc-start -n "$LXCID" "$vm_init_script"
+           ;;
+    esac
     BUILDSTATUS="$?"
     test "$BUILDSTATUS" != 255 || BUILDSTATUS=3
     cleanup_and_exit "$BUILDSTATUS"
 }
 
 vm_kill_lxc() {
-    LXCID=${BUILD_ROOT##*/}
+    lxc_get_id
     lxc-stop -n "$LXCID" || true
-    lxc-destroy -n "$LXCID"
 }
 
 vm_fixup_lxc() {
@@ -71,6 +92,9 @@ vm_detach_swap_lxc() {
 }
 
 vm_cleanup_lxc() {
-    :
+    if test $$ -ne 1 && test $$ -ne 2 ; then
+        lxc_get_id
+        lxc-destroy -n "$LXCID"
+    fi
 }
 
diff --git a/build-vm-pvm b/build-vm-pvm
new file mode 100644 (file)
index 0000000..0c01ce1
--- /dev/null
@@ -0,0 +1,189 @@
+#PowerVM build functions
+
+pvm_setup_bootloader(){
+   disk=$1
+   parted -s $disk mklabel msdos
+   parted -s $disk mkpart primary ext2 0 $bootloader_size
+   parted -s $disk set 1 boot on
+   parted -s $disk set 1 prep on
+   parted -s $disk mkpart primary ext3 8M 100%
+   bl_target=${disk}1
+}
+
+pvm_getdiskname(){
+     lv=$1
+     if [ -z "$SKIP" ];then
+         args=$(pvmctl scsi list -f ' ' -d VirtualDisk.udid ClientAdapter.loc_code --where VirtualDisk.name=$lv)
+         eval $args
+         host=$(ls-vscsi | grep $loc_code| awk -F " " '{print $1}')
+         udid=$(echo $udid | cut -c 3-)
+         devid="/dev/disk/by-id/scsi-SAIX_VDASD_$udid"
+         until test -L $devid;do
+             sleep 1;
+             echo "- - -" >  /sys/class/scsi_host/$host/scan
+         done
+         dev=$(readlink -f $devid)
+     fi
+     case $lv in
+         *root) test -z "$SKIP" && pvm_setup_bootloader "$dev";
+                VM_IMAGE="${dev}2";;
+         *swap) VM_SWAP="${dev}";;
+     esac
+}
+
+pvm_execute(){
+    cmd=$@
+    pvmctl $cmd
+}
+
+pvm_is_created() {
+    dev=$1
+    $(pvmctl lv list -d LogicalVolume.name | grep -q $dev) && SKIP=1
+}
+
+pvm_createdev() {
+     name=$1
+     size=$2
+     target=$3
+     size_gb=`expr $size / 1024`
+     test -z $3 && target=$master_lpar
+     pvm_is_created $name
+     if [ -z "$SKIP" ];then
+         pvm_execute lv create --name $name --size $size_gb
+         target=$master_lpar
+     fi
+     pvm_execute scsi create --vg name=rootvg --type lv --lpar name=$target --stor-id $name
+     test -z "$SKIP" && pvm_getdiskname $name
+}
+
+pvm_lpar_is_running(){
+    state=$(pvmctl lpar list -d LogicalPartition.state --where LogicalPartition.name=$lpname |awk -F "=" '{print $2}')
+    CONSOLEPID=`pgrep -f "cat $hvcdev"`
+    if [ "$state" = "running" ];then
+       return 0
+    else
+       test -n $CONSOLEPID && kill -TERM $CONSOLEPID
+       return 1
+    fi
+}
+
+pvm_watch_build(){
+    while pvm_lpar_is_running $lpname;do
+        sleep 10
+    done
+}
+
+pvm_detachdev(){
+    lv=$1
+    lpar=$2
+    pvm_execute scsi delete --lpar name=$lpar --type lv --stor-id $lv
+}
+
+pvm_deletelv(){
+    viosvrcmd --id 1 -c "rmbdsp -bd $1"
+}
+
+pvm_nametoid(){
+    local id
+    name=$1
+    lparid=$(pvmctl lpar list -d LogicalPartition.id -i name=$name | awk -F "=" '{print $2}')
+}
+
+
+pvm_openconsole(){
+    id=$1
+    pvmutil -o create_vterm_dev --id $id
+    hvcsadmin -console $id
+    hvcdev=$(hvcsadmin -console $id|awk '{print $4}')
+}
+
+pvm_closeconsole(){
+    hvcdev=$(hvcsadmin -console $id|awk '{print $4}')
+    hvcsadmin -close $hvcdev
+    pvmutil -o delete_vterm_dev --id $1
+}
+
+vm_kill_pvm() {
+   pvm_execute lpar power-off --hard -i name="$VM_NAME"
+}
+
+vm_startup_pvm(){
+    cpus=$BUILD_JOBS
+    cores=`echo 0.05 \* $cpus| bc -l`
+    pvm_execute lpar create --name $lpname --mem $VM_MEMSIZE --proc-unit $cores --proc $cpus --proc-type shared --sharing-mode uncapped --type $lpartype
+    pvm_nametoid $lpname
+    vm_attach_root_pvm $lpname
+    vm_attach_swap_pvm $lpname
+    pvm_openconsole $lparid
+    pvm_execute lpar power-on -i name=$lpname
+    pvm_watch_build &
+    PID=$!
+    cat $hvcdev
+    vm_detach_root_pvm $lpname
+    vm_detach_swap_pvm $lpname
+}
+
+vm_verify_options_pvm(){
+    test -z "$VM_WORKER_NR" && VM_WORKER_NR=1
+    lpname="worker-$VM_WORKER_NR"
+    lpartype="AIX/Linux"
+    bootloader_size="8M"
+    rootlv="$lpname"-root
+    swaplv="$lpname"-swap
+    master_lpar=$(cat /proc/device-tree/ibm,partition-name)
+}
+
+vm_attach_root_pvm(){
+    target=$1
+    pvm_createdev $rootlv $VMDISK_ROOTSIZE $target
+}
+
+vm_attach_swap_pvm(){
+    pvm_createdev $swaplv $VMDISK_SWAPSIZE $target
+}
+
+vm_detach_swap_pvm(){
+    lpar=$1
+    test -z $lpar && lpar=$master_lpar
+    pvm_detachdev $swaplv $lpar
+}
+
+vm_detach_root_pvm(){
+    lpar=$1
+    test -z $lpar && lpar=$master_lpar
+    pvm_detachdev $rootlv $lpar
+}
+
+vm_cleanup_pvm(){
+    pvm_nametoid $lpname
+    pvm_closeconsole $lparid
+    vm_detach_root_pvm $lpname
+    vm_detach_root_pvm
+    vm_detach_swap_pvm $lpname
+    vm_detach_swap_pvm
+    pvm_execute lpar delete -i name=$lpname
+    pvm_deletelv $rootlv
+    pvm_deletelv $swaplv
+}
+
+vm_fixup_pvm(){
+    VM_SWAPDEV=/dev/sdb
+    GRUBDIR=`mktemp -d /tmp/grubinstall.XXXX`
+    modules="ext2 part_msdos linux disk elf"
+    grubcfg="$GRUBDIR/grub.cfg"
+    grubimg="$GRUBDIR/grub.img"
+    cat <<'EOF' >> $GRUBDIR/grub.cfg
+insmod ext2
+insmod part_msdos
+insmod linux
+insmod disk
+insmod elf
+set root='ieee1275//vdevice/v-scsi@30000002/disk@8100000000000000,msdos2'
+linux /.build.kernel.kvm init=/.build/build console=hvc0 root=/dev/sda2 rw elevator=noop
+initrd /.build.initrd.kvm
+boot
+EOF
+    grub2-mkimage -O powerpc-ieee1275 -o $grubimg -c $grubcfg $modules
+    dd if=$grubimg of=$bl_target
+    rm -rf $GRUBDIR
+}
index c28442c..57318f2 100644 (file)
@@ -39,7 +39,7 @@ zvm_fatal() {
     cleanup_and_exit 1
 }
 
-prevent_detach() {
+zvm_prevent_detach() {
     if test "$1" = "150" -o "$1" = "0150"; then
         zvm_fatal "don't detach local root"
     fi
@@ -157,7 +157,7 @@ zvm_volume_detach_local() {
     # 1. worker device number
     # 2. worker number
     DEVNR=$(zvm_get_local_devnr $1 $2)
-    prevent_detach $DEVNR
+    zvm_prevent_detach $DEVNR
     dasd_configure 0.0.0$DEVNR 0 0
     if ! vmcp detach $DEVNR >& /dev/null ; then
         zvm_fatal "Could not locally detach disk number $1 from worker $2"
@@ -209,7 +209,7 @@ zvm_worker_init() {
     done
     # Third, remove stale links
     for DEVNR in $DEVNR_ROOT $DEVNR_SWAP ; do
-        prevent_detach $DEVNR
+        zvm_prevent_detach $DEVNR
         if vmcp q v $DEVNR 2> /dev/null ; then
             vmcp detach $DEVNR
         fi
diff --git a/build.1 b/build.1
index 8989c59..8c721db 100644 (file)
--- a/build.1
+++ b/build.1
@@ -52,6 +52,9 @@ A dsc file used to generate Debian binary packages.
 .TP
 .B PKGBUILD
 A file used to generate Arch Linux binary packages.
+.TP
+.B build.collax
+A shell script used to generate a Collax binary package.
 .P
 .SH OPTIONS
 .TP
@@ -162,6 +165,15 @@ Set a specific kernel to boot in the virtual machine.
 .TP
 .B --vm-disk-clean
 Force the recreation of the disk image.
+.TP
+.B "--vm-telnet" PORT
+Is forwarding PORT to a telnet session inside of the VM.
+Specify also needed extra packages via -x parameter, usually:
+.I   --vm-telnet 1234 -x telnet-server -x net-tools
+   And connect from the host via:
+.I   telnet localhost 1234
+   NOTE: The telnet server gets started after all packages got installed.
+
 
 .SH RECIPE FILE OPTIONS
 The
diff --git a/build_kiwi.sh b/build_kiwi.sh
deleted file mode 100644 (file)
index 3f91119..0000000
+++ /dev/null
@@ -1,368 +0,0 @@
-#!/bin/bash
-run_kiwi()
-{
-    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
-    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 -a "$DO_INIT" != "false" ; then
-           echo "creating repodata for $repo"
-           if chroot $BUILD_ROOT createrepo --no-database --simple-md-filenames --help >/dev/null 2>&1 ; then
-               chroot $BUILD_ROOT createrepo --no-database --simple-md-filenames "$repo"
-           else
-               chroot $BUILD_ROOT createrepo "$repo"
-           fi
-        fi
-    done
-    # 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
-    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"
-       ver=`chroot "$BUILD_ROOT" su -c "/usr/sbin/kiwi --version | sed -n 's,.*kiwi version v\(.*\),\1,p'"`
-        if [ ${ver:0:1} == "3" ]; then
-          # old style kiwi 3 builds
-         chroot "$BUILD_ROOT" su -c "APPID=- LANG=POSIX /usr/sbin/kiwi --root $TOPDIR/KIWIROOT -v --logfile terminal -p $TOPDIR/SOURCES --instsource-local --create-instsource $TOPDIR/SOURCES" - abuild < /dev/null && BUILD_SUCCEEDED=true
-          if [ ${ver:2:2} == "01" ]; then
-            ## 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
-                n="${i##*/}"
-                test "$n" = scripts && continue
-                test "$n" != "${n%0}" && continue
-                chroot $BUILD_ROOT su -c "suse-isolinux $TOPDIR/KIWIROOT/main/$n $TOPDIR/KIWI/$n.iso" - $BUILD_USER
-            done
-          fi
-        else
-          if [ ${ver:0:1} == "4" -a ${ver:2:2} -lt 90 ]; then
-            # broken kiwi version, not accepting verbose level
-           chroot "$BUILD_ROOT" su -c "APPID=- LANG=POSIX /usr/sbin/kiwi --root $TOPDIR/KIWIROOT -v -v --logfile terminal -p $TOPDIR/SOURCES --create-instsource $TOPDIR/SOURCES" - abuild < /dev/null && BUILD_SUCCEEDED=true
-          else
-            # current default
-           chroot "$BUILD_ROOT" su -c "APPID=- LANG=POSIX /usr/sbin/kiwi --root $TOPDIR/KIWIROOT -v 2 --logfile terminal -p $TOPDIR/SOURCES --create-instsource $TOPDIR/SOURCES" - abuild < /dev/null && BUILD_SUCCEEDED=true
-          fi
-        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/. ;;
-               *.packages) mv $i $BUILD_ROOT/$TOPDIR/OTHER/. ;;
-               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 $KIWI_PARAMETERS" - 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 $KIWI_PARAMETERS" - 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
-       imageout="$imagename.$imagearch-$imageversion"
-       for imgtype in $imagetype ; do
-           case "$imgtype" in
-               oem)
-                   cat > $BUILD_ROOT/kiwi_post.sh << EOF
-echo "compressing oem images... "
-cd /$TOPDIR/KIWI-oem
-# do not store compressed file _and_ uncompressed one
-[ -e "$imageout.gz" ] && rm -f "$imageout"
-if [ -e "$imageout.iso" ]; then
-       echo "take iso file and create sha256..."
-       mv "$imageout.iso" "/$TOPDIR/KIWI/$imageout$buildnum.iso"
-       pushd /$TOPDIR/KIWI
-       if [ -x /usr/bin/sha256sum ]; then
-           /usr/bin/sha256sum "$imageout$buildnum.iso" > "$imageout$buildnum.iso.sha256"
-        fi
-       popd
-fi
-if [ -e "$imageout.install.iso" ]; then
-       echo "take install.iso file and create sha256..."
-       mv "$imageout.install.iso" "/$TOPDIR/KIWI/$imageout$buildnum.install.iso"
-       pushd /$TOPDIR/KIWI
-       if [ -x /usr/bin/sha256sum ]; then
-           /usr/bin/sha256sum "$imageout$buildnum.install.iso" > "$imageout$buildnum.install.iso.sha256"
-        fi
-       popd
-fi
-if [ -e "$imageout.qcow2" ]; then
-       mv "$imageout.qcow2" "/$TOPDIR/KIWI/$imageout$buildnum.qcow2"
-       pushd /$TOPDIR/KIWI
-       if [ -x /usr/bin/sha256sum ]; then
-           echo "Create sha256 file..."
-           /usr/bin/sha256sum "$imageout$buildnum.qcow2" > "$imageout$buildnum.qcow2.sha256"
-        fi
-       popd
-fi
-if [ -e "$imageout.raw.install.raw" ]; then
-        compress_tool="bzip2"
-        compress_suffix="bz2"
-       if [ -x /usr/bin/xz ]; then
-            # take xz to get support for sparse files
-            compress_tool="xz -2"
-            compress_suffix="xz"
-        fi
-       mv "$imageout.raw.install.raw" "/$TOPDIR/KIWI/$imageout$buildnum.raw.install.raw"
-       pushd /$TOPDIR/KIWI
-       echo "\$compress_tool raw.install.raw file..."
-       \$compress_tool "$imageout$buildnum.raw.install.raw"
-       if [ -x /usr/bin/sha256sum ]; then
-           echo "Create sha256 file..."
-           /usr/bin/sha256sum "$imageout$buildnum.raw.install.raw.\${compress_suffix}" > "$imageout$buildnum.raw.install.raw.\${compress_suffix}.sha256"
-        fi
-       popd
-fi
-if [ -e "$imageout.raw" ]; then
-        compress_tool="bzip2"
-        compress_suffix="bz2"
-       if [ -x /usr/bin/xz ]; then
-            # take xz to get support for sparse files
-            compress_tool="xz -2"
-            compress_suffix="xz"
-        fi
-       mv "$imageout.raw" "/$TOPDIR/KIWI/$imageout$buildnum.raw"
-       pushd /$TOPDIR/KIWI
-       echo "\$compress_tool raw file..."
-       \$compress_tool "$imageout$buildnum.raw"
-       if [ -x /usr/bin/sha256sum ]; then
-           echo "Create sha256 file..."
-           /usr/bin/sha256sum "$imageout$buildnum.raw.\${compress_suffix}" > "$imageout$buildnum.raw.\${compress_suffix}.sha256"
-        fi
-       popd
-fi
-
-tar cvjfS "/$TOPDIR/KIWI/$imageout$buildnum-raw.tar.bz2" \
-       --exclude="$imageout.iso" --exclude="$imageout.raw" --exclude="$imageout.qcow2" *
-cd /$TOPDIR/KIWI
-if [ -x /usr/bin/sha256sum ]; then
-   /usr/bin/sha256sum "$imageout$buildnum-raw.tar.bz2" > "$imageout$buildnum-raw.tar.bz2.sha256"
-fi
-EOF
-                   ;;
-               vmx)
-                   cat > $BUILD_ROOT/kiwi_post.sh << EOF
-echo "compressing vmx images... "
-cd /$TOPDIR/KIWI-vmx
-for suffix in "ovf" "qcow2" "ova"; do
-  if [ -e "$imageout.\$suffix" ]; then
-       mv "$imageout.\$suffix" "/$TOPDIR/KIWI/$imageout$buildnum.\$suffix"
-       pushd /$TOPDIR/KIWI
-       if [ -x /usr/bin/sha256sum ]; then
-           echo "Create sha256 \$suffix file..."
-           /usr/bin/sha256sum "$imageout$buildnum.\$suffix" > "$imageout$buildnum.\$suffix.sha256"
-        fi
-       popd
-  fi
-done
-# This option has a number of format parameters
-VMXFILES=""
-SHAFILES=""
-for i in "$imageout.vmx" "$imageout.vmdk" "$imageout-disk*.vmdk"; do
-       test -e \$i && VMXFILES="\$VMXFILES \$i"
-done
-# take raw files as fallback
-if [ -n "\$VMXFILES" ]; then
-       tar cvjfS "/$TOPDIR/KIWI/$imageout$buildnum-vmx.tar.bz2" \$VMXFILES
-       SHAFILES="\$SHAFILES $imageout$buildnum-vmx.tar.bz2"
-elif [ -e  "$imageout.raw" ]; then
-        compress_tool="bzip2"
-        compress_suffix="bz2"
-       if [ -x /usr/bin/xz ]; then
-            # take xz to get support for sparse files
-            compress_tool="xz -2"
-            compress_suffix="xz"
-        fi
-       mv "$imageout.raw" "/$TOPDIR/KIWI/$imageout$buildnum-vmx.raw"
-       pushd /$TOPDIR/KIWI
-       echo "\$compress_tool raw file..."
-       \$compress_tool "$imageout$buildnum-vmx.raw"
-       SHAFILES="\$SHAFILES $imageout$buildnum-vmx.raw.\${compress_suffix}"
-       popd
-fi
-if [ -e "$imageout.xenconfig" ]; then
-       tar cvjfS "/$TOPDIR/KIWI/$imageout$buildnum-vmx.tar.bz2" $imageout.xenconfig $imageout.raw initrd-*
-       SHAFILES="\$SHAFILES $imageout$buildnum-vmx.tar.bz2"
-fi
-# FIXME: do we need a single .raw file in any case ?
-
-cd /$TOPDIR/KIWI
-if [ -n "\$SHAFILES" -a -x /usr/bin/sha256sum ]; then
-       for i in \$SHAFILES; do
-               echo "Create sha256 file..."
-               /usr/bin/sha256sum "\$i" > "\$i.sha256"
-       done
-fi
-EOF
-                   ;;
-               xen)
-                   cat > $BUILD_ROOT/kiwi_post.sh << EOF
-echo "compressing xen images... "
-cd /$TOPDIR/KIWI-xen
-# do not store compressed file _and_ uncompressed one
-[ -e "$imageout.gz" ] && rm -f "$imageout"
-tar cvjfS "/$TOPDIR/KIWI/$imageout$buildnum-xen.tar.bz2" \
-       `grep ^kernel $imageout.xenconfig | cut -d'"'  -f2` \
-       `grep ^ramdisk $imageout.xenconfig | cut -d'"'  -f2` \
-       initrd-* \
-       "$imageout.xenconfig" \
-       "$imageout"
-if [ -x /usr/bin/sha256sum ]; then
-   echo "Create sha256 file..."
-   cd $TOPDIR/KIWI
-   /usr/bin/sha256sum "$imageout$buildnum-xen.tar.bz2" > "$imageout$buildnum-xen.tar.bz2.sha256"
-fi
-EOF
-                   ;;
-               pxe)
-                   cat > $BUILD_ROOT/kiwi_post.sh << EOF
-echo "compressing pxe images... "
-cd /$TOPDIR/KIWI-pxe
-# do not store compressed file _and_ uncompressed one
-[ -e "$imageout.gz" ] && rm -f "$imageout"
-tar cvjfS "/$TOPDIR/KIWI/$imageout$buildnum-pxe.tar.bz2" ${imageout}* initrd-*
-if [ -x /usr/bin/sha256sum ]; then
-   echo "Create sha256 file..."
-   cd $TOPDIR/KIWI
-   /usr/bin/sha256sum "$imageout$buildnum-pxe.tar.bz2" > "$imageout$buildnum-pxe.tar.bz2.sha256"
-fi
-EOF
-                   ;;
-               iso)
-                   cat > $BUILD_ROOT/kiwi_post.sh << EOF
-cd /$TOPDIR/KIWI-iso
-for i in *.iso; do
-       mv "\$i" "/$TOPDIR/KIWI/\${i%.iso}$buildnum.iso"
-done
-if [ -x /usr/bin/sha256sum ]; then
-   echo "creating sha256 sum for iso images... "
-   cd $TOPDIR/KIWI
-   for i in *.iso; do
-       /usr/bin/sha256sum "\$i" > "\$i.sha256"
-   done
-fi
-EOF
-                   ;;
-               tbz)
-                   cat > $BUILD_ROOT/kiwi_post.sh << EOF
-cd /$TOPDIR/KIWI-tbz
-for i in *.tbz; do
-        file=\$(readlink -f "\$i")
-        [ -z "\$file" ] && echo readlink failed for $i
-       mv "\$file" "/$TOPDIR/KIWI/\${i%.tbz}$buildnum.tbz"
-done
-if [ -x /usr/bin/sha256sum ]; then
-   echo "creating sha256 sum for tar balls... "
-   cd $TOPDIR/KIWI
-   for i in *.tbz; do
-       /usr/bin/sha256sum "\$i" > "\$i.sha256"
-   done
-fi
-EOF
-                   ;;
-               *)
-                   cat > $BUILD_ROOT/kiwi_post.sh << EOF
-echo "compressing unkown images... "
-cd /$TOPDIR/KIWI-$imgtype
-# do not store compressed file _and_ uncompressed one
-[ -e "$imageout.gz" ] && rm -f "$imageout"
-tar cvjfS "/$TOPDIR/KIWI/$imageout$buildnum-$imgtype.tar.bz2" *
-if [ -x /usr/bin/sha256sum ]; then
-   echo "Create sha256 file..."
-   cd /$TOPDIR/KIWI
-   /usr/bin/sha256sum "$imageout$buildnum-$imgtype.tar.bz2" > "$imageout$buildnum-$imgtype.tar.bz2.sha256"
-fi
-EOF
-                   ;;
-           esac
-           cat >> $BUILD_ROOT/kiwi_post.sh << EOF
-cd /$TOPDIR/KIWI-$imgtype
-if [ -e "$imageout.packages" ]; then
-   echo "Found kiwi package list file, exporting as well..."
-   cp "$imageout.packages" "/$TOPDIR/OTHER/$imageout$buildnum-$imgtype.packages"
-fi
-if [ -e "$imageout.verified" ]; then
-   echo "Found rpm verification report, exporting as well..."
-   cp "$imageout.verified" "/$TOPDIR/OTHER/$imageout$buildnum-$imgtype.verified"
-fi
-EOF
-           chroot $BUILD_ROOT su -c "sh -e /kiwi_post.sh" || cleanup_and_exit 1
-           rm -f $BUILD_ROOT/kiwi_post.sh
-       done
-    fi
-    # Hook for running post kiwi build scripts like QA scripts if installed
-    if [ -x $BUILD_ROOT/usr/lib/build/kiwi_post_run ]; then
-        chroot $BUILD_ROOT su -c /usr/lib/build/kiwi_post_run || cleanup_and_exit 1
-    fi
-}
index 2bfc988..512d826 100755 (executable)
@@ -22,6 +22,9 @@
 
 build_host_arch() {
     : ${BUILD_HOST_ARCH:=`uname -m`}
+    # the linux kernel only knows armv7l, armv7hl is a userland definition
+    test armv7l == "$BUILD_HOST_ARCH" && BUILD_HOST_ARCH=armv7hl
+
     BUILD_INITVM_ARCH="$BUILD_HOST_ARCH"
     # avoid multiple initvm.* helpers for i586 and i686
     test i686 != "$BUILD_INITVM_ARCH" || BUILD_INITVM_ARCH=i586
@@ -29,17 +32,29 @@ build_host_arch() {
 
 extend_build_arch() {
     case $BUILD_ARCH in
+      aarch64) BUILD_ARCH="aarch64:aarch64_ilp32:armv8l" ;;
+      aarch64_ilp32) BUILD_ARCH="aarch64_ilp32:aarch64:armv8l" ;;
+      armv8l) BUILD_ARCH="armv8l" ;; # armv8l is aarch64 in 32bit mode. not a superset of armv7
       armv7hl) BUILD_ARCH="armv7hl:armv7l:armv6hl:armv6l:armv5tel" ;;
       armv7l) BUILD_ARCH="armv7l:armv6l:armv5tel" ;;
       armv6hl) BUILD_ARCH="armv6hl:armv6l:armv5tel" ;;
       armv6l) BUILD_ARCH="armv6l:armv5tel" ;;
       armv5tel) BUILD_ARCH="armv5tel" ;;
+      m68k) BUILD_ARCH="m68k" ;;
+      mips64) BUILD_ARCH="mips64:mips" ;;
+      mips) BUILD_ARCH="mips" ;;
       i686) BUILD_ARCH="i686:i586:i486:i386" ;;
       i586) BUILD_ARCH="i586:i486:i386" ;;
       i486) BUILD_ARCH="i486:i386" ;;
       i386) BUILD_ARCH="i386" ;;
+      ia64) BUILD_ARCH="ia64" ;;
+      parisc64) BUILD_ARCH="hppa64:hppa" ;;
+      parisc) BUILD_ARCH="hppa" ;;
+      ppc) BUILD_ARCH="ppc" ;;
       ppc64) BUILD_ARCH="ppc64:ppc" ;;
       ppc64le) BUILD_ARCH="ppc64le" ;;
+      s390x) BUILD_ARCH="s390x:s390" ;;
+      s390) BUILD_ARCH="s390" ;;
       sparc64v) BUILD_ARCH="sparc64v:sparc64:sparcv9v:sparcv9:sparcv8:sparc" ;;
       sparc64) BUILD_ARCH="sparc64:sparcv9:sparcv8:sparc" ;;
       sparcv9v) BUILD_ARCH="sparcv9v:sparcv9:sparcv8:sparc" ;;
index 05944fb..66e80e8 100644 (file)
@@ -4,7 +4,7 @@ Preinstall: glibc bash perl sed grep coreutils pacman pacman-mirrorlist
 Preinstall: gawk gzip filesystem curl libidn acl gpgme libarchive
 Preinstall: openssl libssh2 zlib libassuan libgpg-error attr
 Preinstall: expat xz bzip2 readline lzo krb5 e2fsprogs keyutils
-Preinstall: ncurses
+Preinstall: ncurses lz4
 
 VMinstall: util-linux libutil-linux binutils pcre libcap
 
diff --git a/configs/collax.conf b/configs/collax.conf
new file mode 100644 (file)
index 0000000..4323f31
--- /dev/null
@@ -0,0 +1,7 @@
+Type: collax
+Repotype: debian
+
+Preinstall: acl akutils attr base-files bash bzip2 coreutils diffutils file
+Preinstall: findutils gawk grep gzip heirloom less lbzip2 libc6 libcap libdb
+Preinstall: libgcc1 libgdbmg1 libpam0 libstdc++-v3 m4 ncurses5 patch perl5.8
+Preinstall: pigz sed shadow tar texinfo unzip vim zlib1g
index c37b4c4..14451cc 100644 (file)
@@ -5,7 +5,7 @@ Preinstall: libc6 libncurses5 libacl1 libattr1
 Preinstall: libreadline4 tar gawk dpkg
 Preinstall: sysv-rc gzip base-files
 
-Runscripts: base-files
+Runscripts: base-files initscripts
 
 VMinstall: util-linux binutils libblkid1 libuuid1 libdevmapper1.02 mount
 
diff --git a/configs/sl13.3.conf b/configs/sl13.3.conf
new file mode 100644 (file)
index 0000000..60a4950
--- /dev/null
@@ -0,0 +1,788 @@
+%define gcc_version 5
+
+Substitute: kiwi-packagemanager:instsource kiwi-desc-isoboot-requires kiwi-instsource kiwi-instsource-plugins-openSUSE-13-2
+Substitute: kiwi-setup:image kiwi createrepo tar -kiwi-desc-isoboot-requires -kiwi-desc-oemboot-requires -kiwi-desc-netboot-requires -kiwi-desc-vmxboot-requires -kiwi-desc-xenboot-requires
+Conflict: kiwi:libudev-mini1
+Conflict: kiwi:systemd-mini
+Conflict: libudev1:udev-mini
+
+FileProvides: /usr/sbin/groupadd pwdutils
+FileProvides: /usr/sbin/useradd shadow
+FileProvides: /sbin/netconfig sysconfig-netconfig
+FileProvides: /usr/bin/docbook2man docbook-utils
+FileProvides: /usr/bin/mkisofs cdrkit-cdrtools-compat
+FileProvides: /usr/sbin/lockdev lockdev
+FileProvides: /bin/logger util-linux-systemd
+
+Preinstall: aaa_base attr bash coreutils diffutils
+Preinstall: filesystem fillup glibc grep
+Preinstall: libbz2-1 libgcc_s1 m4 libncurses5 libncurses6 pam
+Preinstall: permissions libreadline6 rpm sed tar libz1 libselinux1
+Preinstall: liblzma5 libcap2 libacl1 libattr1
+Preinstall: libpopt0 libelf1 liblua5_3
+Preinstall: libpcre1
+
+Runscripts: aaa_base
+
+Order: libopenssl0_9_8:openssl-certs
+
+Prefer: libdb-4_8-devel
+VMinstall: util-linux libmount1 perl-base libdb-4_8 libsepol1 libblkid1 libuuid1 libsmartcols1
+VMinstall: kernel-obs-build
+VMInstall: iproute2
+
+ExportFilter: \.x86_64\.rpm$ x86_64
+ExportFilter: \.ia64\.rpm$ ia64
+ExportFilter: \.s390x\.rpm$ s390x
+ExportFilter: \.ppc64\.rpm$ ppc64
+ExportFilter: \.ppc64le\.rpm$ ppc64le
+ExportFilter: \.ppc\.rpm$ ppc
+ExportFilter: -ia32-.*\.rpm$
+ExportFilter: -32bit-.*\.sparc64\.rpm$
+ExportFilter: -64bit-.*\.sparcv9\.rpm$
+ExportFilter: \.armv7l\.rpm$ armv7l
+ExportFilter: \.armv7hl\.rpm$ armv7l
+ExportFilter: ^glibc(?:-devel)?-32bit-.*\.sparc64\.rpm$ sparc64
+ExportFilter: ^glibc(?:-devel)?-64bit-.*\.sparcv9\.rpm$ sparcv9
+ExportFilter: ^acroread.*\.i586.rpm$ . x86_64
+ExportFilter: ^avmailgate.*\.i586.rpm$ . x86_64
+ExportFilter: ^avmailgate.*\.ppc.rpm$ . ppc64
+ExportFilter: ^avmailgate.*\.s390.rpm$ . s390x
+ExportFilter: ^flash-player.*\.i586.rpm$ . x86_64
+ExportFilter: ^novell-messenger-client.*\.i586.rpm$ . x86_64
+ExportFilter: ^openCryptoki-32bit.*\.s390.rpm$ . s390x
+
+Required: rpm-build
+
+# needed for su's default config - perhaps we should use a simplified form?
+Support: pam-modules
+
+# the basic stuff
+Support: perl build-mkbaselibs
+Support: brp-check-suse post-build-checks rpmlint-Factory
+# remove build-compare support to disable "same result" package dropping
+Support: build-compare
+# Extracting appdata.xml from desktop files
+Support: brp-extract-appdata
+
+Prefer: -suse-build-key
+Prefer: krb5-mini krb5-mini-devel
+Conflict: krb5-devel:krb5-mini
+Conflict: krb5:krb5-mini-devel
+Prefer: krb5-mini-devel:krb5-mini
+Prefer: libreadline5
+Prefer: libdb_java-4_8 libicu
+Prefer: cracklib-dict-small postfix
+Prefer: jta fam mozilla mozilla-nss
+Prefer: unixODBC libsoup glitz
+Prefer: gnome-panel desktop-data-openSUSE gnome2-SuSE
+Prefer: mono-nunit gecko-sharp2
+Prefer: mono-devel
+Prefer: apache2-prefork Mesa openmotif-libs ghostscript-mini ghostscript
+Prefer: gtk-sharp2 glib-sharp2 glade-sharp2
+Prefer: libzypp-zmd-backend novell-NLDAPsdk zaptel-kmp-default
+Prefer: hbedv-dazuko-kmp-default dazuko-kmp-default vmware-wkstnmods-kmp-default
+Prefer: virtualbox-kmp-default virtualbox-host-kmp-default
+Prefer: libstdc++6 libgcc_s1 libquadmath0
+Prefer: libstdc++6-32bit libstdc++6-64bit
+Prefer: libstdc++6-x86
+%ifarch s390x
+Prefer: -libstdc++41
+%endif
+Prefer: libstroke
+# for symbol syslog (syslogd is best as it has the least dependencies)
+Prefer: syslog-service syslogd
+Prefer: gnome-sharp2:art-sharp2 gnome-sharp:art-sharp
+Prefer: ifolder3:gnome-sharp2 ifolder3:gconf-sharp2
+Prefer: nautilus-ifolder3:gnome-sharp2 inkscape:gtkmm24
+Prefer: gconf-sharp2:glade-sharp2 gconf-sharp:glade-sharp
+Prefer: gjdoc:antlr-bootstrap
+Prefer: tomboy:gconf-sharp2 tomboy:gnome-sharp2
+Prefer: zmd:libzypp-zmd-backend
+Prefer: yast2-packagemanager-devel:yast2-packagemanager
+Prefer: glitz-32bit:Mesa-32bit
+Prefer: poppler-tools
+Prefer: libjpeg8-devel libjpeg-turbo
+Prefer: banshee:banshee-engine-gst helix-banshee:helix-banshee-engine-gst
+Prefer: banshee-1:banshee-1-client-classic
+Prefer: libfam0
+Prefer: java-1_5_0-ibm:java-1_5_0-ibm-alsa
+Prefer: java-1_5_0-ibm:java-1_5_0-ibm-fonts
+Prefer: java-1_6_0-ibm:java-1_6_0-ibm-fonts
+Prefer: microcode_ctl:kernel-default
+Prefer: notification-daemon
+Prefer: pkg-config gtk-doc wlan-kmp-default lua-libs lua-devel
+Prefer: gnu-jaf classpathx-mail avahi-compat-mDNSResponder yast2-control-center-qt
+Prefer: vim-normal myspell-american wine
+Prefer: eclipse-platform eclipse-scripts
+Prefer: yast2-theme-openSUSE enlightenment-theme-upstream
+Prefer: amarok:amarok-xine
+Prefer: kdenetwork3-vnc:tightvnc
+Prefer: libgweather0 jessie ndesk-dbus ndesk-dbus-glib tomcat-jsp-2_2-api tomcat-jsp-2_3-api tomcat-servlet-2_5-api 
+Prefer: -servletapi3 -servletapi4 -servletapi5
+Prefer: icewm-lite
+Prefer: patterns-openSUSE-GNOME-cd:banshee
+Prefer: yast2-ncurses-pkg
+Prefer: monodevelop: mono-addins
+Prefer: ant-trax:saxon
+Prefer: gnome-session:gnome-session-branding-openSUSE
+Prefer: gnome-session:gconf2-branding-openSUSE
+Prefer: yast2-qt:yast2-qt-branding-openSUSE
+Prefer: bundle-lang-gnome:gnome-session-branding-openSUSE
+Prefer: fcitx:fcitx-branding-openSUSE
+Prefer: xfce4-notifyd:xfce4-notifyd-branding-upstream
+Prefer: exo-data:exo-branding-upstream
+Prefer: xfce4-settings:xfce4-settings-branding-upstream
+Prefer: xfdesktop:xfdesktop-branding-upstream
+Prefer: texlive-xmltex texlive-tools texlive-jadetex
+Prefer: mono-web:mono-data-sqlite
+Prefer: gnome-games:gnuchess
+Prefer: glchess:gnuchess
+Prefer: libreoffice:libreoffice-branding-upstream
+Prefer: yast2-branding-openSUSE
+Prefer: gimp:gimp-branding-upstream
+Prefer: libesd-devel:esound
+Prefer: libesd0:esound-daemon
+Prefer: package-lists-openSUSE-KDE-cd: esound-daemon
+Prefer: glib2:glib2-branding-upstream
+Prefer: libgio-2_0-0:gio-branding-upstream
+Prefer: libglib-2_0-0:glib2-branding-upstream
+Prefer: kdelibs4:kdelibs4-branding-upstream
+Prefer: kdebase4-workspace:kdebase4-workspace-branding-upstream
+Prefer: plasma5-desktop:plasma5-desktop-branding-upstream
+Prefer: plasma5-workspace:plasma5-workspace-branding-upstream
+Prefer: sddm:sddm-branding-upstream
+Prefer: kdelibs4-branding:kdelibs4-branding-upstream
+Prefer: PackageKit:PackageKit-branding-upstream
+Prefer: lightdm-gtk-greeter:lightdm-gtk-greeter-branding-upstream
+Prefer: mysql-connector-java:java-1_5_0-gcj-compat
+Prefer: -geronimo-jta-1_0_1B-api -geronimo-jms-1_1-api -geronimo-el-1_0-api
+Prefer: rhino:xmlbeans-mini
+Prefer: ghostscript-devel:ghostscript-library
+Prefer: gdm:gdm-branding-upstream
+Prefer: rpcbind log4j-mini eclipse-source
+Prefer: mx4j:log4j-mini
+Prefer: podsleuth:sg3_utils
+Prefer: libcdio_cdda0 libcdio_paranoia0
+Prefer: mozilla-xulrunner191
+Prefer: mozilla-xulrunner191-32bit
+Prefer: boo tog-pegasus
+Prefer: kde4-kupdateapplet:kde4-kupdateapplet-zypp
+Prefer: kdebase4-workspace:kdebase4-workspace-ksysguardd
+Prefer: kdebase4-openSUSE:kdebase4-workspace
+Prefer: ant:xerces-j2
+Prefer: dhcp-client:dhcp
+Prefer: dummy-release
+Prefer: e17-devel:e17
+# provides typelib(St)
+Prefer: -cinnamon
+Prefer: -bundle-lang-kde-de -bundle-lang-kde-en -bundle-lang-kde-es
+Prefer: -bundle-lang-kde-fr -bundle-lang-kde-pt -bundle-lang-kde-el
+Prefer: -bundle-lang-kde-zh -bundle-lang-kde-ja -bundle-lang-kde-ru -bundle-lang-kde-pl
+Prefer: -bundle-lang-kde-sv -bundle-lang-kde-ko -bundle-lang-kde-fi -bundle-lang-kde-da
+Prefer: -bundle-lang-kde-cs -bundle-lang-kde-nl -bundle-lang-kde-hu -bundle-lang-kde-nb
+Prefer: -bundle-lang-kde-it -bundle-lang-kde-ca -bundle-lang-kde-ar
+Prefer: -bundle-lang-gnome-es -bundle-lang-gnome-de -bundle-lang-gnome-fr
+Prefer: -bundle-lang-gnome-pt -bundle-lang-gnome-en -bundle-lang-gnome-el
+Prefer: -bundle-lang-gnome-zh -bundle-lang-gnome-ja -bundle-lang-gnome-ru -bundle-lang-gnome-cs
+Prefer: -bundle-lang-gnome-ko -bundle-lang-gnome-da -bundle-lang-gnome-nl -bundle-lang-gnome-hu
+Prefer: -bundle-lang-gnome-pl -bundle-lang-gnome-fi -bundle-lang-gnome-nb -bundle-lang-gnome-sv
+Prefer: -bundle-lang-gnome-it -bundle-lang-gnome-ca -bundle-lang-gnome-ar
+Prefer: -bundle-lang-gnome-extras-es -bundle-lang-gnome-extras-de -bundle-lang-gnome-extras-fr
+Prefer: -bundle-lang-gnome-extras-pt -bundle-lang-gnome-extras-en -bundle-lang-gnome-extras-el
+Prefer: -bundle-lang-gnome-extras-zh -bundle-lang-gnome-extras-ja -bundle-lang-gnome-extras-ru -bundle-lang-gnome-extras-cs
+Prefer: -bundle-lang-gnome-extras-ko -bundle-lang-gnome-extras-da -bundle-lang-gnome-extras-nl -bundle-lang-gnome-extras-hu
+Prefer: -bundle-lang-gnome-extras-pl -bundle-lang-gnome-extras-fi -bundle-lang-gnome-extras-nb -bundle-lang-gnome-extras-sv
+Prefer: -bundle-lang-gnome-extras-it -bundle-lang-gnome-extras-ca -bundle-lang-gnome-extras-ar
+Prefer: -bundle-lang-common-es -bundle-lang-common-de -bundle-lang-common-fr
+Prefer: -bundle-lang-common-pt -bundle-lang-common-en -bundle-lang-common-el
+Prefer: -bundle-lang-common-ja -bundle-lang-common-zh -bundle-lang-common-cs -bundle-lang-common-ru
+Prefer: -bundle-lang-common-nl -bundle-lang-common-hu -bundle-lang-common-pl -bundle-lang-common-da
+Prefer: -bundle-lang-common-ko -bundle-lang-common-nb -bundle-lang-common-fi -bundle-lang-common-sv
+Prefer: -bundle-lang-common-it -bundle-lang-common-ca -bundle-lang-common-ar
+Prefer: -libgcc-mainline -libstdc++-mainline -gcc-mainline-c++
+Prefer: -libgcj-mainline -viewperf -compat -compat-openssl097g
+Prefer: -zmd -libreoffice -pam-laus -libgcc-tree-ssa -busybox-links
+Prefer: -python-setuptools
+Prefer: -kdenetwork3-InstantMessenger
+Prefer: -icc-profiles
+Prefer: libsocialweb:libsocialweb-branding-upstream
+Prefer: gnome-panel:gnome-panel-branding-upstream
+Prefer: vala
+Prefer: wallpaper-branding-openSUSE
+# in doubt, take xerces
+Prefer: -crimson
+# in doubt, take higher versions
+Prefer: -rubygem-rack-1_1 -rubygem-rack-1_2 -rubygem-rack-1_3 -rubygem-tilt-1_1 -rubygem-rack-1_4
+Prefer: -rubygem-method_source-0_7 -rubygem-rails-2_3 -rubygem-activerecord-2_3
+Prefer: -rubygem-json_pure-1_5
+Prefer: geronimo-servlet-2_4-api
+Prefer: -libhdf5-0-openmpi -libhdf5_hl0-openmpi -libhdf5_hl8-openmpi -libhdf5-8-openmpi -libhdf5_hl9-openmpi -libhdf5-9-openmpi -libhdf5-10-openmpi -libhdf5_hl10-openmpi
+# for now gstream 0.10 is it
+Prefer: typelib-1_0-Gst-0_10 gstreamer-0_10-utils-unversioned gstreamer-0_10-utils typelib-1_0-GstInterfaces-0_10 libQtGLib-2_0-0 libQtGLib-devel
+# prefer the small systemd for building
+Prefer: libudev-mini-devel libudev-mini1 udev-debuginfo libudev1-debuginfo
+Prefer: systemd-mini systemd-mini-devel
+Prefer: systemd-mini-devel:systemd-mini
+Prefer: udev-mini libcom_err2-mini libext2fs2-mini
+Prefer: libudev1:udev
+Prefer: xmlgraphics-commons:apache-commons-io
+# the -32bit stuff provides things it shouldn't (hopefully temporary)
+Prefer: -typelib-1_0-GdkPixbuf-2_0-32bit -typelib-1_0-Pango-1_0-32bit
+Prefer: postgresql postgresql-server
+Prefer: -unzip-rcc
+Prefer: -primus -primus-32bit
+Prefer: -staging-build-key
+Prefer: -sssd-wbclient
+Prefer: -clutter-gst-devel
+Prefer: -opencv-qt5-devel
+# ffmpeg and its fork libav both provide libswscale; prefer the 'original' ffmpeg
+Prefer: -libswscale-libav-devel -libavformat-libav-devel -libavresample-libav-devel
+# as long as kactivities4 exists and is provided
+Prefer: kactivities5
+
+# kernel bug (coolo)
+Prefer: kernel-default-devel
+
+Prefer: wxWidgets-2_9-devel
+Prefer: libopenssl-devel
+
+Prefer: -NX -xaw3dd -db43
+Prefer: -xerces-j2-xml-resolver -xerces-j2-xml-apis
+Prefer: -vmware-player
+Prefer: libgcc_s1 libgcc_s1-32bit libgcc_s1-64bit
+Prefer: libffi4 libffi-devel-gcc%{gcc_version}
+Prefer: -libatomic1-gcc49 -libitm1-gcc49 -libgcj_bc1-gcc49 -libtsan0-gcc49 -libatomic1-gcc49-32bit -libitm1-gcc49-32bit
+Prefer: -libitm1-gcc48 -libitm1-gcc48-32bit -libatomic1-gcc48 -libatomic1-gcc48-32bit -libtsan0-gcc48
+Prefer: -libstdc++6-gcc48 -libgomp1-gcc48 -libatomic1-gcc48
+Prefer: libgcc_s1-x86 libgcj_bc1
+Prefer: libffi4-32bit libffi4-64bit
+Prefer: libgomp1 libgomp1-32bit libgomp1-64bit
+Prefer: libmudflap4 libmudflap4-32bit libmudflap4-64bit
+Prefer: libobjc4 libgfortran3 libquadmath0
+Prefer: -libnetpbm -libcdio7-mini -libiso9660-5-mini -libiso9660-7-mini -libcdio10-mini -libcdio12-mini
+Prefer: -libcdio-mini -faac-mini -libcdio-mini-devel
+Prefer: -seamonkey
+Prefer: -libdb-4_4-devel -libdb-4_5-devel -libevoldap-2_4-2
+Prefer: libopenal0-soft openal-soft -lsb-buildenv
+Prefer: -libevent
+Prefer: gnu-crypto libusb-compat-devel
+Prefer: libusb-0_1-4
+Prefer: CASA_auth_token_svc:xerces-j2
+Prefer: libreoffice:xerces-j2
+Prefer: k3b:libdvdread4
+Prefer: glibc-devel
+Prefer: -libpcap -libiniparser -loudmouth -libkonq4 -libnetcdf-4 -java-1_7_0-openjdk-javadoc -java-1_7_0-icedtea-javadoc
+Prefer: -java-1_7_0-icedtea-devel
+Prefer: NetworkManager:dhcp-client
+Prefer: kdebase3-SuSE:kdebase3
+Prefer: kde4-kdm:kde4-kdm-branding-upstream
+Prefer: kdm:kdm-branding-upstream
+Prefer: pcre-tools
+Prefer: libpopt0
+Prefer: -apache2-mod_perl -otrs -qa_apache_testsuite -ctcs2
+Prefer: libgnome-keyring-devel
+Prefer: linux-glibc-devel
+Prefer: squid sysvinit
+Prefer: libpng16-compat-devel
+Prefer: -python3 -python3-gobject-devel -python3-gobject2-devel -x11-video-fglrxG02 -libpng12-0
+Prefer: perl-Mail-SPF:perl-Error libldb0 -audit-libs mysql-community-server mysql-community-server-client
+#needed because new xml-commons package
+Prefer: xml-commons-resolver12 xml-commons-jaxp-1.3-apis
+Prefer: xmlgraphics-fop:xerces-j2
+Prefer: libxfce4ui:libxfce4ui-branding-upstream
+Prefer: libgarcon-1-0:libgarcon-branding-upstream
+Prefer: libgarcon-data:libgarcon-branding-upstream
+Prefer: libexo-1-0:libexo-1-0-branding-upstream
+Prefer: gnome-shell:mozilla-js20
+Prefer: cogl-devel
+Prefer: -perl-XML-SAX perl-Test-YAML
+Prefer: gettext-tools-mini gettext-runtime-mini
+# choice p11-kit-nss-trust
+Prefer: mozilla-nss-certs
+# amarok dependency resolution
+Prefer: phonon-backend-gstreamer
+# replacing mkinitrd
+Prefer: dracut
+# replacing module-init-tools
+Prefer: kmod-compat
+# Temporary
+Prefer: oxygen5-cursors
+# Temporary
+Prefer: -perl-App-cpanminus
+# wireshark has now split off the ui. qt is considered experimental 2014-08-09
+Prefer: wireshark-ui-gtk
+# libmediaart is prepared for a larger update; for now favor mediaart-1.0
+Prefer: -typelib-1_0-MediaArt-2_0
+
+Ignore: installation-images-openSUSE:cracklib-dict-full
+Ignore: java-1_7_0-openjdk:mozilla-nss
+Ignore: java-1_7_0-openjdk:java-ca-certificates
+Ignore: openSUSE-release:openSUSE-release-ftp,openSUSE-release-dvd5,openSUSE-release-biarch,openSUSE-release-livecdkde,openSUSE-release-livecdgnome
+Ignore: cracklib:cracklib-dict
+Ignore: aaa_base:aaa_skel,suse-release,logrotate,ash,distribution-release,udev
+Ignore: sysvinit:mingetty
+Ignore: gettext-tools:libgcj,libstdc++-devel,libgcj41,libstdc++41-devel,libgcj42,libstdc++42-devel
+Ignore: libgcj43,libstdc++43-devel
+Ignore: libgcj44,libstdc++44-devel
+Ignore: libgcj45,libstdc++45-devel
+Ignore: libgcj46,libstdc++46-devel
+Ignore: libgcj47,libstdc++47-devel
+Ignore: pwdutils:openslp
+Ignore: pam-modules:resmgr
+Ignore: rpm:suse-build-key,build-key
+Ignore: bind-utils:bind-libs
+Ignore: alsa:dialog,pciutils
+Ignore: portmap:syslogd
+Ignore: xorg-x11:x11-tools,resmgr,xkeyboard-config,xorg-x11-Mesa,libusb,freetype2,libjpeg,libpng
+Ignore: xorg-x11-server:xorg-x11-driver-input,xorg-x11-driver-video
+Ignore: apache2:logrotate
+Ignore: arts:alsa,audiofile,resmgr,libogg,libvorbis
+Ignore: kdelibs3:alsa,arts,OpenEXR,aspell,cups-libs,mDNSResponder-lib,krb5,libjasper
+Ignore: kdelibs3-devel:libvorbis-devel
+Ignore: kdebase3:kdebase3-ksysguardd,OpenEXR,dbus-1,dbus-1-qt,hal,powersave,openslp,libusb
+Ignore: kdebase3-SuSE:release-notes
+Ignore: jack:alsa,libsndfile
+Ignore: libxml2-devel:readline-devel
+Ignore: gnome-vfs2:gnome-mime-data,desktop-file-utils,cdparanoia,dbus-1,dbus-1-glib,hal,libsmbclient,fam,file_alteration
+Ignore: libgda:file_alteration
+Ignore: gnutls:lzo,libopencdk
+Ignore: gnutls-devel:lzo-devel,libopencdk-devel
+Ignore: pango:cairo,glitz,libpixman,libpng
+Ignore: pango-devel:cairo-devel
+Ignore: cairo-devel:libpixman-devel
+Ignore: libgnomeprint:libgnomecups
+Ignore: libgnomeprintui:libgnomecups
+Ignore: orbit2-devel:indent
+Ignore: qt3:libmng
+Ignore: qt-sql:qt_database_plugin
+Ignore: gtk2:libpng,libtiff
+Ignore: libgnomecanvas-devel:glib-devel
+Ignore: libgnomeui:gnome-icon-theme,shared-mime-info
+Ignore: scrollkeeper:docbook_4
+Ignore: gnome-desktop:libgnomesu,startup-notification
+Ignore: python-devel:python-tk
+Ignore: gnome-pilot:gnome-panel
+Ignore: gnome-panel:control-center2
+Ignore: gnome-menus:kdebase3
+Ignore: gnome-main-menu:rug
+Ignore: libgtk-3-0:adwaita-icon-theme
+Ignore: libbonoboui:gnome-desktop
+Ignore: libxfce4ui-1-0:exo-tools
+Ignore: docbook_4:iso_ent,xmlcharent
+Ignore: control-center2:nautilus,evolution-data-server,gnome-menus,gstreamer-plugins,gstreamer,metacity,mozilla-nspr,mozilla,libxklavier,gnome-desktop,startup-notification
+Ignore: docbook-xsl-stylesheets:xmlcharent
+Ignore: liby2util-devel:libstdc++-devel,openssl-devel
+Ignore: yast2:yast2-ncurses,yast2_theme,perl-Config-Crontab,yast2-xml,SuSEfirewall2
+Ignore: yast2-core:netcat,hwinfo,wireless-tools,sysfsutils
+Ignore: yast2-core-devel:libxcrypt-devel,hwinfo-devel,blocxx-devel,sysfsutils,libstdc++-devel
+Ignore: yast2-packagemanager-devel:rpm-devel,curl-devel,openssl-devel
+Ignore: yast2-devtools:libxslt
+Ignore: yast2-iscsi-lio-server:lio-utils
+Ignore: yast2-installation:yast2-update,yast2-mouse,yast2-country,yast2-bootloader,yast2-packager,yast2-network,yast2-online-update,yast2-users,release-notes,autoyast2-installation
+Ignore: yast2-bootloader:bootloader-theme
+Ignore: yast2-packager:yast2-x11,libyui_pkg
+Ignore: autoyast2:yast2-schema
+# not during build
+Ignore: yui_backend
+Ignore: yast2-x11:sax2-libsax-perl
+Ignore: yast2-network:yast2-inetd
+Ignore: openslp-devel:openssl-devel
+Ignore: java-1_4_2-sun:xorg-x11-libs
+Ignore: java-1_4_2-sun-devel:xorg-x11-libs
+Ignore: tetex:xorg-x11-libs,expat,fontconfig,freetype2,libjpeg,ghostscript-x11,xaw3d,gd,dialog,ed
+Ignore: texlive-bin:ghostscript-x11
+Ignore: texlive-bin-omega:ghostscript-x11
+Ignore: yast2-country:yast2-trans-stats
+Ignore: tpb:tpctl-kmp
+Ignore: tpctl:tpctl-kmp
+Ignore: zaptel:zaptel-kmp
+Ignore: mkinitrd:pciutils
+Ignore: pciutils:pciutils-ids
+Ignore: postfix:iproute2
+Ignore: aaa_base:systemd
+Ignore: gpm:systemd
+Ignore: ConsoleKit:systemd
+Ignore: openssh:systemd
+Ignore: cronie:systemd
+Ignore: systemd:kbd
+Ignore: systemd:kmod
+Ignore: systemd:systemd-presets-branding
+Ignore: systemd:dbus-1
+Ignore: systemd:pam-config
+Ignore: systemd:udev
+Ignore: pesign:systemd
+Ignore: systemd-mini:this-is-only-for-build-envs
+Ignore: libsystemd0-mini:this-is-only-for-build-envs
+Ignore: udev-mini:this-is-only-for-build-envs
+Ignore: libudev-mini1:this-is-only-for-build-envs
+Ignore: jdk-bootstrap:this-is-only-for-build-envs
+Prefer: -harfbuzz-bootstrap -harfbuzz-bootstrap-devel
+Ignore: harfbuzz-bootstrap:this-is-only-for-build-envs
+Ignore: polkit:ConsoleKit
+Ignore: logrotate:cron
+Ignore: texlive-filesystem:cron
+Ignore: xinit:xterm
+Ignore: xdm:xterm
+Ignore: gnome-control-center:gnome-themes-accessibility
+Ignore: coreutils:info
+Ignore: cpio:info
+Ignore: diffutils:info
+Ignore: findutils:info
+Ignore: gawk:info
+Ignore: grep:info
+Ignore: groff:info
+Ignore: m4:info
+Ignore: sed:info
+Ignore: tar:info
+Ignore: util-linux:info
+Ignore: gettext-tools:info
+Ignore: gettext-runtime:info
+Ignore: libgcrypt-devel:info
+Ignore: binutils:info
+Ignore: gzip:info
+Ignore: make:info
+Ignore: bison:info
+Ignore: flex:info
+Ignore: help2man:info
+Ignore: man:groff-full
+Ignore: git-core:rsync
+Ignore: apache2:systemd
+Ignore: icewm-lite:icewm
+Ignore: cluster-glue:sudo
+
+Ignore: libgcc:glibc-32bit
+Ignore: libgcc41:glibc-32bit
+Ignore: libgcc42:glibc-32bit
+Ignore: libgcc43:glibc-32bit
+Ignore: libgcc44:glibc-32bit
+Ignore: libgcc45:glibc-32bit
+Ignore: libgcc46:glibc-32bit
+Ignore: libgcc47:glibc-32bit
+Ignore: libstdc++:glibc-32bit
+Ignore: libstdc41++:glibc-32bit
+Ignore: libstdc42++:glibc-32bit
+Ignore: libstdc43++:glibc-32bit
+Ignore: libstdc44++:glibc-32bit
+Ignore: libstdc45++:glibc-32bit
+Ignore: libstdc46++:glibc-32bit
+Ignore: libstdc47++:glibc-32bit
+Ignore: ncurses-32bit
+
+Ignore: susehelp:susehelp_lang,suse_help_viewer
+Ignore: mailx:smtp_daemon
+Ignore: cron:smtp_daemon
+Ignore: hotplug:syslog
+Ignore: pcmcia:syslog
+Ignore: openct:syslog
+Ignore: postfix:sysvinit(syslog)
+Ignore: cups:sysvinit(syslog)
+Ignore: jython:servlet
+Ignore: ispell:ispell_dictionary,ispell_english_dictionary
+Ignore: aspell:aspel_dictionary,aspell_dictionary
+Ignore: smartlink-softmodem:kernel,kernel-nongpl
+Ignore: libreoffice-de:myspell-german-dictionary
+Ignore: libreoffice:libreoffice-i18n
+Ignore: libreoffice:libreoffice-icon-themes
+Ignore: mediawiki:php-session,php-gettext,php-zlib,php-mysql,mod_php_any
+Ignore: squirrelmail:mod_php_any,php-session,php-gettext,php-iconv,php-mbstring,php-openssl
+Ignore: perl-Log-Log4perl:rrdtool
+
+Ignore: simias:mono(log4net)
+Ignore: zmd:mono(log4net)
+Ignore: horde:mod_php_any,php-gettext,php-mcrypt,php-imap,php-pear-log,php-pear,php-session,php
+
+Ignore: xerces-j2:xml-commons-apis,xml-commons-resolver
+Ignore: xdg-menu:desktop-data
+Ignore: nessus-libraries:nessus-core
+Ignore: evolution:yelp
+Ignore: e17:e17-branding e17:e17-theme
+
+Ignore: mono-tools:mono(gconf-sharp),mono(glade-sharp),mono(gnome-sharp),mono(gtkhtml-sharp),mono(atk-sharp),mono(gdk-sharp),mono(glib-sharp),mono(gtk-sharp),mono(pango-sharp)
+Ignore: gecko-sharp2:mono(glib-sharp),mono(gtk-sharp)
+
+Ignore: vcdimager:libcdio.so.6,libcdio.so.6(CDIO_6),libiso9660.so.4,libiso9660.so.4(ISO9660_4)
+Ignore: libcdio:libcddb.so.2
+
+Ignore: gnome-libs:libgnomeui
+Ignore: nautilus:gnome-themes
+Ignore: gnome-panel:gnome-themes
+Ignore: gnome-panel:tomboy
+Ignore: NetworkManager:NetworkManager-client
+Ignore: libbeagle:beagle
+Ignore: coreutils:coreutils-lang
+Ignore: cpio:cpio-lang
+Ignore: glib2:glib2-lang
+Ignore: gtk2:gtk2-lang
+Ignore: gtk:gtk-lang
+Ignore: atk:atk-lang
+Ignore: hal:pm-utils
+Ignore: MozillaThunderbird:pinentry-dialog
+Ignore: seamonkey:pinentry-dialog
+Ignore: pinentry:pinentry-dialog
+Ignore: gpg2:gpg2-lang
+Ignore: util-linux:util-linux-lang
+Ignore: suseRegister:distribution-release
+Ignore: compiz:compiz-decorator
+Ignore: icecream:gcc-c++
+Ignore: no
+Ignore: package
+Ignore: provides
+Ignore: j9vm/libjvm.so()(64bit)
+Ignore: kdepim3:suse_help_viewer
+Ignore: kdebase3-SuSE:kdebase3-SuSE-branding
+Ignore: kio_sysinfo:kdebase3-SuSE-branding
+Ignore: gnome-menus:gnome-menus-branding
+Ignore: epiphany:epiphany-branding
+Ignore: gnome-control-center:gnome-control-center-branding
+Ignore: phonon:phonon-backend
+Ignore: openwbem-devel
+Ignore: MozillaFirefox:MozillaFirefox-branding
+Ignore: yast2:yast2-branding
+Ignore: plymouth:plymouth-branding 
+Ignore: plymouth:suspend
+Ignore: yast2-qt:yast2-branding
+Ignore: yast2-theme-SLE:yast2-branding
+Ignore: yast2-registration:yast2-registration-branding
+Ignore: compiz:compiz-branding
+Ignore: texlive:perl-Tk texlive-bin:perl-Tk
+Ignore: xfce4-desktop:xfce4-desktop-branding
+Ignore: xfce4-panel:xfce4-panel-branding
+Ignore: xfce4-session:xfce4-session-branding
+Ignore: kdebase4-runtime:kdebase4-runtime-branding
+Ignore: kwin:kdebase4-workspace-branding
+Ignore: pulseaudio:kernel
+Ignore: transmission-common:transmission-ui
+Ignore: mutter-moblin:moblin-branding
+Ignore: sysvinit-tools:mkinitrd cifs-utils:mkinitrd
+Ignore: mkinitrd:sbin_init
+Ignore: opensc:pinentry
+Ignore: gpg2:pinentry
+Ignore: NetworkManager:dhcp
+Ignore: NetworkManager:iproute2
+# sysconfig requires it at runtime, not buildtime
+Ignore: sysconfig:dbus-1
+Ignore: sysconfig:procps
+Ignore: sysconfig:iproute2
+Ignore: sysconfig-network:iproute2
+Ignore: sysconfig:tunctl
+# no build dependencies
+Ignore: libksuseinstall1:yast2-packager
+Ignore: libksuseinstall1:zypper
+Ignore: syslog-service:logrotate
+Ignore: libglue-devel:cluster-glue
+Ignore: libqca2:gpg2
+Ignore: NetworkManager:wpa_supplicant
+Ignore: NetworkManager:dhcp-client
+Ignore: libgio-2_0-0:dbus-1-x11
+Ignore: weather-wallpaper:inkscape
+Ignore: libgamin-1-0:gamin-server
+Ignore: libfam0-gamin:gamin-server
+Ignore: python3:python3-pip
+Ignore: avahi:sysvinit(network)
+Ignore: cluster-glue:sysvinit(network)
+
+# RUBY STUFF
+
+%define %_with_ruby21          0
+
+Macros:
+#
+# IMPORTANT IMPORTANT IMPORTANT IMPORTANT  IMPORTANT IMPORTANT
+#
+#  if you change any macros here you have to update the copy in the
+#  ruby-common as well.
+#
+# IMPORTANT IMPORTANT IMPORTANT IMPORTANT  IMPORTANT IMPORTANT
+#
+%rubygem() %{expand:%%{rubygems%rb_build_versions STOP %*}}
+%rubygemsSTOP() %nil
+%rubygemsxSTOP() %{expand:%%rubygemsxxSTOP -a %*}
+%rubygemsxxSTOP(a:) %{-a*}) %*
+
+%rubySTOP() %nil
+%rubyxSTOP() %*
+
+%ruby() %{expand:%%{ruby%rb_build_versions STOP %*}}
+
+%rubydevel() %{expand:%%{rubydevel%rb_build_versions STOP %*}}
+
+%rubydevelSTOP() %nil
+%rubydevelxSTOP() %*
+
+# IMPORTANT IMPORTANT IMPORTANT IMPORTANT  IMPORTANT IMPORTANT
+# if you change any macros here you have to update the copy in the
+# ruby2.1 package as well.
+
+%rubygemsruby21() rubygem(ruby:2.1.0:%{expand:%%rubygemsx%*} %{expand:%%{rubygems%*}}
+%rubygemsxruby21() %{expand:%%{rubygemsx%*}}
+
+%rubyruby21() ruby2.1 %{expand:%%rubyx%*} %{expand:%%{ruby%*}}
+%rubyxruby21() %{expand:%%{rubyx%*}}
+
+%rubydevelruby21() ruby2.1-devel %{expand:%%rubydevelx%*} %{expand:%%{rubydevel%*}}
+%rubydevelxruby21() %{expand:%%{rubydevelx%*}}
+
+%_with_ruby21               1
+
+:Macros
+
+Macros:
+#
+# IMPORTANT IMPORTANT IMPORTANT IMPORTANT  IMPORTANT IMPORTANT
+#
+#  if you change any macros here you have to update the copy in the
+#  prjconf aswell.
+#
+# IMPORTANT IMPORTANT IMPORTANT IMPORTANT  IMPORTANT IMPORTANT
+#
+%rubygemsruby22() rubygem(ruby:2.2.0:%{expand:%%rubygemsx%*} %{expand:%%{rubygems%*}}
+%rubygemsxruby22() %{expand:%%{rubygemsx%*}}
+
+%rubyruby22() ruby2.2 %{expand:%%rubyx%*} %{expand:%%{ruby%*}}
+%rubyxruby22() %{expand:%%{rubyx%*}}
+
+%rubydevelruby22() ruby2.2-devel %{expand:%%rubydevelx%*} %{expand:%%{rubydevel%*}}
+%rubydevelxruby22() %{expand:%%{rubydevelx%*}}
+
+%_with_ruby22               1
+
+:Macros
+
+%define %_with_ruby21          0
+%define rb_default_ruby        ruby22
+%define rb_default_ruby_suffix ruby2.2
+%define rb_default_ruby_abi    ruby:2.2.0
+
+%define rb_build_ruby_abis     ruby:2.1.0 ruby:2.2.0
+%define rb_build_versions      ruby21 ruby22
+Macros:
+%rb_default_ruby        ruby22
+%rb_default_ruby_suffix ruby2.2
+%rb_default_ruby_abi    ruby:2.2.0
+
+%rb_build_ruby_abis     ruby:2.1.0 ruby:2.2.0 
+%rb_build_versions      ruby21 ruby22
+:Macros
+
+Prefer: -ruby-stdlib
+Prefer: %{rb_default_ruby_suffix}-rubygem-gem2rpm
+Prefer: %{rb_default_ruby_suffix}-rubygem-ruby-dbus
+Prefer: %{rb_default_ruby_suffix}-rubygem-yard
+Prefer: %{rb_default_ruby_suffix}-rubygem-rspec
+Prefer: %{rb_default_ruby_suffix}-rubygem-yast-rake
+Prefer: %{rb_default_ruby_suffix}-rubygem-cheetah
+Prefer: %{rb_default_ruby_suffix}-rubygem-inifile
+Prefer: %{rb_default_ruby_suffix}-rubygem-bundler
+Prefer: %{rb_default_ruby_suffix}-rubygem-sass
+
+# END RUBY STUFF
+
+Prefer: java-1_8_0-openjdk java-1_8_0-openjdk-devel
+Prefer: java-1_7_0-openjdk java-1_7_0-openjdk-devel
+
+Prefer: -java-1_5_0-gcj-compat-devel
+%ifarch %ix86 x86_64
+Prefer: -java-1_5_0-ibm-devel
+%endif
+
+Substitute: java2-devel-packages java-1_7_0-openjdk-devel
+
+%ifarch x86_64 ppc64 s390x sparc64
+Substitute: glibc-devel-32bit glibc-devel-32bit glibc-32bit
+%else
+ %ifarch ppc sparc sparcv9
+Substitute: glibc-devel-32bit glibc-devel-64bit
+ %else
+Substitute: glibc-devel-32bit
+ %endif
+%endif
+
+%ifarch %ix86
+Substitute: kernel-binary-packages kernel-default kernel-smp kernel-bigsmp kernel-debug kernel-xen
+%endif
+%ifarch ia64
+Substitute: kernel-binary-packages kernel-default kernel-debug
+%endif
+%ifarch x86_64
+Substitute: kernel-binary-packages kernel-default kernel-smp kernel-xen
+%endif
+%ifarch ppc
+Substitute: kernel-binary-packages kernel-default kernel-ppc64 kernel-ps3
+%endif
+%ifarch ppc64
+Substitute: kernel-binary-packages kernel-default kernel-ppc64
+%endif
+%ifarch s390
+Substitute: kernel-binary-packages kernel-s390
+%endif
+%ifarch s390x
+Substitute: kernel-binary-packages kernel-default
+%endif
+
+# until the builds of the packages are fixed...
+Substitute: yast2-theme-SLED
+Substitute: yast2-theme-SLE
+
+Optflags: i586 -fomit-frame-pointer -fmessage-length=0 -grecord-gcc-switches
+Optflags: i686 -march=i686 -mtune=generic -fomit-frame-pointer -fmessage-length=0 -grecord-gcc-switches
+Optflags: x86_64 -fmessage-length=0 -grecord-gcc-switches
+Optflags: ppc -fmessage-length=0 -grecord-gcc-switches
+Optflags: ppc64 -fmessage-length=0 -grecord-gcc-switches
+Optflags: ia64 -fmessage-length=0 -grecord-gcc-switches
+Optflags: s390 -fmessage-length=0 -grecord-gcc-switches
+Optflags: s390x -fmessage-length=0 -grecord-gcc-switches
+Optflags: armv7l -fmessage-length=0 -grecord-gcc-switches
+Optflags: armv7hl -fmessage-length=0 -grecord-gcc-switches
+Optflags: armv6l -fmessage-length=0 -grecord-gcc-switches
+Optflags: armv6hl -fmessage-length=0 -grecord-gcc-switches
+Optflags: aarch64 -fmessage-length=0 -grecord-gcc-switches
+Optflags: ppc64le -fmessage-length=0 -grecord-gcc-switches
+# need mcpu=ultrasparc to complete sparcv8plus to sparcv9 (adds, for example, atomic ops)
+Optflags: sparcv9 -fmessage-length=0 -grecord-gcc-switches -mcpu=ultrasparc
+Optflags: sparc64 -fmessage-length=0 -grecord-gcc-switches -mcpu=ultrasparc
+%ifarch sparcv9
+Target: sparcv9
+%endif
+%ifarch armv6l armv6hl
+Target: armv6hl-suse-linux
+%endif
+%ifarch armv7l armv7hl
+Target: armv7hl-suse-linux
+%endif
+
+
+Optflags: * -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
+
+%define suse_version 1321
+%define is_opensuse 1
+
+Macros:
+%suse_version 1321
+%is_opensuse 1
+
+%insserv_prereq insserv sed
+%fillup_prereq fillup coreutils grep diffutils
+%suseconfig_fonts_prereq perl aaa_base
+%install_info_prereq info
+%kernel_module_package_buildreq kmod-compat kernel-syms
+%kernel_module_package_buildreqs kmod-compat kernel-syms
+
+%sles_version 0
+%ul_version 0
+%do_profiling 1
+%_vendor suse
+
+# define which gcc package builds the system libraries
+%product_libs_gcc_ver 5
+
+%ext_info .gz
+%ext_man .gz
+
+%info_add(:-:) test -x /sbin/install-info -a -f %{?2}%{?!2:%{_infodir}}/%{1}%ext_info && /sbin/install-info --info-dir=%{?2}%{?!2:%{_infodir}} %{?2}%{?!2:%{_infodir}}/%{1}%ext_info \
+%{nil}
+
+%info_del(:-:) test -x /sbin/install-info -a ! -f %{?2}%{?!2:%{_infodir}}/%{1}%ext_info && /sbin/install-info --quiet --delete --info-dir=%{?2}%{?!2:%{_infodir}} %{?2}%{?!2:%{_infodir}}/%{1}%ext_info \
+%{nil}
+:Macros
+
diff --git a/configs/sl42.1.conf b/configs/sl42.1.conf
new file mode 100644 (file)
index 0000000..b7ddf1c
--- /dev/null
@@ -0,0 +1,784 @@
+%define gcc_version 48
+
+Substitute: kiwi-packagemanager:zypper zypper
+Substitute: kiwi-packagemanager:smart smart
+Substitute: kiwi-packagemanager:instsource kiwi-instsource cdrkit-cdrtools-compat syslinux kiwi-instsource-plugins-openSUSE-13-2
+Substitute: kiwi-filesystem:ext3 e2fsprogs
+Substitute: kiwi-filesystem:ext4 e2fsprogs
+Substitute: kiwi-filesystem:squashfs squashfs
+Substitute: kiwi-filesystem:btrfs btrfsprogs
+Substitute: kiwi-boot:usbboot kiwi
+Substitute: kiwi-boot:isoboot kiwi-desc-isoboot kiwi-desc-isoboot-requires
+Substitute: kiwi-boot:oemboot kiwi-desc-oemboot kiwi-desc-oemboot-requires
+Substitute: kiwi-boot:tbz kiwi-desc-oemboot kiwi-desc-oemboot-requires
+Substitute: kiwi-boot:netboot kiwi-desc-netboot kiwi-desc-netboot-requires
+Substitute: kiwi-boot:vmxboot kiwi-desc-vmxboot kiwi-desc-vmxboot-requires
+Substitute: kiwi-boot:xenboot kiwi-desc-xenboot kiwi-desc-xenboot-requires
+Substitute: kiwi-setup:image kiwi createrepo tar -kiwi-desc-isoboot-requires -kiwi-desc-oemboot-requires -kiwi-desc-netboot-requires -kiwi-desc-vmxboot-requires -kiwi-desc-xenboot-requires
+Conflict: kiwi:libudev-mini1
+Conflict: kiwi:systemd-mini
+Conflict: libudev1:udev-mini
+
+FileProvides: /usr/sbin/groupadd pwdutils
+FileProvides: /usr/sbin/useradd shadow
+FileProvides: /sbin/netconfig sysconfig-netconfig
+FileProvides: /usr/bin/docbook2man docbook-utils
+FileProvides: /usr/bin/mkisofs cdrkit-cdrtools-compat
+FileProvides: /usr/sbin/lockdev lockdev
+FileProvides: /bin/logger util-linux-systemd
+
+# Until input-utils has been formaly removed
+Prefer: -input-utils
+
+Preinstall: aaa_base attr bash coreutils diffutils
+Preinstall: filesystem fillup glibc grep
+Preinstall: libbz2-1 libgcc_s1 m4 libncurses5 pam
+Preinstall: permissions libreadline6 rpm sed tar libz1 libselinux1
+Preinstall: liblzma5 libcap2 libacl1 libattr1
+Preinstall: libpopt0 libelf1 liblua5_1
+Preinstall: libpcre1
+
+Runscripts: aaa_base
+
+Order: libopenssl0_9_8:openssl-certs
+
+Prefer: libdb-4_8-devel
+VMinstall: util-linux libmount1 perl-base libdb-4_8 libsepol1 libblkid1 libuuid1 net-tools libsmartcols1
+
+%ifarch ppc64le
+Constraint: hostlabel PPC64LE_HOST
+%endif
+
+# On qemu arches, kernel-obs-build does not make any sense
+# on ARMv7 you can not boot the kernel as a guest, there is a special
+# guest kernel. Same is true for PPC
+%ifnarch armv6l armv6hl armv7l armv7hl ppc
+VMinstall: kernel-obs-build
+%endif
+
+%ifarch armv6l armv6hl
+Target: armv6hl-suse-linux
+%endif
+%ifarch armv7l armv7hl
+Target: armv7hl-suse-linux
+%endif
+
+%if "%qemu_user_space_build" == "1"
+
+%ifarch aarch64
+Target: aarch64-suse-linux
+%endif
+
+Hostarch: x86_64
+#Constraint: hostlabel QEMU_ARM
+
+Macros:
+%qemu_user_space_build 1
+%_without_mono 1
+%_without_wayland 1
+:Macros
+
+%ifarch armv6l armv6hl
+Preinstall: qemu-linux-user
+%endif
+
+%ifarch aarch64
+Runscripts: qemu-linux-user
+Preinstall: qemu-linux-user
+%endif
+
+%endif
+
+Required: rpm-build
+
+# needed for su's default config - perhaps we should use a simplified form?
+Support: pam-modules
+
+# the basic stuff
+Support: perl build-mkbaselibs
+Support: brp-check-suse post-build-checks
+%ifnarch armv6hl armv6l aarch64
+Support: rpmlint-Factory
+%endif
+
+%ifarch ia64
+Support: libunwind libunwind-devel
+Preinstall: libunwind
+%endif
+
+Prefer: -suse-build-key
+Prefer: krb5-mini krb5-mini-devel
+Conflict: krb5-devel:krb5-mini
+Conflict: krb5:krb5-mini-devel
+Prefer: krb5-mini-devel:krb5-mini
+Prefer: libreadline5
+Prefer: libdb_java-4_8 libicu
+Prefer: cracklib-dict-small postfix
+Prefer: jta fam mozilla mozilla-nss
+Prefer: unixODBC libsoup glitz
+Prefer: gnome-panel desktop-data-openSUSE gnome2-SuSE
+Prefer: mono-nunit gecko-sharp2
+Prefer: apache2-prefork Mesa openmotif-libs ghostscript-mini ghostscript
+Prefer: gtk-sharp2 glib-sharp2 glade-sharp2
+Prefer: libzypp-zmd-backend novell-NLDAPsdk zaptel-kmp-default
+Prefer: hbedv-dazuko-kmp-default dazuko-kmp-default vmware-wkstnmods-kmp-default
+Prefer: virtualbox-kmp-default virtualbox-host-kmp-default
+Prefer: libstdc++6 libgcc_s1 libquadmath0
+Prefer: libstdc++6-32bit libstdc++6-64bit
+Prefer: libstdc++6-x86
+%ifarch s390x
+Prefer: -libstdc++41
+%endif
+Prefer: libstroke
+# for symbol syslog (syslogd is best as it has the least dependencies)
+Prefer: syslog-service syslogd
+Prefer: gnome-sharp2:art-sharp2 gnome-sharp:art-sharp
+Prefer: ifolder3:gnome-sharp2 ifolder3:gconf-sharp2
+Prefer: nautilus-ifolder3:gnome-sharp2 inkscape:gtkmm24
+Prefer: gconf-sharp2:glade-sharp2 gconf-sharp:glade-sharp
+Prefer: gjdoc:antlr-bootstrap
+Prefer: tomboy:gconf-sharp2 tomboy:gnome-sharp2
+Prefer: zmd:libzypp-zmd-backend
+Prefer: yast2-packagemanager-devel:yast2-packagemanager
+Prefer: glitz-32bit:Mesa-32bit
+Prefer: poppler-tools
+Prefer: libjpeg8-devel libjpeg-turbo
+Prefer: banshee:banshee-engine-gst helix-banshee:helix-banshee-engine-gst
+Prefer: banshee-1:banshee-1-client-classic
+Prefer: libfam0
+Prefer: java-1_5_0-ibm:java-1_5_0-ibm-alsa
+Prefer: java-1_5_0-ibm:java-1_5_0-ibm-fonts
+Prefer: java-1_6_0-ibm:java-1_6_0-ibm-fonts
+Prefer: microcode_ctl:kernel-default
+Prefer: notification-daemon
+Prefer: pkg-config gtk-doc wlan-kmp-default lua-libs lua-devel
+Prefer: gnu-jaf classpathx-mail avahi-compat-mDNSResponder yast2-control-center-qt
+Prefer: vim-normal myspell-american wine
+Prefer: eclipse-platform eclipse-scripts
+Prefer: yast2-theme-openSUSE enlightenment-theme-upstream
+Prefer: amarok:amarok-xine
+Prefer: kdenetwork3-vnc:tightvnc
+Prefer: libgweather0 jessie ndesk-dbus ndesk-dbus-glib tomcat-jsp-2_2-api tomcat6-servlet-2_5-api
+Prefer: icewm-lite
+Prefer: patterns-openSUSE-GNOME-cd:banshee
+Prefer: yast2-ncurses-pkg
+Prefer: monodevelop: mono-addins
+Prefer: ant-trax:saxon
+Prefer: gnome-session:gnome-session-branding-openSUSE
+Prefer: gnome-session:gconf2-branding-openSUSE
+Prefer: yast2-qt:yast2-qt-branding-openSUSE
+Prefer: bundle-lang-gnome:gnome-session-branding-openSUSE
+Prefer: fcitx:fcitx-branding-openSUSE
+Prefer: xfce4-notifyd:xfce4-notifyd-branding-upstream
+Prefer: exo-data:exo-branding-upstream
+Prefer: xfce4-settings:xfce4-settings-branding-upstream
+Prefer: xfdesktop:xfdesktop-branding-upstream
+Prefer: texlive-xmltex texlive-tools texlive-jadetex
+Prefer: mono-web:mono-data-sqlite
+Prefer: gnome-games:gnuchess
+Prefer: glchess:gnuchess
+Prefer: libreoffice:libreoffice-branding-upstream
+Prefer: yast2-branding-openSUSE
+Prefer: gimp:gimp-branding-upstream
+Prefer: libesd-devel:esound
+Prefer: libesd0:esound-daemon
+Prefer: package-lists-openSUSE-KDE-cd: esound-daemon
+Prefer: glib2:glib2-branding-upstream
+Prefer: libgio-2_0-0:gio-branding-upstream
+Prefer: libglib-2_0-0:glib2-branding-upstream
+Prefer: kdelibs4:kdelibs4-branding-upstream
+Prefer: kdebase4-workspace:kdebase4-workspace-branding-upstream
+Prefer: kdelibs4-branding:kdelibs4-branding-upstream
+Prefer: PackageKit:PackageKit-branding-upstream
+Prefer: lightdm-gtk-greeter:lightdm-gtk-greeter-branding-upstream
+Prefer: mysql-connector-java:java-1_5_0-gcj-compat
+Prefer: -geronimo-jta-1_0_1B-api -geronimo-jms-1_1-api -geronimo-el-1_0-api
+Prefer: rhino:xmlbeans-mini
+Prefer: ghostscript-devel:ghostscript-library
+Prefer: gdm:gdm-branding-upstream
+Prefer: rpcbind log4j-mini eclipse-source
+Prefer: mx4j:log4j-mini
+Prefer: podsleuth:sg3_utils
+Prefer: libcdio_cdda0 libcdio_paranoia0
+Prefer: mozilla-xulrunner191
+Prefer: mozilla-xulrunner191-32bit
+Prefer: boo tog-pegasus
+Prefer: kde4-kupdateapplet:kde4-kupdateapplet-zypp
+Prefer: kdebase4-workspace:kdebase4-workspace-ksysguardd
+Prefer: ant:xerces-j2
+Prefer: dhcp-client:dhcp
+Prefer: dummy-release
+# provides typelib(St)
+Prefer: -cinnamon
+Prefer: -bundle-lang-kde-de -bundle-lang-kde-en -bundle-lang-kde-es
+Prefer: -bundle-lang-kde-fr -bundle-lang-kde-pt -bundle-lang-kde-el
+Prefer: -bundle-lang-kde-zh -bundle-lang-kde-ja -bundle-lang-kde-ru -bundle-lang-kde-pl
+Prefer: -bundle-lang-kde-sv -bundle-lang-kde-ko -bundle-lang-kde-fi -bundle-lang-kde-da
+Prefer: -bundle-lang-kde-cs -bundle-lang-kde-nl -bundle-lang-kde-hu -bundle-lang-kde-nb
+Prefer: -bundle-lang-kde-it -bundle-lang-kde-ca -bundle-lang-kde-ar
+Prefer: -bundle-lang-gnome-es -bundle-lang-gnome-de -bundle-lang-gnome-fr
+Prefer: -bundle-lang-gnome-pt -bundle-lang-gnome-en -bundle-lang-gnome-el
+Prefer: -bundle-lang-gnome-zh -bundle-lang-gnome-ja -bundle-lang-gnome-ru -bundle-lang-gnome-cs
+Prefer: -bundle-lang-gnome-ko -bundle-lang-gnome-da -bundle-lang-gnome-nl -bundle-lang-gnome-hu
+Prefer: -bundle-lang-gnome-pl -bundle-lang-gnome-fi -bundle-lang-gnome-nb -bundle-lang-gnome-sv
+Prefer: -bundle-lang-gnome-it -bundle-lang-gnome-ca -bundle-lang-gnome-ar
+Prefer: -bundle-lang-gnome-extras-es -bundle-lang-gnome-extras-de -bundle-lang-gnome-extras-fr
+Prefer: -bundle-lang-gnome-extras-pt -bundle-lang-gnome-extras-en -bundle-lang-gnome-extras-el
+Prefer: -bundle-lang-gnome-extras-zh -bundle-lang-gnome-extras-ja -bundle-lang-gnome-extras-ru -bundle-lang-gnome-extras-cs
+Prefer: -bundle-lang-gnome-extras-ko -bundle-lang-gnome-extras-da -bundle-lang-gnome-extras-nl -bundle-lang-gnome-extras-hu
+Prefer: -bundle-lang-gnome-extras-pl -bundle-lang-gnome-extras-fi -bundle-lang-gnome-extras-nb -bundle-lang-gnome-extras-sv
+Prefer: -bundle-lang-gnome-extras-it -bundle-lang-gnome-extras-ca -bundle-lang-gnome-extras-ar
+Prefer: -bundle-lang-common-es -bundle-lang-common-de -bundle-lang-common-fr
+Prefer: -bundle-lang-common-pt -bundle-lang-common-en -bundle-lang-common-el
+Prefer: -bundle-lang-common-ja -bundle-lang-common-zh -bundle-lang-common-cs -bundle-lang-common-ru
+Prefer: -bundle-lang-common-nl -bundle-lang-common-hu -bundle-lang-common-pl -bundle-lang-common-da
+Prefer: -bundle-lang-common-ko -bundle-lang-common-nb -bundle-lang-common-fi -bundle-lang-common-sv
+Prefer: -bundle-lang-common-it -bundle-lang-common-ca -bundle-lang-common-ar
+Prefer: -libgcc-mainline -libstdc++-mainline -gcc-mainline-c++
+Prefer: -libgcj-mainline -viewperf -compat -compat-openssl097g
+Prefer: -zmd -libreoffice -pam-laus -libgcc-tree-ssa -busybox-links
+Prefer: -python-setuptools
+Prefer: -kdenetwork3-InstantMessenger
+Prefer: -icc-profiles
+Prefer: libsocialweb:libsocialweb-branding-upstream
+Prefer: gnome-panel:gnome-panel-branding-upstream
+Prefer: vala
+Prefer: wallpaper-branding-openSUSE
+# in doubt, take xerces
+Prefer: -crimson
+# in doubt, take higher versions
+Prefer: -rubygem-rack-1_1 -rubygem-rack-1_2 -rubygem-rack-1_3 -rubygem-tilt-1_1 -rubygem-rack-1_4
+Prefer: -rubygem-method_source-0_7 -rubygem-rails-2_3 -rubygem-activerecord-2_3
+Prefer: -rubygem-json_pure-1_5
+Prefer: geronimo-servlet-2_4-api
+Prefer: -libhdf5-0-openmpi -libhdf5_hl0-openmpi -libhdf5_hl8-openmpi -libhdf5-8-openmpi
+# for now gstream 0.10 is it
+Prefer: typelib-1_0-Gst-0_10 gstreamer-0_10-utils-unversioned gstreamer-0_10-utils typelib-1_0-GstInterfaces-0_10
+# prefer the small systemd for building
+Prefer: libudev-mini-devel libudev-mini1 udev-debuginfo libudev1-debuginfo
+Prefer: systemd-mini systemd-mini-devel
+Prefer: systemd-mini-devel:systemd-mini
+Prefer: udev-mini libcom_err2-mini libext2fs2-mini
+Prefer: libudev1:udev
+Prefer: xmlgraphics-commons:apache-commons-io
+# the -32bit stuff provides things it shouldn't (hopefully temporary)
+Prefer: -typelib-1_0-GdkPixbuf-2_0-32bit -typelib-1_0-Pango-1_0-32bit
+Prefer: postgresql postgresql-server
+Prefer: -unzip-rcc
+Prefer: -primus -primus-32bit
+Prefer: -staging-build-key
+# ffmpeg and its fork libav both provide libswscale; prefer the 'original' ffmpeg
+Prefer: -libswscale-libav-devel -libavformat-libav-devel -libavresample-libav-devel -libavcodec-libav-devel
+Prefer: oxygen5-cursors
+Prefer: -opencv-qt5-devel
+Prefer: libopenssl-devel
+
+# kernel bug (coolo)
+Prefer: kernel-default-devel
+
+Prefer: wxWidgets-2_9-devel
+
+Prefer: -NX -xaw3dd -db43
+Prefer: -xerces-j2-xml-resolver -xerces-j2-xml-apis
+Prefer: -vmware-player
+Prefer: libgcc_s1 libgcc_s1-32bit libgcc_s1-64bit
+Prefer: -libgcj_bc1-gcc49 
+Prefer: libitm1 libitm1-32bit libatomic1 libatomic1-32bit libtsan0 libtsan0-32bit
+Prefer: libgcc_s1-x86 libffi4 libgcj_bc1 libffi%{gcc_version}-devel
+Prefer: libffi4-32bit libffi4-64bit
+Prefer: libgomp1 libgomp1-32bit libgomp1-64bit
+Prefer: libmudflap4 libmudflap4-32bit libmudflap4-64bit
+Prefer: libobjc4 libgfortran3 libquadmath0
+Prefer: -libnetpbm -libcdio7-mini -libiso9660-5-mini -libiso9660-7-mini -libcdio10-mini -libcdio12-mini
+Prefer: -libcdio-mini -faac-mini -libcdio-mini-devel
+Prefer: -seamonkey
+Prefer: -libdb-4_4-devel -libdb-4_5-devel -libevoldap-2_4-2
+Prefer: libopenal0-soft openal-soft -lsb-buildenv
+Prefer: -libevent
+Prefer: gnu-crypto libusb-compat-devel
+Prefer: libusb-0_1-4
+Prefer: CASA_auth_token_svc:xerces-j2
+Prefer: libreoffice:xerces-j2
+Prefer: k3b:libdvdread4
+Prefer: glibc-devel
+Prefer: -libpcap -libiniparser -loudmouth -libkonq4 -libnetcdf-4 -java-1_7_0-openjdk-javadoc -java-1_7_0-icedtea-javadoc
+Prefer: -java-1_7_0-icedtea-devel
+Prefer: NetworkManager:dhcp-client
+Prefer: kdebase3-SuSE:kdebase3
+Prefer: kde4-kdm:kde4-kdm-branding-upstream
+Prefer: kdm:kdm-branding-upstream
+Prefer: pcre-tools
+Prefer: libpopt0
+Prefer: -apache2-mod_perl -otrs -qa_apache_testsuite -ctcs2
+Prefer: libgnome-keyring-devel
+Prefer: linux-glibc-devel
+Prefer: squid sysvinit
+Prefer: libpng16-compat-devel
+Prefer: -python3 -python3-gobject-devel -python3-gobject2-devel -x11-video-fglrxG02 -libpng12-0
+Prefer: perl-Mail-SPF:perl-Error libldb0 -audit-libs mysql-community-server mysql-community-server-client
+#needed because new xml-commons package
+Prefer: xml-commons-resolver12 xml-commons-jaxp-1.3-apis
+Prefer: xmlgraphics-fop:xerces-j2
+Prefer: libxfce4ui:libxfce4ui-branding-upstream
+Prefer: libgarcon-1-0:libgarcon-branding-upstream
+Prefer: libgarcon-data:libgarcon-branding-upstream
+Prefer: libexo-1-0:libexo-1-0-branding-upstream
+Prefer: gnome-shell:mozilla-js20
+Prefer: cogl-devel
+Prefer: -perl-XML-SAX
+Prefer: gettext-tools-mini gettext-runtime-mini
+# choice p11-kit-nss-trust
+Prefer: mozilla-nss-certs
+# amarok dependency resolution
+Prefer: phonon-backend-gstreamer
+# replacing mkinitrd
+Prefer: dracut
+# replacing module-init-tools
+Prefer: kmod-compat
+# Temporary
+Prefer: oxygen-cursors4
+# Temporary
+Prefer: -perl-App-cpanminus
+# wireshark has now split off the ui. qt is considered experimental 2014-08-09
+Prefer: wireshark-ui-gtk
+Prefer: plasma5-workspace-branding-upstream
+
+# comes in two flavors
+Prefer: -libhdf5-10-openmpi -libhdf5_hl10-openmpi
+
+Ignore: installation-images-openSUSE:cracklib-dict-full
+Ignore: java-1_7_0-openjdk:mozilla-nss
+Ignore: java-1_7_0-openjdk:java-ca-certificates
+Ignore: openSUSE-release:openSUSE-release-ftp,openSUSE-release-dvd5,openSUSE-release-biarch,openSUSE-release-livecdkde,openSUSE-release-livecdgnome
+Ignore: cracklib:cracklib-dict
+Ignore: aaa_base:aaa_skel,suse-release,logrotate,ash,distribution-release,udev
+Ignore: sysvinit:mingetty
+Ignore: gettext-tools:libgcj,libstdc++-devel,libgcj41,libstdc++41-devel,libgcj42,libstdc++42-devel
+Ignore: libgcj43,libstdc++43-devel
+Ignore: libgcj44,libstdc++44-devel
+Ignore: libgcj45,libstdc++45-devel
+Ignore: libgcj46,libstdc++46-devel
+Ignore: libgcj47,libstdc++47-devel
+Ignore: pwdutils:openslp
+Ignore: pam-modules:resmgr
+Ignore: rpm:suse-build-key,build-key
+Ignore: bind-utils:bind-libs
+Ignore: alsa:dialog,pciutils
+Ignore: portmap:syslogd
+Ignore: xorg-x11:x11-tools,resmgr,xkeyboard-config,xorg-x11-Mesa,libusb,freetype2,libjpeg,libpng
+Ignore: xorg-x11-server:xorg-x11-driver-input,xorg-x11-driver-video
+Ignore: apache2:logrotate
+Ignore: arts:alsa,audiofile,resmgr,libogg,libvorbis
+Ignore: kdelibs3:alsa,arts,OpenEXR,aspell,cups-libs,mDNSResponder-lib,krb5,libjasper
+Ignore: kdelibs3-devel:libvorbis-devel
+Ignore: kdebase3:kdebase3-ksysguardd,OpenEXR,dbus-1,dbus-1-qt,hal,powersave,openslp,libusb
+Ignore: kdebase3-SuSE:release-notes
+Ignore: jack:alsa,libsndfile
+Ignore: libxml2-devel:readline-devel
+Ignore: gnome-vfs2:gnome-mime-data,desktop-file-utils,cdparanoia,dbus-1,dbus-1-glib,hal,libsmbclient,fam,file_alteration
+Ignore: libgda:file_alteration
+Ignore: gnutls:lzo,libopencdk
+Ignore: gnutls-devel:lzo-devel,libopencdk-devel
+Ignore: pango:cairo,glitz,libpixman,libpng
+Ignore: pango-devel:cairo-devel
+Ignore: cairo-devel:libpixman-devel
+Ignore: libgnomeprint:libgnomecups
+Ignore: libgnomeprintui:libgnomecups
+Ignore: orbit2-devel:indent
+Ignore: qt3:libmng
+Ignore: qt-sql:qt_database_plugin
+Ignore: gtk2:libpng,libtiff
+Ignore: libgnomecanvas-devel:glib-devel
+Ignore: libgnomeui:gnome-icon-theme,shared-mime-info
+Ignore: scrollkeeper:docbook_4
+Ignore: gnome-desktop:libgnomesu,startup-notification
+Ignore: python-devel:python-tk
+Ignore: gnome-pilot:gnome-panel
+Ignore: gnome-panel:control-center2
+Ignore: gnome-menus:kdebase3
+Ignore: gnome-main-menu:rug
+Ignore: libgtk-3-0:adwaita-icon-theme
+Ignore: libbonoboui:gnome-desktop
+Ignore: libxfce4ui-1-0:exo-tools
+Ignore: docbook_4:iso_ent,xmlcharent
+Ignore: control-center2:nautilus,evolution-data-server,gnome-menus,gstreamer-plugins,gstreamer,metacity,mozilla-nspr,mozilla,libxklavier,gnome-desktop,startup-notification
+Ignore: docbook-xsl-stylesheets:xmlcharent
+Ignore: liby2util-devel:libstdc++-devel,openssl-devel
+Ignore: yast2:yast2-ncurses,yast2_theme,perl-Config-Crontab,yast2-xml,SuSEfirewall2
+Ignore: yast2-core:netcat,hwinfo,wireless-tools,sysfsutils
+Ignore: yast2-core-devel:libxcrypt-devel,hwinfo-devel,blocxx-devel,sysfsutils,libstdc++-devel
+Ignore: yast2-packagemanager-devel:rpm-devel,curl-devel,openssl-devel
+Ignore: yast2-devtools:libxslt
+Ignore: yast2-iscsi-lio-server:lio-utils
+Ignore: yast2-installation:yast2-update,yast2-mouse,yast2-country,yast2-bootloader,yast2-packager,yast2-network,yast2-online-update,yast2-users,release-notes,autoyast2-installation
+Ignore: yast2-bootloader:bootloader-theme
+Ignore: yast2-packager:yast2-x11,libyui_pkg
+Ignore: autoyast2:yast2-schema
+# not during build
+Ignore: yui_backend
+Ignore: yast2-x11:sax2-libsax-perl
+Ignore: yast2-network:yast2-inetd
+Ignore: openslp-devel:openssl-devel
+Ignore: java-1_4_2-sun:xorg-x11-libs
+Ignore: java-1_4_2-sun-devel:xorg-x11-libs
+Ignore: tetex:xorg-x11-libs,expat,fontconfig,freetype2,libjpeg,ghostscript-x11,xaw3d,gd,dialog,ed
+Ignore: texlive-bin:ghostscript-x11
+Ignore: texlive-bin-omega:ghostscript-x11
+Ignore: yast2-country:yast2-trans-stats
+Ignore: tpb:tpctl-kmp
+Ignore: tpctl:tpctl-kmp
+Ignore: zaptel:zaptel-kmp
+Ignore: mkinitrd:pciutils
+Ignore: pciutils:pciutils-ids
+Ignore: postfix:iproute2
+Ignore: aaa_base:systemd
+Ignore: gpm:systemd
+Ignore: ConsoleKit:systemd
+Ignore: openssh:systemd
+Ignore: cronie:systemd
+Ignore: systemd:kbd
+Ignore: systemd:kmod
+Ignore: systemd:systemd-presets-branding
+Ignore: systemd:dbus-1
+Ignore: systemd:pam-config
+Ignore: systemd:udev
+Ignore: pesign:systemd
+Ignore: systemd-mini:this-is-only-for-build-envs
+Ignore: udev-mini:this-is-only-for-build-envs
+Ignore: libudev-mini1:this-is-only-for-build-envs
+Ignore: jdk-bootstrap:this-is-only-for-build-envs
+Ignore: polkit:ConsoleKit
+Ignore: logrotate:cron
+Ignore: texlive-filesystem:cron
+Ignore: xinit:xterm
+Ignore: xdm:xterm
+Ignore: gnome-control-center:gnome-themes-accessibility
+Ignore: coreutils:info
+Ignore: cpio:info
+Ignore: diffutils:info
+Ignore: findutils:info
+Ignore: gawk:info
+Ignore: grep:info
+Ignore: groff:info
+Ignore: m4:info
+Ignore: sed:info
+Ignore: tar:info
+Ignore: util-linux:info
+Ignore: gettext-tools:info
+Ignore: gettext-runtime:info
+Ignore: libgcrypt-devel:info
+Ignore: binutils:info
+Ignore: gzip:info
+Ignore: make:info
+Ignore: bison:info
+Ignore: flex:info
+Ignore: help2man:info
+Ignore: man:groff-full
+Ignore: git-core:rsync
+Ignore: apache2:systemd
+Ignore: icewm-lite:icewm
+Ignore: cluster-glue:sudo
+
+Ignore: libgcc:glibc-32bit
+Ignore: libgcc41:glibc-32bit
+Ignore: libgcc42:glibc-32bit
+Ignore: libgcc43:glibc-32bit
+Ignore: libgcc44:glibc-32bit
+Ignore: libgcc45:glibc-32bit
+Ignore: libgcc46:glibc-32bit
+Ignore: libgcc47:glibc-32bit
+Ignore: libstdc++:glibc-32bit
+Ignore: libstdc41++:glibc-32bit
+Ignore: libstdc42++:glibc-32bit
+Ignore: libstdc43++:glibc-32bit
+Ignore: libstdc44++:glibc-32bit
+Ignore: libstdc45++:glibc-32bit
+Ignore: libstdc46++:glibc-32bit
+Ignore: libstdc47++:glibc-32bit
+Ignore: ncurses-32bit
+
+Ignore: susehelp:susehelp_lang,suse_help_viewer
+Ignore: mailx:smtp_daemon
+Ignore: cron:smtp_daemon
+Ignore: hotplug:syslog
+Ignore: pcmcia:syslog
+Ignore: openct:syslog
+Ignore: postfix:sysvinit(syslog)
+Ignore: cups:sysvinit(syslog)
+Ignore: avalon-logkit:servlet
+Ignore: jython:servlet
+Ignore: ispell:ispell_dictionary,ispell_english_dictionary
+Ignore: aspell:aspel_dictionary,aspell_dictionary
+Ignore: smartlink-softmodem:kernel,kernel-nongpl
+Ignore: libreoffice-de:myspell-german-dictionary
+Ignore: libreoffice:libreoffice-i18n
+Ignore: libreoffice:libreoffice-icon-themes
+Ignore: mediawiki:php-session,php-gettext,php-zlib,php-mysql,mod_php_any
+Ignore: squirrelmail:mod_php_any,php-session,php-gettext,php-iconv,php-mbstring,php-openssl
+Ignore: perl-Log-Log4perl:rrdtool
+
+Ignore: simias:mono(log4net)
+Ignore: zmd:mono(log4net)
+Ignore: horde:mod_php_any,php-gettext,php-mcrypt,php-imap,php-pear-log,php-pear,php-session,php
+
+Ignore: xerces-j2:xml-commons-apis,xml-commons-resolver
+Ignore: xdg-menu:desktop-data
+Ignore: nessus-libraries:nessus-core
+Ignore: evolution:yelp
+Ignore: e17:e17-branding e17:e17-theme
+
+Ignore: mono-tools:mono(gconf-sharp),mono(glade-sharp),mono(gnome-sharp),mono(gtkhtml-sharp),mono(atk-sharp),mono(gdk-sharp),mono(glib-sharp),mono(gtk-sharp),mono(pango-sharp)
+Ignore: gecko-sharp2:mono(glib-sharp),mono(gtk-sharp)
+
+Ignore: vcdimager:libcdio.so.6,libcdio.so.6(CDIO_6),libiso9660.so.4,libiso9660.so.4(ISO9660_4)
+Ignore: libcdio:libcddb.so.2
+
+Ignore: gnome-libs:libgnomeui
+Ignore: nautilus:gnome-themes
+Ignore: gnome-panel:gnome-themes
+Ignore: gnome-panel:tomboy
+Ignore: NetworkManager:NetworkManager-client
+Ignore: libbeagle:beagle
+Ignore: coreutils:coreutils-lang
+Ignore: cpio:cpio-lang
+Ignore: glib2:glib2-lang
+Ignore: gtk2:gtk2-lang
+Ignore: gtk:gtk-lang
+Ignore: atk:atk-lang
+Ignore: hal:pm-utils
+Ignore: MozillaThunderbird:pinentry-dialog
+Ignore: seamonkey:pinentry-dialog
+Ignore: pinentry:pinentry-dialog
+Ignore: gpg2:gpg2-lang
+Ignore: util-linux:util-linux-lang
+Ignore: suseRegister:distribution-release
+Ignore: compiz:compiz-decorator
+Ignore: icecream:gcc-c++
+Ignore: no
+Ignore: package
+Ignore: provides
+Ignore: j9vm/libjvm.so()(64bit)
+Ignore: kdepim3:suse_help_viewer
+Ignore: kdebase3-SuSE:kdebase3-SuSE-branding
+Ignore: kio_sysinfo:kdebase3-SuSE-branding
+Ignore: gnome-menus:gnome-menus-branding
+Ignore: epiphany:epiphany-branding
+Ignore: gnome-control-center:gnome-control-center-branding
+Ignore: phonon:phonon-backend
+Ignore: openwbem-devel
+Ignore: MozillaFirefox:MozillaFirefox-branding
+Ignore: yast2:yast2-branding
+Ignore: plymouth:plymouth-branding 
+Ignore: plymouth:suspend
+Ignore: yast2-qt:yast2-branding
+Ignore: yast2-theme-SLE:yast2-branding
+Ignore: yast2-registration:yast2-registration-branding
+Ignore: compiz:compiz-branding
+Ignore: texlive:perl-Tk texlive-bin:perl-Tk
+Ignore: xfce4-desktop:xfce4-desktop-branding
+Ignore: xfce4-panel:xfce4-panel-branding
+Ignore: xfce4-session:xfce4-session-branding
+Ignore: kdebase4-runtime:kdebase4-runtime-branding
+Ignore: kwin:kdebase4-workspace-branding
+Ignore: pulseaudio:kernel
+Ignore: transmission-common:transmission-ui
+Ignore: mutter-moblin:moblin-branding
+Ignore: sysvinit-tools:mkinitrd cifs-utils:mkinitrd
+Ignore: mkinitrd:sbin_init
+Ignore: opensc:pinentry
+Ignore: gpg2:pinentry
+Ignore: NetworkManager:dhcp
+Ignore: NetworkManager:iproute2
+# sysconfig requires it at runtime, not buildtime
+Ignore: sysconfig:dbus-1
+Ignore: sysconfig:procps
+Ignore: sysconfig:iproute2
+Ignore: sysconfig-network:iproute2
+Ignore: sysconfig:tunctl
+# no build dependencies
+Ignore: libksuseinstall1:yast2-packager
+Ignore: libksuseinstall1:zypper
+Ignore: syslog-service:logrotate
+Ignore: libglue-devel:cluster-glue
+Ignore: libqca2:gpg2
+Ignore: NetworkManager:wpa_supplicant
+Ignore: NetworkManager:dhcp-client
+Ignore: libgio-2_0-0:dbus-1-x11
+Ignore: weather-wallpaper:inkscape
+Ignore: libgamin-1-0:gamin-server
+Ignore: libfam0-gamin:gamin-server
+Ignore: python3:python3-pip
+Ignore: avahi:sysvinit(network)
+Ignore: cluster-glue:sysvinit(network)
+
+Prefer: java-1_7_0-openjdk java-1_7_0-openjdk-devel
+
+Prefer: -java-1_5_0-gcj-compat-devel
+%ifarch %ix86 x86_64
+Prefer: -java-1_5_0-ibm-devel
+%endif
+
+Substitute: java2-devel-packages java-1_7_0-openjdk-devel
+
+%ifarch x86_64 ppc64 s390x sparc64
+Substitute: glibc-devel-32bit glibc-devel-32bit glibc-32bit
+%else
+ %ifarch ppc sparc sparcv9
+Substitute: glibc-devel-32bit glibc-devel-64bit
+ %else
+Substitute: glibc-devel-32bit
+ %endif
+%endif
+
+%ifarch %ix86
+Substitute: kernel-binary-packages kernel-default kernel-smp kernel-bigsmp kernel-debug kernel-xen
+%endif
+%ifarch ia64
+Substitute: kernel-binary-packages kernel-default kernel-debug
+%endif
+%ifarch x86_64
+Substitute: kernel-binary-packages kernel-default kernel-smp kernel-xen
+%endif
+%ifarch ppc
+Substitute: kernel-binary-packages kernel-default kernel-ppc64 kernel-ps3
+%endif
+%ifarch ppc64
+Substitute: kernel-binary-packages kernel-default kernel-ppc64
+%endif
+%ifarch s390
+Substitute: kernel-binary-packages kernel-s390
+%endif
+%ifarch s390x
+Substitute: kernel-binary-packages kernel-default
+%endif
+
+# until the builds of the packages are fixed...
+Substitute: yast2-theme-SLED
+Substitute: yast2-theme-SLE
+
+Optflags: i586 -fomit-frame-pointer -fmessage-length=0 -grecord-gcc-switches
+Optflags: i686 -march=i686 -mtune=generic -fomit-frame-pointer -fmessage-length=0 -grecord-gcc-switches
+Optflags: x86_64 -fmessage-length=0 -grecord-gcc-switches
+Optflags: ppc -fmessage-length=0 -grecord-gcc-switches
+Optflags: ppc64 -fmessage-length=0 -grecord-gcc-switches
+Optflags: ppc64le -fmessage-length=0 -grecord-gcc-switches
+Optflags: ia64 -fmessage-length=0 -grecord-gcc-switches
+Optflags: s390 -fmessage-length=0 -grecord-gcc-switches
+Optflags: s390x -fmessage-length=0 -grecord-gcc-switches
+Optflags: armv6l -fmessage-length=0 -grecord-gcc-switches
+Optflags: armv6hl -fmessage-length=0 -grecord-gcc-switches
+Optflags: armv7l -fmessage-length=0 -grecord-gcc-switches
+Optflags: armv7hl -fmessage-length=0 -grecord-gcc-switches
+Optflags: aarch64 -fmessage-length=0 -grecord-gcc-switches
+# need mcpu=ultrasparc to complete sparcv8plus to sparcv9 (adds, for example, atomic ops)
+Optflags: sparcv9 -fmessage-length=0 -grecord-gcc-switches -mcpu=ultrasparc
+Optflags: sparc64 -fmessage-length=0 -grecord-gcc-switches -mcpu=ultrasparc
+%ifarch sparcv9
+Target: sparcv9
+%endif
+
+Optflags: * -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables
+
+
+%define sle_version 120100
+%define suse_version 1315
+%define is_opensuse 1
+
+Macros:
+%sle_version 120100
+%suse_version 1315
+%is_opensuse 1
+:Macros
+
+%define _without_mono 1
+%define _without_wayland 1
+%define _without_vlc 1
+%define _without_compat_libs 1
+
+%define _with_ruby21 1
+
+%define rb_default_ruby        ruby21
+%define rb_default_ruby_suffix ruby2.1
+%define rb_default_ruby_abi    ruby:2.1.0
+
+%define rb_build_ruby_abis     ruby:2.1.0
+%define rb_build_versions      ruby21
+
+#Prefer: rubygem(%{rb_default_ruby_abi}:gem2rpm)
+Prefer: %{rb_default_ruby_suffix}-rubygem-gem2rpm
+Prefer: %{rb_default_ruby_suffix}-rubygem-rack
+
+Macros:
+%insserv_prereq insserv sed
+%fillup_prereq fillup coreutils grep diffutils
+%suseconfig_fonts_prereq perl aaa_base
+%install_info_prereq info
+%kernel_module_package_buildreq kmod-compat kernel-syms
+%kernel_module_package_buildreqs kmod-compat kernel-syms
+
+%sles_version 0
+%ul_version 0
+%do_profiling 1
+%opensuse_bs 1
+%_without_mono 1
+%_without_vlc 1
+%_without_compat_libs 1
+%_with_ruby21 1
+%rb_default_ruby        ruby21
+%rb_default_ruby_suffix ruby2.1
+%rb_default_ruby_abi    ruby:2.1.0
+
+%rb_build_ruby_abis     ruby:2.1.0
+%rb_build_versions      ruby21
+
+%rubygemsruby21() rubygem(ruby:2.1.0:%{expand:%%rubygemsx%*} %{expand:%%{rubygems%*}}
+%rubygemsxruby21() %{expand:%%{rubygemsx%*}}
+#
+%rubygemsruby22() rubygem(ruby:2.2.0:%{expand:%%rubygemsx%*} %{expand:%%{rubygems%*}}
+%rubygemsxruby22() %{expand:%%{rubygemsx%*}}
+#
+%rubygem() %{expand:%%{rubygems%rb_build_versions STOP %*}}
+%rubygemsSTOP() %nil
+%rubygemsxSTOP() %{expand:%%rubygemsxxSTOP -a %*}
+%rubygemsxxSTOP(a:) %{-a*}) %*
+#
+%rubyruby21() ruby2.1 %{expand:%%rubyx%*} %{expand:%%{ruby%*}}
+%rubyxruby21() %{expand:%%{rubyx%*}}
+#
+%rubyruby22() ruby2.2 %{expand:%%rubyx%*} %{expand:%%{ruby%*}}
+%rubyxruby22() %{expand:%%{rubyx%*}}
+#
+%rubySTOP() %nil
+%rubyxSTOP() %*
+#
+%ruby() %{expand:%%{ruby%rb_build_versions STOP %*}}
+#
+%rubydevelruby21() ruby2.1-devel %{expand:%%rubydevelx%*} %{expand:%%{rubydevel%*}}
+%rubydevelxruby21() %{expand:%%{rubydevelx%*}}
+#
+%rubydevelruby22() ruby2.2-devel %{expand:%%rubydevelx%*} %{expand:%%{rubydevel%*}}
+%rubydevelxruby22() %{expand:%%{rubydevelx%*}}
+#
+%rubydevel() %{expand:%%{rubydevel%rb_build_versions STOP %*}}
+#
+%rubydevelSTOP() %nil
+%rubydevelxSTOP() %*
+
+%_vendor suse
+
+# define which gcc package builds the system libraries
+%product_libs_gcc_ver_libasan0 48
+%product_lifiullbs_gcc_ver_libgcj_bc1 48
+%product_libs_gcc_ver_libobjc4 48
+%product_libs_gcc_ver 5
+
+
+%ext_info .gz
+%ext_man .gz
+
+%info_add(:-:) test -x /sbin/install-info -a -f %{?2}%{?!2:%{_infodir}}/%{1}%ext_info && /sbin/install-info --info-dir=%{?2}%{?!2:%{_infodir}} %{?2}%{?!2:%{_infodir}}/%{1}%ext_info \
+%{nil}
+
+%info_del(:-:) test -x /sbin/install-info -a ! -f %{?2}%{?!2:%{_infodir}}/%{1}%ext_info && /sbin/install-info --quiet --delete --info-dir=%{?2}%{?!2:%{_infodir}} %{?2}%{?!2:%{_infodir}}/%{1}%ext_info \
+%{nil}
+
diff --git a/configs/ubuntu.conf b/configs/ubuntu.conf
new file mode 100644 (file)
index 0000000..e383e60
--- /dev/null
@@ -0,0 +1,233 @@
+
+Repotype: debian
+
+Preinstall: bash sed grep coreutils debianutils
+Preinstall: libc6 libncurses5 libacl1 libattr1 libpcre3
+Preinstall: libreadline6 tar gawk dpkg libc-bin
+Preinstall: sysv-rc init-system-helpers
+Preinstall: gzip base-files base-passwd
+Preinstall: readline-common libselinux1 libsepol1
+Preinstall: libgcc1 util-linux debconf tzdata findutils upstart libdbus-1-3
+Preinstall: liblzma5 xz-utils libstdc++6 passwd libnih1 libnih-dbus1
+Preinstall: login zlib1g libbz2-1.0 libtinfo5 libsigsegv2 
+Preinstall: dash insserv libmpfr4 libgmp10 libdebconfclient0
+Preinstall: perl-base perl libperl5.22
+
+Order: libc6:libc-bin
+Order: base-files:screen
+Order: base-files:initscripts
+Order: initscripts:util-linux
+Order: sysv-rc:hostname
+Order: sysv-rc:kmod
+
+Runscripts: gawk
+
+Runscripts: base-files base-passwd passwd sysv-rc
+
+VMinstall: binutils libblkid1 libuuid1 mount libmount1 libsmartcols1
+%ifarch ppc64le
+# for LE switch
+VMinstall: kernel-obs-build
+%endif
+
+Substitute: snapcraft-plugin:kbuild snapcraft
+Prefer: -sudo-ldap
+
+Required: autoconf automake binutils bzip2 gcc gettext libc6
+Required: libtool libncurses5 perl zlib1g dpkg
+Required: build-essential
+
+Support: fakeroot
+Support: bison cpio cvs login
+Support: file findutils flex diffutils
+Support: groff-base gzip hostname info less
+Support: make man sysv-rc
+Support: net-tools
+Support: patch procps psmisc strace
+Support: unzip vim ncurses-base
+Support: locales upstart-compat-sysv
+Support: mount
+# module-init-tools texinfo
+
+# circular dependendencies in openjdk stack
+Order: openjdk-6-jre-lib:openjdk-6-jre-headless
+Order: openjdk-6-jre-headless:ca-certificates-java
+
+Order: base-files:glibc
+Order: dpkg:gawk
+
+# Workaround for missing prerequires:
+Preinstall: initramfs-tools initscripts
+Support: initramfs-tools initscripts
+
+Keep: binutils cpp file findutils gawk gcc gcc-ada gcc-c++
+Keep: gzip libada libstdc++ libunwind
+Keep: libunwind-devel libzio make pam-devel pam-modules
+Keep: patch perl timezone
+Keep: m4 dpkg dpkg-dev perl-modules libdpkg-perl
+
+Prefer: gawk libdb-dev
+Prefer: xorg-x11-libs libpng fam mozilla mozilla-nss xorg-x11-Mesa
+Prefer: unixODBC libsoup glitz java-1_4_2-sun gnome-panel
+Prefer: desktop-data-SuSE gnome2-SuSE mono-nunit gecko-sharp2
+Prefer: apache2-prefork openmotif-libs ghostscript-mini gtk-sharp
+Prefer: glib-sharp libzypp-zmd-backend mDNSResponder
+
+Prefer: gnome-sharp2:art-sharp2 gnome-sharp:art-sharp
+Prefer: ifolder3:gnome-sharp2 ifolder3:gconf-sharp2
+Prefer: nautilus-ifolder3:gnome-sharp2
+Prefer: gconf-sharp2:glade-sharp2 gconf-sharp:glade-sharp
+Prefer: tomboy:gconf-sharp tomboy:gnome-sharp
+Prefer: zmd:libzypp-zmd-backend
+Prefer: yast2-packagemanager-devel:yast2-packagemanager
+Prefer: default-jdk
+
+Prefer: -libgcc-mainline -libstdc++-mainline -gcc-mainline-c++
+Prefer: -libgcj-mainline -viewperf -compat -compat-openssl097g
+Prefer: -zmd -OpenOffice_org -pam-laus -libgcc-tree-ssa -busybox-links
+Prefer: -crossover-office -libjack-dev
+Prefer: -libjpeg-turbo8-dev -libblas3gf
+Prefer: -make-guile
+
+# double packages in universe
+Prefer: -pkgconf
+
+Conflict: ghostscript-library:ghostscript-mini
+
+Ignore: upstart:ifupdown
+Ignore: aaa_base:aaa_skel,suse-release,logrotate,ash,mingetty,distribution-release
+Ignore: gettext-devel:libgcj,libstdc++-devel
+Ignore: pwdutils:openslp
+Ignore: pam-modules:resmgr
+Ignore: rpm:suse-build-key,build-key
+Ignore: bind-utils:bind-libs
+Ignore: alsa:dialog,pciutils
+Ignore: portmap:syslogd
+Ignore: fontconfig:freetype2
+Ignore: fontconfig-devel:freetype2-devel
+Ignore: initramfs-tools:udev
+Ignore: mountall:udev
+Ignore: mountall:plymouth
+Ignore: xorg-x11-libs:freetype2
+Ignore: xorg-x11:x11-tools,resmgr,xkeyboard-config,xorg-x11-Mesa,libusb,freetype2,libjpeg,libpng
+Ignore: apache2:logrotate
+Ignore: arts:alsa,audiofile,resmgr,libogg,libvorbis
+Ignore: kdelibs3:alsa,arts,pcre,OpenEXR,aspell,cups-libs,mDNSResponder,krb5,libjasper
+Ignore: kdelibs3-devel:libvorbis-devel
+Ignore: kdebase3:kdebase3-ksysguardd,OpenEXR,dbus-1,dbus-1-qt,hal,powersave,openslp,libusb
+Ignore: kdebase3-SuSE:release-notes
+Ignore: jack:alsa,libsndfile
+Ignore: libxml2-devel:readline-devel
+Ignore: gnome-vfs2:gnome-mime-data,desktop-file-utils,cdparanoia,dbus-1,dbus-1-glib,krb5,hal,libsmbclient,fam,file_alteration
+Ignore: libgda:file_alteration
+Ignore: gnutls:lzo,libopencdk
+Ignore: gnutls-devel:lzo-devel,libopencdk-devel
+Ignore: pango:cairo,glitz,libpixman,libpng
+Ignore: pango-devel:cairo-devel
+Ignore: cairo-devel:libpixman-devel
+Ignore: libgnomeprint:libgnomecups
+Ignore: libgnomeprintui:libgnomecups
+Ignore: orbit2:libidl
+Ignore: orbit2-devel:libidl,libidl-devel,indent
+Ignore: qt3:libmng
+Ignore: qt-sql:qt_database_plugin
+Ignore: gtk2:libpng,libtiff
+Ignore: libgnomecanvas-devel:glib-devel
+Ignore: libgnomeui:gnome-icon-theme,shared-mime-info
+Ignore: scrollkeeper:docbook_4,sgml-skel
+Ignore: gnome-desktop:libgnomesu,startup-notification
+Ignore: python-devel:python-tk
+Ignore: gnome-pilot:gnome-panel
+Ignore: gnome-panel:control-center2
+Ignore: gnome-menus:kdebase3
+Ignore: gnome-main-menu:rug
+Ignore: libbonoboui:gnome-desktop
+Ignore: postfix:pcre
+Ignore: docbook_4:iso_ent,sgml-skel,xmlcharent
+Ignore: control-center2:nautilus,evolution-data-server,gnome-menus,gstreamer-plugins,gstreamer,metacity,mozilla-nspr,mozilla,libxklavier,gnome-desktop,startup-notification
+Ignore: docbook-xsl-stylesheets:xmlcharent
+Ignore: liby2util-devel:libstdc++-devel,openssl-devel
+Ignore: yast2:yast2-ncurses,yast2-theme-SuSELinux,perl-Config-Crontab,yast2-xml,SuSEfirewall2
+Ignore: yast2-core:netcat,hwinfo,wireless-tools,sysfsutils
+Ignore: yast2-core-devel:libxcrypt-devel,hwinfo-devel,blocxx-devel,sysfsutils,libstdc++-devel
+Ignore: yast2-packagemanager-devel:rpm-devel,curl-devel,openssl-devel
+Ignore: yast2-devtools:perl-XML-Writer,libxslt,pkgconfig
+Ignore: yast2-installation:yast2-update,yast2-mouse,yast2-country,yast2-bootloader,yast2-packager,yast2-network,yast2-online-update,yast2-users,release-notes,autoyast2-installation
+Ignore: yast2-bootloader:bootloader-theme
+Ignore: yast2-packager:yast2-x11
+Ignore: yast2-x11:sax2-libsax-perl
+Ignore: openslp-devel:openssl-devel
+Ignore: java-1_4_2-sun:xorg-x11-libs
+Ignore: java-1_4_2-sun-devel:xorg-x11-libs
+Ignore: kernel-um:xorg-x11-libs
+Ignore: tetex:xorg-x11-libs,expat,fontconfig,freetype2,libjpeg,libpng,ghostscript-x11,xaw3d,gd,dialog,ed
+Ignore: yast2-country:yast2-trans-stats
+Ignore: susehelp:susehelp_lang,suse_help_viewer
+Ignore: mailx:smtp_daemon
+Ignore: cron:smtp_daemon
+Ignore: hotplug:syslog
+Ignore: pcmcia:syslog
+Ignore: avalon-logkit:servlet
+Ignore: jython:servlet
+Ignore: ispell:ispell_dictionary,ispell_english_dictionary
+Ignore: aspell:aspel_dictionary,aspell_dictionary
+Ignore: smartlink-softmodem:kernel,kernel-nongpl
+Ignore: OpenOffice_org-de:myspell-german-dictionary
+Ignore: mediawiki:php-session,php-gettext,php-zlib,php-mysql,mod_php_any
+Ignore: squirrelmail:mod_php_any,php-session,php-gettext,php-iconv,php-mbstring,php-openssl
+
+Ignore: simias:mono(log4net)
+Ignore: zmd:mono(log4net)
+Ignore: horde:mod_php_any,php-gettext,php-mcrypt,php-imap,php-pear-log,php-pear,php-session,php
+Ignore: xerces-j2:xml-commons-apis,xml-commons-resolver
+Ignore: xdg-menu:desktop-data
+Ignore: nessus-libraries:nessus-core
+Ignore: evolution:yelp
+Ignore: mono-tools:mono(gconf-sharp),mono(glade-sharp),mono(gnome-sharp),mono(gtkhtml-sharp),mono(atk-sharp),mono(gdk-sharp),mono(glib-sharp),mono(gtk-sharp),mono(pango-sharp)
+Ignore: gecko-sharp2:mono(glib-sharp),mono(gtk-sharp)
+Ignore: vcdimager:libcdio.so.6,libcdio.so.6(CDIO_6),libiso9660.so.4,libiso9660.so.4(ISO9660_4)
+Ignore: libcdio:libcddb.so.2
+Ignore: gnome-libs:libgnomeui
+Ignore: nautilus:gnome-themes
+Ignore: gnome-panel:gnome-themes
+Ignore: gnome-panel:tomboy
+
+Substitute: utempter
+
+%ifnarch s390 s390x ppc ia64
+Substitute: java2-devel-packages java-1_4_2-sun-devel
+%else
+ %ifnarch s390x
+Substitute: java2-devel-packages java-1_4_2-ibm-devel
+ %else
+Substitute: java2-devel-packages java-1_4_2-ibm-devel xorg-x11-libs-32bit
+ %endif
+%endif
+
+%ifarch %ix86
+Substitute: kernel-binary-packages kernel-default kernel-smp kernel-bigsmp kernel-debug kernel-um kernel-xen kernel-kdump
+%endif
+%ifarch ia64
+Substitute: kernel-binary-packages kernel-default kernel-debug
+%endif
+%ifarch x86_64
+Substitute: kernel-binary-packages kernel-default kernel-smp kernel-xen kernel-kdump
+%endif
+%ifarch ppc
+Substitute: kernel-binary-packages kernel-default kernel-kdump kernel-ppc64 kernel-iseries64
+%endif
+%ifarch ppc64
+Substitute: kernel-binary-packages kernel-ppc64 kernel-iseries64
+%endif
+%ifarch s390
+Substitute: kernel-binary-packages kernel-s390
+%endif
+%ifarch s390x
+Substitute: kernel-binary-packages kernel-default
+%endif
+
+%define ubuntu_version 1604
+
+Macros:
+%ubuntu_version 1604
+
diff --git a/createmdkdeps b/createmdkdeps
new file mode 100755 (executable)
index 0000000..f1b8c96
--- /dev/null
@@ -0,0 +1,50 @@
+#!/usr/bin/perl -w
+
+################################################################
+#
+# Copyright (c) 2015 SUSE Linux GmbH
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 or 3 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program (see the file COPYING); if not, write to the
+# Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+#
+################################################################
+
+# Mandriva/Mageia support
+
+BEGIN {
+  unshift @INC, ($::ENV{"BUILD_DIR"} || "/usr/lib/build");
+}
+
+use strict;
+use Build ':mdk';
+use Build::Mdkrepo;
+use Digest::MD5 ();
+use File::Path;
+use Getopt::Long;
+
+Getopt::Long::Configure("no_ignore_case");
+
+my $cachedir = "/var/cache/build";
+
+GetOptions("cachedir=s"  => \$cachedir) or exit(1);
+
+for my $url (@ARGV) {
+  die("$url: not an remote mandriva/mageia repo") unless $url =~ /^(:?ftps?|https?):\/\/([^\/]*)\/?/;
+  my $repoid = Digest::MD5::md5_hex($url);
+  my $dir = "$cachedir/$repoid";
+  $url .= '/' unless $url =~ /\/$/;
+  File::Path::mkpath($dir);
+  system("$INC[0]/download", $dir, "${url}media_info/synthesis.hdlist.cz");
+  Build::Mdkrepo::parse("$dir/synthesis.hdlist.cz", sub { Build::writedeps(\*STDOUT, $_[0], $url) }, 'addselfprovides' => 1);
+}
index 5c688af..fdb5346 100755 (executable)
@@ -89,20 +89,20 @@ for my $url (@ARGV) {
     $dir = "$cachedir/$repoid/";
     $baseurl .= '/' unless $baseurl =~ /\/$/;
     mkpath("${dir}repodata");
-    my $sem;
-    my $key = IPC::SysV::ftok($dir, '1');
-    if ($sem = IPC::Semaphore->new($key, 1, S_IRUSR | S_IWUSR | IPC_CREAT | IPC_EXCL)) {
-      $sem->setval(0, 1);
-    } else {
-      $sem = IPC::Semaphore->new($key, 1, S_IRUSR | S_IWUSR | IPC_CREAT);
-    }
-
-    $sem->op(0, -1, SEM_UNDO);
-    if (!-f "${dir}repodata/repomd.xml") {
-      system($INC[0].'/download', "${dir}repodata", "${baseurl}repodata/repomd.xml");
-    }
-    $sem->op(0, 1, SEM_UNDO);
-    $sem->remove();
+       my $sem;
+       my $key = IPC::SysV::ftok($dir, '1');
+       if ($sem = IPC::Semaphore->new($key, 1, S_IRUSR | S_IWUSR | IPC_CREAT | IPC_EXCL)) {
+         $sem->setval(0, 1);
+       } else {
+         $sem = IPC::Semaphore->new($key, 1, S_IRUSR | S_IWUSR | IPC_CREAT);
+       }
+       
+       $sem->op(0, -1, SEM_UNDO);
+       if (!-f "${dir}repodata/repomd.xml") {
+         system($INC[0].'/download', "${dir}repodata", "${baseurl}repodata/repomd.xml");
+       }
+       $sem->op(0, 1, SEM_UNDO);
+       $sem->remove();
   } else {
     $dir = $url;
   }
@@ -126,14 +126,14 @@ for my $url (@ARGV) {
       utf8::downgrade($u);
     }
     my $cached;
-    my $sem;
-    my $key = IPC::SysV::ftok("${dir}repodata/", '1');
-    if ($sem = IPC::Semaphore->new($key, 1, S_IRUSR | S_IWUSR | IPC_CREAT | IPC_EXCL)) {
-      $sem->setval(0, 1);
-    } else {
-      $sem = IPC::Semaphore->new($key, 1, S_IRUSR | S_IWUSR | IPC_CREAT);
-    }
-    $sem->op(0, -1, SEM_UNDO);
+       my $sem;
+       my $key = IPC::SysV::ftok("${dir}repodata/", '1');
+       if ($sem = IPC::Semaphore->new($key, 1, S_IRUSR | S_IWUSR | IPC_CREAT | IPC_EXCL)) {
+         $sem->setval(0, 1);
+       } else {
+         $sem = IPC::Semaphore->new($key, 1, S_IRUSR | S_IWUSR | IPC_CREAT);
+       }
+       $sem->op(0, -1, SEM_UNDO);
     if (-e $u) {
       $cached = 1;
       $cached = 0 if exists($f->{'size'}) && $f->{'size'} != (-s _);
@@ -149,8 +149,8 @@ for my $url (@ARGV) {
        die("inconsistent repodata in $url\n");
       }
     }
-    $sem->op(0, 1, SEM_UNDO);
-    $sem->remove();
+       $sem->op(0, 1, SEM_UNDO);
+       $sem->remove();
 
     my $fh;
     open($fh, '<', $u) or die "Error opening $u: $!\n";
diff --git a/createrpmdeps b/createrpmdeps
deleted file mode 100755 (executable)
index c8c796d..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-#!/usr/bin/perl -w
-
-BEGIN {
-  unshift @INC, ($::ENV{'BUILD_DIR'} || '/usr/lib/build');
-}
-
-use Build;
-use strict;
-
-######################################################################
-
-my $rpmdepfile = $ARGV[0];
-
-my %tag;
-
-my %oldp;
-my %oldr;
-if (defined($rpmdepfile) && open(F, '<', $rpmdepfile)) {
-  while (<F>) {
-    chomp;
-    if (/^P:([^ ]): /) {
-      $oldp{$1} = $_;
-    } elsif (/^R:([^ ]): /) {
-      $oldr{$1} = $_;
-    }
-  }
-  close F;
-}
-
-my $redo = 1;
-foreach my $dir (@ARGV) {
-  $redo = 0;
-  my @known;
-  my %known2fn;
-  my %known2path;
-  my %fnsize2id;
-  my $cmd = "find $dir -follow -type f \\( -name \"*.rpm\" -o -name \"*.deb\" \\) -a ! -name \"*src.rpm\" -printf '\%T@/\%s/\%i \%p\\n'";
-  open(F, '-|', $cmd) or next;
-  while (<F>) {
-    chomp;
-    next unless /^([\d\.]+\/\d+\/\d+) (.*)$/;
-    my $id = $1;
-    my $path = $2;
-    # new find added a fraction part to %T@, ignore it
-    $id =~ s/^(\d+)\.\d+/$1/;
-    next unless $path =~ /\.(?:rpm|deb)$/;
-    my $fn = $path;
-    $fn =~ s/.*\///;
-    next if $fn =~ /\.(?:patch|delta)\.rpm$/;
-    my ($r, $arch);
-    if ($fn =~ /^(.*)-[^-]+-[^-]+\.([^\. ]+)\.rpm$/) {
-      $r = $1;
-      $arch = $2;
-    } elsif ($path =~ /^(?:.*\/)?([^\/ ]+)\/([^\/ ]+)\.rpm$/) {
-      #next if $1 eq '.';
-      $r = $2;
-      $arch = $1;
-    } elsif ($fn =~ /^([^_]*)_(?:[^_]*)_([^_]*)\.deb$/) {
-      $r = $1;
-      $arch = $2;
-      $arch = 'noarch' if $arch eq 'all';
-    } else {
-      next;
-    }
-    next if $arch eq 'src' || $arch eq 'nosrc';
-    push @known, "$r.$arch-$id";
-    $known2fn{"$r.$arch-$id"} = $fn;
-    $known2path{"$r.$arch-$id"} = $path;
-    my $size = (split('/', $id))[1];
-    $fnsize2id{"$fn-$size"} = $id;
-  }
-
-  close F;
-
-  my %newp;
-  my %newr;
-  for (@known) {
-    $newp{$_} = $oldp{$_} if $oldp{$_};
-    $newr{$_} = $oldr{$_} if $oldr{$_};
-  }
-
-  my @todo = grep {!($newp{$_} && $newr{$_})} @known;
-  if (@todo) {
-    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";
-       }
-
-       $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);
-      }
-    }
-  }
-  @known = grep {$newp{$_} && $newr{$_}} @known;
-  for (@known) {
-    print "F:$_: $known2path{$_}\n";
-    print "$newp{$_}\n";
-    print "$newr{$_}\n";
-    print "I:$_: $tag{$_}\n" if exists $tag{$_};
-  }
-}
index 3d18326..0b286f1 100755 (executable)
@@ -32,7 +32,7 @@ sub parsedsc {
   my ($fn) = @_;
   my @control;
   local *F;
-  open(F, '<', $fn) || die("$fn: $!\n");
+  open(F, '<', $fn) || die("Error in reading $fn: $!\n");
   @control = <F>;
   close F;
   chomp @control;
@@ -59,7 +59,8 @@ sub parsedsc {
 
 sub writedsc {
   my ($fn, $tags) = @_;
-  open(F, '>', $fn) || die("$fn: $!\n");
+  print "Writing $fn\n";
+  open(F, '>', $fn) || die("open $fn: $!\n");
   my @seq = @{$tags->{'__seq'} || []};
   my %seq = map {uc($_) => 1} @seq;
   for (sort keys %$tags) {
@@ -78,44 +79,48 @@ sub writedsc {
 
 sub listtar {
   my ($tar, $skipdebiandir) = @_;
+  print "Scanning $tar...\n";
   local *F;
   my @c;
   unless(defined($skipdebiandir)) {
     $skipdebiandir = 1;
   }
-  open(F, '-|', 'tar', '--numeric-owner', '-tvf', $tar) || die("tar: $!\n");
+  open(F, '-|', 'tar', '--numeric-owner', '-tvf', $tar) ||
+    die("Execution of tar subprocess failed: $!\n");
   while(<F>) {
     next unless /^([-dlbcp])(.........)\s+\d+\/\d+\s+(\S+) \d\d\d\d-\d\d-\d\d \d\d:\d\d(?::\d\d)? (.*)$/;
     my ($type, $mode, $size, $name) = ($1, $2, $3, $4);
     next if $type eq 'd';
     if ($type eq 'l') {
       next if $skipdebiandir eq 0;
-      die("debian tar contains link: $name\n");
+      die("Archive contains a link: $name\n");
     }
     if ($type ne '-') {
       next if $skipdebiandir eq 0;
-      die("debian tar contains unexpected file type: $name\n");
+      die("Archive contains an unexpected type for file \"$name\"\n");
     }
     $name =~ s/^\.\///;
     $name =~ s/^debian\/// if $skipdebiandir eq 1;
     push @c, {'name' => $name, 'size' => $size};
   }
-  close(F) || die("tar: $!\n");
+  close(F) || die("tar exited with non-zero status: $!\n");
   return @c;
 }
 
 sub extracttar {
   my ($tar, $filename, $s) = @_;
   local *F;
-  open(F, '-|', 'tar', '-xOf', $tar, $filename) || die("tar: $!\n");
+  print "Extracting $tar...\n";
+  open(F, '-|', 'tar', '-xOf', $tar, $filename) ||
+    die("Execution of tar subprocess failed: $!\n");
   my $file = '';
   while ($s > 0) {
     my $l = sysread(F, $file, $s, length($file));
-    die("tar read error\n") unless $l;
+    die("Error while reading from tar subprocess: $!\n") unless $l;
     $s -= $l;
   }
   my @file = split("\n", $file);
-  close(F);
+  close(F) || warn("tar exited with non-zero status: $!\n");
   return @file;
 }
 
@@ -174,7 +179,8 @@ sub dotar {
 sub dofile {
   my ($file, $tardir, $dfile, $origtarfile) = @_;
   local *F;
-  open(F, '<', $file) || die("$file: $!\n");
+  print "Processing file \"$file\"...\n";
+  open(F, '<', $file) || die("Error in reading $file: $!\n");
   my @file = <F>;
   close F;
   chomp(@file);
@@ -192,13 +198,15 @@ sub doseries {
   my @series = <F>;
   close F;
   chomp(@series);
+  print "Processing series file \"$series\"...\n";
   for my $patch (@series) {
     $patch =~ s/(^|\s+)#.*//;
     next if $patch =~ /^\s*$/;
     my $level = 1;
     $level = $1 if $patch =~ /\s.*-p\s*(\d+)/;
     $patch =~ s/\s.*//;
-    open(F, '<', "$dir/$patch") || die("$dir/$patch: $!\n");
+    print "Processing patch $dir/$patch...\n";
+    open(F, '<', "$dir/$patch") || die("Error in reading $dir/$patch: $!\n");
     while(<F>) {
       chomp;
       if ((/^--- ./ || /^\+\+\+ ./) && !/^... \/dev\/null/) {
@@ -227,7 +235,7 @@ sub addfile {
   my $base = $file;
   $base =~ s/.*\///;
   local *F;
-  open(F, '<', $file) || die("$file: $!\n");
+  open(F, '<', $file) || die("Error in reading $file: $!\n");
   my $size = -s F;
   my $ctx = Digest::MD5->new;
   $ctx->addfile(*F);
@@ -236,7 +244,7 @@ sub addfile {
   return "$md5 $size $base";
 }
 
-print "debtransform: ", join( " ", @ARGV ), "\n";
+print "** Started: debtransform @ARGV\n";
 
 my $debug = 0;
 my $changelog;
@@ -265,11 +273,11 @@ my $dir = $ARGV[0];
 my $dsc = $ARGV[1];
 my $out = $ARGV[2];
 
-die("$out: $!\n") unless -d $out;
+die("$out is not a directory\n") unless -d $out;
 
 my $tags = parsedsc($dsc);
 
-opendir(D, $dir) || die("$dir: $!\n");
+opendir(D, $dir) || die("Could not open $dir: $!\n");
 my @dir = grep {$_ ne '.' && $_ ne '..'} readdir(D);
 closedir(D);
 my %dir = map {$_ => 1} @dir;
@@ -281,32 +289,44 @@ if ($tags->{'DEBTRANSFORM-FILES-TAR'}) {
 }
 
 if (!$tarfile || !@debtarfiles) {
-  my @tars = grep {/\.tgz$|\.tar(?:\.gz|\.bz2)?$/} @dir;
-  my @debtars = grep {/^debian\.tar(?:\.gz|\.bz2)?$/} @tars;
+  my @tars = grep {/\.tgz$|\.tar(?:\.gz|\.bz2|\.xz)?$/} @dir;
+  my @debtars = grep {/^debian\.tar(?:\.gz|\.bz2|\.xz)?$/} @tars;
   if (!$tarfile) {
-    @tars = grep {!/^debian\.tar(?:\.gz|\.bz2)?$/} @tars;
+    print "No DEBTRANSFORM-TAR line in the .dsc file.\n";
+    print "Attempting automatic discovery of a suitable source archive.\n";
+    @tars = grep {!/^debian\.tar(?:\.gz|\.bz2|\.xz)?$/} @tars;
     if (@debtarfiles) {
       my %debtarfiles = map {$_ => 1} @debtarfiles;
       @tars = grep {!$debtarfiles{$_}} @tars;
     }
-    die("package contains no tar file\n") unless @tars;
-    die("package contains more than one tar file: @tars\n") if @tars > 1;
+    die("None of the files looks like a usable source tarball.\n") unless @tars;
+    die("Too many files looking like a usable source tarball (would not know which to pick): @tars\n") if @tars > 1;
     $tarfile = $tars[0];
+    print "Source archive chosen for transformation: $tarfile\n";
+  }
+  if (!exists($tags->{'DEBTRANSFORM-FILES-TAR'})) {
+    print "No DEBTRANSFORM-FILES-TAR line in the .dsc file.\n";
+    print "Attempting automatic discovery of a debian archive.\n";
   }
   if (@debtars && !exists($tags->{'DEBTRANSFORM-FILES-TAR'})) {
-    die("package contains more than one debian tar file\n") if @debtars > 1;
+    die("package contains more than one debian archive\n") if @debtars > 1;
     @debtarfiles = ($debtars[0]);
+    print "Debian archive chosen for transformation: $debtars[0]\n";
   }
 }
 
 my $name = $tags->{'SOURCE'};
-die("dsc file contains no source\n") unless defined($name);
+die("dsc file contains no Source: line\n") unless defined($name);
 my $version = $tags->{'VERSION'};
-die("dsc file contains no version\n") unless defined($version);
-$version =~ s/^\d+://; # no epoch in version, please
+die("dsc file contains no Version: line\n") unless defined($version);
+# no epoch in version, please
+if ($version =~ s/^\d+://) {
+       print "Stripped epoch from Version field, which is now \"$version\".\n";
+}
 
 
-# transform 
+# debtransform will always generate a 1.0 format type,
+# so it has to transform all source archives into weak gzip files.
 my $tmptar;
 if ($tarfile =~ /\.tar\.bz2/) {
     my $old = $tarfile;
@@ -315,6 +335,13 @@ if ($tarfile =~ /\.tar\.bz2/) {
     print "converting $dir/$old to $tarfile\n";
     system( ( "debtransformbz2", "$dir/$old", "$tmptar" )) == 0 || die("cannot transform .tar.bz2 to .tar.gz");
 }
+if ($tarfile =~ /\.tar\.xz/) {
+    my $old = $tarfile;
+    $tarfile =~ s/\.tar\.xz/\.tar\.gz/;
+    $tmptar = "$out/$tarfile";
+    print "converting $dir/$old to $tarfile\n";
+    system( ( "debtransformxz", "$dir/$old", "$tmptar" )) == 0 || die("cannot transform .tar.xz to .tar.gz");
+}
 if ($tarfile =~ /\.zip/) {
     my $old = $tarfile;
     $tarfile =~ s/\.zip/\.tar\.gz/;
@@ -336,12 +363,15 @@ $v =~ s/-[^-]*$//;
 $tarfile =~ /.*(\.tar.*?)$/;
 my $ntarfile = "${name}_$v.orig$1";
 if( $tmptar ) {
-  link("$tmptar", "$out/$ntarfile") || die("link $dir/$tarfile $out/$ntarfile: $!\n");
+  print "Moving $dir/$tarfile to $out/$ntarfile\n";
+  link("$tmptar", "$out/$ntarfile") || die("link: $!\n");
   unlink("$tmptar");
 } else {
-  link("$dir/$tarfile", "$out/$ntarfile") || die("link $dir/$tarfile $out/$ntarfile: $!\n");
+  print "Hardlinking $dir/$tarfile to $out/$ntarfile\n";
+  link("$dir/$tarfile", "$out/$ntarfile") || die("link: $!\n");
 }
 push @files, addfile("$out/$ntarfile");
+print "files @files\n";
 
 if ( $tags->{'DEBTRANSFORM-RELEASE'} && $release ) {
     # if dsc file contains the tag DEBTRANSFORM-RELEASE
@@ -353,6 +383,7 @@ if ( $tags->{'DEBTRANSFORM-RELEASE'} && $release ) {
     # (same as for RPMs)
     $version = $v . "-" . $release;
     $tags->{'VERSION'} = $version;
+    print "Modifying dsc Version field to \"$tags->{VERSION}\"\n";
 }
 
 my $tarpath = "$out/$ntarfile";
@@ -360,9 +391,12 @@ my $tardir = $tarfile;
 $tardir =~ s/\.orig\.tar/\.tar/;
 $tardir =~ s/\.tar.*?$//;
 my @tarfilecontent = listtar($tarpath, 0);
-my $origtarfile = { 'name', $tarpath, 'content', \@tarfilecontent, 'version', $tags->{'VERSION'}, 'tardir', $tardir};
+my $origtarfile = {'name' => $tarpath, 'content' => \@tarfilecontent, 'version' => $tags->{'VERSION'}, 'tardir' => $tardir};
 
-open(DIFF, '>', "$out/${name}_$version.diff") || die("$out/${name}_$version.diff: $!\n");
+print "Generating $out/${name}_$version.diff\n";
+# Since we are generating a unitary diff, we must re-set Format:.
+$tags->{"FORMAT"} = "1.0";
+open(DIFF, '>', "$out/${name}_$version.diff") || die("Cannot open $out/${name}_$version.diff for write: $!\n");
 
 undef $changelog if $dir{'debian.changelog'};
 
@@ -372,7 +406,7 @@ for my $debtarfile (@debtarfiles) {
   my @c = listtar("$dir/$debtarfile");
   $debtarcontent{$debtarfile} = \@c;
   for (@c) {
-    die("debian tar and directory both contain '$_->{'name'}'\n") if $dir{"debian.$_->{'name'}"};
+    die("\"$_->{'name'}\" exists in both the debian archive as well as the package source directory.\n") if $dir{"debian.$_->{'name'}"};
     undef $changelog if $_->{'name'} eq 'changelog';
     $debtarorigin{$_->{'name'}} = "$dir/$debtarfile";
   }
diff --git a/debtransformxz b/debtransformxz
new file mode 100755 (executable)
index 0000000..91d0f83
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/sh
+if test $# -ne 2; then
+       exit 1
+fi
+xz -cd "$1" | gzip -f - >"$2" || exit 1
+exit 0
diff --git a/detect_architecture.sh b/detect_architecture.sh
deleted file mode 100644 (file)
index 6ac345e..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/bash
-
-source common_functions
-
-build_host_arch
-
-echo $BUILD_HOST_ARCH
-
index ac6e9f4..40b3295 100755 (executable)
--- a/download
+++ b/download
@@ -65,27 +65,27 @@ for my $url (@ARGV) {
       last;
     }
   } else {
-    my $found = 0;
-    if ( defined $ENV{BUILD_ROOT} && -e $ENV{BUILD_ROOT} . "/.repo.config" ) {
-        open FILE, "<", $ENV{BUILD_ROOT} . "/.repo.config" or die $!;
-        while (<FILE>) {
-            next if ($_ !~ /^http[s]?:\/\/([^\/]*)\/?/);
-            chomp($_);
-            my $hidden = URI->new($_);
-            my $ui = $hidden->userinfo;
-            $hidden->userinfo(undef);
-            if ( $url =~ m/^$hidden/ ) {
-                $url = URI->new($url);
-                $url->userinfo($ui);
-                $found = 1;
-                last;
-            }
-        }
-        close FILE;
-    }
-    if ($found == 0 ) {
-        $url = URI->new($url);
-    }
+   my $found = 0;
+   if ( defined $ENV{BUILD_ROOT} && -e $ENV{BUILD_ROOT} . "/.repo.config" ) {
+       open FILE, "<", $ENV{BUILD_ROOT} . "/.repo.config" or die $!;
+       while (<FILE>) {
+           next if ($_ !~ /^http[s]?:\/\/([^\/]*)\/?/);
+           chomp($_);
+           my $hidden = URI->new($_);
+           my $ui = $hidden->userinfo;
+           $hidden->userinfo(undef);
+           if ( $url =~ m/^$hidden/ ) {
+               $url = URI->new($url);
+               $url->userinfo($ui);
+               $found = 1;
+               last;
+           }
+       }
+       close FILE;
+   }
+   if ($found == 0 ) {
+       $url = URI->new($url);
+   }
   }
   $ua->env_proxy  if $url->scheme ne 'https';
   my $dest = "$dir/".basename($url->path);
@@ -95,8 +95,8 @@ for my $url (@ARGV) {
     my $res = $ua->mirror($url, $dest);
     last if $res->is_success;
     # if it's a redirect we probably got a bad mirror and should just retry
-    die "reqesting " . hide_passwd($original) . " failed: ".$res->status_line."\n" unless $retry && $res->previous;
-    warn "retrying " . hide_passwd($original) . "\n";
+       die "reqesting " . hide_passwd($original) . " failed: ".$res->status_line."\n" unless $retry && $res->previous;
+       warn "retrying " . hide_passwd($original) . "\n";
   }
 }
 
index b40e4ad..d233844 100755 (executable)
@@ -108,10 +108,10 @@ for my $arg (@ARGV) {
 
 my $binarytype;
 my @archs = split(':', $archs);
-if ($recipe =~ /(^|\/)PKGBUILD$/) {
+if ($recipe && $recipe =~ /(^|\/)PKGBUILD$/) {
   push @archs, 'any' unless grep {$_ eq 'any'} @archs;
   $binarytype = 'arch';
-} elsif ($recipe =~ /\.dsc$/) {
+} elsif ($recipe && $recipe =~ /\.dsc$/) {
   push @archs, 'all' unless grep {$_ eq 'noarch'} @archs;
   $binarytype = 'deb';
 } else {
@@ -134,6 +134,7 @@ my %ids;
 
 my %packs_arch;
 my %packs_done;
+
 # XXX: move to separate tool
 if (!defined($dist) || $dist eq '') {
   my $rpmarch = (grep {$fn{"rpm.$_"}} @archs)[0];
@@ -161,11 +162,11 @@ if (!defined($dist) || $dist eq '') {
   print STDERR "Warning: distribution not specified, assuming '$dist' (see $configdir).\n";
 }
 
-$cf ||= Build::read_config_dist($dist, $archs[0], $configdir);
+my $cf = Build::read_config_dist($dist, $archs[0], $configdir);
 $cf->{'warnings'} = 1;
 
 my $dofileprovides = %{$cf->{'fileprovides'}};
-$dofileprovides = 1 if ($binarytype || 'rpm') ne 'rpm';
+
 my %exportfilters = %{$cf->{'exportfilter'}};
 
 open(F, '<', $rpmdeps) || die("$rpmdeps: $!\n");
@@ -186,11 +187,11 @@ while(<F>) {
   if (/^F:(.*?)-\d+\/\d+\/\d+: (.*)$/) {
     my $pkgname = basename($2);
     $pkgF = $2;
-    next if $fn{$1};
-    $fn{$1} = $2;
-    my $pack = $1;
-    $pack =~ /^(.*)\.([^\.]+)$/ or die;
-    push @{$packs_arch{$2}}, $1;
+       next if $fn{$1};
+       $fn{$1} = $2;
+       my $pack = $1;
+       $pack =~ /^(.*)\.([^\.]+)$/ or die;
+       push @{$packs_arch{$2}}, $1;
     my $basename = $1;
     my $arch = $2;
     for(keys %exportfilters) {
@@ -204,39 +205,38 @@ while(<F>) {
     }
   } elsif (/^P:(.*?)-\d+\/\d+\/\d+: (.*)$/) {
     $pkgP = $2;
-    next if $prov{$1};
-    $prov{$1} = $2;
+       next if $prov{$1};
+       $prov{$1} = $2
   } elsif (/^R:(.*?)-\d+\/\d+\/\d+: (.*)$/) {
     $pkgR = $2;
-    next if $req{$1};
-    $req{$1} = $2;
-  } elsif (/^r:(.*?)-\d+\/\d+\/\d+: (.*)$/) {
-    $pkgr = $2;
+       next if $req{$1};
+       $req{$1} = $2;
   } elsif (/^C:(.*?)-\d+\/\d+\/\d+: (.*)$/) {
     $pkgC = $2;
-    next if $con{$1};
-    $con{$1} = $2;
+       next if $con{$1};
+       $con{$1} = $2;
   } elsif (/^O:(.*?)-\d+\/\d+\/\d+: (.*)$/) {
     $pkgO = $2;
-    next if $obs{$1};
-    $obs{$1} = $2;
+       next if $obs{$1};
+       $obs{$1} = $2;
   } elsif (/^r:(.*?)-\d+\/\d+\/\d+: (.*)$/) {
     $pkgr = $2;
   } elsif (/^s:(.*?)-\d+\/\d+\/\d+: (.*)$/) {
     $pkgs = $2;
   } elsif (/^I:(.*?)-\d+\/\d+\/\d+: (.*)$/) {
-    my $r = 0;
-    if ($usehigherdeps) {
-      $r = 1;
-    } else {
-      if ($packs_done{$1}) {
-        $r = 0;
-      } else {
-        $r = 1;
-      }
-    }
-
-    next unless ($r);
+    #next if $packs_done{$1};
+   my $r = 0;
+   if ($usehigherdeps) {
+     $r = 1;
+   } else {
+     if ($packs_done{$1}) {
+       $r = 0;
+     } else {
+       $r = 1;
+     }
+   }
+
+   next unless ($r);
     my ($i, $newid) = ($1, $2);
     undef $i unless !$ids{$i} || $verscmp->($ids{$i}, $newid) < 0;
     undef $i unless defined($pkgF) && defined($pkgP) && defined($pkgR);
@@ -250,24 +250,24 @@ while(<F>) {
       delete $rec{$i};
       delete $con{$i};
       delete $obs{$i};
-      delete $rec{$i};
-      delete $sup{$i};
+         delete $rec{$i};
+         delete $sup{$i};
       $req{$i}  = $pkgR;
       $con{$i}  = $pkgC if defined $pkgC;
       $obs{$i}  = $pkgO if defined $pkgO;
-      $rec{$i}  = $pkgr if defined $pkgr;
-      $sup{$i}  = $pkgs if defined $pkgs;
+         $rec{$i}  = $pkgr if defined $pkgr;
+         $sup{$i}  = $pkgs if defined $pkgs
     } else {
-      next if $ids{$1};
-      $ids{$1} = $2;
-    }
+         next if $ids{$1};
+         $ids{$1} = $2;
+       }
     undef $pkgF;
     undef $pkgP;
     undef $pkgR;
     undef $pkgC;
     undef $pkgO;
-    undef $pkgr;
-    undef $pkgs;
+       undef $pkgr;
+       undef $pkgs;
   } elsif ($_ eq 'D:') {
     %packs_done = %ids;
   }
@@ -278,6 +278,7 @@ for my $arch (@archs) {
   $packs{$_} ||= "$_.$arch" for @{$packs_arch{$arch} || []};
 }
 
+
 for my $pack (keys %packs) {
   my $r = {};
   my (@s, $s, @pr, @re, @co, @ob, @rc, @su);
@@ -313,30 +314,30 @@ for my $pack (keys %packs) {
       splice(@s, 0, 2);
     }
   }
 @s = split(' ', $con{$packs{$pack}} || '');
 while (@s) {
-    $s = shift @s;
-    next if !$dofileprovides && $s =~ /^\//;
-    push @co, $s;
-    while (@s && $s[0] =~ /^[\(<=>|]/) {
-      $co[-1] .= " $s[0] $s[1]";
-      $co[-1] =~ s/ \((.*)\)/ $1/;
-      $co[-1] =~ s/(<|>){2}/$1/;
-      splice(@s, 0, 2);
-    }
 }
 @s = split(' ', $obs{$packs{$pack}} || '');
 while (@s) {
-    $s = shift @s;
-    next if !$dofileprovides && $s =~ /^\//;
-    push @ob, $s;
-    while (@s && $s[0] =~ /^[\(<=>|]/) {
-      $ob[-1] .= " $s[0] $s[1]";
-      $ob[-1] =~ s/ \((.*)\)/ $1/;
-      $ob[-1] =~ s/(<|>){2}/$1/;
-      splice(@s, 0, 2);
-    }
 }
+ @s = split(' ', $con{$packs{$pack}} || '');
+ while (@s) {
+   $s = shift @s;
+   next if !$dofileprovides && $s =~ /^\//;
+   push @co, $s;
+   while (@s && $s[0] =~ /^[\(<=>|]/) {
+     $co[-1] .= " $s[0] $s[1]";
+     $co[-1] =~ s/ \((.*)\)/ $1/;
+     $co[-1] =~ s/(<|>){2}/$1/;
+     splice(@s, 0, 2);
+   }
+ }
+ @s = split(' ', $obs{$packs{$pack}} || '');
+ while (@s) {
+   $s = shift @s;
+   next if !$dofileprovides && $s =~ /^\//;
+   push @ob, $s;
+   while (@s && $s[0] =~ /^[\(<=>|]/) {
+     $ob[-1] .= " $s[0] $s[1]";
+     $ob[-1] =~ s/ \((.*)\)/ $1/;
+     $ob[-1] =~ s/(<|>){2}/$1/;
+     splice(@s, 0, 2);
+   }
+ }
   @s = split(' ', $rec{$packs{$pack}} || '');
   while (@s) {
     $s = shift @s;
@@ -357,9 +358,9 @@ for my $pack (keys %packs) {
   while (@s) {
     $s = shift @s;
     next if !$dofileprovides && $s =~ /^\//;
-    if ($s =~ /^rpmlib\(/) {
-      splice(@s, 0, 2);
-      next;
+         if ($s =~ /^rpmlib\(/) {
+        splice(@s, 0, 2);
+           next;
     }
     push @su, $s;
     while (@s && $s[0] =~ /^[\(<=>|]/) {
@@ -427,34 +428,25 @@ if ($useusedforbuild) {
 
 #######################################################################
 
-my ($packname, $packvers, $subpacks, @packdeps);
-$subpacks = [];
+my $subpacks = [];
+
+my $buildtype = '';
+my $extrasysdeps;
 
 if ($recipe) {
   my $d = Build::parse($cf, $recipe) || {};
-  my $buildtype = Build::recipe2buildtype($recipe) || '';
+  $buildtype = Build::recipe2buildtype($recipe) || '';
   $cf->{'type'} = $buildtype if $buildtype;
   if ($buildtype eq 'kiwi') {
     # lets see if this is a product or image build
-    my $type = $d->{'imagetype'} && $d->{'imagetype'}->[0] eq 'product' ? 'product' : 'image';
-    my @kdeps;
-    if ($type eq 'image') {
-      @kdeps = @{$cf->{'substitute'}->{'kiwi-setup:image'} || []};
-      @kdeps = ('kiwi', 'createrepo', 'tar') unless @kdeps;
-    } else {
-      @kdeps = @{$cf->{'substitute'}->{'kiwi-setup:product'} || []};
-      @kdeps = ('kiwi') unless @kdeps;
-    }
-    push @kdeps, grep {/^kiwi-.*:/} @{$d->{'deps'} || []};
-    $d = { 'deps' => \@kdeps, 'subpacks' => [] };
+    $buildtype = $d->{'imagetype'} && $d->{'imagetype'}->[0] eq 'product' ? 'kiwi-product' : 'kiwi-image';
+    $extrasysdeps = [ grep {/^kiwi-.*:/} @{$d->{'deps'} || []} ];
   }
-  $packname = $d->{'name'};
-  $packvers = $d->{'version'};
   $subpacks = $d->{'subpacks'};
-  @packdeps = @{$d->{'deps'} || []};
+  unshift @extradeps, @{$d->{'deps'} || []};
   if ($d->{'prereqs'}) {
-    my %deps = map {$_ => 1} (@packdeps, @{$d->{'subpacks'} || []});
-    push @packdeps, grep {!$deps{$_} && !/^%/} @{$d->{'prereqs'}};
+    my %deps = map {$_ => 1} (@extradeps, @{$d->{'subpacks'} || []});
+       push @packdeps, grep {!$deps{$_} && !/^%/} @{$d->{'prereqs'}};
   }
 }
 
@@ -462,6 +454,15 @@ Build::readdeps($cf, undef, \%repo);
 
 #######################################################################
 
+my @sysdeps = Build::get_sysbuild($cf, $buildtype, $extrasysdeps);
+
+if ($buildtype eq 'kiwi-image' || $buildtype eq 'kiwi-product') {
+  # just use the sysdeps for now, ignore real deps
+  print_rpmlist(@sysdeps);
+  exit(0);
+}
+
+push @extradeps, '--ignoreignore--' if @sysdeps;
 if ($isvm) {
   push @packdeps, @{$cf->{'vminstall'}};
 }
@@ -473,7 +474,6 @@ if (!shift @bdeps) {
   exit(1);
 }
 
-my @sysdeps = Build::get_sysbuild($cf);
 if (@sysdeps) {
   if (!shift @sysdeps) {
     print STDERR "expansion error\n";
@@ -488,10 +488,7 @@ if (@sysdeps) {
 }
 
 # make sure all preinstalls are in bdeps;
-# XXX: also add vmdeps?
 @bdeps = Build::unify(@bdeps, Build::get_preinstalls($cf));
-if ($isvm) {
-  @bdeps = Build::unify(@bdeps, Build::get_vminstalls($cf));
-}
+@bdeps = Build::unify(@bdeps, Build::get_vminstalls($cf)) if $isvm;
 
 print_rpmlist(@bdeps);
diff --git a/find-debuginfo.sh b/find-debuginfo.sh
deleted file mode 100755 (executable)
index bb8a369..0000000
+++ /dev/null
@@ -1,470 +0,0 @@
-#!/bin/bash
-#find-debuginfo.sh - automagically generate debug info and file list
-#for inclusion in an rpm spec file.
-#
-# Usage: find-debuginfo.sh [--strict-build-id] [-g] [-r] [-m]
-#                         [-o debugfiles.list]
-#                         [--run-dwz] [--dwz-low-mem-die-limit N]
-#                         [--dwz-max-die-limit N]
-#                         [[-l filelist]... [-p 'pattern'] -o debuginfo.list]
-#                         [builddir]
-#
-# The -g flag says to use strip -g instead of full strip on DSOs or EXEs.
-# The --strict-build-id flag says to exit with failure status if
-# any ELF binary processed fails to contain a build-id note.
-# The -r flag says to use eu-strip --reloc-debug-sections.
-#
-# A single -o switch before any -l or -p switches simply renames
-# the primary output file from debugfiles.list to something else.
-# A -o switch that follows a -p switch or some -l switches produces
-# an additional output file with the debuginfo for the files in
-# the -l filelist file, or whose names match the -p pattern.
-# The -p argument is an grep -E -style regexp matching the a file name,
-# and must not use anchors (^ or $).
-#
-# The --run-dwz flag instructs find-debuginfo.sh to run the dwz utility
-# if available, and --dwz-low-mem-die-limit and --dwz-max-die-limit
-# provide detailed limits.  See dwz(1) -l and -L option for details.
-#
-# All file names in switches are relative to builddir (. if not given).
-#
-
-# With -g arg, pass it to strip on libraries or executables.
-strip_g=false
-
-# with -r arg, pass --reloc-debug-sections to eu-strip.
-strip_r=false
-
-# with -m arg, add minimal debuginfo to binary.
-include_minidebug=false
-
-# Barf on missing build IDs.
-strict=false
-
-# DWZ parameters.
-run_dwz=false
-dwz_low_mem_die_limit=
-dwz_max_die_limit=
-
-BUILDDIR=.
-out=debugfiles.list
-nout=0
-while [ $# -gt 0 ]; do
-  case "$1" in
-  --strict-build-id)
-    strict=true
-    ;;
-  --run-dwz)
-    run_dwz=true
-    ;;
-  --dwz-low-mem-die-limit)
-    dwz_low_mem_die_limit=$2
-    shift
-    ;;
-  --dwz-max-die-limit)
-    dwz_max_die_limit=$2
-    shift
-    ;;
-  -g)
-    strip_g=true
-    ;;
-  -m)
-    include_minidebug=true
-    ;;
-  -o)
-    if [ -z "${lists[$nout]}" -a -z "${ptns[$nout]}" ]; then
-      out=$2
-    else
-      outs[$nout]=$2
-      ((nout++))
-    fi
-    shift
-    ;;
-  -l)
-    lists[$nout]="${lists[$nout]} $2"
-    shift
-    ;;
-  -p)
-    ptns[$nout]=$2
-    shift
-    ;;
-  -r)
-    strip_r=true
-    ;;
-  *)
-    BUILDDIR=$1
-    shift
-    break
-    ;;
-  esac
-  shift
-done
-
-i=0
-while ((i < nout)); do
-  outs[$i]="$BUILDDIR/${outs[$i]}"
-  l=''
-  for f in ${lists[$i]}; do
-    l="$l $BUILDDIR/$f"
-  done
-  lists[$i]=$l
-  ((++i))
-done
-
-LISTFILE="$BUILDDIR/$out"
-SOURCEFILE="$BUILDDIR/debugsources.list"
-LINKSFILE="$BUILDDIR/debuglinks.list"
-ELFBINSFILE="$BUILDDIR/elfbins.list"
-
-echo "/usr" > "$SOURCEFILE"
-echo "/usr" > "$LISTFILE"
-echo "/usr" > "$LINKSFILE"
-echo "/usr" > "$ELFBINSFILE"
-
-debugdir="${RPM_BUILD_ROOT}/usr/lib/debug"
-
-strip_to_debug()
-{
-  local g=
-  local r=
-  $strip_r && r=--reloc-debug-sections
-  $strip_g && case "$(file -bi "$2")" in
-  application/x-sharedlib*) g=-g ;;
-  application/x-executable*) g=-g ;;
-  esac
-  eu-strip --remove-comment $r $g -f "$1" "$2" || exit
-  chmod 444 "$1" || exit
-}
-
-add_minidebug()
-{
-  local debuginfo="$1"
-  local binary="$2"
-
-  local dynsyms=`mktemp`
-  local funcsyms=`mktemp`
-  local keep_symbols=`mktemp`
-  local mini_debuginfo=`mktemp`
-
-  # Extract the dynamic symbols from the main binary, there is no need to also have these
-  # in the normal symbol table
-  nm -D "$binary" --format=posix --defined-only | awk '{ print $1 }' | sort > "$dynsyms"
-  # Extract all the text (i.e. function) symbols from the debuginfo 
-  nm "$debuginfo" --format=posix --defined-only | awk '{ if ($2 == "T" || $2 == "t") print $1 }' | sort > "$funcsyms"
-  # Keep all the function symbols not already in the dynamic symbol table
-  comm -13 "$dynsyms" "$funcsyms" > "$keep_symbols"
-  # Copy the full debuginfo, keeping only a minumal set of symbols and removing some unnecessary sections
-  objcopy -S --remove-section .gdb_index --remove-section .comment --keep-symbols="$keep_symbols" "$debuginfo" "$mini_debuginfo" &> /dev/null
-  #Inject the compressed data into the .gnu_debugdata section of the original binary
-  xz "$mini_debuginfo"
-  mini_debuginfo="${mini_debuginfo}.xz"
-  objcopy --add-section .gnu_debugdata="$mini_debuginfo" "$binary"
-  rm -f "$dynsyms" "$funcsyms" "$keep_symbols" "$mini_debuginfo"
-}
-
-# Make a relative symlink to $1 called $3$2
-shopt -s extglob
-link_relative()
-{
-  local t="$1" f="$2" pfx="$3"
-  local fn="${f#/}" tn="${t#/}"
-  local fd td d
-
-  while fd="${fn%%/*}"; td="${tn%%/*}"; [ "$fd" = "$td" ]; do
-    fn="${fn#*/}"
-    tn="${tn#*/}"
-  done
-
-  d="${fn%/*}"
-  if [ "$d" != "$fn" ]; then
-    d="${d//+([!\/])/..}"
-    tn="${d}/${tn}"
-  fi
-
-  mkdir -p "$(dirname "$pfx$f")" && ln -snf "$tn" "$pfx$f"
-}
-
-# Make a symlink in /usr/lib/debug/$2 to $1
-debug_link()
-{
-  local l="/usr/lib/debug$2"
-  local t="$1"
-  echo >> "$LINKSFILE" "$l $t"
-  link_relative "$t" "$l" "$RPM_BUILD_ROOT"
-}
-
-# Provide .2, .3, ... symlinks to all filename instances of this build-id.
-make_id_dup_link()
-{
-  local id="$1" file="$2" idfile
-
-  local n=1
-  while true; do
-    idfile=".build-id/${id:0:2}/${id:2}.$n"
-    [ $# -eq 3 ] && idfile="${idfile}$3"
-    if [ ! -L "$RPM_BUILD_ROOT/usr/lib/debug/$idfile" ]; then
-      break
-    fi
-    n=$[$n+1]
-  done
-  debug_link "$file" "/$idfile"
-}
-
-# Make a build-id symlink for id $1 with suffix $3 to file $2.
-make_id_link()
-{
-  local id="$1" file="$2"
-  local idfile=".build-id/${id:0:2}/${id:2}"
-  [ $# -eq 3 ] && idfile="${idfile}$3"
-  local root_idfile="$RPM_BUILD_ROOT/usr/lib/debug/$idfile"
-
-  if [ ! -L "$root_idfile" ]; then
-    debug_link "$file" "/$idfile"
-    return
-  fi
-
-  make_id_dup_link "$@"
-
-  [ $# -eq 3 ] && return 0
-
-  local other=$(readlink -m "$root_idfile")
-  other=${other#$RPM_BUILD_ROOT}
-  if cmp -s "$root_idfile" "$RPM_BUILD_ROOT$file" ||
-     eu-elfcmp -q "$root_idfile" "$RPM_BUILD_ROOT$file" 2> /dev/null; then
-    # Two copies.  Maybe one has to be setuid or something.
-    echo >&2 "*** WARNING: identical binaries are copied, not linked:"
-    echo >&2 "        $file"
-    echo >&2 "   and  $other"
-  else
-    # This is pathological, break the build.
-    echo >&2 "*** ERROR: same build ID in nonidentical files!"
-    echo >&2 "        $file"
-    echo >&2 "   and  $other"
-    exit 2
-  fi
-}
-
-get_debugfn()
-{
-  dn=$(dirname "${1#$RPM_BUILD_ROOT}")
-  bn=$(basename "$1" .debug).debug
-
-  debugdn=${debugdir}${dn}
-  debugfn=${debugdn}/${bn}
-}
-
-set -o pipefail
-
-strict_error=ERROR
-$strict || strict_error=WARNING
-
-# Strip ELF binaries
-find "$RPM_BUILD_ROOT" ! -path "${debugdir}/*.debug" -type f \
-                    \( -perm -0100 -or -perm -0010 -or -perm -0001 \) \
-                    -print |
-file -N -f - | sed -n -e 's/^\(.*\):[  ]*.*ELF.*, not stripped.*/\1/p' |
-xargs --no-run-if-empty stat -c '%h %D_%i %n' |
-while read nlinks inum f; do
-  get_debugfn "$f"
-  [ -f "${debugfn}" ] && continue
-
-  # If this file has multiple links, keep track and make
-  # the corresponding .debug files all links to one file too.
-  if [ $nlinks -gt 1 ]; then
-    eval linked=\$linked_$inum
-    if [ -n "$linked" ]; then
-      eval id=\$linkedid_$inum
-      make_id_dup_link "$id" "$dn/$(basename $f)"
-      make_id_dup_link "$id" "/usr/lib/debug$dn/$bn" .debug
-      link=$debugfn
-      get_debugfn "$linked"
-      echo "hard linked $link to $debugfn"
-      mkdir -p "$(dirname "$link")" && ln -nf "$debugfn" "$link"
-      continue
-    else
-      eval linked_$inum=\$f
-      echo "file $f has $[$nlinks - 1] other hard links"
-    fi
-  fi
-
-  echo "extracting debug info from $f"
-  id=$(/usr/lib/rpm/debugedit -b "$RPM_BUILD_DIR" -d /usr/src/debug \
-                             -i -l "$SOURCEFILE" "$f") || exit
-  if [ $nlinks -gt 1 ]; then
-    eval linkedid_$inum=\$id
-  fi
-  if [ -z "$id" ]; then
-    echo >&2 "*** ${strict_error}: No build ID note found in $f"
-    $strict && exit 2
-  fi
-
-  [ -x /usr/bin/gdb-add-index ] && /usr/bin/gdb-add-index "$f" > /dev/null 2>&1
-
-  # A binary already copied into /usr/lib/debug doesn't get stripped,
-  # just has its file names collected and adjusted.
-  case "$dn" in
-  /usr/lib/debug/*)
-    [ -z "$id" ] || make_id_link "$id" "$dn/$(basename $f)"
-    continue ;;
-  esac
-
-  mkdir -p "${debugdn}"
-  if test -w "$f"; then
-    strip_to_debug "${debugfn}" "$f"
-  else
-    chmod u+w "$f"
-    strip_to_debug "${debugfn}" "$f"
-    chmod u-w "$f"
-  fi
-
-  # strip -g implies we have full symtab, don't add mini symtab in that case.
-  $strip_g || ($include_minidebug && add_minidebug "${debugfn}" "$f")
-
-  echo "./${f#$RPM_BUILD_ROOT}" >> "$ELFBINSFILE"
-  
-  if [ -n "$id" ]; then
-    make_id_link "$id" "$dn/$(basename $f)"
-    make_id_link "$id" "/usr/lib/debug$dn/$bn" .debug
-  fi
-done || exit
-
-# Invoke the DWARF Compressor utility.
-if $run_dwz && type dwz >/dev/null 2>&1 \
-   && [ -d "${RPM_BUILD_ROOT}/usr/lib/debug" ]; then
-  dwz_files="`cd "${RPM_BUILD_ROOT}/usr/lib/debug"; find -type f -name \*.debug`"
-  if [ -n "${dwz_files}" ]; then
-    dwz_multifile_name="${RPM_PACKAGE_NAME}-${RPM_PACKAGE_VERSION}-${RPM_PACKAGE_RELEASE}.${RPM_ARCH}"
-    dwz_multifile_suffix=
-    dwz_multifile_idx=0
-    while [ -f "${RPM_BUILD_ROOT}/usr/lib/debug/.dwz/${dwz_multifile_name}${dwz_multifile_suffix}" ]; do
-      let ++dwz_multifile_idx
-      dwz_multifile_suffix=".${dwz_multifile_idx}"
-    done
-    dwz_multfile_name="${dwz_multifile_name}${dwz_multifile_suffix}"
-    dwz_opts="-h -q -r -m .dwz/${dwz_multifile_name}"
-    mkdir -p "${RPM_BUILD_ROOT}/usr/lib/debug/.dwz"
-    [ -n "${dwz_low_mem_die_limit}" ] \
-      && dwz_opts="${dwz_opts} -l ${dwz_low_mem_die_limit}"
-    [ -n "${dwz_max_die_limit}" ] \
-      && dwz_opts="${dwz_opts} -L ${dwz_max_die_limit}"
-    ( cd "${RPM_BUILD_ROOT}/usr/lib/debug" && dwz $dwz_opts $dwz_files )
-    # Remove .dwz directory if empty
-    rmdir "${RPM_BUILD_ROOT}/usr/lib/debug/.dwz" 2>/dev/null
-    if [ -f "${RPM_BUILD_ROOT}/usr/lib/debug/.dwz/${dwz_multifile_name}" ]; then
-      id="`readelf -Wn "${RPM_BUILD_ROOT}/usr/lib/debug/.dwz/${dwz_multifile_name}" \
-            2>/dev/null | sed -n 's/^    Build ID: \([0-9a-f]\+\)/\1/p'`"
-      [ -n "$id" ] \
-       && make_id_link "$id" "/usr/lib/debug/.dwz/${dwz_multifile_name}" .debug
-    fi
-  fi
-fi
-
-# dwz invalidates .gnu_debuglink CRC32 in the main files.
-cat "$ELFBINSFILE" |
-(cd "$RPM_BUILD_ROOT"; xargs -d '\n' /usr/lib/rpm/sepdebugcrcfix usr/lib/debug)
-
-# For each symlink whose target has a .debug file,
-# make a .debug symlink to that file.
-find "$RPM_BUILD_ROOT" ! -path "${debugdir}/*" -type l -print |
-while read f
-do
-  t=$(readlink -m "$f").debug
-  f=${f#$RPM_BUILD_ROOT}
-  t=${t#$RPM_BUILD_ROOT}
-  if [ -f "$debugdir$t" ]; then
-    echo "symlinked /usr/lib/debug$t to /usr/lib/debug${f}.debug"
-    debug_link "/usr/lib/debug$t" "${f}.debug"
-  fi
-done
-
-if [ -s "$SOURCEFILE" ]; then
-  mkdir -p "${RPM_BUILD_ROOT}/usr/src/debug"
-  LC_ALL=C sort -z -u "$SOURCEFILE" | grep -E -v -z '(<internal>|<built-in>)$' |
-  (cd "$RPM_BUILD_DIR"; cpio -pd0mL "${RPM_BUILD_ROOT}/usr/src/debug")
-  # stupid cpio creates new directories in mode 0700, fixup
-  find "${RPM_BUILD_ROOT}/usr/src/debug" -type d -print0 |
-  xargs --no-run-if-empty -0 chmod a+rx
-fi
-
-if [ -d "${RPM_BUILD_ROOT}/usr/lib" -o -d "${RPM_BUILD_ROOT}/usr/src" ]; then
-  ((nout > 0)) ||
-  test ! -d "${RPM_BUILD_ROOT}/usr/lib" ||
-  (cd "${RPM_BUILD_ROOT}/usr/lib"; find debug -type d) |
-  sed 's,^,%dir /usr/lib/,' >> "$LISTFILE"
-
-  (cd "${RPM_BUILD_ROOT}/usr"
-   test ! -d lib/debug || find lib/debug ! -type d
-   test ! -d src/debug || find src/debug -mindepth 1 -maxdepth 1
-  ) | sed 's,^,/usr/,' >> "$LISTFILE"
-fi
-
-# Append to $1 only the lines from stdin not already in the file.
-append_uniq()
-{
-  grep -F -f "$1" -x -v >> "$1"
-}
-
-# Helper to generate list of corresponding .debug files from a file list.
-filelist_debugfiles()
-{
-  local extra="$1"
-  shift
-  sed 's/^%[a-z0-9_][a-z0-9_]*([^)]*) *//
-s/^%[a-z0-9_][a-z0-9_]* *//
-/^$/d
-'"$extra" "$@"
-}
-
-# Write an output debuginfo file list based on given input file lists.
-filtered_list()
-{
-  local out="$1"
-  shift
-  test $# -gt 0 || return
-  grep -F -f <(filelist_debugfiles 's,^.*$,/usr/lib/debug&.debug,' "$@") \
-       -x $LISTFILE >> $out
-  sed -n -f <(filelist_debugfiles 's/[\\.*+#]/\\&/g
-h
-s,^.*$,s# &$##p,p
-g
-s,^.*$,s# /usr/lib/debug&.debug$##p,p
-' "$@") "$LINKSFILE" | append_uniq "$out"
-}
-
-# Write an output debuginfo file list based on an grep -E -style regexp.
-pattern_list()
-{
-  local out="$1" ptn="$2"
-  test -n "$ptn" || return
-  grep -E -x -e "$ptn" "$LISTFILE" >> "$out"
-  sed -n -r "\#^$ptn #s/ .*\$//p" "$LINKSFILE" | append_uniq "$out"
-}
-
-#
-# When given multiple -o switches, split up the output as directed.
-#
-i=0
-while ((i < nout)); do
-  > ${outs[$i]}
-  filtered_list ${outs[$i]} ${lists[$i]}
-  pattern_list ${outs[$i]} "${ptns[$i]}"
-  grep -Fvx -f ${outs[$i]} "$LISTFILE" > "${LISTFILE}.new"
-  mv "${LISTFILE}.new" "$LISTFILE"
-  ((++i))
-done
-if ((nout > 0)); then
-  # Now add the right %dir lines to each output list.
-  (cd "${RPM_BUILD_ROOT}"; find usr/lib/debug -type d) |
-  sed 's#^.*$#\\@^/&/@{h;s@^.*$@%dir /&@p;g;}#' |
-  LC_ALL=C sort -ur > "${LISTFILE}.dirs.sed"
-  i=0
-  while ((i < nout)); do
-    sed -n -f "${LISTFILE}.dirs.sed" "${outs[$i]}" | sort -u > "${outs[$i]}.new"
-    cat "${outs[$i]}" >> "${outs[$i]}.new"
-    mv -f "${outs[$i]}.new" "${outs[$i]}"
-    ((++i))
-  done
-  sed -n -f "${LISTFILE}.dirs.sed" "${LISTFILE}" | sort -u > "${LISTFILE}.new"
-  cat "$LISTFILE" >> "${LISTFILE}.new"
-  mv "${LISTFILE}.new" "$LISTFILE"
-fi
diff --git a/getchangetarget b/getchangetarget
deleted file mode 100755 (executable)
index c9e51a1..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/usr/bin/perl -w
-
-BEGIN {
-  unshift @INC, ($::ENV{'BUILD_DIR'} || '/usr/lib/build');
-}
-
-use strict;
-
-use Build;
-
-my ($dist, $archs, $configdir);
-
-while (@ARGV)  {
-  if ($ARGV[0] eq '--dist') {
-    shift @ARGV;
-    $dist = shift @ARGV;
-    next;
-  }
-  if ($ARGV[0] eq '--archpath') {
-    shift @ARGV;
-    $archs = shift @ARGV;
-    next;
-  }
-  if ($ARGV[0] eq '--configdir') {
-    shift @ARGV;
-    $configdir = shift @ARGV;
-    next;
-  }
-  last;
-}
-
-die("Usage: getchangetarget --dist <dist> --archpath <archpath> [--configdir <configdir>]\n") if @ARGV;
-
-my $cf = Build::read_config_dist($dist, $archs, $configdir);
-print "$cf->{'target'}\n" if $cf->{'target'};
diff --git a/getmacros b/getmacros
deleted file mode 100755 (executable)
index d15af57..0000000
--- a/getmacros
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/usr/bin/perl -w
-
-BEGIN {
-  unshift @INC, ($::ENV{'BUILD_DIR'} || '/usr/lib/build');
-}
-
-use Build;
-use strict;
-
-my ($dist, $configdir, $archs);
-
-while (@ARGV)  {
-  if ($ARGV[0] eq '--dist') {
-    shift @ARGV;
-    $dist = shift @ARGV;
-    next;
-  }
-  if ($ARGV[0] eq '--archpath') {
-    shift @ARGV;
-    $archs = shift @ARGV;
-    next;
-  }
-  if ($ARGV[0] eq '--configdir') {
-    shift @ARGV;
-    $configdir = shift @ARGV;
-    next;
-  }
-  last;
-}
-die("Usage: getmacros --dist <dist> [--configdir <configdir>]\n") if @ARGV;
-my $cf = Build::read_config_dist($dist, $archs, $configdir);
-print $cf->{'rawmacros'} if exists $cf->{'rawmacros'};
-exit(0);
diff --git a/getoptflags b/getoptflags
deleted file mode 100755 (executable)
index 8031bf9..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/usr/bin/perl -w
-
-BEGIN {
-  unshift @INC, ($::ENV{'BUILD_DIR'} || '/usr/lib/build');
-}
-
-use strict;
-
-use Build;
-
-my ($dist, $archs, $configdir, $debug);
-
-while (@ARGV)  {
-  if ($ARGV[0] eq '--dist') {
-    shift @ARGV;
-    $dist = shift @ARGV;
-    next;
-  }
-  if ($ARGV[0] eq '--archpath') {
-    shift @ARGV;
-    $archs = shift @ARGV;
-    next;
-  }
-  if ($ARGV[0] eq '--configdir') {
-    shift @ARGV;
-    $configdir = shift @ARGV;
-    next;
-  }
-  if ($ARGV[0] eq '--debug') {
-    shift @ARGV;
-    $debug = 1;
-    next;
-  }
-  last;
-}
-
-die("Usage: getoptflags --dist <dist> --archpath <archpath> [--configdir <configdir>]\n") if @ARGV;
-
-my $cf = Build::read_config_dist($dist, $archs, $configdir);
-exit 0 unless $cf->{'optflags'};
-my $all = $cf->{'optflags'}->{'*'};
-$all = defined($all) && $all ne '' ? " $all" : '';
-$all .= " -g" if $debug;
-for (sort keys %{$cf->{'optflags'}}) {
-  next if $_ eq '*';
-  print "optflags: $_ $cf->{'optflags'}->{$_}$all\n";
-}
diff --git a/gettype b/gettype
deleted file mode 100755 (executable)
index 1ceb746..0000000
--- a/gettype
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/perl -w
-
-BEGIN {
-  unshift @INC, ($::ENV{'BUILD_DIR'} || '/usr/lib/build');
-}
-
-use strict;
-
-use Build;
-
-my ($dist, $archs, $configdir, $debug);
-
-while (@ARGV)  {
-  if ($ARGV[0] eq '--dist') {
-    shift @ARGV;
-    $dist = shift @ARGV;
-    next;
-  }
-  if ($ARGV[0] eq '--archpath') {
-    shift @ARGV;
-    $archs = shift @ARGV;
-    next;
-  }
-  if ($ARGV[0] eq '--configdir') {
-    shift @ARGV;
-    $configdir = shift @ARGV;
-    next;
-  }
-  last;
-}
-
-die("Usage: gettype --dist <dist> --archpath <archpath> [--configdir <configdir>]\n") if @ARGV;
-
-my $cf = Build::read_config_dist($dist, $archs, $configdir);
-exit 0 unless $cf->{'binarytype'};
-print "$cf->{'binarytype'}\n";
index 2ed0473..9ccfade 100755 (executable)
@@ -32,6 +32,7 @@
 #
 export SRC
 export BUILD_DIR=${BUILD_DIR:-/usr/lib/build}
+PATH="$BUILD_DIR:$PATH"
 
 export YAST_IS_RUNNING=instsys
 
@@ -45,12 +46,6 @@ repos=()
 
 . $BUILD_DIR/common_functions || exit 1
 
-BUILD_IS_RUNNING=$BUILD_ROOT/not-ready
-TMPFILE=$BUILD_ROOT/tmpfile
-RPMIDFMT="%{NAME}-%{VERSION}-%{RELEASE} %{BUILDTIME}-%{ARCH}\n"
-RPMCHECKOPTS_HOST=
-test -x /usr/bin/rpmquery && RPMCHECKOPTS_HOST="--nodigest --nosignature"
-
 # should RPMs be installed with --force ?
 USE_FORCE=false
 PREPARE_VM=
@@ -63,6 +58,7 @@ CREATE_BUILD_BINARIES=
 DLNOSIGNATURE=
 CACHE_DIR=/var/cache/build
 USEHIGHERDEPS=
+test -z "$CONFIG_DIR" && CONFIG_DIR="$BUILD_DIR/configs"
 
 while test -n "$1" ; do
     case "$1" in
@@ -70,10 +66,10 @@ while test -n "$1" ; do
            shift
            PREPARE_VM=true
            ;;
-       --keep-packs)
-           shift
-           KEEP_PACKS=true
-           ;;
+       --keep-packs)
+        shift
+        KEEP_PACKS=true
+        ;;
        --create-build-binaries)
            shift
            CREATE_BUILD_BINARIES=true
@@ -109,16 +105,28 @@ while test -n "$1" ; do
            shift 2
            ;;
        --configdir)
-           CONFIG_DIR=$2
+           CONFIG_DIR="$2"
            shift 2
            ;;
        --nosignature)
            shift
            DLNOSIGNATURE="--nosignature"
            ;;
-       --use-higher-deps)
-           shift
-           USEHIGHERDEPS="--usehigherdeps"
+    --use-higher-deps)
+        shift
+        USEHIGHERDEPS="--usehigherdeps"
+        ;;
+       --root)
+           BUILD_ROOT="$2"
+           shift 2
+           ;;
+       --arch)
+           BUILD_ARCH="$2"
+           shift 2
+           ;;
+       --dist)
+           BUILD_DIST="$2"
+           shift 2
            ;;
        *)
            break
@@ -127,6 +135,14 @@ while test -n "$1" ; do
 done
 PKGS=("$@")
 
+if test -z "$BUILD_ROOT" ; then
+    echo "Please specify a build root!"
+    exit 1
+fi
+
+BUILD_IS_RUNNING=$BUILD_ROOT/not-ready
+TMPFILE=$BUILD_ROOT/tmpfile
+
 #
 # needed functions
 #
@@ -261,6 +277,7 @@ create_devs() {
        mknod urandom 644 c 1 9
        mknod tty     666 c 5 0
        mknod ptmx    666 c 5 2
+       mknod loop-control 600 c 10 237
        mknod loop0   640 b 7 0
        mknod loop1   640 b 7 1
        mknod loop2   640 b 7 2
@@ -314,20 +331,31 @@ create_cache_file() {
     fi
     if ! test -f $CACHE_FILE.id ; then
        test -z "$LIST_STATE" && echo initializing $CACHE_FILE ...
-       BINTYPE=
+       REPOTYPE=
        if test -n "$BUILD_DIST" ; then
-           BINTYPE=`queryconfig binarytype --dist "$BUILD_DIST" --configdir "$CONFIG_DIR" --archpath "$BUILD_ARCH"`
-           test "$BINTYPE" = UNDEFINED && BINTYPE=
+           for i in `queryconfig repotype --dist "$BUILD_DIST" --configdir "$CONFIG_DIR" --archpath "$BUILD_ARCH"` ; do
+               case $i in
+                   arch|debian|hdlist2|rpm-md) REPOTYPE=$i
+               esac
+               test -n "$REPOTYPE" && break
+           done
+           if test -z "$REPOTYPE"; then
+               BINTYPE=`queryconfig binarytype --dist "$BUILD_DIST" --configdir "$CONFIG_DIR" --archpath "$BUILD_ARCH"`
+               case "$BINTYPE" in
+                   arch) REPOTYPE=arch ;;
+                   deb)  REPOTYPE=debian ;;
+               esac
+           fi
        fi
-       if test -z "$BINTYPE" ; then
+       if test -z "$REPOTYPE" ; then
            # check the first init_buildsystem arg, maybe it is a recipe
            case ${PKGS[0]} in
                *.spec)
-                   BINTYPE=rpm ;;
+                   REPOTYPE=rpm-md ;;
                *.dsc)
-                   BINTYPE=deb ;;
+                   REPOTYPE=debian ;;
                */PKGBUILD|PKGBUILD)
-                   BINTYPE=arch ;;
+                   REPOTYPE=arch ;;
            esac
        fi
        for SRC in "${repos[@]}" -- ${BUILD_RPMS//:/ /}; do
@@ -339,10 +367,12 @@ create_cache_file() {
            if test "${SRC#http://}" != "$SRC" -o "${SRC#https://}" != "$SRC" -o "${SRC#ftp://}" != "$SRC" -o "${SRC#ftps://}" != "$SRC" ; then
                # remote repo, cache binary packages
                mkdir -p "$(getcachedir "$SRC")"
-               if test "$BINTYPE" = arch ; then
+               if test "$REPOTYPE" = arch ; then
                    set -- $BUILD_DIR/createarchdeps --cachedir="$CACHE_DIR" "$SRC"
-               elif test "$BINTYPE" = deb ; then
+               elif test "$REPOTYPE" = debian ; then
                    set -- $BUILD_DIR/createdebdeps --cachedir="$CACHE_DIR" --archpath "$BUILD_ARCH" "$SRC"
+               elif test "$REPOTYPE" = hdlist2 ; then
+                   set -- $BUILD_DIR/createmdkdeps --cachedir="$CACHE_DIR" "$SRC"
                else
                    set -- $BUILD_DIR/createrepomddeps --cachedir="$CACHE_DIR" "$SRC"
                fi
@@ -409,7 +439,7 @@ downloadpkg() {
        ;;
     esac
     mv "$destfile" "$SRC" || cleanup_and_exit 1
-    rm -rf $destdir
+       rm -rf $destdir
 }
 
 getcachedir() {
@@ -424,11 +454,15 @@ getcachedir() {
 }
 
 can_reuse_cached_package() {
-    local cachepkgid pkgid
+    local cachepkgid pkgid xpkgid
     test -s "$1" || return 1
     if test -s "$BUILD_ROOT/.init_b_cache/rpms/$PKG.id" ; then
-        pkgid=$(rpm -qp --qf "${RPMIDFMT}" $RPMCHECKOPTS_HOST "${1}")
+           pkgid=$(rpm -qp --qf "${RPMIDFMT}" $RPMCHECKOPTS_HOST "${1}")
        read cachepkgid < $BUILD_ROOT/.init_b_cache/rpms/$PKG.id
+       # check if the build time is zero
+       case $cachepkgid in
+           *" 0-"*) xpkgid="${pkgid##* }"; pkgid="${pkgid% *} 0-${xpkgid#*-}" ;;
+       esac
        test "$cachepkgid" = "$pkgid" || return 1
     fi
     return 0
@@ -439,9 +473,9 @@ check_copy_qemu()
     local arch
 
     for arch in $EMULATOR_DEVS; do
-       if test -e $BUILD_DIR/qemu-$arch; then
-           return 0
-       fi
+       if test -e $BUILD_DIR/qemu-$arch; then
+           return 0
+       fi
     done
     return 1
 }
@@ -456,36 +490,36 @@ copy_qemu()
 
     if check_copy_qemu; then
 
-       for path in $BUILD_DIR/qemu-*; do
-           if file $path | grep -q static; then
-               dest="$BUILD_ROOT/usr/bin/${path##*/}"
-               if [ -f "$path" -a ! -x "$dest" ]; then
-                   echo -n " $path"            # report copy
-                   #echo install -m755 "$path" "$dest"
-                   install -m755 "$path" "$dest"
-               fi
-           fi
-       done
+       for path in $BUILD_DIR/qemu-*; do
+           if file $path | grep -q static; then
+               dest="$BUILD_ROOT/usr/bin/${path##*/}"
+               if [ -f "$path" -a ! -x "$dest" ]; then
+                   echo -n " $path"            # report copy
+                   #echo install -m755 "$path" "$dest"
+                   install -m755 "$path" "$dest"
+               fi
+           fi
+       done
 
     else
 
-       for path in /usr/bin/qemu-*; do
-           if file $path | grep -q static; then
-               dest="$BUILD_ROOT/usr/bin/${path##*/}"
-               if [ -f "$path" -a ! -x "$dest" ]; then
-                   echo -n " $path"            # report copy
-                   #echo install -m755 "$path" "$dest"
-                   install -m755 "$path" "$dest"
-               fi
-           fi
-       done
-
-       if [ -e /usr/sbin/qemu-binfmt-conf.sh \
-           -a ! -e $BUILD_ROOT/usr/sbin/qemu-binfmt-conf.sh ]; then
-           echo " /usr/sbin/qemu-binfmt-conf.sh"               # report copy
-           mkdir -p $BUILD_ROOT/usr/sbin
-           install -m755 /usr/sbin/qemu-binfmt-conf.sh $BUILD_ROOT/usr/sbin
-       fi
+       for path in /usr/bin/qemu-*; do
+           if file $path | grep -q static; then
+               dest="$BUILD_ROOT/usr/bin/${path##*/}"
+               if [ -f "$path" -a ! -x "$dest" ]; then
+                   echo -n " $path"            # report copy
+                   #echo install -m755 "$path" "$dest"
+                   install -m755 "$path" "$dest"
+               fi
+           fi
+       done
+
+       if [ -e /usr/sbin/qemu-binfmt-conf.sh \
+           -a ! -e $BUILD_ROOT/usr/sbin/qemu-binfmt-conf.sh ]; then
+           echo " /usr/sbin/qemu-binfmt-conf.sh"               # report copy
+           mkdir -p $BUILD_ROOT/usr/sbin
+           install -m755 /usr/sbin/qemu-binfmt-conf.sh $BUILD_ROOT/usr/sbin
+       fi
 
     fi
     echo ""
@@ -493,15 +527,16 @@ copy_qemu()
     # Below for backward compatibility when /.build/initvm is not present
 
     if [ -n "$PREPARE_VM" ]; then
-       if [ -x /bin/bash-static -a -x /bin/mount-static ]; then
-           echo " /bin/bash-static /bin/mount-static"  # report copy
-           mkdir -p $BUILD_ROOT/bin
-           install -m755 /bin/bash-static $BUILD_ROOT/bin
-           install -m755 /bin/mount-static $BUILD_ROOT/bin
-       fi
+       if [ -x /bin/bash-static -a -x /bin/mount-static ]; then
+           echo " /bin/bash-static /bin/mount-static"  # report copy
+           mkdir -p $BUILD_ROOT/bin
+           install -m755 /bin/bash-static $BUILD_ROOT/bin
+           install -m755 /bin/mount-static $BUILD_ROOT/bin
+       fi
     fi
 }
 
+
 set_build_arch
 
 trap fail_exit EXIT
@@ -535,7 +570,7 @@ if test -e "$BUILD_IS_RUNNING" ; then
     read ANSWER
     case "$ANSWER" in
        c|C)
-           rm -f $BUILD_IS_RUNNING ;;
+           rm -f $BUILD_IS_RUNNING $BUILD_ROOT/exit ;;
        y|Y)
            clean_build_root ;;
        *)
@@ -582,9 +617,9 @@ else
        #
        RPMLIST=$BUILD_ROOT/.init_b_cache/rpmlist
        test -z "$LIST_STATE" && echo "expanding package dependencies..."
-        VMOPT=
-        test -z "$PREPARE_VM" || VMOPT=--vm
-       if ! $BUILD_DIR/expanddeps $USEUSEDFORBUILD $VMOPT $USEHIGHERDEPS "${definesnstuff[@]}" --dist "$BUILD_DIST" --depfile "$CACHE_FILE" --archpath "$BUILD_ARCH" --configdir $CONFIG_DIR "${PKGS[@]}" > $RPMLIST ; then
+       VMOPT=
+       test -z "$PREPARE_VM" || VMOPT=--vm
+       if ! $BUILD_DIR/expanddeps $USEUSEDFORBUILD $USEHIGHERDEPS "${definesnstuff[@]}" --dist "$BUILD_DIST" --depfile "$CACHE_FILE" --archpath "$BUILD_ARCH" --configdir $CONFIG_DIR "${PKGS[@]}" > $RPMLIST ; then
            rm -f $BUILD_IS_RUNNING
            cleanup_and_exit 1
        fi
@@ -609,7 +644,7 @@ else
     # register the QEMU emulator if needed
     # (we do not need this for the prepare step, as we do not run scripts in this case)
     #
-    copy_qemu
+       copy_qemu
     if test -z "$PREPARE_VM" ; then
        if check_use_emulator ; then
            echo "registering binfmt handlers for cross build"
@@ -725,6 +760,7 @@ else
 
     # check if we really can use cached versions for packages on the download list
     if test -s $BUILD_ROOT/.init_b_cache/rpmlist.download ; then
+       echo "calculating packages to download..."
        rm -f $BUILD_ROOT/.init_b_cache/rpmlist.download2
         while read PKG SRC ; do
            cachepkg="${SRC##*/}"
@@ -922,12 +958,11 @@ if [ -z "$KEEP_PACKS" ]; then
         PKG=${PKG##*/}
         test "$PKG" = "*" && continue
         echo "deleting $PKG"
-        pkg_erase
+        rpm_e "$PKG"
         check_exit
     done
     rm -rf "$BUILD_ROOT/.init_b_cache/todelete"
 fi
-
 rm -rf "$BUILD_ROOT/.init_b_cache/preinstalls"
 mkdir -p "$BUILD_ROOT/.init_b_cache/preinstalls"
 for PKG in $PACKAGES_TO_PREINSTALL; do
@@ -971,20 +1006,20 @@ for PKG in $MAIN_LIST ; do
        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 "keeping ${PKGID%% *}"
            rm -f $BUILD_ROOT/.init_b_cache/$PKG.$PSUF
            echo "$PKGID" > $BUILD_ROOT/installed-pkg/$PKG
            test -n "$PKG_HDRMD5" && echo "$PKG_HDRMD5 $PKGID" > $BUILD_ROOT/.preinstall_image/$PKG
            continue
        fi
     fi
-    
-    # revert use rpm to query pkgid if building rpm package 
-    if test "$PSUF" != "rpm" ; then
-        PKGID=$(perl -I$BUILD_DIR -MBuild -e Build::showquery "$BUILD_ROOT/.init_b_cache/rpms/$PKG.$PSUF" buildid)
-    else
-        PKGID=`rpm -qp --qf "$RPMIDFMT" $RPMCHECKOPTS_HOST $BUILD_ROOT/.init_b_cache/rpms/$PKG.rpm`
-    fi
+   
+   # revert use rpm to query pkgid if building rpm package 
+   if test "$PSUF" != "rpm" ; then
+       PKGID=$(perl -I$BUILD_DIR -MBuild -e Build::showquery "$BUILD_ROOT/.init_b_cache/rpms/$PKG.$PSUF" buildid)
+   else
+       PKGID=`rpm -qp --qf "$RPMIDFMT" $RPMCHECKOPTS_HOST $BUILD_ROOT/.init_b_cache/rpms/$PKG.rpm`
+   fi
 
     if test -f $BUILD_ROOT/.init_b_cache/alreadyinstalled/$PKG ; then
        read OLDPKGID < $BUILD_ROOT/.init_b_cache/alreadyinstalled/$PKG
@@ -993,7 +1028,7 @@ for PKG in $MAIN_LIST ; do
            pkg_erase
        else
            if test "$VERIFY_BUILD_SYSTEM" != true || pkg_verify_installed ; then
-               #echo "keeping ${PKGID%% *}"
+               echo "keeping ${PKGID%% *}"
                echo "$PKGID" > $BUILD_ROOT/installed-pkg/$PKG
                test -n "$PKG_HDRMD5" && echo "$PKG_HDRMD5 $PKGID" > $BUILD_ROOT/.preinstall_image/$PKG
                continue
@@ -1007,17 +1042,6 @@ for PKG in $MAIN_LIST ; do
        check_exit
     fi
     
-    export ADDITIONAL_PARAMS=
-    if test "$USE_FORCE" = true ; then
-       export ADDITIONAL_PARAMS="$ADDITIONAL_PARAMS --force"
-    fi
-    # work around for cross-build installs, we must not overwrite the running rpm
-    if test "$PKG" = rpm ; then
-       for i in $BUILD_ROOT/.init_b_cache/preinstalls/rpm-x86-* ; do
-           test -e "$i" && ADDITIONAL_PARAMS="$ADDITIONAL_PARAMS --justdb"
-       done
-    fi
-    
     if pkg_cumulate ; then
        echo "cumulate ${PKGID%% *}"
        continue
@@ -1118,7 +1142,7 @@ done
 
 if test -e $BUILD_ROOT/usr/share/zoneinfo/UTC ; then
     for PROG in /usr/sbin/zic /usr/bin/zic /bin/zic /sbin/zic ; do
-        test -x $BUILD_ROOT/$PROG  && chroot $BUILD_ROOT bash -c "$PROG -l $(readlink -f /usr/share/zoneinfo/UTC)"
+        test -x $BUILD_ROOT/$PROG  && chroot $BUILD_ROOT bash -c "$PROG -l \$(readlink -f /usr/share/zoneinfo/UTC)"
     done
 fi
 
@@ -1137,7 +1161,6 @@ if test -x $BUILD_ROOT/bin/rpm -a ! -f $BUILD_ROOT/var/lib/rpm/packages.rpm -a !
     pkg_initdb_rpm
     chroot $BUILD_ROOT rpm -q --whatprovides rpm >/dev/null 2>&1       # create provides index
 fi
-
 rm -f $BUILD_ROOT/.rpmmacros $BUILD_ROOT/root/.rpmmacros
 rm -rf "$BUILD_ROOT/.init_b_cache"
 rm -f $BUILD_IS_RUNNING
diff --git a/initscript_qemu_vm b/initscript_qemu_vm
deleted file mode 100755 (executable)
index be8d8b5..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/bash-static
-
-# from /usr/sbin/qemu-binfmt-conf.sh
-if [ ! -f /proc/sys ]; then
-  mount-static -n proc -t proc /proc
-fi
-if [ ! -f /proc/sys/fs/binfmt_misc/register ]; then
-  mount-static -n binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc
-fi
-# register arm, ppc, mips
-
-echo   ':arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-arm:'             > /proc/sys/fs/binfmt_misc/register
-echo   ':armeb:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-armeb:'         > /proc/sys/fs/binfmt_misc/register
-
-echo   ':ppc:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-ppc:'             > /proc/sys/fs/binfmt_misc/register
-
-echo   ':mips:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-mips:'           > /proc/sys/fs/binfmt_misc/register
-echo   ':mipsel:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-mipsel:'       > /proc/sys/fs/binfmt_misc/register
-#echo   ':mipsn32:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-mipsn32:'     > /proc/sys/fs/binfmt_misc/register
-#echo   ':mipsn32el:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-mipsn32el:' > /proc/sys/fs/binfmt_misc/register
-#echo   ':mips64:M::\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-mips64:'       > /proc/sys/fs/binfmt_misc/register
-#echo   ':mips64el:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-mips64el:'   > /proc/sys/fs/binfmt_misc/register
-
-echo    ':sh4:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a\x00:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-sh4:' > /proc/sys/fs/binfmt_misc/register
-echo    ':sh4eb:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-sh4eb:' > /proc/sys/fs/binfmt_misc/register
-
-#exec /.build/build 
-/bin/bash-static /.build/build
index 241cf41..db23045 100644 (file)
--- a/initvm.c
+++ b/initvm.c
@@ -39,6 +39,7 @@
 
 #include <sys/mount.h>
 #include <sys/stat.h>
+#include <sys/utsname.h>
 #include <fcntl.h>
 #include <stdlib.h>
 #include <string.h>
@@ -174,6 +175,8 @@ enum okfail binfmt_register(char *datafile, char *regfile)
        char buf[BUFSIZ];
        FILE *fp;
        int line;
+       struct utsname myuname;
+       uname(&myuname);
 
        fp = fopen(datafile, "r");
        if (fp == NULL)
@@ -186,6 +189,7 @@ enum okfail binfmt_register(char *datafile, char *regfile)
        {
                char tokens[BUFSIZ];
                char *s = tokens;
+               char *blacklist;
                char *f[n_fields];      /* field content pointers */
                int n;                  /* current field */
                char path[BUFSIZ];
@@ -194,6 +198,32 @@ enum okfail binfmt_register(char *datafile, char *regfile)
                {
                        continue;
                }
+               blacklist = strchr(buf, ' ');
+               if (blacklist) {
+                       int skip = 0;
+                       char *eol;
+
+                       *blacklist = '\0';
+                       blacklist++;
+
+                       eol = strchr(blacklist, '\n');
+                       if (eol)
+                               *eol = '\0';
+
+                       for (n = 0; blacklist != NULL; n++)
+                       {
+                               char *bp = strsep(&blacklist, " ");
+                               if (!strcmp(bp, myuname.machine)) {
+#ifdef DEBUG
+                                       fprintf(stderr, " skipping on hostarch %s line %s\n", bp, buf);
+#endif /* DEBUG */
+                                       skip = 1;
+                                       break;
+                               }
+                       }
+                       if (skip)
+                               continue;
+               }
 
                /* copy buf and tokenize :-seperated fields into f[] */
                strcpy(tokens, buf);
@@ -229,9 +259,6 @@ enum okfail binfmt_register(char *datafile, char *regfile)
                 /* Is an interpreter for this arch already registered? */
                snprintf(path, sizeof(path), SYSFS_BINFMT_MISC "/%s", f[name]);
                ret=access(path, X_OK);
-                       fprintf(stderr, 
-                               "interpreter for '%s' is %d\n",
-                               f[name], ret);
                if (ret == 0) {
 #ifdef DEBUG
                        fprintf(stderr, 
@@ -240,6 +267,11 @@ enum okfail binfmt_register(char *datafile, char *regfile)
 #endif /* DEBUG */
                        continue;
                }
+#ifdef DEBUG
+               fprintf(stderr, 
+                       "registering interpreter for '%s'...\n",
+                       f[name]);
+#endif /* DEBUG */
 
                 /* Does the interpreter exists? */
                ret=access(f[interpreter], X_OK);
index d95924a..d2efd29 100644 (file)
--- a/lxc.conf
+++ b/lxc.conf
@@ -13,3 +13,6 @@ lxc.cgroup.devices.allow = c 1:9 rw
 lxc.cgroup.devices.allow = c 5:0 rw
 # ptmx
 lxc.cgroup.devices.allow = c 5:2 rw
+# console
+lxc.console = none
+lxc.console.logfile = /dev/stdout
index 33bcee3..d248a21 100755 (executable)
@@ -1117,6 +1117,11 @@ for my $rpm (@pkgs) {
     warn ("$rpm does not exist, skipping\n");
     next;
   }
+  my @rpmfiles = `rpm -qp --queryformat "[%{FILENAMES}\n]" $rpm`;
+  if (!@rpmfiles) {
+    warn ("$rpm is empty, skipping\n");
+    next;
+  }
   next if $rpm =~ /\.(no)?src\.rpm$/;  # ignore source rpms
   next if $rpm =~ /\.spm$/;
   $rpmn =~ s/.*\///;   # Remove leading path info
@@ -1136,6 +1141,11 @@ my @debs;
 for my $deb (@pkgs) {
   my $debn = $deb;
   next unless $debn =~ /\.deb$/;
+  my @debfiles = `dpkg --contents $deb`;
+  if (!@debfiles) {
+    warn ("$deb is empty, skipping\n");
+    next;
+  }
   $debn =~ s/.*\///;   # Remove leading path info
   $debn =~ s/_[^_]+_[^_]+\.deb$//; # remove all version info and extension
   push @debs, $deb if $debs_to_process{$debn};
diff --git a/mkdrpms b/mkdrpms
index a6ba730..eadca44 100755 (executable)
--- a/mkdrpms
+++ b/mkdrpms
@@ -96,7 +96,10 @@ for my $dir (@ARGV) {
     for my $file (lsrpms($dir)) {
        my $q = query($file);
        next unless $q;
+       next if $q->{'arch'} eq 'src' || $q->{'arch'} eq 'nosrc';
+       next if $q->{'name'} =~  /-debug(:?info|source)/;       # no debug deltas
        my $n = $q->{'name'}.'.'.$q->{'arch'};
+        
        for my $oq (@{$oldpkgs{$n} || []}) {
            my $v = $oq->{'version'};
            my $r = $oq->{'release'};
index 15a6c6a..6e0b67c 100644 (file)
@@ -1,9 +1,4 @@
 -------------------------------------------------------------------
-Fri Apr 28 12:00:00 CST 2017 - junbill.wang@samsung.com
-
-- update tizen version to tizen20170428
-
--------------------------------------------------------------------
 Wed Apr 5 19:00:00 KST 2017 - sk7.park@samsung.com
 
 - update tizen version to tizen20170405
index 2abf7a0..47c0764 100644 (file)
@@ -22,14 +22,14 @@ License:        GPL-2.0+ and GPL-2.0
 Epoch:          1
 Group:          Development/Tools/Building
 %if 0%{?suse_version} >= 1230
-Version:        20150115 
+Version:        20160629 
 %else
-Version:        20150115
+Version:        20160629
 %else
 %endif
 Release:        3.1
 #!BuildIgnore:  build-mkbaselibs
-Source:         obs-build-2015.01.15.tar.gz
+Source:         obs-build-2016.06.29.tar.gz
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 # Manual requires to avoid hard require to bash-static
@@ -129,7 +129,7 @@ This package provides a script for building RPMs for SUSE Linux in a
 chroot or a secure virtualized
 
 %prep
-%setup -q -n obs-build-2015.01.15
+%setup -q -n obs-build-2016.06.29
 
 %build
 # initvm
@@ -194,8 +194,8 @@ test -e default.conf
 /usr/lib/build/initvm.*
 
 %changelog
-* Fri Apr 28 2017 junbill.wang@samsung.com
-- update tizen version to tizen20170428
+* Mon Apr 10 2017 shuai01.fu@samsung.com
+- update tizen version to tizen20170410
 * Wed Apr 5 2017 sk7.park@samsung.com
 - update tizen version to tizen20170405
 * Sat Jan 14 2017 sk7.park@samsung.com
index 0346863..a555394 100644 (file)
--- a/qemu-reg
+++ b/qemu-reg
@@ -4,20 +4,29 @@
 
 # NOTE: this requires a qemu with the binfmt misc handler binary
 
-#:aarch64:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-aarch64-binfmt:P
-:aarch64:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-arm64-binfmt:P
-:arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfa\xff\xff\xff:/usr/bin/qemu-arm-static:
-:armeb:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-armeb-binfmt:P
-:ppc:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-ppc-binfmt:P
-:ppc64:M::i\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff::/usr/bin/qemu-ppc64-binfmt:P
-:ppc64le:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff::/usr/bin/qemu-ppc64le-binfmt:P
-:mips:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-mips-binfmt:P
-:mipsel:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-mipsel-binfmt:P
-#:mipsn32:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-mipsn32-binfmt:P
-#:mipsn32el:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-mipsn32el-binfmt:P
-#:mips64:M::\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-mips64-binfmt:P
-#:mips64el:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-mips64el-binfmt:P
-
-:sh4:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-sh4-binfmt:P
-:sh4eb:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-sh4eb-binfmt:P
+# NOTE: blacklisted host machine types are added via space separated elements
+
+:aarch64:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-aarch64-binfmt:P aarch64
+:aarch64:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xb7:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-arm64-binfmt:P aarch64
+
+:alpha:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x26\x90:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-alpha-binfmt:P alpha
+
+:arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-arm-static:P armv6l armv7l armv8l
+:armeb:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-armeb-binfmt:P armv6b armv7b armv8b
+
+:ppc:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-ppc-binfmt:P ppc ppc64
+:ppc64:M::\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-ppc64-binfmt:P ppc64
+:ppc64le:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-ppc64le-binfmt:P ppc64le
+
+:m68k:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x04:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-m68k-binfmt:P m68k
+
+:mips:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-mips-binfmt:P mips
+:mipsel:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-mipsel-binfmt:P mipsel
+
+:s390x:M::\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x16:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-s390x-binfmt:P s390x
+
+:sh4:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-sh4-binfmt:P sh4
+:sh4eb:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-sh4eb-binfmt:P sh4eb
+
+:sparc:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x02:\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-sparc-binfmt:P sparc
 
index ea319a1..f130931 100755 (executable)
@@ -61,8 +61,13 @@ if ($type eq 'buildflags') {
   die("Specify which buildflag to query\n") unless $argument;
   my $result = $cf->{"buildflags:$argument"};
   print "$result\n" if defined $result;
+} elsif ($type eq 'hostarch') {
+  my $result = $cf->{"hostarch"};
+  print "$result\n" if defined $result;
 } elsif ($type eq 'target' || $type eq 'type' || $type eq 'binarytype' || $type eq 'buildengine' || $type eq 'rawmacros') {
   print "$cf->{$type}\n" if $cf->{$type};
+} elsif ($type eq 'repotype') {
+  print join(' ', @{$cf->{$type}})."\n" if $cf->{$type};
 } elsif ($type eq 'optflags') {
   exit(0) unless $cf->{'optflags'};
   my $all = $cf->{'optflags'}->{'*'};
diff --git a/runservices b/runservices
new file mode 100755 (executable)
index 0000000..63d20cc
--- /dev/null
@@ -0,0 +1,92 @@
+#!/usr/bin/perl -w
+
+BEGIN {
+  unshift @INC, ($::ENV{'BUILD_DIR'} || '/usr/lib/build');
+}
+
+use POSIX;
+use File::Temp ();
+use File::Copy ();
+
+use strict;
+
+use Build::SimpleXML;
+
+my $servicedir = '/usr/lib/obs/service';
+my $buildroot = '';
+
+sub ls {
+  local *D;
+  opendir(D, $_[0]) || return ();
+  my @r = grep {$_ ne '.' && $_ ne '..'} readdir(D);
+  closedir D;
+  return @r;
+}
+
+sub run_services {
+  my ($xml) = @_;
+
+  my $servicexml = Build::SimpleXML::parse($xml);
+  die("not a valid _service file\n") unless $servicexml && $servicexml->{'services'};
+  $servicexml = $servicexml->{'services'}->[0];
+
+  my $tempdir;
+  if ($buildroot ne '') {
+    $tempdir = File::Temp::tempdir('CLEANUP' => 1, 'DIR' => "$buildroot/tmp");
+    die("bad tempdir\n") unless $tempdir =~ s/^\Q$buildroot\E//;
+  } else {
+    $tempdir = File::Temp::tempdir('CLEANUP' => 1);
+  }
+
+  # take default version setting
+  for my $s (@{$servicexml->{'service'} || []}) {
+    # buildtime only is default
+    next unless $s->{'mode'} && $s->{'mode'} eq 'buildtime';
+    die("missing name in service\n") unless $s->{'name'};
+
+    if (! -x "$buildroot$servicedir/$s->{'name'}") {
+      die("service '$s->{'name'}' configured to run, but is not available\n");
+    }
+
+    my @run;
+    push @run, "$servicedir/$s->{'name'}";
+    for my $param (@{$s->{'param'}}) {
+      next if $param->{'name'} eq 'outdir';
+      next unless $param->{'_content'};
+      push @run, "--$param->{'name'}";
+      push @run, $param->{'_content'};
+    }
+    push @run, "--outdir";
+    push @run, $tempdir;
+    my $pid = fork();
+    die("fork: $!\n") unless defined $pid;
+    if ($pid == 0) {
+      if ($buildroot ne '') {
+        chroot($buildroot) || die("chroot $buildroot: $!\n");
+      }
+      exec(@run);
+      die("$run[0]: $!\n");
+    }
+    1 while waitpid($pid, 0) != $pid;
+    die("service run failed for service '$s->{'name'}'\n") if $?;
+    # copy back
+    for my $file (grep {!/^[:\.]/} ls("$buildroot$tempdir")) {
+      File::Copy::move("$buildroot$tempdir/$file", $file) if -f "$buildroot$tempdir/$file";
+    }
+  }
+}
+
+if (@ARGV > 1 && $ARGV[0] eq '--buildroot') {
+  shift @ARGV;
+  $buildroot = shift @ARGV;
+  $buildroot = '' if $buildroot && $buildroot eq '/';
+  die("bad buildroot\n") unless $buildroot eq '' || $buildroot =~ /^\//;
+}
+
+local *F;
+open(F, '<', '_service') || die("_service: $!\n");
+my $xml = '';
+1 while sysread(F, $xml, 4096, length($xml)) > 0;
+close F;
+
+run_services($xml);
index 7b7cf36..fa0fa2b 100755 (executable)
@@ -64,6 +64,7 @@ my $in_prep = 0;
 my $in_global = 1;
 my $last_patch_in_prep_index = 0;
 my $last_patch_in_global_index = 0;
+my $last_source_in_global_index = 0;
 my @c = ();
 my $index = 0;
 
@@ -109,7 +110,7 @@ while(<S>)
     }
 
     if ($in_global && $ifdef_level == 0 && /^Source(?:\d+)?:/) {
-        $last_patch_in_global_index = $index;
+        $last_source_in_global_index = $index;
     }
 
     if ($in_prep && $ifdef_level == 0 && /^\%patch/) {
@@ -120,6 +121,11 @@ while(<S>)
 }
 close(S);
 
+# append after last Source if this spec doesn't have any Patches
+if ($last_patch_in_global_index == 0) {
+    $last_patch_in_global_index = $last_source_in_global_index;
+}
+
 die if ($ifdef_level > 0);
 die if ($in_global || $in_prep);
 die if ($last_patch_in_prep_index == 0);
@@ -138,8 +144,16 @@ for my $diffname (keys %diffs) {
     my $striplevel = "";
     open(P, '<', $diffname) or die "$diffname: $!\n";
     while(<P>) {
-       $striplevel = " -p1" if (m/^--- a/ or m/^--- [^\/]+-\d+\./);
-       last if (/^--- /);
+        # Check if either the --- filename starts with 'a/' or the +++
+        # filename starts with 'b/', or either starts with a package
+        # name/version prefix.  We have to check for either, because either
+        # of them could be /dev/null if a file is being added or
+        # deleted.
+        $striplevel = " -p1"
+           if m,^--- a/, or
+               m,^\+\+\+ b/, or
+               m,^(---|\+\+\+) [^/]+-\d+\.,;
+       last if (/^@@ -\d/);
 
     }
     close(P);
diff --git a/telnet_login_wrapper b/telnet_login_wrapper
new file mode 100755 (executable)
index 0000000..23aa13d
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+# login wrapper, just start a shell without arguments.
+# this skips all parameters and is the only way to open a shell without login
+# prompt on most telnetd implementations
+
+/bin/bash --login || sh
+
diff --git a/vc b/vc
index 66f3da0..12e7ec1 100755 (executable)
--- a/vc
+++ b/vc
@@ -106,6 +106,7 @@ if [ -z "$changelog" ]; then
 fi
 
 if [ ! -e "$changelog" ]; then
+       created_new_changelog=true
        touch $changelog
 fi
 
@@ -144,6 +145,9 @@ if [ -z "$message" ]; then
        set -- `md5sum "$tmpfile"`
        if [ -z "$content" -a "$chksum" == "$1" ]; then
                echo "no changes made"
+               if [ "$created_new_changelog" = true ]; then
+                       rm -f "$changelog"
+               fi
                exit 0
        fi
 fi
diff --git a/zvm_functions b/zvm_functions
deleted file mode 100644 (file)
index a914694..0000000
+++ /dev/null
@@ -1,223 +0,0 @@
-#!/bin/bash
-
-zvm_cleanup_and_exit()
-{
-    if test -n "$1"; then
-        echo "$1"
-        umount ${BUILD_ROOT}/proc
-        umount ${BUILD_ROOT}/dev/pts
-        cleanup_and_exit 1
-    else
-        exit 0
-        cleanup_and_exit 1
-    fi
-}
-
-prevent_detach()
-{
-    if test "$1" = "150" -o "$1" = "0150"; then
-        echo "don't detach local root"
-        zvm_cleanup_and_exit 1
-    fi
-}
-
-zvm_memset()
-{
-    # defining the worker also resets the operating system. Be careful
-    # $1: user name
-    # $2: amount in MB
-    # Note, that this is also limited by the worker definition in the user directory
-    if test -n "$2"; then
-        if ! vmcp send $1 define storage ${2}M ; then
-            zvm_cleanup_and_exit "Could not redefine storage of $1 to ${2}M"
-        fi
-    fi
-}
-
-zvm_logon()
-{
-    # kill machine if it already runs
-    # autolog machine
-    # Needs machine name as $1
-    if test -n "$1"; then
-        if $(vmcp q "$1" >& /dev/null); then
-            vmcp force $1
-            sleep 1
-        fi
-        if ! $(vmcp q "$1" >& /dev/null); then
-            if ! $(vmcp xautolog $1 >& /dev/null); then
-                zvm_cleanup_and_exit "Could not start machine $1. Is $1 defined in the user directory?"
-            else
-                # give the worker a moment to initialize
-                sleep 2
-                zvm_memset $1 $MEMSIZE
-               sleep 2
-            fi
-        fi
-    fi
-}
-
-zvm_ipl()
-{
-    # IPL worker. Needs user as $1 and ipl device as $2.
-    if test -n "$1" -a -n "$2"; then
-        if ! $(vmcp q "$1" >& /dev/null); then
-            zvm_cleanup_and_exit "User $1 not logged on."
-        else
-            if ! $(vmcp send $1 ipl $2); then
-                 zvm_cleanup_and_exit "Could not send command to $1"
-            fi
-        fi
-    else
-        zvm_cleanup_and_exit "Not enough arguments for ipl. Need user and device number."
-    fi
-}
-
-
-zvm_destroy()
-{
-    # Destroy build. Done by killing the worker machine.
-    # needs user as $1
-    if test -n "$1"; then
-        if ! $(vmcp force $1 ); then
-            zvm_cleanup_and_exit "Could not force $1"
-        fi
-    fi
-}
-
-zvm_get_local_devnr()
-{
-    # $1 is base address, either 150 or 250
-    # $2 is worker number
-    # there is room for up to 100 workers for this controlling guest, however in our setup I expect only up to 10 workers.
-    #echo "Debug: zvm_get_local_devnr: arg1: $1 arg2: $2"
-    if test $2 -ge 100 ; then
-        zvm_cleanup_and_exit "Not more than 100 workers supported by one controlling guest."
-    fi
-    if test "$1" = "0150" -o "$1" = "150" ; then 
-        DEVNR=$((300+$2))
-    else
-        if test "$1" = "0250" -o "$1" = "250" ; then 
-            DEVNR=$((400+$2))
-        else
-            zvm_cleanup_and_exit "The disk devices for root and swap must be 150 and 250 respectively."
-        fi
-    fi
-    echo $DEVNR
-}
-
-zvm_volume_link_local()
-{
-    # attach worker disk to local system as preparation for 
-    # a) prepare worker for build
-    # b) get rpms of the swap disk after build finished
-    # disk must be detached from worker first
-    # The following arguments are needed:
-    # 1. Worker user name
-    # 2. Worker disk device number
-    # 3. Mult password for the disk
-    # 4. Worker number to generate a uniq local device number
-    if test -n "$4"; then
-        DEVNR=$(zvm_get_local_devnr $2 $4)
-        if ! vmcp link $1 $2 $DEVNR MW pass=THR4ME >& /dev/null ; then
-            zvm_cleanup_and_exit "Could not link disk $2 from user $1 to local device $DEVNR."
-        fi
-        dasd_configure 0.0.0$DEVNR 1 0 >& /dev/null
-       udevadm settle
-        DEVICE=$(ls /sys/bus/ccw/devices/0.0.0$DEVNR/block/)
-        if ! test -b /dev/${DEVICE}1 ; then
-            zvm_cleanup_and_exit "The device /sys/bus/ccw/devices/0.0.0$DEVNR has not been setup correctly."
-        fi
-        echo "${DEVICE}1"
-    else
-        zvm_cleanup_and_exit "Not enough arguments given to volume_link_local."
-    fi 
-}
-
-zvm_volume_detach_local()
-{
-    # we need
-    # 1. worker device number
-    # 2. worker number
-    DEVNR=$(zvm_get_local_devnr $1 $2)
-    prevent_detach $DEVNR
-    dasd_configure 0.0.0$DEVNR 0 0
-    if ! vmcp detach $DEVNR >& /dev/null ; then
-        zvm_cleanup_and_exit "Could not locally detach disk number $1 from worker $2"
-    fi
-}
-
-zvm_volume_attach()
-{
-    # link the local disk of the worker 
-    # $1: user name
-    # $2: disk device number
-    # send link * nr nr
-    if ! vmcp send $1 link \* $2 $2 ; then
-        zvm_cleanup_and_exit "Could not link remote worker disk number $2 from user $1"
-    fi 
-}
-
-zvm_volume_detach()
-{
-    # send machine detach nr
-    # $1: user name
-    # $2: disk
-    if ! vmcp send $1 detach $2 ; then
-        zvm_cleanup_and_exit "Could not detach disk $2 on worker $1"
-    fi
-}
-
-zvm_worker_init()
-{
-    # 1. Worker user name
-    # 2. Worker root device number
-    # 3. Worker swap device number
-    # 4. Worker number to generate a uniq local device number
-    # Check for: 
-    # - still mounted dasd
-    # - configured dasd
-    # - linked dasd
-    # - reset worker with force and autolog 
-    DEVNR_ROOT=$(zvm_get_local_devnr $2 $4) 
-    DEVNR_SWAP=$(zvm_get_local_devnr $3 $4)
-    # First, check for mounts:
-    for DEVNR in $DEVNR_ROOT $DEVNR_SWAP; do
-        if [ -d /sys/bus/ccw/devices/0.0.0$DEVNR/block ]; then
-            DEV=$(ls /sys/bus/ccw/devices/0.0.0$DEVNR/block/)
-            echo "Found device of worker $1 available at $DEVNR, device is /dev/$DEV."
-            grep "/dev/$DEV" /proc/mounts >& /dev/null && umount /dev/${DEV}1
-        fi
-    done
-    # Second, check if devices are online
-    for DEVNR in $DEVNR_ROOT $DEVNR_SWAP; do
-        lsdasd $DEVNR | grep $DEVNR && dasd_configure 0.0.0$DEVNR 0 0
-    done
-    # Third, remove stale links
-    for DEVNR in $DEVNR_ROOT $DEVNR_SWAP; do
-        prevent_detach $DEVNR
-        if vmcp q v $DEVNR 2> /dev/null; then
-            vmcp detach $DEVNR
-        fi
-    done
-    # Fourth, reset worker
-    zvm_logon $1
-}
-
-zvm_cp()
-{
-    modprobe vmcp || zvm_cleanup_and_exit "Cannod load vmcp module"
-    if test -n $1 ; then
-        case "$1" in 
-            start)                shift ; zvm_logon $*          ;;
-            ipl)                  shift ; zvm_ipl $*            ;;
-            destroy)              shift ; zvm_destroy $*        ;;
-            volume_attach)        shift ; zvm_volume_attach $*  ;;
-            volume_detach)        shift ; zvm_volume_detach $*  ;;
-            volume_link_local)    shift ; zvm_volume_link_local $*   ;;
-            volume_detach_local)  shift ; zvm_volume_detach_local $* ;;
-            memset)               shift ; zvm_memset $*         ;;
-            worker_init)          shift ; zvm_worker_init $*    ;;
-        esac
-    fi
-}