Reorganize Git interface scripts

Move the Git interface scripts from git-interface/ to aurweb/git/. Use
setuptools to automatically create wrappers which can be installed using
`python3 setup.py install`. Update the configuration files, the test
suite as well as the INSTALL and README files to reflect these changes.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
Lukas Fleischer 2016-10-08 14:19:11 +02:00
parent e182ba0c42
commit d4fe77ac57
12 changed files with 26 additions and 48 deletions

28
INSTALL
View file

@ -37,11 +37,16 @@ Setup on Arch Linux
$ mysql -uaur -p AUR </srv/http/aurweb/schema/aur-schema.sql $ mysql -uaur -p AUR </srv/http/aurweb/schema/aur-schema.sql
5) Create a new user: 5) Install Python modules and dependencies:
# pacman -S python-mysql-connector python-pygit2 python-srcinfo
# python3 setup.py install
6) Create a new user:
# useradd -U -d /srv/http/aurweb -c 'AUR user' aur # useradd -U -d /srv/http/aurweb -c 'AUR user' aur
6) Initialize the Git repository: 7) Initialize the Git repository:
# mkdir /srv/http/aurweb/aur.git/ # mkdir /srv/http/aurweb/aur.git/
# cd /srv/http/aurweb/aur.git/ # cd /srv/http/aurweb/aur.git/
@ -49,29 +54,20 @@ Setup on Arch Linux
# git config --local transfer.hideRefs '^refs/' # git config --local transfer.hideRefs '^refs/'
# git config --local --add transfer.hideRefs '!refs/' # git config --local --add transfer.hideRefs '!refs/'
# git config --local --add transfer.hideRefs '!HEAD' # git config --local --add transfer.hideRefs '!HEAD'
# ln -s ../../git-interface/git-update.py hooks/update # ln -s /usr/local/bin/aurweb-git-update hooks/update
# chown -R aur . # chown -R aur .
7) Install needed Python modules: 8) Configure sshd(8) for the AUR. Add the following lines at the end of your
# pacman -S python-mysql-connector python-pygit2 python-srcinfo
8) Install the git-auth wrapper script:
# cd /srv/http/aurweb/git-interface/
# make && make install
9) Configure sshd(8) for the AUR. Add the following lines at the end of your
sshd_config(5) and restart the sshd. Note that OpenSSH 6.9 or newer is sshd_config(5) and restart the sshd. Note that OpenSSH 6.9 or newer is
needed! needed!
Match User aur Match User aur
PasswordAuthentication no PasswordAuthentication no
AuthorizedKeysCommand /usr/local/bin/aur-git-auth "%t" "%k" AuthorizedKeysCommand /usr/local/bin/aurweb-git-auth "%t" "%k"
AuthorizedKeysCommandUser aur AuthorizedKeysCommandUser aur
10) If you want to enable smart HTTP support with nginx and fcgiwrap, you can 9) If you want to enable smart HTTP support with nginx and fcgiwrap, you can
use the following directives: use the following directives:
location ~ "^/([a-z0-9][a-z0-9.+_-]*?)(\.git)?/(git-(receive|upload)-pack|HEAD|info/refs|objects/(info/(http-)?alternates|packs)|[0-9a-f]{2}/[0-9a-f]{38}|pack/pack-[0-9a-f]{40}\.(pack|idx))$" { location ~ "^/([a-z0-9][a-z0-9.+_-]*?)(\.git)?/(git-(receive|upload)-pack|HEAD|info/refs|objects/(info/(http-)?alternates|packs)|[0-9a-f]{2}/[0-9a-f]{38}|pack/pack-[0-9a-f]{40}\.(pack|idx))$" {
fastcgi_pass unix:/run/fcgiwrap.sock; fastcgi_pass unix:/run/fcgiwrap.sock;

5
README
View file

@ -18,7 +18,7 @@ Directory Layout
---------------- ----------------
aurweb:: aurweb::
Shared aurweb Python modules. aurweb Python modules.
conf:: conf::
Configuration and configuration templates. Configuration and configuration templates.
@ -26,9 +26,6 @@ conf::
doc:: doc::
Project documentation. Project documentation.
git-interface::
Scripts that make up the Git and SSH interface.
po:: po::
Translation files for strings in the aurweb interface. Translation files for strings in the aurweb interface.

View file

@ -46,14 +46,14 @@ RSA = SHA256:Ju+yWiMb/2O+gKQ9RJCDqvRg7l+Q95KFAeqM5sr6l2s
[auth] [auth]
valid-keytypes = ssh-rsa ssh-dss ecdsa-sha2-nistp256 ecdsa-sha2-nistp384 ecdsa-sha2-nistp521 ssh-ed25519 valid-keytypes = ssh-rsa ssh-dss ecdsa-sha2-nistp256 ecdsa-sha2-nistp384 ecdsa-sha2-nistp521 ssh-ed25519
username-regex = [a-zA-Z0-9]+[.\-_]?[a-zA-Z0-9]+$ username-regex = [a-zA-Z0-9]+[.\-_]?[a-zA-Z0-9]+$
git-serve-cmd = /srv/http/aurweb/git-interface/git-serve.py git-serve-cmd = /usr/local/bin/aurweb-git-serve
ssh-options = restrict ssh-options = restrict
[serve] [serve]
repo-path = /srv/http/aurweb/aur.git/ repo-path = /srv/http/aurweb/aur.git/
repo-regex = [a-z0-9][a-z0-9.+_-]*$ repo-regex = [a-z0-9][a-z0-9.+_-]*$
git-shell-cmd = /usr/bin/git-shell git-shell-cmd = /usr/bin/git-shell
git-update-cmd = /srv/http/aurweb/git-interface/git-update.py git-update-cmd = /usr/local/bin/aurweb-git-update
ssh-cmdline = ssh aur@aur.archlinux.org ssh-cmdline = ssh aur@aur.archlinux.org
[update] [update]

View file

@ -1,18 +0,0 @@
GIT_INTERFACE_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
include config.mk
git-auth.sh:
sed 's#%GIT_INTERFACE_DIR%#$(GIT_INTERFACE_DIR)#' <git-auth.sh.in >git-auth.sh
chmod +x git-auth.sh
install: git-auth.sh
install -Dm0755 git-auth.sh "$(DESTDIR)$(PREFIX)/bin/aur-git-auth"
uninstall:
rm -f "$(DESTDIR)$(PREFIX)/bin/aur-git-auth"
clean:
rm -f git-auth.sh
.PHONY: install uninstall clean

View file

@ -1 +0,0 @@
PREFIX = /usr/local

View file

@ -1,3 +0,0 @@
#!/bin/sh
%GIT_INTERFACE_DIR%/git-auth.py "$1" "$2"

View file

@ -17,4 +17,11 @@ setup(
name="aurweb", name="aurweb",
version=version, version=version,
packages=find_packages(), packages=find_packages(),
entry_points={
'console_scripts': [
'aurweb-git-auth = aurweb.git.auth:main',
'aurweb-git-serve = aurweb.git.serve:main',
'aurweb-git-update = aurweb.git.update:main',
],
},
) )

View file

@ -8,9 +8,9 @@ PYTHONPATH="$TOPLEVEL"
export PYTHONPATH export PYTHONPATH
# Configure paths to the Git interface scripts. # Configure paths to the Git interface scripts.
GIT_AUTH="$TOPLEVEL/git-interface/git-auth.py" GIT_AUTH="$TOPLEVEL/aurweb/git/auth.py"
GIT_SERVE="$TOPLEVEL/git-interface/git-serve.py" GIT_SERVE="$TOPLEVEL/aurweb/git/serve.py"
GIT_UPDATE="$TOPLEVEL/git-interface/git-update.py" GIT_UPDATE="$TOPLEVEL/aurweb/git/update.py"
MKPKGLISTS="$TOPLEVEL/scripts/mkpkglists.py" MKPKGLISTS="$TOPLEVEL/scripts/mkpkglists.py"
TUVOTEREMINDER="$TOPLEVEL/scripts/tuvotereminder.py" TUVOTEREMINDER="$TOPLEVEL/scripts/tuvotereminder.py"
PKGMAINT="$TOPLEVEL/scripts/pkgmaint.py" PKGMAINT="$TOPLEVEL/scripts/pkgmaint.py"
@ -38,7 +38,7 @@ reply-to = noreply@aur.archlinux.org
[auth] [auth]
valid-keytypes = ssh-rsa ssh-dss ecdsa-sha2-nistp256 ecdsa-sha2-nistp384 ecdsa-sha2-nistp521 ssh-ed25519 valid-keytypes = ssh-rsa ssh-dss ecdsa-sha2-nistp256 ecdsa-sha2-nistp384 ecdsa-sha2-nistp521 ssh-ed25519
username-regex = [a-zA-Z0-9]+[.\-_]?[a-zA-Z0-9]+$ username-regex = [a-zA-Z0-9]+[.\-_]?[a-zA-Z0-9]+$
git-serve-cmd = /srv/http/aurweb/git-interface/git-serve.py git-serve-cmd = $GIT_SERVE
ssh-options = restrict ssh-options = restrict
[serve] [serve]