summaryrefslogtreecommitdiffstats
path: root/git-interface
AgeCommit message (Collapse)AuthorFilesLines
2016-08-05git-interface: Add database abstraction layerLukas Fleischer4-146/+150
Add a new class that connects to the database specified in the configuration file and provides an interface to execute SQL queries. Prepared statements with qmark ("?") placeholders are supported. Replace all direct database accesses with calls to the new abstraction layer. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2016-08-05git-update: Make maximum blob size configurableLukas Fleischer1-2/+15
Support setting the maximum blob size in the configuration file. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2016-08-05git-update: Use AUR_PRIVILEGED for forced pushesLukas Fleischer1-5/+2
Instead of looking up the account type of the current user again, use the AUR_PRIVILEGED environment variable to check whether the user is allowed to perform non-fast-forward ref updates. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2016-08-05git-update: Fix some issues reported by pyflakesLukas Fleischer1-2/+5
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2016-08-04git-serve: Deprecate setup-repoLukas Fleischer1-0/+5
Since 02dd9c5 (git-serve.py: Automatically create repositories, 2015-01-06), one can create new package bases by running `git push`. It is no longer necessary to run setup-repo manually. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2016-08-04git-update: Notify privileged users of forced uploadsLukas Fleischer1-4/+5
Show a warning when a Trusted User or a developer creates a package that is blacklisted or already provided by an official package. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2016-08-04git-serve: Refactor environment variable accessLukas Fleischer1-10/+10
Read all environment variables at the beginning of the script and immediately pre-process their values. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2016-05-18Use the official provider list to detect duplicatesLukas Fleischer1-0/+6
Instead of automatically adding packages from the official binary repositories to the package blacklist, use the official provider list to prevent users from uploading duplicates. This does not only result in reduced disk usage but also has a nice visible side effect. The error messages printed by the update hook now look like error: package already provided by [community]: powerline-fonts instead of error: package is blacklisted: powerline-fonts which was confusing to most end users. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2016-02-09git-serve: Change syntax for setting keywordsLukas Fleischer1-17/+10
Instead of `config <pkgbase> keywords <keyword1> <keyword2>...`, the new syntax is `set-keywords <pkgbase> <keyword1> <keyword2>...`. The `config` keyword was rather general and it was not obvious that it could be used to change package base settings. Instead of replacing it with an even more verbose expression, remove that unnecessary level of indirection. Since we do not (and probably never will) support keywords anywhere else, the chance of name conflicts is small. Suggested-by: Dave Reisner <dreisner@archlinux.org> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2016-02-07Add support for package update notificationsLukas Fleischer1-2/+16
Introduce a new notification option to receive notifications when a new commit is pushed to a package repository. Implements FS#30109. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2016-02-07Rename the CommentNotify table to PackageNotificationsLukas Fleischer2-3/+3
As a preparatory step to adding support for package notifications on events other than comments, rename the database table accordingly. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2016-02-07git-update: Replace aurinfo.py with python-srcinfoJohannes Löthberg2-234/+25
python-srcinfo is a more transparent and simpler library for parsing SRCINFO files. Signed-off-by: Johannes Löthberg <johannes@kyriasis.com> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2016-02-06Fix issues reported by pyflakesLukas Fleischer3-14/+36
Fix several style issues and remove unneeded imports/assignments. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-11-26git-serve: Fix pkgbase_exists()Mark Weiman1-1/+1
Fixes a regression introduced in 8c87b1d (git-serve: Add support for setting keywords, 2015-10-22). Signed-off-by: Mark Weiman <mark.weiman@markzz.com> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-10-24git-serve: Add support for setting keywordsLukas Fleischer1-11/+44
This allows for setting keywords using the SSH interface. The syntax is `config <pkgbase> keywords <keyword1> <keyword2>...`. Implements FS#45627. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-10-03Do not show ".SRCINFO unchanged" warning on restoreLukas Fleischer1-1/+1
Since 612300b (Show a warning if .SRCINFO is unchanged, 2015-09-29), the git-update script displays a warning when a ref update does not affect the content of the package base meta data. We also invoke git-update to rebuild the package base details in the aurweb database when a package base is restored via the SSH interface. In that case, fake information is passed to the update hook: Both the old and the new object IDs refer to the current HEAD. Check for such "Everything up-to-date" updates and not display the ".SRCINFO unchanged" in these cases. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-09-29Show a warning if .SRCINFO is unchangedLukas Fleischer1-0/+10
Warn users when a remote ref update does not change the content of .SRCINFO such that users are reminded of updating package meta data. Implements FS#46130. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-09-16git-update: Use proper stop value for sliceLukas Fleischer1-1/+1
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-08-16Add a restore command to the SSH interfaceLukas Fleischer2-9/+31
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-14git-update: Add commentsLukas Fleischer1-0/+5
Add some comments to explain the major steps performed in the update hook. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-08-14git-update: Remove superfluous assignmentLukas Fleischer1-1/+0
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-14git-update: Move blacklist reading further downLukas Fleischer1-3/+3
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-04aurinfo: Fix parsing with custom file when running scriptJohannes Löthberg1-1/+1
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-08-04aurinfo: Allow lines starting with spacesJohannes Löthberg1-1/+1
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-07-16git-update: Error out if PKGBUILD is missingLukas Fleischer1-2/+3
Fixes FS#45646. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-07-04git-update: Fix error when printing SRCINFO errorsJohannes Löthberg1-1/+1
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-06-27git-update: Improve error message on invalid pkgbaseLukas Fleischer1-1/+1
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-27Add support for multiple SSH public keysLukas Fleischer1-2/+4
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-27git-update: Allow privileged users to bypass blacklistJohannes Löthberg1-1/+2
Fixes FS#45410. Signed-off-by: Johannes Löthberg <johannes@kyriasis.com> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-27git-serve: Drop direct AccountType checking, use AUR_PRIVILEGEDJohannes Löthberg1-2/+1
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-27git-auth: Set AUR_PRIVILEGED env var for TUs & devsJohannes Löthberg1-2/+4
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-27git: Use AUR_USER env var instead of ForceCommand argumentJohannes Löthberg2-3/+24
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-27git: Use .format everywhere instead of %Johannes Löthberg3-47/+47
% 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-20Make url and pkgdesc fields optionalJohannes Löthberg1-2/+6
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-20git-update: Remove regex matching of URLJohannes Löthberg1-3/+0
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-14git-update: Fix parsing of versioned optdependsLukas Fleischer1-4/+12
Fixes FS#43649. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-14aurinfo: Fix bug with space indents creating split packagesJohannes Löthberg1-1/+5
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-12git-serve: Support cloning with simplified pathsJohannes Löthberg1-2/+4
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-11git-update: Allow non-fast-forwards for TUsLukas Fleischer1-6/+9
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-11git-update: Deny non-fast-forwardsLukas Fleischer1-0/+9
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-11Support exceptions in the maintenance modeLukas Fleischer1-1/+4
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-11Implement a maintenance modeLukas Fleischer1-0/+5
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-11Do not use symrefs for manually created Git refsLukas Fleischer2-17/+10
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-08git-update: Avoid duplicate notificationsLukas Fleischer1-2/+6
Fixes FS#45254. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
2015-06-08git-update: Drop writing git description fileJohannes Löthberg1-6/+0
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-08git-update: Improve error message for non-blob objectsLukas Fleischer1-1/+10
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-08Use extract_arch_fields when checking for source filesJohannes Löthberg1-1/+2
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-08git-update: Increase maximum blob size to 250kBLukas Fleischer1-2/+2
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-08git-serve: Use `pkgbase` for errors about invalid namesWieland Hoffmann1-1/+1
`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-04git-update: Prevent from overwriting packagesLukas Fleischer1-1/+11
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>