Commit graph

39 commits

Author SHA1 Message Date
Lukas Fleischer
2c20403cc4 git-update: Use proper stop value for slice
Fixes a regression introduced in 4112e57 (Add a restore command to the
SSH interface, 2015-08-14).

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-09-16 22:10:06 +02:00
Lukas Fleischer
4112e572aa Add a restore command to the SSH interface
Implement a new command that can be used to restore deleted package
bases without having to push a new commit.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-08-16 06:49:12 +02:00
Lukas Fleischer
da875276d4 git-update: Add comments
Add some comments to explain the major steps performed in the update
hook.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-08-14 12:52:32 +02:00
Lukas Fleischer
80e06e5fc3 git-update: Remove superfluous assignment
The pkgbase variable already contains the package base name at this
point, no need to reassign it.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-08-14 12:50:35 +02:00
Lukas Fleischer
4bc6c55d98 git-update: Move blacklist reading further down
Since c4870a9 (git-update: Only check HEAD for blacklisted packages,
2015-06-04), only the HEAD commit package name is looked up in the
blacklist. This means that we no longer need to read the blacklist
before running the commit walker. Moving the blacklist reading code
further down makes the code easier to read.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-08-14 12:45:36 +02:00
Johannes Löthberg
950abb0189 aurinfo: Fix parsing with custom file when running script
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-08-04 05:57:02 +02:00
Johannes Löthberg
f19892f7c2 aurinfo: Allow lines starting with spaces
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-08-04 05:57:02 +02:00
Lukas Fleischer
38b1bbe78d git-update: Error out if PKGBUILD is missing
Fixes FS#45646.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-07-16 14:09:55 +02:00
Johannes Löthberg
f4f1921fc6 git-update: Fix error when printing SRCINFO errors
This commit fixes a bug introduced by ae2907a (git: Use .format
everywhere instead of %, 2015-06-27) where passing the error tuple to
.format wasn't prefixed with an asterisk.

Fixes FS#45545.

Reported-by: Marty <vadmium+al@gmail.com>
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-07-04 15:02:04 +02:00
Lukas Fleischer
d0be66015a git-update: Improve error message on invalid pkgbase
When the package base does not match the repository name, we currently
show an error message that only mentions the package base name:

    error: invalid pkgbase: yate-qt4

To the end user this sounds like the package base name is malformed
itself (and we show exactly the same error message when it contains
invalid characters, indeed). Clarify that there is a name mismatch by
also printing the expected value:

    error: invalid pkgbase: yate-qt4, expected: yate4-qt

Inspired by FS#45483.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-27 13:04:03 +02:00
Lukas Fleischer
b036b436aa Add support for multiple SSH public keys
Attaching more than one SSH public key to the same account is useful,
e.g. if one uses different machines to access the AUR SSH interface.
Multiple keys can now be specified by adding multiple lines to the text
area on the account edit form.

Implements FS#45469.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Acked-by: Leonidas Spyropoulos <artafinde@gmail.com>
2015-06-27 13:04:03 +02:00
Johannes Löthberg
4da759e638 git-update: Allow privileged users to bypass blacklist
Fixes FS#45410.

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-27 13:04:03 +02:00
Johannes Löthberg
e93f198ede git-serve: Drop direct AccountType checking, use AUR_PRIVILEGED
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-27 13:04:03 +02:00
Johannes Löthberg
ed0e2fd975 git-auth: Set AUR_PRIVILEGED env var for TUs & devs
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-27 13:04:03 +02:00
Johannes Löthberg
e9485531be git: Use AUR_USER env var instead of ForceCommand argument
Also add an utility function for formatting the ForceCommand, using
shlex.quote to quote the value.

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-27 13:04:03 +02:00
Johannes Löthberg
ae2907a57e git: Use .format everywhere instead of %
% formatting is deprecated, and .format should be used instead.

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-27 13:04:03 +02:00
Johannes Löthberg
61cdf09cd0 Make url and pkgdesc fields optional
The url and pkgdesc PKGBUILD variables are optional, so they should be
in the AUR as well.

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-20 14:29:43 +02:00
Johannes Löthberg
5d9a80a546 git-update: Remove regex matching of URL
The regex check that a URL is either http or ftp doesn't really have any
use, and it forces you to leave proper URLs for eg projects hosted on
gopher empty.

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-20 14:28:23 +02:00
Lukas Fleischer
3bc4496328 git-update: Fix parsing of versioned optdepends
Fixes FS#43649.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-14 17:58:56 +02:00
Johannes Löthberg
cc6c7a1caa aurinfo: Fix bug with space indents creating split packages
If a .SRCINFO line doesn't start with a tab, check if the key is pkgname
before adding it as a package.

Fixes a bug where if you have accidentally gotten a line indented with
spaces, from that line forward it will think it is a split package,
instead of erroring out.

Reported-by: Raansu <Gero3977@gmail.com>
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-14 17:58:55 +02:00
Johannes Löthberg
3158e038c8 git-serve: Support cloning with simplified paths
This commit adds support for cloning repositories over SSH without a
leading slash or with a trailing .git

Fixes FS#45260

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-12 16:58:00 +02:00
Lukas Fleischer
5225dfef48 git-update: Allow non-fast-forwards for TUs
Although we theoretically never want to lose history, there may be rare
occasions when a forced push is required (e.g. if illegal data is
pushed). Allow Trusted Users and Developers to perform non-fast-forward
pushes.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-11 17:56:51 +02:00
Lukas Fleischer
a0f3060f23 git-update: Deny non-fast-forwards
To make sure we never lose any history, non-fast-forwards are forbidden.
Instead of relying on receive.denyNonFastForwards, add a simple check to
the update hook. This has the added benefit of more flexibility.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-11 17:56:26 +02:00
Lukas Fleischer
078f7256e3 Support exceptions in the maintenance mode
Allow for excluding certain IP addresses from the maintenance mode. This
allows administrators to view the web page while the site is still under
maintenance for the rest of the world.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-11 14:48:01 +02:00
Lukas Fleischer
a45b5073ca Implement a maintenance mode
Add support for a maintenance mode that disables both the website and
the SSH interface and can be enabled easily using a configuration
option.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-11 14:32:21 +02:00
Lukas Fleischer
2164750f1e Do not use symrefs for manually created Git refs
When creating the refs for the package base branch and the HEAD ref
workaround, directly use commit IDs instead of symrefs. It looks like
Git cannot pack symrefs, so this is expected to improve space
efficiency. Also, since the refs are now only created (or updated) when
new objects are actually received, this fixes a problem with dangling
refs that were created when a user initialized a repository but did not
push anything.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-11 14:03:56 +02:00
Lukas Fleischer
c7ff97a6a8 git-update: Avoid duplicate notifications
Fixes FS#45254.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-08 21:52:59 +02:00
Johannes Löthberg
fcbfaf6a37 git-update: Drop writing git description file
All PKGBUILDs are stored in a single repository now, so there is no use
for writing out a description file for the repo anymore.

This fixes a bug where pkgdescs containing UTF-8 characters are rejected
due to it trying to write the file out using ASCII.

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-08 15:04:13 +02:00
Lukas Fleischer
ed72af6378 git-update: Improve error message for non-blob objects
When a repository contains a directory, a user is currently faced with
the following error message:

    remote: Traceback (most recent call last):
    remote:   File "hooks/update", line 194, in <module>
    remote:     if repo[treeobj.id].size > 250000:
    remote: AttributeError: '_pygit2.Tree' object has no attribute 'size'
    remote: error: hook declined to update refs/heads/master

Explicitly check for directories and other non-blob objects and display
a more intuitive message.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-08 14:26:26 +02:00
Johannes Löthberg
6e52439e6f Use extract_arch_fields when checking for source files
This fixes a bug where pushes are rejected in split PKGBUILDs if there
are no arch-independent source array.

Fixes FS#45253

Reported-by: Marti <marti@juffo.org>
Reported-by: Maxime Gauduin <alucryd@archlinux.org>
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-08 14:26:26 +02:00
Lukas Fleischer
debe76299d git-update: Increase maximum blob size to 250kB
Large blobs are needed in some packages, such as customized Linux
kernels including kernel configurations.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-08 13:15:23 +02:00
Wieland Hoffmann
d5beada7c3 git-serve: Use pkgbase for errors about invalid names
`repo` is not defined at the point it's used, so you would get errors
like

> Traceback (most recent call last):
>   File "/srv/http/vhosts/aur-dev.archlinux.org/public/git-interface/git-serve.py", line 138, in <module>
>     die('%s: invalid repository name: %s' % (action, repo))
> NameError: name 'repo' is not defined

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-08 12:43:58 +02:00
Lukas Fleischer
58db164732 git-update: Prevent from overwriting packages
Make sure we do not overwrite a package belonging to another package
base. We forgot to add this check to git-update when porting the package
submission script to Python in commit 74edb6f (Use Git repositories to
store packages, 2014-06-06).

Reported-by: Johannes Löthberg <johannes@kyriasis.com>
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-04 11:35:46 +02:00
Lukas Fleischer
c4870a95fc git-update: Only check HEAD for blacklisted packages
When a part of a package base is moved to the official repositories, it
needs to be dropped from the AUR package. However, we want to allow that
the moved packages still appear in the history.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-04 11:25:01 +02:00
Lukas Fleischer
50c0ee9ec4 git-update: Only check HEAD for matching pkgbase
When renaming a package base, we want to keep commits of the former
package. Move the check that compares the package base name with the
repository name such that only HEAD is validated.

Fixes FS#45065.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-04 11:25:01 +02:00
Lukas Fleischer
c38f95f632 config.proto: Cleanup
Remove the template-path and git-update-hook options which are no longer
used. Update the git_clone_uri_anon default value.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-02 15:16:24 +02:00
Lukas Fleischer
6fe8792508 Setup Git repositories even if package base exists
Sometimes, we need to initialize the Git repository even if the package
base already exists (e.g. when using a non-empty package database with
empty repositories during the AUR 4.0.0 migration period). Make sure
that the package branch and the namespaced HEAD ref is always created.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-02 15:12:00 +02:00
Lukas Fleischer
124ad00997 Add a Makefile for the git-auth wrapper
Avoid manual editing of the wrapper script when a non-standard path is
used.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-02 10:49:33 +02:00
Lukas Fleischer
10ecd3982d Restructure scripts
* Move scripts/git-integration/ to git-interface/.
* Move scripts/aurblup/aurblup.py to scripts/aurblup.py.

Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-02 10:34:34 +02:00