mirror of https://git.sr.ht/~sircmpwn/hub.sr.ht
Add setup.py, build manifest
This commit is contained in:
parent
f29b90b8fa
commit
c6ab88e46d
|
@ -0,0 +1,44 @@
|
|||
image: alpine/3.11
|
||||
repositories:
|
||||
sr.ht: >
|
||||
https://mirror.sr.ht/alpine/v3.11/sr.ht/
|
||||
https://mirror.sr.ht/alpine/alpine%40sr.ht.rsa.pub
|
||||
alpine@sr.ht.rsa.pub
|
||||
packages:
|
||||
- rsync
|
||||
sources:
|
||||
- https://git.sr.ht/~sircmpwn/hub.sr.ht
|
||||
- https://git.sr.ht/~sircmpwn/sr.ht-apkbuilds
|
||||
environment:
|
||||
project: hub.sr.ht
|
||||
remote: deploy@mirror.sr.ht
|
||||
remote_path: /var/www/mirror.sr.ht/alpine
|
||||
master: deploy@hub.sr.ht
|
||||
secrets:
|
||||
- fa00a8d3-7b63-42d5-8060-3bb31c3e3018 # ssh deploy key
|
||||
- d0adc1d4-af78-4852-920f-1134392f5d10 # package signing key
|
||||
tasks:
|
||||
- archive: |
|
||||
cd ${project}
|
||||
pkgver=$(~/sr.ht-apkbuilds/pkgkit pkgver)
|
||||
echo "pkgver=$pkgver" >> ~/.buildenv
|
||||
git archive \
|
||||
-o ~/sr.ht-apkbuilds/sr.ht/${project}/${project}-$pkgver.tar.gz \
|
||||
--prefix=${project}-$pkgver/ HEAD
|
||||
- pkgkit: |
|
||||
cd sr.ht-apkbuilds
|
||||
./pkgkit add-repo -s sr.ht ~/.abuild/alpine@sr.ht.rsa
|
||||
cd sr.ht/$project
|
||||
sed -e 's?::https://git.sr.ht/.*archive.*??g' -i APKBUILD
|
||||
- package: |
|
||||
cd sr.ht-apkbuilds
|
||||
./pkgkit build -cuv "$pkgver" "$project"
|
||||
cd ~/$project
|
||||
git describe --exact-match HEAD || complete-build
|
||||
- publish: |
|
||||
cd sr.ht-apkbuilds
|
||||
echo "StrictHostKeyChecking=no" >> ~/.ssh/config
|
||||
./pkgkit upload "$remote" "$remote_path" "$project"
|
||||
- deploy: |
|
||||
ssh $master doas apk upgrade -U
|
||||
ssh -t $master doas service $project restart
|
|
@ -0,0 +1,63 @@
|
|||
#!/usr/bin/env python3
|
||||
from distutils.core import setup
|
||||
import subprocess
|
||||
import os
|
||||
import site
|
||||
import sys
|
||||
|
||||
if hasattr(site, 'getsitepackages'):
|
||||
pkg_dirs = site.getsitepackages()
|
||||
if site.getusersitepackages():
|
||||
pkg_dirs.append(site.getusersitepackages())
|
||||
for pkg_dir in pkg_dirs:
|
||||
srht_path = os.path.join(pkg_dir, "srht")
|
||||
if os.path.isdir(srht_path):
|
||||
break
|
||||
else:
|
||||
raise Exception("Can't find core srht module in your site packages "
|
||||
"directories. Please install it first.")
|
||||
else:
|
||||
srht_path = os.getenv("SRHT_PATH")
|
||||
if not srht_path:
|
||||
raise Exception("You're running inside a virtual environment. "
|
||||
"Due to virtualenv limitations, you need to set the "
|
||||
"$SRHT_PATH environment variable to the path of the "
|
||||
"core srht module.")
|
||||
elif not os.path.isdir(srht_path):
|
||||
raise Exception(
|
||||
"The $SRHT_PATH environment variable points to an invalid "
|
||||
"directory: {}".format(srht_path))
|
||||
|
||||
make = os.environ.get("MAKE", "make")
|
||||
subp = subprocess.run([make, "SRHT_PATH=" + srht_path])
|
||||
if subp.returncode != 0:
|
||||
sys.exit(subp.returncode)
|
||||
|
||||
ver = os.environ.get("PKGVER") or subprocess.run(['git', 'describe', '--tags'],
|
||||
stdout=subprocess.PIPE).stdout.decode().strip()
|
||||
|
||||
setup(
|
||||
name = 'hubsrht',
|
||||
packages = [
|
||||
'hubsrht',
|
||||
'hubsrht.blueprints',
|
||||
'hubsrht.types',
|
||||
],
|
||||
version = ver,
|
||||
description = 'hub.sr.ht website',
|
||||
author = 'Drew DeVault',
|
||||
author_email = 'sir@cmpwn.com',
|
||||
url = 'https://git.sr.ht/~sircmpwn/hub.sr.ht',
|
||||
install_requires = ['srht'],
|
||||
license = 'AGPL-3.0',
|
||||
package_data={
|
||||
'hubsrht': [
|
||||
'templates/*.html',
|
||||
'static/*',
|
||||
'static/icons/*',
|
||||
]
|
||||
},
|
||||
scripts = [
|
||||
'hubsrht-initdb',
|
||||
]
|
||||
)
|
Loading…
Reference in New Issue