Verified Commit 76436a49 authored by Oskar Roesler's avatar Oskar Roesler
Browse files

Add local repo support for building

parent 690500df
import subprocess
import os
import sys
import glob
import shutil
from git import Repo
from aurci.general import Routines
REPO_ADD_BIN = '/usr/bin/repo-add'
MAKECHROOTPKG_BIN = '/usr/bin/makechrootpkg'
class Packages(Routines):
FAILED_FILE = "failed.txt"
SUCCESS_FILE = "success.txt"
CHROOT = os.environ.get('CHROOT')
def __init__(self, package, verbosity, output):
Routines.__init__(self, package, verbosity, output)
self.chroot = os.environ.get('CHROOT', os.path.join(self.cache_path, "chroot"))
self.localrepo_path = os.path.join(self.cache_path, 'repo')
def makepkg(self):
if os.path.isfile(os.path.join(self.repos_path, "PKGBUILD")):
try:['makechrootpkg', '-c', '-r', self.CHROOT], stdout=( None if self.verbosity else subprocess.DEVNULL), \[MAKECHROOTPKG_BIN, '-c', '-d', self.localrepo_path, '-r',
self.chroot], stdout=( None if self.verbosity else subprocess.DEVNULL), \
stderr=subprocess.STDOUT, cwd=self.repos_path, check=True)
with open("success.txt", "a") as fobj:
fobj.write(self.package + "\n")
......@@ -27,6 +39,11 @@ class Packages(Routines):
raise RuntimeWarning("Building of {0} failed".format(self.package))
raise FileNotFoundError("No PKBUILD existing: ", self.repos_path)
try:[REPO_ADD_BIN, 'localhost.db.tar.zst'] + glob.glob(os.path.join(self.localrepo_path, '*.pkg.tar.*')),
check=True, cwd=self.localrepo_path)
except subprocess.CalledProcessError as e:
print(e.stdout, file=sys.stderr)
def build(self):
if self.package=="all":
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment