[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [OSSTEST PATCH 4/7] Replace with-lock-ex with flock
with-lock-ex comes from a Debian-only, not installed by default chiark-utils-bin package, while flock have equivalent functionality and is part of standard util-linux package. This is especially important for apt-get call under the lock (TestSupport.pm:target_run_pkgmanager_install function), which could be used to install chiark-utils-bin but will fail because with-lock-ex is not there. Signed-off-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx> --- Osstest/Executive.pm | 2 +- Osstest/TestSupport.pm | 2 +- cr-daily-branch | 2 +- cr-for-branches | 6 +++--- cr-try-bisect | 2 +- cri-args-hostlists | 4 ++-- cri-getconfig | 2 +- cri-lock-repos | 4 ++-- crontab | 2 +- crontab-cambridge | 2 +- memoise | 2 +- ts-freebsd-host-install | 2 +- 12 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Osstest/Executive.pm b/Osstest/Executive.pm index 0be27b6..8a272e7 100644 --- a/Osstest/Executive.pm +++ b/Osstest/Executive.pm @@ -130,7 +130,7 @@ sub grabrepolock_reexec { my $repos_locked= $ENV{OSSTEST_REPOS_LOCK_LOCKED}; unless (defined $repos_locked && $repos_locked eq $repos_lock) { $ENV{OSSTEST_REPOS_LOCK_LOCKED}= $repos_lock; - exec "with-lock-ex","-w",$repos_lock, $0,@org_argv; + exec "flock","-w",$repos_lock, $0,@org_argv; die $!; } } diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm index 2910842..9515c9b 100644 --- a/Osstest/TestSupport.pm +++ b/Osstest/TestSupport.pm @@ -535,7 +535,7 @@ sub target_run_pkgmanager_install ($$;$$) { push @cmd, qw(lockf /var/run/osstest-pkg-lock pkg-static install); } else { push @cmd, qw(DEBIAN_PRIORITY=critical UCF_FORCE_CONFFOLD=y - with-lock-ex -w /var/lock/osstest-apt apt-get); + flock /var/lock/osstest-apt apt-get); push @cmd, qw(-f) if $force; push @cmd, qw(--no-install-recommends) if $norec; push @cmd, qw(-y install); diff --git a/cr-daily-branch b/cr-daily-branch index e1528d4..492eff0 100755 --- a/cr-daily-branch +++ b/cr-daily-branch @@ -475,7 +475,7 @@ if grep -xF "$NEW_REVISION" $branch.force-rev; then push=$OSSTEST_PUSH; fi if test -f $branch.block; then push=false; fi if test -e $mrof && test -e $tree_bisect && ! grep '^broken' $mrof; then - with-lock-ex -w $tree_bisect/$mrof.lock bash -xec " + flock $tree_bisect/$mrof.lock bash -xec " rm -f $tree_bisect/$mrof.in.new cp $mrof $tree_bisect/$mrof.in.new cd $tree_bisect diff --git a/cr-for-branches b/cr-for-branches index 2e9717e..93a713a 100755 --- a/cr-for-branches +++ b/cr-for-branches @@ -1,6 +1,6 @@ #!/bin/bash # usage: cr-for-branches BRANCHESDIR WLEM "SCRIPT OPTIONS" ARGS... -# will run cd BRANCHESDIR && with-lock-ex WLEM SCRIPT OPTIONS BRANCH ARGS... +# will run cd BRANCHESDIR && flock WLEM SCRIPT OPTIONS BRANCH ARGS... # This is part of "osstest", an automated testing framework for Xen. # Copyright (C) 2009-2013 Citrix Inc. @@ -39,7 +39,7 @@ if [ "x$fetchwlem" = x-q ]; then fetchwlem=-f fi -with-lock-ex $fetchwlem data-tree-lock bash -ec ' +flock $fetchwlem data-tree-lock bash -ec ' exec >>$LOGFILE date printf "%s\n" "$FOR_LOGFILE" @@ -68,7 +68,7 @@ for branch in $BRANCHES; do export LOCK_ACQU_START=`date +%s` - with-lock-ex $wlem data-tree-lock bash -ec ' + flock $wlem data-tree-lock bash -ec ' m="$*" mkdir -p tmp diff --git a/cr-try-bisect b/cr-try-bisect index d613c34..afe4b86 100755 --- a/cr-try-bisect +++ b/cr-try-bisect @@ -31,7 +31,7 @@ startstamp=tmp/bisection-start-stamp anyflagfile=tmp/bisected-any.$branch -with-lock-ex -w $mrof.lock bash -xec " +flock $mrof.lock bash -xec " if test -e $mrof.in; then if test -e $mrof; then mv $mrof $mrof.old; fi rm -f $anyflagfile diff --git a/cri-args-hostlists b/cri-args-hostlists index 7d23087..a502ac1 100644 --- a/cri-args-hostlists +++ b/cri-args-hostlists @@ -114,7 +114,7 @@ start_email () { globallockdir=`getconfig GlobalLockDir` - with-lock-ex -w $globallockdir/report-lock \ + flock $globallockdir/report-lock \ ./sg-report-job-history --html-dir=$job_html_dir --flight=$flight ./sg-report-flight --html-dir=$flight_html_dir/$flight/ \ @@ -122,7 +122,7 @@ start_email () { $sgr_args $flight mkdir -p $host_html_dir - with-lock-ex -w $globallockdir/report-lock \ + flock $globallockdir/report-lock \ ./sg-report-host-history --html-dir=$host_html_dir flight:$flight } diff --git a/cri-getconfig b/cri-getconfig index f8397c1..928f140 100644 --- a/cri-getconfig +++ b/cri-getconfig @@ -57,7 +57,7 @@ get_psql_cmd () { # and set OSSTEST_PSQL_ONLY_DO to an integer if [ "x$OSSTEST_PSQL_ONLY_DO" != x ]; then local f=t.psql-counter - psql_counter=$( with-lock-ex -w $f.lock bash -ec ' + psql_counter=$( flock $f.lock bash -ec ' psql_counter=$(cat '$f' || echo 0) echo $(( $psql_counter + 1 )) >'$f'.tmp mv -f '$f'.tmp '$f' diff --git a/cri-lock-repos b/cri-lock-repos index e7e0fa8..b3500f9 100644 --- a/cri-lock-repos +++ b/cri-lock-repos @@ -26,8 +26,8 @@ if [ "x$AP_FETCH_PLACEHOLDERS" = xy ] && ! [ -e $repos ]; then echo "AP_FETCH_PLACEHOLDERS, not locking" >&2 elif [ "x$OSSTEST_REPOS_LOCK_LOCKED" != "x$repos_lock" ]; then OSSTEST_REPOS_LOCK_LOCKED="$repos_lock" \ - exec with-lock-ex -w "$repos_lock" \ + exec flock "$repos_lock" \ "$0" "$@" - echo >&2 "arrgh, exec with-lock-ex failed $?" + echo >&2 "arrgh, exec flock failed $?" exit 1 fi diff --git a/crontab b/crontab index e1e798a..9c2489f 100755 --- a/crontab +++ b/crontab @@ -16,6 +16,6 @@ MAILTO=osstest-admin@xxxxxxxxxxxxxx 34 15 23 * * cd testing.git && BRANCHES=examine ./cr-for-branches branches -w "./cr-daily-branch --real" 18 4 * * * cd testing.git && BRANCHES='linux-3.0 libvirt rumprun' ./cr-for-branches branches -w "./cr-daily-branch --real" 6-59/15 * * * * cd testing.git && EXTRA_BRANCHES='xen-unstable-smoke linux-3.0 rumprun libvirt freebsd-master' ./cr-for-branches bisects -w "./cr-try-bisect --real" -#8-59/5 * * * * cd bisects/adhoc.git && with-lock-ex -q data-tree-lock bash -c "./cr-try-bisect-adhoc; exit $?" +#8-59/5 * * * * cd bisects/adhoc.git && flock -n -E 0 data-tree-lock bash -c "./cr-try-bisect-adhoc; exit $?" 22 8 * * * cd testing.git && BRANCHES=maintjobs ./cr-for-branches . -w ./cr-all-branch-statuses '' 3 4 * * * savelog -c28 testing.git/tmp/cr-for-branches.log >/dev/null diff --git a/crontab-cambridge b/crontab-cambridge index 86f069a..8c0d346 100755 --- a/crontab-cambridge +++ b/crontab-cambridge @@ -21,6 +21,6 @@ MAILTO=ian.jackson@xxxxxxxxxx 34 15 25 * * cd testing.git && BRANCHES=examine ./cr-for-branches branches -w "./cr-daily-branch --real" -#8-59/5 * * * * cd bisects/adhoc.git && with-lock-ex -q data-tree-lock bash -c "./cr-try-bisect-adhoc; exit $?" +#8-59/5 * * * * cd bisects/adhoc.git && flock -n -E 0 data-tree-lock bash -c "./cr-try-bisect-adhoc; exit $?" 22 8 * * * cd testing.git && BRANCHES=maintjobs ./cr-for-branches . -w ./cr-all-branch-statuses '' 3 4 * * * savelog -c28 testing.git/tmp/cr-for-branches.log >/dev/null diff --git a/memoise b/memoise index 73f15e6..9a6439d 100755 --- a/memoise +++ b/memoise @@ -43,7 +43,7 @@ id=${id% -} f="$datadir/$id" if ! [ -f "$f.o" ]; then - with-lock-ex -w "$f.l" sh -ec ' + flock "$f.l" sh -ec ' f=$1; shift if [ -f "$f.o" ]; then exit 0; fi exec </dev/null >"$f.t" diff --git a/ts-freebsd-host-install b/ts-freebsd-host-install index 53daeef..ee1cede 100755 --- a/ts-freebsd-host-install +++ b/ts-freebsd-host-install @@ -105,7 +105,7 @@ ln $sharedpath $targetpath # Prune old images not used anymore find `dirname $sharedpath` -links 1 -ctime +7 -delete END - my @cmd = ( "with-lock-ex", "-w", "$tftp_freebsd/lock", + my @cmd = ( "flock", "$tftp_freebsd/lock", "bash", "-exc", "$script", "x", "$tftp_freebsd", "$image", "by-hash/$hash.img", "$ho->{Tftp}{Path}/$pxeimg" ); -- git-series 0.9.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |