[csw-devel] SF.net SVN: gar:[16417] csw/mgar/gar/v2

dmichelsen at users.sourceforge.net dmichelsen at users.sourceforge.net
Thu Dec 8 18:17:16 CET 2011


Revision: 16417
          http://gar.svn.sourceforge.net/gar/?rev=16417&view=rev
Author:   dmichelsen
Date:     2011-12-08 17:17:16 +0000 (Thu, 08 Dec 2011)
Log Message:
-----------
mGAR v2: Make sure EXTRA_MERGE_INCLUDE_FILES works again

Modified Paths:
--------------
    csw/mgar/gar/v2/bin/pcopy
    csw/mgar/gar/v2/gar.mk

Modified: csw/mgar/gar/v2/bin/pcopy
===================================================================
--- csw/mgar/gar/v2/bin/pcopy	2011-12-08 16:58:53 UTC (rev 16416)
+++ csw/mgar/gar/v2/bin/pcopy	2011-12-08 17:17:16 UTC (rev 16417)
@@ -12,8 +12,9 @@
 
 use Data::Dumper;
 
-# pcopy [-s <regex> ]* [--paxargs <arg>]* <src> <target>
+# pcopy [-i <path>] [-s <regex> ]* [--paxargs <arg>]* <src> <target>
 #   Regex: -s 's,(/opt/csw/lib)/(.*\.so),\1/bdb33/\2,'
+#   -i  Make sure to include this path, later exclusions or replacements to the empty name are ignored
 # Objectives:
 # - Copy directory trees verbatim
 # - exclude entries
@@ -26,10 +27,11 @@
 my $help = 0;
 my $verbose = 0;
 my $matchonly = 0;	# Copy only files that match at least one regex
-my @subst;
+my (@subst, at incl);
 
 GetOptions(
 	's=s' => \@subst,
+	'i=s' => \@incl,
 	'm|matchonly' => \$matchonly,
 	'v' => \$verbose,
 	'help|?' => \$help,
@@ -70,6 +72,11 @@
   my $target = $File::Find::name;
   my @matches = ($target);
   my $didmatch = 0;
+
+  my $keepfile = 0;
+  foreach my $i (@incl) {
+    $keepfile = 1 if( $target =~ /$i/ );
+  }
   foreach my $s (@subst) {
     my $t = $target;
     $s =~ s/p$//;
@@ -77,6 +84,13 @@
     $s =~ s/\\\)/)/;
     # print "Regex: $s\n";
     eval( '$didmatch = 1 if( $target =~ s' . $s . ')');
+
+    # Undo deletions if we want to keep this file
+    if( $keepfile && $target eq '' ) {
+      $target = $t;
+      $keepfile = 2;
+    }
+
     if( $t ne $target ) {
       push @matches, $target;
       #$didmatch = 1;
@@ -87,7 +101,11 @@
     return;
   }
 
-  print join( " >> ", @matches ), "\n" if( $matches[-1] ne '' );
+  if( $matches[-1] ne '' ) {
+    print join( " >> ", @matches );
+    print " (kept)" if( $keepfile == 2 );
+    print "\n";
+  }
 
   if( $target eq '' ) {
     return;

Modified: csw/mgar/gar/v2/gar.mk
===================================================================
--- csw/mgar/gar/v2/gar.mk	2011-12-08 16:58:53 UTC (rev 16416)
+++ csw/mgar/gar/v2/gar.mk	2011-12-08 17:17:16 UTC (rev 16417)
@@ -820,7 +820,7 @@
 
 # This variable contains parameter for pax to honor global file inclusion/exclusion
 # Make sure include overrides are processed first
-_INC_EXT_RULE = $(foreach F,$(EXTRA_MERGE_INCLUDE_FILES) $(EXTRA_MERGE_INCLUDE_FILES_$(MODULATION)),-s ",^\(\.$F\)$$,\1,")
+_INC_EXT_RULE = $(foreach F,$(EXTRA_MERGE_INCLUDE_FILES) $(EXTRA_MERGE_INCLUDE_FILES_$(MODULATION)),-i "^\.$F$$")
 # Exclude by replacing files with the empty string
 _INC_EXT_RULE += $(foreach F,$(_MERGE_EXCLUDE_FILES),-s ',^\.$F$$,,')
 # Replace files by itself terminating on first match
@@ -945,7 +945,7 @@
 
 # Copy 
 merge-copy-config-only:
-	$(_DBG_MERGE)(cd $(INSTALLISADIR)$(if $(ALLOW_RELOCATE),$(RELOCATE_PREFIX)); umask 022 && pcopy $(_PAX_ARGS) \
+	$(_DBG_MERGE)(cd $(INSTALLISADIR)$(if $(ALLOW_RELOCATE),$(RELOCATE_PREFIX)); umask 022 && pcopy \
 		-m -s ",^\(\.$(bindir)/.*-config\)\$$,\1,p" \
 		. $(PKGROOT) \
 	)

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list