[interchange-cvs] interchange - kwalsh modified lib/Vend/Config.pm

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Thu Aug 9 03:32:45 EDT 2007


User:      kwalsh
Date:      2007-08-09 07:32:44 GMT
Modified:  lib/Vend Config.pm
Log:
    * Added "file" (readable file) and "executable" (executable file)
      as additional Require directive tests, closing RT issue #99.

Revision  Changes    Path
2.219     +29 -3     interchange/lib/Vend/Config.pm


rev 2.219, prev_rev 2.218
Index: Config.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Config.pm,v
retrieving revision 2.218
retrieving revision 2.219
diff -u -r2.218 -r2.219
--- Config.pm	27 Jun 2007 22:42:36 -0000	2.218
+++ Config.pm	9 Aug 2007 07:32:44 -0000	2.219
@@ -1,6 +1,6 @@
 # Vend::Config - Configure Interchange
 #
-# $Id: Config.pm,v 2.218 2007/06/27 22:42:36 jon Exp $
+# $Id: Config.pm,v 2.219 2007/08/09 07:32:44 kwalsh Exp $
 #
 # Copyright (C) 2002-2007 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -54,7 +54,7 @@
 use Vend::Data;
 use Vend::Cron;
 
-$VERSION = substr(q$Revision: 2.218 $, 10);
+$VERSION = substr(q$Revision: 2.219 $, 10);
 
 my %CDname;
 my %CPname;
@@ -2641,7 +2641,7 @@
 		$error_message = "\a\n\n$1\n";
 	}
 
-	if($val =~ s%\s+((/[\w-]+)+)%%) {
+	if($val =~ s%\s+((/[\w.-]+)+)%%) {
 		$pathinfo = $1;
 	}
 	
@@ -2738,6 +2738,32 @@
 				}
 				return 0;
 			};
+	}
+	elsif ($val =~ s/^file\s*//i) {
+		$require = {};
+		$name = 'Readable file';
+		$val = $pathinfo unless $val;
+
+		$testsub = sub {
+			my $path = Vend::File::make_absolute_file(shift, $C ? 0 : 1);
+			if ($C && $path =~ s:^/+::) {
+				$path = "$C->{VendRoot}/$path";
+			}
+			return -r $path;
+		};
+	}
+	elsif ($val =~ s/^executable\s*//i) {
+		$require = {};
+		$name = 'Executable file';
+		$val = $pathinfo unless $val;
+
+		$testsub = sub {
+			my $path = Vend::File::make_absolute_file(shift, $C ? 0 : 1);
+			if ($C && $path =~ s:^/+::) {
+				$path = "$C->{VendRoot}/$path";
+			}
+			return -x $path;
+		};
 	}
 	my @requires = grep /\S/, split /\s+/, $val;
 








More information about the interchange-cvs mailing list