Update of /cvsroot/leaf/src/bering-uclibc/buildtool
In directory sc8-pr-cvs1:/tmp/cvs-serv17581

Modified Files:
        buildpacket.pl 
Log Message:
Added switch "--all" to automatically build all packages defined by buildtool.cfg


Index: buildpacket.pl
===================================================================
RCS file: /cvsroot/leaf/src/bering-uclibc/buildtool/buildpacket.pl,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** buildpacket.pl      9 Aug 2003 12:40:51 -0000       1.3
--- buildpacket.pl      25 Aug 2003 07:09:04 -0000      1.4
***************
*** 9,13 ****
  
  
! # $Header:
  
  use strict;
--- 9,13 ----
  
  
! # $Header$
  
  use strict;
***************
*** 33,37 ****
  
  my $Usage =
! qq{$0: --package=packagename --packager=name [--target=packagefile] 
[--lrp=filename.lrp] [--verbose]
   package  Package to create
   packager Name of the person who packaged the lrp (used for the packagename.help 
file)
--- 33,37 ----
  
  my $Usage =
! qq{$0: --package=packagename --packager=name [--all|--target=packagefile] 
[--lrp=filename.lrp] [--verbose]
   package  Package to create
   packager Name of the person who packaged the lrp (used for the packagename.help 
file)
***************
*** 39,42 ****
--- 39,43 ----
            needed for packages (like openssh) which create more than one lrp
   lrp      (optional) existing lrp-file to import config from
+  all      (optional) create all packages defined by packagename
  };
  
***************
*** 242,249 ****
--- 243,285 ----
        }
  
+ 
+ 
        return join("\n", @{$p_l_files});
  
  }
  
+ # packageExclude($config)
+ #
+ # Returns the contents of the .exclude.list file of the package
+ sub packageExclude($) {
+       my ($p_h_packageConfig) = @_;
+       my $file ;
+ 
+       print "Generating package exclude.list file\n"  if $verbose;
+       my $p_l_files = [];
+ 
+       foreach my $p_h_file (@{$p_h_packageConfig->{'contents'}->{'file'}}) {
+ 
+               next unless exists($p_h_file->{'type'}->{'EXCLUDE'});
+               my $filename = $p_h_file->{'filename'};
+ 
+               # turn the filename into an absolute path (if necessary)
+               if (!File::Spec->file_name_is_absolute($filename)) {
+                       $filename = 
File::Spec->catfile(File::Spec->rootdir(),$filename);
+               }
+ 
+               push(@{$p_l_files},$filename)
+       }
+ 
+       # remove leading slashes (otherwise, tar will complain while backing up)
+       my $p_l_returnFiles = [];
+       foreach my $file (sort(@{$p_l_files})) {
+               $file =~ s/^\///ig;
+               push (@{$p_l_returnFiles}, $file);
+       }
+ 
+       return join("\n", @{$p_l_returnFiles});
+ 
+ }
  
  
***************
*** 270,274 ****
        confess("Temp dir undefined") unless defined($tmpDir);
        confess("Will not delete root dir") if File::Spec->canonpath($tmpDir) eq 
File::Spec->rootdir();
- 
        system("rm -rf $tmpDir");
        rmdir($tmpDir);
--- 306,309 ----
***************
*** 476,481 ****
--- 511,525 ----
                ) unless $str eq '';
  
+       $str = packageExclude($p_h_package);
+       writeToFile(File::Spec->catfile($destDir, $p_h_options->{'target'} . 
".exclude.list"),
+                               $str . "\n"
+               ) unless $str eq '';
+ 
+ 
        $str = packageLocal($p_h_package);
  
+ 
+ 
+ 
        print ".local: $str\n" if $verbose;
        writeToFile(File::Spec->catfile($destDir, $p_h_options->{'target'} . ".local"),
***************
*** 524,528 ****
                }
  
! print $file . ", " . $permission . ", " . $ownership . "\n";
  
                # make sure this looks like an octal to perl
--- 568,572 ----
                }
  
!               #print $file . ", " . $permission . ", " . $ownership . "\n";
  
                # make sure this looks like an octal to perl
***************
*** 594,598 ****
                                                        'lrp=s',
                                                        'packager=s',
!                                                       'verbose')      or die $Usage;
  
  die $Usage unless exists($options->{'package'});
--- 638,643 ----
                                                        'lrp=s',
                                                        'packager=s',
!                                                       'verbose',
!                                                       'all')  or die $Usage;
  
  die $Usage unless exists($options->{'package'});
***************
*** 700,782 ****
  
  
- my $p_h_package = $packageConfig->value('package')->{$options->{'target'}};
- die "Could not read package config for package " . $options->{'target'}
-       unless defined($p_h_package);
  
  
! # turn the list if $p_h_package->{'contents'}->{'file'}->{'type'} into a hash
  
! foreach my $p_h_file (@{$p_h_package->{'contents'}->{'file'}}) {
  
-       my $p_l_list;
  
-       if (ref($p_h_file->{'type'}) eq 'ARRAY') {
-               $p_l_list = $p_h_file->{'type'};
  
!       } else {
!               $p_l_list = [$p_h_file->{'type'}];
!       }
  
  
  
!       $p_h_file->{'type'} = {};
!       foreach my $type (@{$p_l_list}) {
!               $p_h_file->{'type'}->{uc($type)} = 1;
!       }
  
! #use Data::Dumper;
! #my $dumper = Data::Dumper->new([$p_h_file]);
! #$dumper->Indent(1);
! #print STDERR  $dumper->Dumpxs(), "\n";
  
! }
  
  
- # find the skelFile
- $skelFile  = $p_h_package->{'skeleton'};
  
! # ok, finally...
  
! # create a temporary directory
! $tmpDir = prepareTempDir();
  
! # extract the skel file to the tempdir (if we have a skel file)
! copySkelFileToPackageStaging($skelFile, $sourceDir) if (defined($skelFile));
  
- # (optional) copy existing lrp
- if (exists($options->{'lrp'})) {
-       my $lrpFile = File::Spec->catfile(
-                                                                       $baseDir,
-                                                                       
$options->{'lrp'}
-                                                                       );
  
!       print "Importing lrp: $lrpFile\n" if $verbose;
!       copyExistingLrpToPackageStaging($lrpFile) ;
! }
  
! # copy binaries
! copyBinariesToPackageStaging($p_h_package, $stagingDir);
  
! # create links
! createLinksInStaging($p_h_package, $stagingDir);
  
! # TODO
! # add hook for "interactive" mode
  
! # create list of files
! my $p_h_packageContents = {};
! generateFileList('.', $p_h_packageContents);
  
! # generate lrpkg files
! generateLrpkgFiles($p_h_package, $p_h_packageContents,$options);
  
! # set up permissions
! applyOwnershipsAndPermissions($p_h_package, $p_h_packageContents);
  
! # create new lrp file in $packageDir
! createLrpPacket($p_h_package, $packageDir, $options, $gzipOptions);
  
! #clean up tmpDir
! cleanTempDir();
  
  exit;
--- 745,845 ----
  
  
  
  
! my $p_l_targets = [];
  
! if (exists($options->{'all'})) {
!       # fetch all possible targets for this package
!       foreach my $target (keys(%{$packageConfig->value('package')})) {
!               push(@$p_l_targets, $target);
!       }
! } else {
!       push(@$p_l_targets, $options->{'target'});
! }
  
  
  
! foreach my $target (@$p_l_targets) {
!       $options->{'target'} = $target;
!       print "Generating package $target\n";
!       my $p_h_package = $packageConfig->value('package')->{$options->{'target'}};
!       die "Could not read package config for package " . $options->{'target'}
!               unless defined($p_h_package);
  
+       # turn the list if $p_h_package->{'contents'}->{'file'}->{'type'} into a hash
  
+       foreach my $p_h_file (@{$p_h_package->{'contents'}->{'file'}}) {
  
!               my $p_l_list;
  
!               if (ref($p_h_file->{'type'}) eq 'ARRAY') {
!                       $p_l_list = $p_h_file->{'type'};
  
!               } else {
!                       $p_l_list = [$p_h_file->{'type'}];
!               }
  
  
  
!               $p_h_file->{'type'} = {};
!               foreach my $type (@{$p_l_list}) {
!                       $p_h_file->{'type'}->{uc($type)} = 1;
!               }
  
!       #use Data::Dumper;
!       #my $dumper = Data::Dumper->new([$p_h_file]);
!       #$dumper->Indent(1);
!       #print STDERR  $dumper->Dumpxs(), "\n";
  
!       }
  
  
!       # find the skelFile
!       $skelFile  = $p_h_package->{'skeleton'};
  
!       # ok, finally...
  
!       # create a temporary directory
!       $tmpDir = prepareTempDir();
  
!       # extract the skel file to the tempdir (if we have a skel file)
!       copySkelFileToPackageStaging($skelFile, $sourceDir) if (defined($skelFile));
  
!       # (optional) copy existing lrp
!       if (exists($options->{'lrp'})) {
!               my $lrpFile = File::Spec->catfile(
!                                                                               
$baseDir,
!                                                                               
$options->{'lrp'}
!                                                                               );
  
!               print "Importing lrp: $lrpFile\n" if $verbose;
!               copyExistingLrpToPackageStaging($lrpFile) ;
!       }
  
!       # copy binaries
!       copyBinariesToPackageStaging($p_h_package, $stagingDir);
  
!       # create links
!       createLinksInStaging($p_h_package, $stagingDir);
  
!       # TODO
!       # add hook for "interactive" mode
! 
!       # create list of files
!       my $p_h_packageContents = {};
!       generateFileList('.', $p_h_packageContents);
! 
!       # generate lrpkg files
!       generateLrpkgFiles($p_h_package, $p_h_packageContents,$options);
! 
!       # set up permissions
!       applyOwnershipsAndPermissions($p_h_package, $p_h_packageContents);
! 
!       # create new lrp file in $packageDir
!       createLrpPacket($p_h_package, $packageDir, $options, $gzipOptions);
! 
!       #clean up tmpDir
!       cleanTempDir();
! }
  
  exit;




-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines
at the same time. Free trial click here:http://www.vmware.com/wl/offer/358/0
_______________________________________________
Leaf-cvs-commits mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/leaf-cvs-commits

Reply via email to