summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaleb Maclennan2020-02-28 15:09:15 +0300
committerCaleb Maclennan2020-02-28 15:11:24 +0300
commit1ba140b991f83c088eded4a3e99d4800d7e3a7ff (patch)
tree8947c8a70a54b99e1760e699a8f3a93883ee4cbf
parent159d2111c47c449e8ccfbf36fb8b5d2c4a65b425 (diff)
downloadaur-1ba140b991f83c088eded4a3e99d4800d7e3a7ff.tar.gz
Setup per-database type configuration files
-rw-r--r--.SRCINFO19
-rw-r--r--PKGBUILD29
2 files changed, 32 insertions, 16 deletions
diff --git a/.SRCINFO b/.SRCINFO
index b0bb9f851c44..a593f0e7a2b2 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = pagure
pkgdesc = A git-centered forge based on python using pygit2
pkgver = 5.8.1
- pkgrel = 0.18
+ pkgrel = 0.19
url = https://pagure.io/pagure
arch = any
license = GPL2
@@ -47,7 +47,7 @@ pkgbase = pagure
sha256sums = c1da9e6ae2255f7896920ecb261f18c59f8ad6ba5726a8484f6287ae3962c854
pkgname = pagure
- depends = pagure-backend=5.8.1
+ depends = pagure-database=5.8.1
optdepends = pagure-apache: Apache host configuration files
backup = etc/pagure/alembic.ini
backup = etc/pagure/pagure.cfg
@@ -60,31 +60,34 @@ pkgname = pagure-apache
backup = etc/httpd/conf/extra/pagure.conf
pkgname = pagure-mariadb
- pkgdesc = A git-centered forge based on python using pygit2 (MariaDB backend configuration)
+ pkgdesc = A git-centered forge based on python using pygit2 (MariaDB database configuration)
install = pagure-mariadb.install
depends = pagure=5.8.1
depends = mariadb
depends = python-mysqlclient
- provides = pagure-backend
+ provides = pagure-database
conflicts = pagure-postgresql
conflicts = pagure-sqlite
+ backup = etc/pagure/pagure_database.cfg
pkgname = pagure-postgresql
- pkgdesc = A git-centered forge based on python using pygit2 (PostgreSQL backend configuration)
+ pkgdesc = A git-centered forge based on python using pygit2 (PostgreSQL database configuration)
install = pagure-postgresql.install
depends = pagure=5.8.1
depends = postgresql
depends = python-psycopg2
- provides = pagure-backend
+ provides = pagure-database
conflicts = pagure-mariadb
conflicts = pagure-sqlite
+ backup = etc/pagure/pagure_database.cfg
pkgname = pagure-sqlite
- pkgdesc = A git-centered forge based on python using pygit2 (SQLite backend configuration)
+ pkgdesc = A git-centered forge based on python using pygit2 (SQLite database configuration)
install = pagure-sqlite.install
depends = pagure=5.8.1
depends = sqlite
- provides = pagure-backend
+ provides = pagure-database
conflicts = pagure-mariadb
conflicts = pagure-postgresql
+ backup = etc/pagure/pagure_database.cfg
diff --git a/PKGBUILD b/PKGBUILD
index 2ff64619088d..eae7a52602fe 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -7,7 +7,7 @@
pkgbase=pagure
pkgname=("$pkgbase" "$pkgbase-apache" "$pkgbase-mariadb" "$pkgbase-postgresql" "$pkgbase-sqlite")
pkgver=5.8.1
-pkgrel=0.18
+pkgrel=0.19
pkgdesc="A git-centered forge based on python using pygit2"
arch=("any")
url="https://pagure.io/$pkgbase"
@@ -54,6 +54,7 @@ source=("https://releases.pagure.org/$pkgbase/$pkgbase-$pkgver.tar.gz"
sha256sums=('5e150bad0a3f932d265cb59d46c8b6a532be0f757aab695a8c37df3f5f4db687'
'c1da9e6ae2255f7896920ecb261f18c59f8ad6ba5726a8484f6287ae3962c854')
_homedir="/var/lib/$pkgbase"
+_user=$pkgbase
prepare() {
cd "$pkgbase-$pkgver"
@@ -64,7 +65,10 @@ prepare() {
-e '/!mod_authz/,+4d' \
-e '/# Apache 2.4/d' \
-e "s#/path/to/git/repositorios#$_homedir#g" \
+ -e "s/=git/=$_user/g" \
files/pagure.conf
+ sed -i -e "/^#DB_URL/d;/^DB_URL/s/^.*$/execdir('pagure_database.cfg')/" \
+ files/pagure.cfg.sample
}
build() {
@@ -78,7 +82,7 @@ check() {
}
package_pagure() {
- depends=("$pkgbase-backend=$pkgver")
+ depends=("$pkgbase-database=$pkgver")
optdepends=("$pkgbase-apache: Apache host configuration files")
backup=("etc/$pkgbase/alembic.ini"
"etc/$pkgbase/pagure.cfg")
@@ -103,25 +107,34 @@ package_pagure-apache() {
}
package_pagure-mariadb() {
- pkgdesc+=" (MariaDB backend configuration)"
+ pkgdesc+=" (MariaDB database configuration)"
depends=("$pkgbase=$pkgver" 'mariadb' 'python-mysqlclient') # alternative: python-pymysql
- provides=("$pkgbase-backend")
+ provides=("$pkgbase-database")
conflicts=("$pkgbase-postgresql" "$pkgbase-sqlite")
+ backup=("etc/$pkgbase/pagure_database.cfg")
install="$pkgbase-mariadb.install"
+ install -Dm600 <(echo "DB_URL = 'mysql://$_user:<password>@localhost/$pkgbase'") \
+ "$pkgdir/etc/$pkgbase/pagure_database.cfg"
}
package_pagure-postgresql() {
- pkgdesc+=" (PostgreSQL backend configuration)"
+ pkgdesc+=" (PostgreSQL database configuration)"
depends=("$pkgbase=$pkgver" 'postgresql' 'python-psycopg2') # alternative: python-pg8000
- provides=("$pkgbase-backend")
+ provides=("$pkgbase-database")
conflicts=("$pkgbase-mariadb" "$pkgbase-sqlite")
+ backup=("etc/$pkgbase/pagure_database.cfg")
install="$pkgbase-postgresql.install"
+ install -Dm600 <(echo "DB_URL = 'postgres://$_user:<password>@localhost/$pkgbase'") \
+ "$pkgdir/etc/$pkgbase/pagure_database.cfg"
}
package_pagure-sqlite() {
- pkgdesc+=" (SQLite backend configuration)"
+ pkgdesc+=" (SQLite database configuration)"
depends=("$pkgbase=$pkgver" 'sqlite')
- provides=("$pkgbase-backend")
+ provides=("$pkgbase-database")
conflicts=("$pkgbase-mariadb" "$pkgbase-postgresql")
+ backup=("etc/$pkgbase/pagure_database.cfg")
install="$pkgbase-sqlite.install"
+ install -Dm600 <(echo "DB_URL = 'sqlite:///var/tmp/$pkgbase.sqlite'") \
+ "$pkgdir/etc/$pkgbase/pagure_database.cfg"
}