Update of /cvsroot/fink/fink/perlmod/Fink
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18601
Modified Files:
ChangeLog Services.pm
Log Message:
Improved PATH searching for *_lockwait()
Index: Services.pm
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/Services.pm,v
retrieving revision 1.162
retrieving revision 1.163
diff -u -d -r1.162 -r1.163
--- Services.pm 28 Apr 2005 03:25:32 -0000 1.162
+++ Services.pm 28 Apr 2005 05:00:44 -0000 1.163
@@ -1554,35 +1554,53 @@
=item dpkg_lockwait
my $path = dpkg_lockwait;
-
-Gets the path to dpkg-lockwait (a dpkg which will wait for a lock rather than
-just dying). Safely falls back to regular dpkg if dpkg-lockwait is not
-available.
+
+Returns path to dpkg-lockwait, or dpkg (see lockwait_executable
+for more information).
=cut
sub dpkg_lockwait {
- my $name = "dpkg";
- return ((grep { -f "$_/$name-lockwait" && -x _ } split /:/, $ENV{PATH})
- ? "$name-lockwait"
- : $name);
+ &lockwait_executable('dpkg');
}
=item aptget_lockwait
my $path = aptget_lockwait;
-
-Just like dpkg_lockwait, but for apt-get.
+
+Returns path to apt-get-lockwait, or apt-get (see lockwait_executable
+for more information).
=cut
sub aptget_lockwait {
- my $name = "apt-get";
- return ((grep { -f "$_/$name-lockwait" && -x _ } split /:/, $ENV{PATH})
- ? "$name-lockwait"
- : $name);
+ &lockwait_executable('apt-get');
}
+=item lockwait_executable
+
+ my $path = lockwait_executable($basename);
+
+Finds an executable file named $basename with "-lockwait" appended in
+the current PATH. If found, returns the full path to it. If not,
+returns just the given $basename. The *-lockwait executables are
+wrappers around the parent executables, but only a single instance of
+them can run at a time. Other calls to any of the *-lockwait
+executables wait until no other instances of them are running before
+launching the parent executable.
+
+=cut
+
+sub lockwait_executable {
+ my $basename = shift;
+
+ my $lockname = $basename . '-lockwait';
+ my $fullpath = &get_path($lockname);
+
+ return $fullpath eq $lockname
+ ? $basename
+ : $fullpath;
+}
=back
Index: ChangeLog
===================================================================
RCS file: /cvsroot/fink/fink/perlmod/Fink/ChangeLog,v
retrieving revision 1.983
retrieving revision 1.984
diff -u -d -r1.983 -r1.984
--- ChangeLog 28 Apr 2005 03:25:31 -0000 1.983
+++ ChangeLog 28 Apr 2005 05:00:38 -0000 1.984
@@ -1,5 +1,10 @@
2005-04-27 Dave Vasilevsky <[EMAIL PROTECTED]>
+ * Services.pm: New lockwait_executable (with better PATH
+ searching) back-end for *_lockwait()
+
+2005-04-27 Dave Vasilevsky <[EMAIL PROTECTED]>
+
* Services.pm: Don't restrict dpkg/apt-get to %p/bin.
2005-04-27 Daniel Macks <[EMAIL PROTECTED]>
-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans!
Take this survey and enter to win a one-year sub to SourceForge.net
Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix
_______________________________________________
Fink-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fink-commits