grokmirror support

This commit is contained in:
clime 2017-05-25 13:20:32 +02:00
parent 1ef09b7de8
commit eb0c75da81
10 changed files with 71 additions and 8 deletions

3
Vagrantfile vendored
View file

@ -62,5 +62,8 @@ Vagrant.configure(2) do |config|
distgit.vm.provision "shell", distgit.vm.provision "shell",
inline: "echo 'clime ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers" inline: "echo 'clime ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers"
distgit.vm.provision "shell",
inline: "dnf install -y python-grokmirror"
end end
end end

View file

@ -39,7 +39,7 @@ rlJournalStart
rlRun "git push" rlRun "git push"
# get srpm file using fedpkg # get srpm file using fedpkg
rlRun 'fedpkg --dist f25 srpm' rlRun "fedpkg --dist f25 srpm"
cd .. cd ..
@ -47,11 +47,37 @@ rlJournalStart
rlRun "git clone git://pkgs.example.org/prunerepo.git prunerepo-copy" rlRun "git clone git://pkgs.example.org/prunerepo.git prunerepo-copy"
rlRun "git clone http://pkgs.example.org/git/prunerepo prunerepo-copy2" rlRun "git clone http://pkgs.example.org/git/prunerepo prunerepo-copy2"
# test manifest file update
rlRun "wget http://pkgs.example.org/manifest.js.gz"
gunzip ./manifest.js.gz
rlRun "cat manifest.js | grep prunerepo.git"
mv ./manifest.js manifest.js.prev
# clone repo using fedpkg
rlRun "fedpkg clone /var/lib/dist-git/git/prunerepo prunerepo2"
cd prunerepo2
echo "manifest test" > sources
rlRun "git add -A && git commit -m 'test commit 2'"
rlRun "git push"
cd ..
rlRun "wget http://pkgs.example.org/manifest.js.gz"
gunzip ./manifest.js.gz
rlRun "cat manifest.js | grep prunerepo.git"
modified_prev=`jq '.["/prunerepo.git"].modified' manifest.js.prev`
modified=`jq '.["/prunerepo.git"].modified' manifest.js`
rlAssertGreater "Check that 'modifed' timestamp has been updated in the manifest file" $modified $modified_prev
cd $CWD cd $CWD
rlPhaseEnd rlPhaseEnd
rlPhaseStartCleanup BasicTest rlPhaseStartCleanup BasicTest
rm -rf $TESTPATH/prunerepo $TESTPATH/prunerepo-copy* $TESTPATH/prunerepo-1.1.tar.gz rm -rf $TESTPATH/prunerepo $TESTPATH/prunerepo-copy* $TESTPATH/prunerepo2 $TESTPATH/prunerepo-1.1.tar.gz $TESTPATH/manifest*
pkgs_cmd 'rm -rf /var/lib/dist-git/git/prunerepo.git' pkgs_cmd 'rm -rf /var/lib/dist-git/git/prunerepo.git'
pkgs_cmd 'sudo rm -rf /var/lib/dist-git/cache/lookaside/pkgs/prunerepo' pkgs_cmd 'sudo rm -rf /var/lib/dist-git/cache/lookaside/pkgs/prunerepo'
rlPhaseEnd rlPhaseEnd

View file

@ -5,3 +5,4 @@ git_author_email = rel-eng@lists.fedoraproject.org
cache_dir = /var/lib/dist-git/cache cache_dir = /var/lib/dist-git/cache
gitroot_dir = /var/lib/dist-git/git gitroot_dir = /var/lib/dist-git/git
gitolite = True gitolite = True
grok = True

View file

@ -0,0 +1,5 @@
Alias /manifest.js.gz /var/lib/dist-git/git/manifest.js.gz
<Location /manifest.js.gz>
Require all granted
</Location>

View file

@ -29,8 +29,13 @@ Requires: python-configparser
Requires: mod_ssl Requires: mod_ssl
Requires: fedmsg Requires: fedmsg
Requires: crudini Requires: crudini
Requires: moreutils
Requires(pre): shadow-utils Requires(pre): shadow-utils
%if 0%{?fedora}
Suggests: python-grokmirror
%endif
%description %description
Dist Git is a remote Git repository specifically designed to hold RPM Dist Git is a remote Git repository specifically designed to hold RPM
package sources. package sources.

View file

@ -0,0 +1,4 @@
#!/bin/bash
eval "$(crudini --format=sh --get /etc/dist-git/dist-git.conf dist-git)"
/usr/bin/grok-manifest -m $gitroot_dir/manifest.js.gz -t $gitroot_dir -n `pwd`

View file

@ -0,0 +1,4 @@
#!/bin/bash
# pee redirects stdin to each of the post-receive hooks in place.
/usr/bin/pee $GIT_DIR/hooks/post-receive-chained.d/*

View file

@ -146,6 +146,9 @@ for NAME in $PACKAGES ; do
popd >/dev/null popd >/dev/null
exit -2 exit -2
} }
if [[ $grok && $grok != "False" ]]; then
/usr/bin/grok-manifest -m $REPODIR/manifest.js.gz -t $REPODIR -n $REPODIR/$NAME.git
fi
done done
echo echo

View file

@ -146,6 +146,9 @@ for NAME in $PACKAGES ; do
popd >/dev/null popd >/dev/null
exit -2 exit -2
} }
if [[ $grok && $grok != "False" ]]; then
/usr/bin/grok-manifest -m $REPODIR/manifest.js.gz -t $REPODIR -n $REPODIR/$NAME.git
fi
done done
echo echo

View file

@ -85,6 +85,20 @@ git config --add hooks.mailinglist "$PACKAGE-owner@fedoraproject.org,scm-commits
git config --add hooks.maildomain fedoraproject.org git config --add hooks.maildomain fedoraproject.org
popd >/dev/null popd >/dev/null
mkdir -p $REPODIR/$PACKAGE.git/hooks/post-receive-chained.d
if [[ $grok && $grok != "False" ]]; then
if ! [ -f $REPODIR/manifest.js.gz ]; then
echo 'Generating initial grok manifest...'
/usr/bin/grok-manifest -m $REPODIR/manifest.js.gz -t $REPODIR
fi
ln -s /usr/share/dist-git/hooks/grok_update \
$REPODIR/$PACKAGE.git/hooks/post-receive-chained.d/grok_update
fi
# This one kicks off all the others in post-receive-chained.d
ln -s /usr/share/dist-git/hooks/post-receive \
$REPODIR/$PACKAGE.git/hooks/post-receive
# Now clone that repo and create the .gitignore and sources file # Now clone that repo and create the .gitignore and sources file
git init -q $TMPDIR/$PACKAGE git init -q $TMPDIR/$PACKAGE
pushd $TMPDIR/$PACKAGE >/dev/null pushd $TMPDIR/$PACKAGE >/dev/null
@ -103,17 +117,12 @@ if [[ $gitolite && $gitolite != "False" ]]; then
fi fi
# Setup our post-receive hooks # Setup our post-receive hooks
mkdir -p $REPODIR/$PACKAGE.git/hooks/post-receive-chained.d
ln -s /usr/share/git-core/mail-hooks/gnome-post-receive-email \ ln -s /usr/share/git-core/mail-hooks/gnome-post-receive-email \
$REPODIR/$PACKAGE.git/hooks/post-receive-chained.d/post-receive-email $REPODIR/$PACKAGE.git/hooks/post-receive-chained.d/post-receive-email
ln -s /usr/share/git-core/post-receive-fedmsg \ ln -s /usr/share/git-core/post-receive-fedmsg \
$REPODIR/$PACKAGE.git/hooks/post-receive-chained.d/post-receive-fedmsg $REPODIR/$PACKAGE.git/hooks/post-receive-chained.d/post-receive-fedmsg
ln -s /usr/share/git-core/post-receive-alternativearch \ ln -s /usr/share/git-core/post-receive-alternativearch \
$REPODIR/$PACKAGE.git/hooks/post-receive-chained.d/post-receive-alternativearch $REPODIR/$PACKAGE.git/hooks/post-receive-chained.d/post-receive-alternativearch
# This one kicks off all the others in post-receive-chained.d
ln -s /usr/share/git-core/post-receive-chained \
$REPODIR/$PACKAGE.git/hooks/post-receive
rm -rf $TMPDIR rm -rf $TMPDIR
echo "Done." echo "Done."