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

Modified Files:
        buildpacket.pl 
Log Message:
Added changes to handle links within a package


Index: buildpacket.pl
===================================================================
RCS file: /cvsroot/leaf/src/bering-uclibc/buildtool/buildpacket.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** buildpacket.pl      12 Jun 2003 20:24:06 -0000      1.1
--- buildpacket.pl      19 Jul 2003 13:37:32 -0000      1.2
***************
*** 132,136 ****
                $p_h_allFiles->{$file} = 1;
        }
! 
        my $p_l_listFiles = [
                        File::Spec->catfile(File::Spec->rootdir(), 
'var','lib','lrpkg',"$target.*"),
--- 132,136 ----
                $p_h_allFiles->{$file} = 1;
        }
!       
        my $p_l_listFiles = [
                        File::Spec->catfile(File::Spec->rootdir(), 
'var','lib','lrpkg',"$target.*"),
***************
*** 284,287 ****
--- 284,314 ----
  }
  
+ sub createDirUnlessItExists($$) {
+       my ($path,$p_h_package) = @_;
+ 
+ 
+       while (!(-e $path)) {
+               print "Creating dir $path\n"  if $verbose;              
+               my @dirs = File::Spec->splitdir( $path );
+ 
+               my $permissions = $p_h_package->{'permissions'}->{'directories'} ;
+               my $dirToCreate = "";           
+               foreach my $dir (@dirs) {
+                       $dirToCreate = File::Spec->catdir($dirToCreate, $dir);
+       
+ 
+                       if (!(-e $dirToCreate)) {
+                               print " Creating dir $dirToCreate\n"  if $verbose;     
                                                 
+                               mkdir($dirToCreate,$permissions) or confess("creating 
dir " . $path . " failed. $!");                   
+                       }
+                       
+               }
+ 
+ 
+ 
+               
+       }
+ }
+ 
  sub copyBinariesToPackageStaging($$) {
        my ($p_h_package, $build_dir) = @_;
***************
*** 293,299 ****
--- 320,337 ----
                        next unless exists($p_h_file->{'type'}->{'BINARY'});
  
+ 
                        my $source_filename = 
File::Spec->catfile($build_dir,$p_h_file->{'source'});
                        my $destination_filename = 
File::Spec->catfile($tmpDir,$filename);
  
+                       my ($volume,$path,$file) = File::Spec->splitpath( 
$destination_filename );
+ 
+                       # create the target directory, if it doesn't exist
+                       createDirUnlessItExists($path,$p_h_package);
+                       unless (-e $path) {
+                               print "Creating dir $path\n"  if $verbose;
+                               my $permissions = 
$p_h_package->{'permissions'}->{'directories'} ;
+                               mkdir($path,$permissions) or confess("creating dir " . 
$path . " failed. $!");
+                       }
+                       
                        my $retVal = system("cp $source_filename 
$destination_filename");
                        if ($retVal>>8 != 0 ) {
***************
*** 304,307 ****
--- 342,384 ----
  }
  
+ sub createLinksInStaging($$) {
+       my ($p_h_package, $build_dir) = @_;
+       print "Creating links\n"  if($verbose);
+ 
+       foreach my $p_h_file (@{$p_h_package->{'contents'}->{'file'}}) {
+                       my $filename = $p_h_file->{'filename'};
+ 
+                       next unless exists($p_h_file->{'type'}->{'LINK'});
+ 
+                       my $link_target = 
File::Spec->catfile($tmpDir,$p_h_file->{'target'});
+                       #$link_target = File::Spec->abs2rel( $link_target, $tmpDir ) ;
+                       
+                       my ($volume1,$targetPath) = File::Spec->splitpath( 
$link_target );
+ 
+                       # create the target directory, if it doesn't exist
+                       createDirUnlessItExists($targetPath,$p_h_package);
+                       
+                       my $link_filename = File::Spec->catfile($tmpDir,$filename);    
                 
+                       my ($volume2,$linkPath) = File::Spec->splitpath( 
$link_filename );                      
+                       $link_target = File::Spec->abs2rel( $link_target, $linkPath ) 
;                 
+                       #$link_filename = File::Spec->abs2rel( $link_filename, $tmpDir 
) ;
+                       
+                       # create the target directory, if it doesn't exist
+                       createDirUnlessItExists($linkPath,$p_h_package);
+ 
+ 
+                       print "Creating link $link_filename -> $link_target\n" if 
$verbose;
+                                               
+                       my $retVal = system("cd $tmpDir && ln -s $link_target 
$link_filename");
+                       if ($retVal>>8 != 0 ) {
+                               cleanTempDir();
+                               confess("Creating link $link_filename -> $link_target 
failed. $!");
+                       }
+       }
+       
+       system("ls -al $tmpDir/usr/lib");
+ }
+ 
+ 
  # prototype - needed because of the recursion
  sub generateFileList($$);
***************
*** 370,373 ****
--- 447,453 ----
        my $str;
  
+       # create the target directory, if it doesn't exist
+       createDirUnlessItExists($destDir,$p_h_package);
+ 
        $str = packageHelp($p_h_package);
        writeToFile(File::Spec->catfile($destDir, $p_h_options->{'target'} . ".help"),
***************
*** 435,446 ****
                                $ownership = $p_h_file->{'owner'} if 
exists($p_h_file->{'owner'});
                                last;
!                       }
                }
  
                # make sure this looks like an octal to perl
                $permission = '0' . $permission   unless $permission =~ /^0/;
                chmod(oct($permission),$file) or die "chmod failed on $file";
  
!               #print "chmod $permission $file\n"  if $verbose;
  
                # fetch the numeric uid/gid is user- and group-names were specified
--- 515,528 ----
                                $ownership = $p_h_file->{'owner'} if 
exists($p_h_file->{'owner'});
                                last;
!                       }                       
                }
  
+ print $file . ", " . $permission . ", " . $ownership . "\n";                  
+ 
                # make sure this looks like an octal to perl
                $permission = '0' . $permission   unless $permission =~ /^0/;
                chmod(oct($permission),$file) or die "chmod failed on $file";
  
!               print "chmod $permission $file\n"  if $verbose;
  
                # fetch the numeric uid/gid is user- and group-names were specified
***************
*** 670,673 ****
--- 752,758 ----
  copyBinariesToPackageStaging($p_h_package, $stagingDir);
  
+ # create links
+ createLinksInStaging($p_h_package, $stagingDir);
+ 
  # TODO
  # add hook for "interactive" mode
***************
*** 807,810 ****
--- 892,901 ----
                        </File>
  
+                       <File>
+                               Filename        = usr/lib/libcrypto.so.0
+                               Target          = usr/lib/libcrypto.so.0.9.7
+                               Type            = link
+                       </File>                 
+ 
                </Contents>
        </sshd>
***************
*** 868,871 ****
--- 959,966 ----
  =over 4
  
+ =item Target
+ filename (including B<relative> path) that the link should point to (only used 
together
+ with Type=link)
+ 
  =item Filename
  filename (including B<relative> path) of the file in the package
***************
*** 893,896 ****
--- 988,997 ----
  only the type "I" (for including the file in the local backup) is supported,
  type "X" (for excluding a file from the local backup) is not.
+ 
+ =item link
+ 
+ Specifies that this file is a (soft-) link that should be created during package 
creation
+ Filename specifies the name of the link (relative to the root dir).
+ You MUST also specify Target (which tells buildpacket where the link should point to)
  
  =back




-------------------------------------------------------
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/345/0
_______________________________________________
Leaf-cvs-commits mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/leaf-cvs-commits

Reply via email to