incremental enhancements
authorAnas Nashif <anas.nashif@intel.com>
Wed, 2 May 2012 18:06:41 +0000 (19:06 +0100)
committerAnas Nashif <anas.nashif@intel.com>
Wed, 2 May 2012 18:06:41 +0000 (19:06 +0100)
check_unresolved [new file with mode: 0755]
depanneur

diff --git a/check_unresolved b/check_unresolved
new file mode 100755 (executable)
index 0000000..2d8e038
--- /dev/null
@@ -0,0 +1,276 @@
+#!/usr/bin/perl -w
+
+BEGIN {
+  unshift @INC, ($::ENV{'BUILD_DIR'} || '/usr/lib/build');
+}
+
+use strict;
+
+use Build;
+
+my ($dist, $rpmdeps, $archs, $configdir, $useusedforbuild);
+
+while (@ARGV)  {
+  if ($ARGV[0] eq '--dist') {
+    shift @ARGV;
+    $dist = shift @ARGV;
+    next;
+  }
+  if ($ARGV[0] eq '--depfile') {
+    shift @ARGV;
+    $rpmdeps = 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 '--useusedforbuild') {
+    shift @ARGV;
+    $useusedforbuild = 1;
+    next;
+  }
+  if ($ARGV[0] eq '--define') {
+    shift @ARGV;
+    my $def = shift @ARGV;
+    Build::define($def);
+    next;
+  }
+  if ($ARGV[0] eq '--with') {
+    shift @ARGV;
+    my $def = shift @ARGV;
+    Build::define("_with_$def --with-$def");
+    next;
+  }
+  if ($ARGV[0] eq '--without') {
+    shift @ARGV;
+    my $def = shift @ARGV;
+    Build::define("_without_$def --without-$def");
+    next;
+  }
+  last;
+}
+$configdir = '.' unless defined $configdir;
+$archs = '' unless defined $archs;
+die("you must specfiy a depfile!\n") unless defined $rpmdeps;
+
+my @extradeps = grep {!/(^|\/)PKGBUILD$/ && !/\.(?:spec|dsc|kiwi)$/} @ARGV;
+my @specs = grep {/(^|\/)PKGBUILD$/ || /\.(?:spec|dsc|kiwi)$/} @ARGV;
+die("can only work with at most one spec\n") if @specs > 1;
+my $spec = $specs[0];
+
+my @archs = split(':', $archs);
+if ($spec =~ /(^|\/)PKGBUILD$/) {
+  push @archs, 'any' unless grep {$_ eq 'any'} @archs;
+} else {
+  push @archs, 'noarch' unless grep {$_ eq 'noarch'} @archs;
+}
+
+my (%fn, %prov, %req);
+
+my %packs;
+my %repo;
+my %ids;
+
+my %packs_arch;
+my %packs_done;
+open(F, '<', $rpmdeps) || die("$rpmdeps: $!\n");
+# WARNING: the following code assumes that the 'I' tag comes last
+my ($pkgF, $pkgP, $pkgR);
+while(<F>) {
+  chomp;
+  if (/^F:(.*?)-\d+\/\d+\/\d+: (.*)$/) {
+    $pkgF = $2;
+    next if $fn{$1};
+    $fn{$1} = $2;
+    my $pack = $1;
+    $pack =~ /^(.*)\.([^\.]+)$/ or die;
+    push @{$packs_arch{$2}}, $1;
+  } elsif (/^P:(.*?)-\d+\/\d+\/\d+: (.*)$/) {
+    $pkgP = $2;
+    next if $prov{$1};
+    $prov{$1} = $2;
+  } elsif (/^R:(.*?)-\d+\/\d+\/\d+: (.*)$/) {
+    $pkgR = $2;
+    next if $req{$1};
+    $req{$1} = $2;
+  } elsif (/^I:(.*?)-\d+\/\d+\/\d+: (.*)$/) {
+    if ($ids{$1} && !$packs_done{$1} && defined($pkgF) && defined($pkgP) && defined($pkgR)) {
+      my $i = $1;
+      my $oldid = $ids{$1};
+      my $newid = $2;
+      #print $oldid . " ===== " . $newid . "\n";
+      if (Build::Rpm::verscmp($oldid, $newid) < 0) {
+        $ids{$i}  = $newid;
+        $fn{$i}   = $pkgF;
+        $prov{$i} = $pkgP;
+        $req{$i}  = $pkgR;
+      }
+    } else {
+      next if $ids{$1};
+      $ids{$1} = $2;
+    }
+    undef $pkgF;
+    undef $pkgP;
+    undef $pkgR;
+  } elsif ($_ eq 'D:') {
+    %packs_done = %ids;
+  }
+}
+close F;
+
+for my $arch (@archs) {
+  $packs{$_} ||= "$_.$arch" for @{$packs_arch{$arch} || []};
+}
+
+# XXX: move to separate tool
+if (!defined($dist) || $dist eq '') {
+  my $rpmarch = (grep {$fn{"rpm.$_"}} @archs)[0];
+  if (!$rpmarch) {
+    $dist = 'default';
+  } else {
+    my $rpmfn = $fn{"rpm.$rpmarch"};
+    if ($rpmfn =~ /^[a-z]+:\/\//) {
+      require File::Temp;
+      my $tmpdir = File::Temp::tempdir('CLEANUP' => 1);
+      $rpmfn =~ s/.*\//$tmpdir\// unless system("$INC[0]/download", $tmpdir, $rpmfn);
+    }
+    my $rpmdist = '';
+    if ($rpmfn =~ /^\// && -e $rpmfn) {
+      my %res = Build::Rpm::rpmq($rpmfn, 1010);
+      $rpmdist = $res{1010}->[0] || '';
+    }
+    $dist = Build::dist_canon($rpmdist, $archs[0]);
+    # need some extra work for sles11 :(
+    if ($dist =~ /^sles11-/) {
+      my %res = Build::Rpm::rpmq($rpmfn, 1049);
+      $dist =~ s/^sles11-/sles11sp2-/ if grep {/^liblzma/} @{$res{1049} || []};
+    }
+  }
+  print STDERR "Warning: distribution not specified, assuming '$dist' (see $configdir).\n";
+}
+
+my $cf = Build::read_config_dist($dist, $archs[0], $configdir);
+$cf->{'warnings'} = 1;
+
+my $dofileprovides = %{$cf->{'fileprovides'}};
+
+for my $pack (keys %packs) {
+  my $r = {};
+  my (@s, $s, @pr, @re);
+  @s = split(' ', $prov{$packs{$pack}} || '');
+  while (@s) {
+    $s = shift @s;
+    next if !$dofileprovides && $s =~ /^\//;
+    if ($s =~ /^rpmlib\(/) {
+      splice(@s, 0, 2);
+      next;
+    }
+    push @pr, $s;
+    splice(@s, 0, 2) if @s && $s[0] =~ /^[<=>]/;
+  }
+  @s = split(' ', $req{$packs{$pack}} || '');
+  while (@s) {
+    $s = shift @s;
+    next if !$dofileprovides && $s =~ /^\//;
+    if ($s =~ /^rpmlib\(/) {
+      splice(@s, 0, 2);
+      next;
+    }
+    push @re, $s;
+    splice(@s, 0, 2) if @s && $s[0] =~ /^[<=>]/;
+  }
+  $r->{'provides'} = \@pr;
+  $r->{'requires'} = \@re;
+  $repo{$pack} = $r;
+}
+
+
+#######################################################################
+
+sub print_rpmlist
+{
+  for (@_) {
+    print "$_ $fn{$packs{$_}}\n";
+    print "rpmid: $_:$ids{$packs{$_}}\n" if exists $ids{$packs{$_}};
+  }
+  print "preinstall: @{$cf->{'preinstall'} || []}\n";
+  print "vminstall: @{$cf->{'vminstall'} || []}\n";
+  print "cbpreinstall: @{$cf->{'cbpreinstall'} || []}\n"; # preinstall if is_emulator_arch
+  print "cbinstall: @{$cf->{'cbinstall'} || []}\n";       # install if is_emulator_arch
+  print "runscripts: @{$cf->{'runscripts'} || []}\n";
+  print "dist: $dist\n" if defined $dist;
+}
+
+if ($useusedforbuild) {
+  die("Need a specfile/dscfile for --usedforbuild\n") unless defined $spec;
+  local *F;
+  open(F, '<', $spec) || die("$spec: $!\n");
+  my @usedforbuild;
+  my @buildrequires;
+  while(<F>) {
+    chomp;
+    if (/^#\s*usedforbuild\s*(.*)$/) {
+      push @usedforbuild, split(' ', $1);
+    }
+    if (/^buildrequires:\s*(.*)$/i) {
+      push @buildrequires, split(' ', $1);
+    }
+  }
+  close F;
+  @usedforbuild = @buildrequires unless @usedforbuild;
+  @usedforbuild = Build::unify(@usedforbuild) if @usedforbuild;
+  my @errors;
+  for (@usedforbuild) {
+    push @errors, "package $_ not found" unless $packs{$_} && $fn{$packs{$_}};
+  }
+  if (@errors) {
+    print STDERR "expansion error\n";
+    print STDERR "  $_\n" for @errors;
+    exit(1);
+  }
+  print_rpmlist(@usedforbuild);
+  exit(0);
+}
+
+#######################################################################
+
+my ($packname, $packvers, $subpacks, @packdeps);
+$subpacks = [];
+
+if ($spec) {
+  my $d;
+  if ($spec =~ /\.kiwi$/) {
+    # just set up kiwi root for now
+    $d = {
+      'deps' => [ 'kiwi', 'zypper', 'createrepo', 'squashfs' ],
+      'subpacks' => [],
+    };
+  } else {
+    $d = Build::parse($cf, $spec);
+  }
+  $packname = $d->{'name'};
+  $packvers = $d->{'version'};
+  $subpacks = $d->{'subpacks'};
+  @packdeps = @{$d->{'deps'} || []};
+}
+
+Build::readdeps($cf, undef, \%repo);
+
+#######################################################################
+
+my @bdeps = Build::get_build($cf, $subpacks, @packdeps, @extradeps);
+
+if (!shift @bdeps) {
+  print STDERR "expansion error\n";
+  print STDERR "  $_\n" for @bdeps;
+  exit(1);
+}
+
+exit(0);
index 2460129049681555124246460178406ecdbc3ab2..ec2c192e461cbf75c98211e13b8e8502de223e04 100755 (executable)
--- a/depanneur
+++ b/depanneur
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl 
 #
 # SMOCK - Simpler Mock
 # by Dan Berrange and Richard W.M. Jones.
@@ -48,9 +48,12 @@ use Build::Rpm;
 use Data::Dumper;
 use File::Basename;
 
+my @exclude = ();
 my $arch = "";
+my $path = "";
+my $style = "";
 my $chain = 0;
-my $chain = 0;
+my $buildall = 0;
 my $dist = "";
 my $dryrun = 0;
 my $help = 0;
@@ -63,8 +66,11 @@ my $suffix = "";
 GetOptions (
     "arch=s" => \$arch,
     "chain" => \$chain,
+    "exclude=s" => \@exclude,
     "build-all" => \$buildall,
     "dist=s" => \$dist,
+    "style=s" => \$style,
+    "path=s" => \$path,
     "dryrun" => \$dryrun,
     "help|?" => \$help,
     "keepgoing" => \$keepgoing,
@@ -170,13 +176,24 @@ a custom one.
 
 =cut
 
+
 my @packs = @ARGV;
+my $package_path = "";
+
+if ( $path == "" ) {
+    $package_path = "$ENV{TIZEN_DEVEL_ROOT}/packages";
+} else {
+    $package_path = $path;
+}
 
-# Traverse desired filesystems
 if ($buildall) {
-    File::Find::find({wanted => \&wanted}, "$ENV{TIZEN_DEVEL_ROOT}/packages");
+    if ($style eq "git") {
+        File::Find::find({wanted => \&wanted}, $path );
+    } elsif ($style eq "obs") {
+        File::Find::find({wanted => \&obs_wanted}, $path );
+    }
 } else {
-    if (@packs = 0) {
+    if (@packs == 0) {
         die("Please provide a list of packages to build.");
     }
 }
@@ -189,6 +206,14 @@ sub wanted {
     && fill_pacs($name);
 }
 
+sub obs_wanted {
+    /^.*\.spec\z/s && obs_pacs($name);
+}
+sub obs_pacs()
+{
+    my $name = shift;
+    $name =~ m/\.osc/ || push(@packs, $name);
+}
 
 sub fill_pacs()
 {
@@ -204,16 +229,15 @@ sub fill_pacs()
 
         my $pwd = getcwd;
         my $base = dirname($name);
-        print "Creating archive for $name\n";
-        #system("cd $base; git archive --format=tar --prefix=$pack->{name}-$pack->{version}/ HEAD | bzip2 > $name/$pack->{name}-$pack->{version}.tar.bz2; cd $pwd");
+        my $filename = "$name/$pack->{name}-$pack->{version}.tar.bz2";
+        #print "Creating archive $filename\n";
+        system("cd $base; git archive --format=tar --prefix=$pack->{name}-$pack->{version}/ HEAD | bzip2 > $name/$pack->{name}-$pack->{version}.tar.bz2; cd $pwd") if ! -e $filename;
+        $filename = "$name/$pack->{name}-$pack->{version}.tar.gz";
+        system("cd $base; git archive --format=tar --prefix=$pack->{name}-$pack->{version}/ HEAD | gzip > $name/$pack->{name}-$pack->{version}.tar.gz; cd $pwd") if ! -e $filename;
         push(@packs, $spec);
     }
 }
 
-# Resolve the names, dependency list, etc. of the SRPMs that were
-# specified.
-
-
 sub get_lines
 {
     local $_;
@@ -233,17 +257,20 @@ foreach my $spec (@packs) {
     my $archs="i586";
     my $configdir="$ENV{TIZEN_BUILD_ROOT}/tools/dist-configs";
     my $config = Build::read_config_dist($dist, $archs, $configdir);
-    #print Dumper($config);
     my $pack = Build::Rpm::parse($config, $spec);
+    #print Dumper($pack);
     my $name = $pack->{name};
     my $version = $pack->{version};
     my $release = $pack->{release};
     my @buildrequires = $pack->{deps};
+    my @subpacks = $pack->{subpacks};
+    #print Dumper(@buildrequires);
     $packs{$name} = {
         name => $name,
         version => $version,
         release => $release,
         deps => @buildrequires,
+        subpacks => @subpacks,
         filename => $spec
     }
 }
@@ -268,99 +295,9 @@ sub is_member_of
     0;
 }
 
-sub dependency_in
-{
-    my $dep = shift;            # eg. dbus-devel
-
-    while ($dep) {
-        return $dep if is_member_of ($dep, @_);
-        my $newdep = $dep;
-        $newdep =~ s/-\w+$//;   # eg. dbus-devel -> dbus
-        last if $newdep eq $dep;
-        $dep = $newdep;
-    }
-    0;
-}
-
-foreach my $name (keys %packs) {
-    my @buildrequires = @{$packs{$name}->{deps}};
-    @buildrequires =
-        grep { $_ = dependency_in ($_, keys %packs) } @buildrequires;
-    $packs{$name}{deps} = \@buildrequires;
-}
-
-# This function takes a list of package names and sorts them into the
-# correct order for building, given the existing %packs hash
-# containing buildrequires.  We use the external 'tsort' program.
-
-sub tsort
-{
-    my @names = @_;
-
-    my ($fh, $filename) = tempfile ();
-
-    foreach my $name (@names) {
-        my @buildrequires = @{$packs{$name}->{deps}};
-        foreach (@buildrequires) {
-            print $fh "$_ $name\n"
-        }
-        # Add a self->self dependency.  This ensures that any
-        # packages which don't have or appear as a dependency of
-        # any other package still get built.
-        print $fh "$name $name\n"
-    }
-    close $fh;
-
-    get_lines "tsort $filename";
-}
-
-# Sort the initial list of package names.
-
-my @names = sort keys %packs;
-my @buildorder = tsort (@names);
-
-# With --chain flag we print the packages in groups for chain building.
-
-if ($chain) {
-    my %group = ();
-    my $name;
-
-    print 'make chain-build CHAIN="';
-
-    foreach $name (@buildorder) {
-        my @br = @{$packs{$name}->{deps}};
-
-        # If a BR occurs within the current group, then start the next group.
-        my $occurs = 0;
-        foreach (@br) {
-            if (exists $group{$_}) {
-                $occurs = 1;
-                last;
-            }
-        }
-
-        if ($occurs) {
-            %group = ();
-            print ": ";
-        }
-
-        $group{$name} = 1;
-        print "$name ";
-    }
-    print "\"\n";
-
-    exit 0
-}
 
 # With --dryrun flag we just print the packages in build order then exit.
 
-if ($dryrun) {
-    foreach (@buildorder) {
-        print "$_\n";
-    }
-
-    exit 0
-}
 
 # Now we can build each SRPM.
 
@@ -397,62 +334,98 @@ my @errors = ();
 
 # NB: Need to do the arch/distro in the outer loop to work
 # around the caching bug in mock/yum.
-        foreach my $name (@buildorder) {
-            my $version = $packs{$name}->{version};
-            my $release = $packs{$name}->{release};
-            my $srpm_filename = $packs{$name}->{filename};
 
-            $release =~ s/\.fc?\d+$//; # "1.fc9" -> "1"
+my @done = ();
+while () {
+    my @order = ();
+    my $repo = "http://biruni.local:82/Tizen:/Base/standard/";
+    my $bd = "$ENV{'VIRTUAL_ENV'}/usr/lib/build";
+    if ( system("$bd/createrepomddeps --cachedir=$ENV{TIZEN_DEVEL_ROOT}/local/order $repo > $ENV{TIZEN_DEVEL_ROOT}/local/order/.repo.cache ") == 0 && 
+        system("$bd/createrpmdeps $localrepo/$dist/$arch/RPMS >> $ENV{TIZEN_DEVEL_ROOT}/local/order/.repo.cache ") == 0 ) {
+        foreach my $name (keys %packs) {
+            if( ! (grep $_ eq $name, @done) && ! (grep $_ eq $name, @exclude)) {
+                my $fn = $packs{$name}->{filename};
+                print "Checking dependencies for $name:\n";
+                if ( system("$ENV{VIRTUAL_ENV}/bin/check_unresolved --depfile $ENV{TIZEN_DEVEL_ROOT}/local/order/.repo.cache --configdir $ENV{TIZEN_BUILD_ROOT}/tools/dist-configs --dist $dist --archpath i586:i686:noarch $fn") == 0 ) {
+                    push(@order, $name);
+                }
+            } else {
+                print "We handled this already: $name\n";
+            }
+        }
+    }
+    if (@order == 0) {
+        last;
+    } else {
+        push(@done, @order);
+        print "First pass:\n";
+        foreach my $o (@order) {
+            print "$o\n";
+        }
+    }
+    if ($dryrun) {
+        exit 1
+    }
+    
+    foreach my $name (@order) {
+        my $version = $packs{$name}->{version};
+        my $release = $packs{$name}->{release};
+        my $srpm_filename = $packs{$name}->{filename};
+
+        $release =~ s/\.fc?\d+$//; # "1.fc9" -> "1"
 
-            # Does the built (binary) package exist already?
-            my $pattern = "$localrepo/$dist/$arch/RPMS/$name-$version-$release.*.rpm";
-            #print "pattern = $pattern\n";
-            my @binaries = glob $pattern;
+        # Does the built (binary) package exist already?
+        my $pattern = "$localrepo/$dist/src/SRPMS/$name-$version-$release.*.rpm";
+        #print "pattern = $pattern\n";
+        my @binaries = glob $pattern;
 
-            if (@binaries != 0 && $overwrite) {
-                print "*** overwriting $name-$version-$release $arch $dist ***\n";
-            }
+        if (@binaries != 0 && $overwrite) {
+            print "*** overwriting $name-$version-$release $arch $dist ***\n";
+        }
 
-            if (@binaries == 0 || $overwrite)
-            {
-                # Rebuild the package.
-                print "*** building $name-$version-$release $arch $dist ***\n";
+        if (@binaries == 0 || $overwrite)
+        {
+            # Rebuild the package.
+            print "*** building $name-$version-$release $arch $dist ***\n";
 
-                createrepo ($arch, $dist);
+            createrepo ($arch, $dist);
 
-                my $scratchdir = "$ENV{TIZEN_BUILD_ROOT}/local/scratch";
+            my $scratchdir = "$ENV{TIZEN_BUILD_ROOT}/local/scratch";
 
-                $ENV{'BUILD_DIR'} = "$ENV{'VIRTUAL_ENV'}/usr/lib/build";
-                my $pattern = "$localrepo/$dist/$arch/repodata/*.xml";
-                my @repomd = glob $pattern;
+            $ENV{'BUILD_DIR'} = "$ENV{'VIRTUAL_ENV'}/usr/lib/build";
+            my $pattern = "$localrepo/$dist/$arch/repodata/*.xml";
+            my @repomd = glob $pattern;
 
-                #my $repos = "--repository http://192.168.1.41:82/Tizen:/Base/standard/ ";
-                my $repos = "--repository http://download.tz.otcshare.org/live/Tizen:/Base/standard/ ";
-                if (@repomd != 0 ) {
-                    $repos .= "--rpms $localrepo/$dist/$arch/RPMS ";
-                }
-                if (system ("sudo BUILD_ROOT=$ENV{TIZEN_BUILD_ROOT}/local/scratch BUILD_DIR=\"$ENV{'VIRTUAL_ENV'}/usr/lib/build\" build --clean --cachedir $ENV{TIZEN_BUILD_ROOT}/local/cache --dist $dist --configdir $ENV{TIZEN_BUILD_ROOT}/tools/dist-configs $repos $srpm_filename") == 0) {
-                    # Build was a success so move the final RPMs into the
-                    # mock repo for next time.
-                    system ("cp $scratchdir/home/abuild/rpmbuild/SRPMS/*.rpm $localrepo/$dist/src/SRPMS") == 0 or die "mv";
-                    system ("cp $scratchdir/home/abuild/rpmbuild/RPMS/*/*.rpm $localrepo/$dist/$arch/RPMS") == 0 or die "mv";
-                    my_mkdir "$localrepo/$dist/$arch/logs/$name-$version-$release";
-                    system ("cp $scratchdir/.build.log $localrepo/$dist/$arch/logs/$name-$version-$release/log") == 0 or die "mv";
+            my $repos = "";
+            if (@repomd != 0 ) {
+                $repos .= "--rpms $localrepo/$dist/$arch/RPMS ";
+            }
+            $repos .= "--repository $repo ";
 
-                    createrepo ($arch, $dist);
+            if (system ("sudo BUILD_ROOT=$ENV{TIZEN_BUILD_ROOT}/local/scratch BUILD_DIR=\"$ENV{'VIRTUAL_ENV'}/usr/lib/build\" build  --cachedir $ENV{TIZEN_BUILD_ROOT}/local/cache --dist $dist --configdir $ENV{TIZEN_BUILD_ROOT}/tools/dist-configs   $repos $srpm_filename") == 0) {
+                # Build was a success so move the final RPMs into the
+                # mock repo for next time.
+                system ("cp $scratchdir/home/abuild/rpmbuild/SRPMS/*.rpm $localrepo/$dist/src/SRPMS") == 0 or die "mv";
+                system ("cp $scratchdir/home/abuild/rpmbuild/RPMS/*/*.rpm $localrepo/$dist/$arch/RPMS") == 0 or die "mv";
+                my_mkdir "$localrepo/$dist/$arch/logs/$name-$version-$release";
+                system ("cp $scratchdir/.build.log $localrepo/$dist/$arch/logs/$name-$version-$release/log") == 0 or die "mv";
+                system ("cp $scratchdir/.srcfiles.cache $ENV{TIZEN_DEVEL_ROOT}/local/order/.repo.cache") == 0 or die "mv";
+
+                createrepo ($arch, $dist);
 
-                }
-                else {
-                    push @errors, "$name-$dist-$arch$suffix";
-                    print STDERR "Build failed, return code $?\nLeaving the logs in $scratchdir\n";
-                    exit 1 unless $keepgoing;
-                }
             }
-            else
-            {
-                print "skipping $name-$version-$release $arch $dist\n";
+            else {
+                push @errors, "$name-$dist-$arch$suffix";
+                print STDERR "Build failed, return code $?\nLeaving the logs in $scratchdir\n";
+                exit 1 unless $keepgoing;
             }
         }
+        else
+        {
+            print "skipping $name-$version-$release $arch $dist\n";
+        }
+    }
+}
 
 if (@errors) {
     print "\n\n\nBuild failed for the following packages:\n";