getting some root invalidation errors
This commit is contained in:
parent
6f44079c92
commit
e49a524c2d
@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
targetNamespace="http://git.square-r00t.net/OpTools/tree/arch/autorepo/"
|
||||
xmlns="http://git.square-r00t.net/OpTools/tree/arch/autorepo/tree/"
|
||||
xmlns:archrepo="http://git.square-r00t.net/OpTools/tree/arch/autorepo/"
|
||||
targetNamespace="http://git.square-r00t.net/Arch_Repo_Builder/tree/"
|
||||
xmlns="http://git.square-r00t.net/Arch_Repo_Builder/tree/"
|
||||
xmlns:archrepo="http://git.square-r00t.net/Arch_Repo_Builder/tree/"
|
||||
elementFormDefault="qualified"
|
||||
attributeFormDefault="unqualified">
|
||||
|
61
build.py
61
build.py
@ -21,24 +21,58 @@ from lxml import etree
|
||||
|
||||
|
||||
# TODO: track which versions are built so we don't need to consistently rebuild ALL packages
|
||||
# TODO: logging
|
||||
# TODO: should this be a configuration option?
|
||||
aurbase = 'https://aur.archlinux.org'
|
||||
|
||||
_dflts = {'cfgfile': '~/.config/optools/arch/autorepo.xml'}
|
||||
|
||||
|
||||
class Repo(object):
|
||||
def __init__(self, repo_xml):
|
||||
self.repo_xml = repo_xml
|
||||
self.gpg = None
|
||||
|
||||
def _initSigner(self):
|
||||
|
||||
self.gpg = gpg.Context()
|
||||
|
||||
# Just grab the first private key until we flesh this out.
|
||||
for k in self.gpg.keylist(secret = True):
|
||||
if k.can_sign:
|
||||
self.gpg.signers = [k]
|
||||
break
|
||||
return()
|
||||
|
||||
class Packager(object):
|
||||
def __init__(self, cfgfile = _dflts['cfgfile'], *args, **kwargs):
|
||||
user_params = kwargs
|
||||
self.args = copy.deepcopy(_dflts)
|
||||
self.args.update(user_params)
|
||||
def __init__(self, cfgfile = _dflts['cfgfile'], validate = True, *args, **kwargs):
|
||||
self.cfgfile = os.path.abspath(os.path.expanduser(cfgfile))
|
||||
self.cfg = None
|
||||
self.xml = None
|
||||
self.schema = None
|
||||
self._initCfg(validate = validate)
|
||||
self.origdir = os.path.abspath(os.path.expanduser(os.getcwd()))
|
||||
self.gpg = None
|
||||
self.args['destdir'] = os.path.abspath(os.path.expanduser(self.args['destdir']))
|
||||
if not self.args['pkgs']:
|
||||
self.args['pkgs'] = _dflts['pkgs']
|
||||
self._initSigner()
|
||||
|
||||
def _initCfg(self, validate = True):
|
||||
with open(self.cfgfile, 'rb') as f:
|
||||
self.xml = etree.parse(f)
|
||||
self.xml.xinclude()
|
||||
self.cfg = self.xml.getroot()
|
||||
if validate:
|
||||
if not self.schema:
|
||||
from urllib.request import urlopen
|
||||
xsi = self.cfg.nsmap.get('xsi', 'http://www.w3.org/2001/XMLSchema-instance')
|
||||
schemaLocation = '{{{0}}}schemaLocation'.format(xsi)
|
||||
schemaURL = self.cfg.attrib.get(schemaLocation,
|
||||
('http://git.square-r00t.net/Arch_Repo_Builder/plain/archrepo.xsd'))
|
||||
with urlopen(schemaURL) as url:
|
||||
self.schema = url.read()
|
||||
self.schema = etree.XMLSchema(etree.XML(self.schema))
|
||||
self.schema.assertValid(self.xml)
|
||||
return()
|
||||
|
||||
def buildPkgs(self, auronly = None):
|
||||
for p in self.args['pkgs']:
|
||||
print(p)
|
||||
@ -103,15 +137,6 @@ class Packager(object):
|
||||
shutil.rmtree(extract_dir)
|
||||
return()
|
||||
|
||||
def _initSigner(self):
|
||||
self.gpg = gpg.Context()
|
||||
# Just grab the first private key until we flesh this out.
|
||||
for k in self.gpg.keylist(secret = True):
|
||||
if k.can_sign:
|
||||
self.gpg.signers = [k]
|
||||
break
|
||||
return()
|
||||
|
||||
def _getAUR(self, pkgnm, extract_dir):
|
||||
dl_url = None
|
||||
pkg_srch = requests.get(os.path.join(self.args['aurbase'],
|
||||
@ -173,6 +198,10 @@ class Packager(object):
|
||||
|
||||
def parseArgs():
|
||||
args = argparse.ArgumentParser(description = 'Build Pacman packages and update a local repository')
|
||||
args.add_argument('-n', '--no-validate',
|
||||
dest = 'validate',
|
||||
action = 'store_false',
|
||||
help = ('If specified, do NOT attempt to validate the config file (-c/--config)'))
|
||||
args.add_argument('-c', '--config',
|
||||
dest = 'cfgfile',
|
||||
default = _dflts['cfgfile'],
|
||||
|
@ -4,8 +4,8 @@
|
||||
You can use external XML snippets if that's easier/cleaner (it usually is).
|
||||
-->
|
||||
<archrepo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://git.square-r00t.net/OpTools/tree/arch/autorepo/"
|
||||
xsi:schemaLocation="http://git.square-r00t.net/OpTools/plain/arch/autorepo/autorepo.xsd">
|
||||
xmlns="http://git.square-r00t.net/Arch_Repo_Builder/tree/"
|
||||
xsi:schemaLocation="http://git.square-r00t.net/Arch_Repo_Builder/plain/archrepo.xsd">
|
||||
<!--
|
||||
The repo element contains information for each repository we should build for.
|
||||
Attributes:
|
||||
@ -103,7 +103,13 @@
|
||||
The pkgbuild element specifies packages that are locally developed/designed.
|
||||
They contain the name of the package.
|
||||
Attributes:
|
||||
path: The path to the package to build.
|
||||
path: The path to the package to build. It can be:
|
||||
- a tarball (.tar.gz) (as created with the allsource flag for makepkg)
|
||||
- a directory, which will search for a file named PKGBUILD
|
||||
- a file, which is assumed to be a PKGBUILD file
|
||||
alwaysBuild: Accepts "1"/"true" or "0"/"false". If true, always build the package even if the same
|
||||
version exists already. This only works if you don't delete/empty your staging
|
||||
directory, otherwise it will be built.
|
||||
-->
|
||||
<pkgbuild path="/path/to/pkgnm.snapshot.tar.gz" alwaysBuild="true">pkgnm</pkgbuild>
|
||||
<pkgbuild path="/path/to/PKGBUILD" alwaysBuild="false">pkgnm2</pkgbuild>
|
Loading…
Reference in New Issue
Block a user