Switch the order of our two big pkgdb calls to resolve a race condition.

This commit is contained in:
Ralph Bean 2015-12-18 16:22:10 +00:00
parent d29eec75ab
commit 1392043bbd

View file

@ -1,38 +1,39 @@
#!/bin/bash -e #!/bin/bash -e
export GL_BINDIR=/usr/bin
TEMPDIR=`mktemp -d -p /var/tmp genacls.XXXXX`
cd $TEMPDIR
# If this fails, then the -e option will cause the whole script to quit.
/usr/local/bin/genacls.pkgdb > gitolite.conf
# Then create the repos and branches on disk (if we need any new ones)
python /usr/local/bin/pkgdb_sync_git_branches.py python /usr/local/bin/pkgdb_sync_git_branches.py
TEMPDIR=`mktemp -d -p /var/tmp genacls.XXXXX` mv gitolite.conf /etc/gitolite/conf/
export GL_BINDIR=/usr/bin chown gen-acls:gen-acls -R /etc/gitolite/conf/
HOME=/srv/git /usr/bin/gitolite compile
cd $TEMPDIR # After compiling, we have to stick some magic into the gl-conf files of
# Only replace the acls if genacls completes successfully # every repo so that gitolite will understand our symlinks from rpms/
if /usr/local/bin/genacls.pkgdb > gitolite.conf ; then cd /srv/git/repositories
mv gitolite.conf /etc/gitolite/conf/ for repodir in *.git; do
chown gen-acls:gen-acls -R /etc/gitolite/conf/ glconf=$repodir/gl-conf;
HOME=/srv/git /usr/bin/gitolite compile
# After compiling, we have to stick some magic into the gl-conf files of # Strip off the '.git' on the end.
# every repo so that gitolite will understand our symlinks from rpms/ repo=${repodir::-4}
cd /srv/git/repositories
for repodir in *.git; do
glconf=$repodir/gl-conf;
# Strip off the '.git' on the end. # Check which repo from gitolite.conf won the gitolite race.
repo=${repodir::-4} if grep --quiet rpms/ $glconf; then
# ...and map things one way
# Check which repo from gitolite.conf won the gitolite race. echo '$one_config{"'$repo'"} = $one_config{"rpms/'$repo'"};' >> $glconf;
if grep --quiet rpms/ $glconf; then echo '$one_repo{"'$repo'"} = $one_repo{"rpms/'$repo'"};' >> $glconf;
# ...and map things one way else
echo '$one_config{"'$repo'"} = $one_config{"rpms/'$repo'"};' >> $glconf; # or map them the other way
echo '$one_repo{"'$repo'"} = $one_repo{"rpms/'$repo'"};' >> $glconf; echo '$one_config{"rpms/'$repo'"} = $one_config{"'$repo'"};' >> $glconf;
else echo '$one_repo{"rpms/'$repo'"} = $one_repo{"'$repo'"};' >> $glconf;
# or map them the other way fi
echo '$one_config{"rpms/'$repo'"} = $one_config{"'$repo'"};' >> $glconf; done
echo '$one_repo{"rpms/'$repo'"} = $one_repo{"'$repo'"};' >> $glconf;
fi
done
fi
cd / cd /