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

Modified Files:
        buildpacket.pl 
Log Message:
Minor fix for chmowning links


Index: buildpacket.pl
===================================================================
RCS file: /cvsroot/leaf/src/bering-uclibc/buildtool/buildpacket.pl,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** buildpacket.pl      25 Aug 2003 07:09:04 -0000      1.4
--- buildpacket.pl      9 Sep 2003 15:41:02 -0000       1.5
***************
*** 352,355 ****
--- 352,373 ----
  }
  
+ sub createDirectories($$){
+               my ($p_h_package, $build_dir) = @_;
+               print "Creating directories\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'}->{'DIRECTORY'});
+ 
+                               my $destination_path = 
File::Spec->catdir($tmpDir,$filename);
+ 
+                               # create the target directory, if it doesn't exist
+                               
createDirUnlessItExists($destination_path,$p_h_package);
+ 
+               }
+ 
+ }
+ 
  sub copyBinariesToPackageStaging($$) {
        my ($p_h_package, $build_dir) = @_;
***************
*** 369,377 ****
                        # 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");
--- 387,395 ----
                        # 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");
***************
*** 529,534 ****
  }
  
! sub applyOwnershipsAndPermissions($$) {
!       my ($p_h_package, $p_h_package_contents) = @_;;
        print "Setting file ownerships and permissions\n"  if $verbose;
  
--- 547,552 ----
  }
  
! sub applyOwnershipsAndPermissions($$;$) {
!       my ($p_h_package, $p_h_package_contents, $firstrun) = @_;;
        print "Setting file ownerships and permissions\n"  if $verbose;
  
***************
*** 536,539 ****
--- 554,559 ----
        my $ownership;
  
+ 
+ 
        foreach my $file (keys %{$p_h_package_contents}) {
                # setup defaults
***************
*** 546,556 ****
                }
  
                if (!File::Spec->file_name_is_absolute($file)) {
                        $file =File::Spec->catfile($tmpDir,$file  )
                }
  
- 
                # check if there's a permission/owner specified
- 
                foreach my $p_h_file (@{$p_h_package->{'contents'}->{'file'}}) {
                        my $filename = $p_h_file->{'filename'};
--- 566,575 ----
                }
  
+ 
                if (!File::Spec->file_name_is_absolute($file)) {
                        $file =File::Spec->catfile($tmpDir,$file  )
                }
  
                # check if there's a permission/owner specified
                foreach my $p_h_file (@{$p_h_package->{'contents'}->{'file'}}) {
                        my $filename = $p_h_file->{'filename'};
***************
*** 562,569 ****
--- 581,592 ----
  
                        if ($file eq $filename) {
+ 
                                $permission = $p_h_file->{'permissions'} if 
exists($p_h_file->{'permissions'} );
                                $ownership = $p_h_file->{'owner'} if 
exists($p_h_file->{'owner'});
                                last;
+ 
+ 
                        }
+ 
                }
  
***************
*** 589,596 ****
                }
  
!               chown($uid, $gid, $file) or die "chown failed on $file";
!               #print "chown $uid:$gid $file\n"  if $verbose;
!       }
  
  }
  
--- 612,626 ----
                }
  
!               #chown($uid, $gid, $file) or die "chown failed on $file";
!               # --- don't use perl's chown, since it doesn't work on
!               # symlinks (at least on V5.6.1
!               my $retVal = system("chown $uid:$gid $file");
!               if ($retVal>>8 != 0 ) {
!                               cleanTempDir();
!                               confess("chown failed on $file $!");
!               }
  
+               print "chown $uid:$gid $file\n"  if $verbose;
+       }
  }
  
***************
*** 769,772 ****
--- 799,809 ----
        # turn the list if $p_h_package->{'contents'}->{'file'}->{'type'} into a hash
  
+       # only one file in this package
+       if (ref($p_h_package->{'contents'}->{'file'}) ne 'ARRAY') {
+               my $p_h_file = $p_h_package->{'contents'}->{'file'};
+               $p_h_package->{'contents'}->{'file'} = [];
+               push(@{$p_h_package->{'contents'}->{'file'}}, $p_h_file);
+       }
+ 
        foreach my $p_h_file (@{$p_h_package->{'contents'}->{'file'}}) {
  
***************
*** 817,820 ****
--- 854,860 ----
        }
  
+       # create empty directories, if needed
+       createDirectories($p_h_package, $stagingDir);
+ 
        # copy binaries
        copyBinariesToPackageStaging($p_h_package, $stagingDir);
***************
*** 967,970 ****
--- 1007,1015 ----
                        </File>
  
+                       <File>
+                               Filename        = etc/somedir
+                               Type            = directory
+                       </File>
+ 
                </Contents>
        </sshd>
***************
*** 1063,1066 ****
--- 1108,1117 ----
  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)
+ 
+ =item directory
+ 
+ Filename specifies the name of a directory that should be created. Source is ignored.
+ Only useful if you need to create empty directories in the package (if they weren't 
empty
+ buildpacket would create them automatically anyway)
  
  =back




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Leaf-cvs-commits mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/leaf-cvs-commits

Reply via email to