mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
feat: Add blacklist check for pkgbase
Also check "pkgbase" against our blacklist. Signed-off-by: moson <moson@archlinux.org>
This commit is contained in:
parent
057685f304
commit
d050b626db
3 changed files with 53 additions and 0 deletions
|
@ -440,6 +440,8 @@ def main(): # noqa: C901
|
||||||
|
|
||||||
cur = conn.execute("SELECT Name FROM PackageBlacklist")
|
cur = conn.execute("SELECT Name FROM PackageBlacklist")
|
||||||
blacklist = [row[0] for row in cur.fetchall()]
|
blacklist = [row[0] for row in cur.fetchall()]
|
||||||
|
if pkgbase in blacklist:
|
||||||
|
warn_or_die("pkgbase is blacklisted: {:s}".format(pkgbase))
|
||||||
|
|
||||||
cur = conn.execute("SELECT Name, Repo FROM OfficialProviders")
|
cur = conn.execute("SELECT Name, Repo FROM OfficialProviders")
|
||||||
providers = dict(cur.fetchall())
|
providers = dict(cur.fetchall())
|
||||||
|
|
|
@ -223,5 +223,40 @@ export GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME
|
||||||
git add PKGBUILD .SRCINFO
|
git add PKGBUILD .SRCINFO
|
||||||
git commit -q -m 'Initial import'
|
git commit -q -m 'Initial import'
|
||||||
|
|
||||||
|
git checkout -q --orphan refs/namespaces/forbidden/refs/heads/master
|
||||||
|
|
||||||
|
cat >PKGBUILD <<-EOF
|
||||||
|
pkgname=foobar3
|
||||||
|
pkgver=1
|
||||||
|
pkgrel=1
|
||||||
|
pkgdesc='aurweb test package.'
|
||||||
|
url='https://aur.archlinux.org/'
|
||||||
|
license=('MIT')
|
||||||
|
arch=('any')
|
||||||
|
depends=('python-pygit2')
|
||||||
|
source=()
|
||||||
|
md5sums=()
|
||||||
|
|
||||||
|
package() {
|
||||||
|
echo 'Hello world!'
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat >.SRCINFO <<-EOF
|
||||||
|
pkgbase = forbidden
|
||||||
|
pkgdesc = aurweb test package.
|
||||||
|
pkgver = 1
|
||||||
|
pkgrel = 1
|
||||||
|
url = https://aur.archlinux.org/
|
||||||
|
arch = any
|
||||||
|
license = MIT
|
||||||
|
depends = python-pygit2
|
||||||
|
|
||||||
|
pkgname = foobar3
|
||||||
|
EOF
|
||||||
|
|
||||||
|
git add PKGBUILD .SRCINFO
|
||||||
|
git commit -q -m 'Initial import'
|
||||||
|
|
||||||
git checkout -q refs/namespaces/foobar/refs/heads/master
|
git checkout -q refs/namespaces/foobar/refs/heads/master
|
||||||
)
|
)
|
||||||
|
|
|
@ -536,6 +536,22 @@ test_expect_success 'Pushing a blacklisted package.' '
|
||||||
test_cmp expected actual
|
test_cmp expected actual
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'Pushing a blacklisted pkgbase.' '
|
||||||
|
test_when_finished "git -C aur.git checkout refs/namespaces/foobar/refs/heads/master" &&
|
||||||
|
git -C aur.git checkout -q refs/namespaces/forbidden/refs/heads/master &&
|
||||||
|
old=$(git -C aur.git rev-parse HEAD) &&
|
||||||
|
echo " " >>aur.git/.SRCINFO &&
|
||||||
|
git -C aur.git commit -q -am "Do something" &&
|
||||||
|
new=$(git -C aur.git rev-parse HEAD) &&
|
||||||
|
cat >expected <<-EOD &&
|
||||||
|
error: pkgbase is blacklisted: forbidden
|
||||||
|
EOD
|
||||||
|
test_must_fail \
|
||||||
|
env AUR_USER=user AUR_PKGBASE=forbidden AUR_PRIVILEGED=0 \
|
||||||
|
cover "$GIT_UPDATE" refs/heads/master "$old" "$new" >actual 2>&1 &&
|
||||||
|
test_cmp expected actual
|
||||||
|
'
|
||||||
|
|
||||||
test_expect_success 'Pushing a blacklisted package as Package Maintainer.' '
|
test_expect_success 'Pushing a blacklisted package as Package Maintainer.' '
|
||||||
old=$(git -C aur.git rev-parse HEAD) &&
|
old=$(git -C aur.git rev-parse HEAD) &&
|
||||||
test_when_finished "git -C aur.git reset --hard $old" &&
|
test_when_finished "git -C aur.git reset --hard $old" &&
|
||||||
|
|
Loading…
Add table
Reference in a new issue