Use mozLock instead of flock() when building lists.

git-svn-id: svn://10.0.0.236/trunk@101298 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
cls%seawood.org
2001-08-17 12:06:03 +00:00
parent a3454095af
commit 99b12b961f
3 changed files with 15 additions and 11 deletions

View File

@@ -31,12 +31,14 @@
use Fcntl qw(:DEFAULT :flock);
use Getopt::Std;
use mozLock;
sub usage() {
print "$0 [-l] <filename> <entry>\n";
exit(1);
}
$lockfile =
$nofilelocks = 0;
getopts("l");
@@ -46,6 +48,8 @@ $nofilelocks = 1 if defined($::opt_l);
$file = shift;
$entry = shift;
$lockfile = $file . ".lck";
# touch the file if it doesn't exist
if ( ! -e "$file") {
$now = time;
@@ -54,7 +58,7 @@ if ( ! -e "$file") {
# This needs to be atomic
open(OUT, ">>$file") || die ("$file: $!\n");
flock(OUT, LOCK_EX) unless $nofilelocks;
mozLock($lockfile) unless $nofilelocks;
open(RES, "grep -c '^$entry\$' $file |") or $err = $!;
if ($err) {
flock(OUT,LOCK_UN) unless $nofilelocks;
@@ -65,7 +69,7 @@ close(RES);
if (!$val) {
print OUT "$entry\n";
}
flock(OUT, LOCK_UN) unless $nofilelocks;
mozUnlock($lockfile) unless $nofilelocks;
close(OUT);
exit(0);

View File

@@ -417,16 +417,16 @@ INSTALL_FILES: $(INSTALL_FILE_LIST)
# It's to be linked into a meta-component. Add the component name to
# the meta component's list
export::
$(PERL) $(DEPTH)\config\build-list.pl $(_NO_FLOCK) $(META_LINK_COMPS:\=/) $(LIBRARY_NAME)
$(PERL) $(DEPTH)\config\build-list.pl $(_NO_FLOCK) $(META_LINK_COMP_NAMES:\=/) $(MODULE_NAME)
$(PERL) -I$(DEPTH)\config $(DEPTH)\config\build-list.pl $(_NO_FLOCK) $(META_LINK_COMPS:\=/) $(LIBRARY_NAME)
$(PERL) -I$(DEPTH)\config $(DEPTH)\config\build-list.pl $(_NO_FLOCK) $(META_LINK_COMP_NAMES:\=/) $(MODULE_NAME)
!else # defined(META_COMPONENT)
# Otherwise, it's to be linked into the main executable. Add the component
# name to the list of components, and the library name to the list of
# static libs.
export::
$(PERL) $(DEPTH)\config\build-list.pl $(_NO_FLOCK) $(FINAL_LINK_COMPS:\=/) $(LIBRARY_NAME)
$(PERL) $(DEPTH)\config\build-list.pl $(_NO_FLOCK) $(FINAL_LINK_COMP_NAMES:\=/) $(MODULE_NAME)
$(PERL) -I$(DEPTH)\config $(DEPTH)\config\build-list.pl $(_NO_FLOCK) $(FINAL_LINK_COMPS:\=/) $(LIBRARY_NAME)
$(PERL) -I$(DEPTH)\config $(DEPTH)\config\build-list.pl $(_NO_FLOCK) $(FINAL_LINK_COMP_NAMES:\=/) $(MODULE_NAME)
!endif # defined(META_COMPONENT)
@@ -467,14 +467,14 @@ clobber::
# meta component's list
export::
$(PERL) $(DEPTH)\config\build-list.pl $(_NO_FLOCK) $(META_LINK_LIBS:\=/) $(LIBRARY_NAME)
$(PERL) -I$(DEPTH)\config $(DEPTH)\config\build-list.pl $(_NO_FLOCK) $(META_LINK_LIBS:\=/) $(LIBRARY_NAME)
!else # defined(META_COMPONENT)
# Otherwise, it's to be linked into the main executable. Add the
# library to the list of static libs.
export::
$(PERL) $(DEPTH)\config\build-list.pl $(_NO_FLOCK) $(FINAL_LINK_LIBS:\=/) $(LIBRARY_NAME)
$(PERL) -I$(DEPTH)\config $(DEPTH)\config\build-list.pl $(_NO_FLOCK) $(FINAL_LINK_LIBS:\=/) $(LIBRARY_NAME)
!endif # defined(META_COMPONENT)

View File

@@ -544,13 +544,13 @@ ifdef LIBRARY_NAME
ifdef EXPORT_LIBRARY
ifdef IS_COMPONENT
ifdef BUILD_STATIC_LIBS
@$(PERL) $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_COMPS) $(LIBRARY_NAME)
@$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_COMPS) $(LIBRARY_NAME)
ifdef MODULE_NAME
@$(PERL) $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_COMP_NAMES) $(MODULE_NAME)
@$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_COMP_NAMES) $(MODULE_NAME)
endif
endif
else
$(PERL) $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_LIBS) $(LIBRARY_NAME)
$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_LIBS) $(LIBRARY_NAME)
endif # IS_COMPONENT
endif # EXPORT_LIBRARY
endif # LIBRARY_NAME