Update of /cvsroot/fink/fink
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1587
Modified Files:
.cvsignore ChangeLog install.sh setup.sh
Added Files:
lockwait.in
Log Message:
dpkg and apt-get wait for other instances to finish instead of bombing out
Index: .cvsignore
===================================================================
RCS file: /cvsroot/fink/fink/.cvsignore,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- .cvsignore 28 Sep 2004 05:59:41 -0000 1.3
+++ .cvsignore 27 Apr 2005 18:30:20 -0000 1.4
@@ -7,3 +7,6 @@
pathsetup.sh
postinstall.pl
shlibs.default
+dpkg-lockwait
+apt-get-lockwait
+
Index: install.sh
===================================================================
RCS file: /cvsroot/fink/fink/install.sh,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- install.sh 25 Apr 2005 06:36:48 -0000 1.30
+++ install.sh 27 Apr 2005 18:30:22 -0000 1.31
@@ -57,6 +57,8 @@
install -c -p -m 755 fink "$basepath/bin/"
install -c -p -m 755 fink-virtual-pkgs "$basepath/bin/"
install -c -p -m 755 pathsetup.sh "$basepath/bin/"
+install -c -p -m 755 dpkg-lockwait "$basepath/bin/"
+install -c -p -m 755 apt-get-lockwait "$basepath/bin/"
install -c -p -m 644 fink.8 "$basepath/share/man/man8/"
install -c -p -m 644 fink.conf.5 "$basepath/share/man/man5/"
install -c -p -m 644 images/*.png "$basepath/share/fink/images/"
--- NEW FILE: lockwait.in ---
#!/usr/bin/perl
use warnings;
use strict;
use Fcntl qw(:DEFAULT :seek);
use POSIX qw(:errno_h);
my $basepath = "@PREFIX@";
my $exec = "$basepath/bin/@PROG@";
my $timeout = 10;
my $debug = 0;
print STDERR "exec = $exec, timeout = $timeout\n" if $debug;
if ($> == 0) {
print STDERR "We're root, gonna pre-lock\n" if $debug;
print STDERR "Opening the lockfile\n" if $debug;
my $lockfile = "$basepath/var/lib/dpkg/lock";
open LOCK, ">$lockfile" or die "lockwait: Can't open: $!";
print STDERR "Locking it\n" if $debug;
### Note this pack() is specific to OS X and Darwin!!!
my $struct_flock = pack("lllliss", (0, 0), (0, 0), 0, F_WRLCK,
SEEK_SET);
unless (fcntl(LOCK, F_SETLK, $struct_flock)) {
die "lockwait: Can't get lock: $!" unless $! == EAGAIN || $! ==
EACCES;
my $msg = $timeout ? "$timeout seconds " : "";
print STDERR "Waiting ${msg}for access to the dpkg database...
";
eval {
local $SIG{ALRM} = sub { die "alarm\n" };
alarm $timeout if $timeout;
print STDERR "Waiting for lock, timeout = $timeout\n"
if $debug;
fcntl(LOCK, F_SETLKW, $struct_flock) or
die "lockwait: Can't get lock or wait: $!";
alarm 0;
};
if ($@) {
die unless $@ eq "alarm\n";
print STDERR "\nTimed out, cancelling operation!\n";
exit(1);
}
print STDERR "done.\n";
}
print STDERR "Got the lock\n" if $debug;
print STDERR "Clear close-on-exec, so exec'ed process gets the lock\n"
if $debug;
fcntl(LOCK, F_SETFD, 0) or die "lockwait: Can't clear close-on-exec:
$!";
} else {
print STDERR "Non-root, can't pre-lock\n" if $debug;
}
print STDERR "Execing $exec with args: ", join(' ', @ARGV), "\n" if $debug;
exec($exec, @ARGV) or die "lockwait: Exec failed: $!";
Index: setup.sh
===================================================================
RCS file: /cvsroot/fink/fink/setup.sh,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- setup.sh 2 Jan 2005 15:50:15 -0000 1.17
+++ setup.sh 27 Apr 2005 18:30:22 -0000 1.18
@@ -52,4 +52,8 @@
echo "Creating postinstall script..."
sed "s|@PREFIX@|$basepath|g" <postinstall.pl.in >postinstall.pl
+echo "Creating lockwait wrappers..."
+sed -e "s|@PREFIX@|$basepath|g" -e "s|@PROG@|dpkg|g" <lockwait.in
>dpkg-lockwait
+sed -e "s|@PREFIX@|$basepath|g" -e "s|@PROG@|apt-get|g" <lockwait.in
>apt-get-lockwait
+
exit 0
Index: ChangeLog
===================================================================
RCS file: /cvsroot/fink/fink/ChangeLog,v
retrieving revision 1.329
retrieving revision 1.330
diff -u -d -r1.329 -r1.330
--- ChangeLog 27 Apr 2005 13:23:39 -0000 1.329
+++ ChangeLog 27 Apr 2005 18:30:21 -0000 1.330
@@ -1,3 +1,8 @@
+2005-04-27 Dave Vasilevsky <[EMAIL PROTECTED]>
+
+ * lockwait.in, .cvsignore, setup.sh, install.sh: Install -lockwait
+ versions of dpkg and apt-get.
+
2005-04-27 Dave Morrison <[EMAIL PROTECTED]>
* VERSION: Bumped package manager version to 0.24.5, a release
-------------------------------------------------------
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