mirror of
https://git.centos.org/centos/centpkg.git
synced 2025-02-24 00:32:55 +00:00
Lots of changes, starting to try out 2 configs for the distro/SIG
buildsystems
This commit is contained in:
parent
e206a784e3
commit
3edf28ae80
6 changed files with 143 additions and 68 deletions
27
src/centpkg-sig.conf
Normal file
27
src/centpkg-sig.conf
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
[centpkg-sig]
|
||||||
|
lookaside = https://git.centos.org/sources
|
||||||
|
lookasidehash = sha512
|
||||||
|
lookaside_cgi = https://git.centos.org/sources/upload.cgi
|
||||||
|
distgit_namespaced = True
|
||||||
|
distgit_namespaces = rpms
|
||||||
|
gitbaseurl = ssh://git@git.centos.org/%(repo)s.git
|
||||||
|
anongiturl = https://git.centos.org/%(repo)s
|
||||||
|
branchre = .+\d$|.+\d-.+|master$
|
||||||
|
kojiprofile = cbs
|
||||||
|
build_client = cbs
|
||||||
|
lookaside_namespaced = True
|
||||||
|
git_excludes =
|
||||||
|
i386/
|
||||||
|
i686/
|
||||||
|
x86_64/
|
||||||
|
ppc/
|
||||||
|
ppc64/
|
||||||
|
ia64/
|
||||||
|
mips/
|
||||||
|
arm/
|
||||||
|
noarch/
|
||||||
|
/*.src.rpm
|
||||||
|
/build*.log
|
||||||
|
/.build-*.log
|
||||||
|
results_*/
|
||||||
|
clog
|
|
@ -1,13 +1,29 @@
|
||||||
[centpkg]
|
[centpkg]
|
||||||
lookaside = https://git.stg.centos.org/sources
|
lookaside = https://sources.stream.rdu2.redhat.com/sources
|
||||||
lookasidehash = sha1
|
lookasidehash = sha512
|
||||||
lookaside_cgi = https://git.stg.centos.org/sources/upload.cgi
|
lookaside_cgi = https://sources.stream.rdu2.redhat.com/sources/upload.cgi
|
||||||
lookaside_request_params = branch
|
|
||||||
distgit_namespaced = True
|
distgit_namespaced = True
|
||||||
distgit_namespaces = rpms
|
distgit_namespaces = rpms
|
||||||
gitbaseurl = https://%(user)s@git.stg.centos.org/%(repo)s.git
|
gitbaseurl = ssh://git@gitlab.com/%(repo)s.git
|
||||||
anongiturl = https://git.stg.centos.org/%(repo)s
|
anongiturl = https://gitlab.com/%(repo)s
|
||||||
branchre = .+\d$|.+\d-.+|master$
|
branchre = .+\d$|.+\d-.+|master$
|
||||||
kojiprofile = cbs
|
kojiprofile = stream
|
||||||
build_client = cbs
|
build_client = stream
|
||||||
clone_config =
|
kerberos_realms = REDHAT.COM,IPA.REDHAT.COM
|
||||||
|
distgit_namespaced = True
|
||||||
|
lookaside_namespaced = True
|
||||||
|
git_excludes =
|
||||||
|
i386/
|
||||||
|
i686/
|
||||||
|
x86_64/
|
||||||
|
ppc/
|
||||||
|
ppc64/
|
||||||
|
ia64/
|
||||||
|
mips/
|
||||||
|
arm/
|
||||||
|
noarch/
|
||||||
|
/*.src.rpm
|
||||||
|
/build*.log
|
||||||
|
/.build-*.log
|
||||||
|
results_*/
|
||||||
|
clog
|
||||||
|
|
|
@ -19,13 +19,11 @@
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import urlparse
|
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
from pyrpkg import Commands, rpkgError
|
from pyrpkg import Commands, rpkgError
|
||||||
from pyrpkg.layout import ExplodedSRPMLayout, DistGitLayout
|
from pyrpkg.layout import SRPMLayout, DistGitLayout
|
||||||
from centos import centos_cert
|
from .lookaside import StreamLookasideCache,SIGLookasideCache
|
||||||
from .lookaside import CentOSLookasideCache
|
|
||||||
from pyrpkg.utils import cached_property
|
from pyrpkg.utils import cached_property
|
||||||
from . import cli
|
from . import cli
|
||||||
|
|
||||||
|
@ -39,7 +37,7 @@ class DistGitDirectory(object):
|
||||||
distrobranch = False
|
distrobranch = False
|
||||||
|
|
||||||
def __init__(self, branchtext):
|
def __init__(self, branchtext):
|
||||||
sigtobranchre = r'c(?P<centosversion>\d+)-sig-(?P<signame>\w+)-?(?P<projectname>\w+)?-?(?P<releasename>\w+)?'
|
sigtobranchre = r'c(?P<centosversion>\d+[s]?)-sig-(?P<signame>\w+)-?(?P<projectname>\w+)?-?(?P<releasename>\w+)?'
|
||||||
distrobranchre = r'c(?P<centosversion>\d+)-?(?P<projectname>\w+)?'
|
distrobranchre = r'c(?P<centosversion>\d+)-?(?P<projectname>\w+)?'
|
||||||
oldbranchre = r'(?P<signame>\w+)(?P<centosversion>\d)'
|
oldbranchre = r'(?P<signame>\w+)(?P<centosversion>\d)'
|
||||||
sigmatch = re.match(sigtobranchre, branchtext)
|
sigmatch = re.match(sigtobranchre, branchtext)
|
||||||
|
@ -77,8 +75,12 @@ class DistGitDirectory(object):
|
||||||
releaseorcommon = self.releasename
|
releaseorcommon = self.releasename
|
||||||
|
|
||||||
if self.distrobranch:
|
if self.distrobranch:
|
||||||
return '-'.join(filter(None, ['c'+self.centosversion,
|
if self.centosversion not in ('6','7'):
|
||||||
projectorcommon]))
|
return 'c{}s-candidate'.format(self.centosversion)
|
||||||
|
else:
|
||||||
|
return '-'.join(filter(None, ['c'+self.centosversion,
|
||||||
|
projectorcommon]))
|
||||||
|
|
||||||
|
|
||||||
if not releaseorcommon:
|
if not releaseorcommon:
|
||||||
if not projectorcommon or projectorcommon == 'common':
|
if not projectorcommon or projectorcommon == 'common':
|
||||||
|
@ -100,19 +102,23 @@ class Commands(Commands):
|
||||||
'''
|
'''
|
||||||
super(Commands, self).__init__(*args, **kwargs)
|
super(Commands, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
self.source_entry_type = 'old'
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def distgitdir(self):
|
def distgitdir(self):
|
||||||
return DistGitDirectory(self.branch_merge)
|
return DistGitDirectory(self.branch_merge)
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def lookasidecache(self):
|
def lookasidecache(self):
|
||||||
return CentOSLookasideCache(self.lookasidehash,
|
if self.distgitdir.distrobranch:
|
||||||
self.lookaside,
|
return StreamLookasideCache(self.lookasidehash,
|
||||||
self.lookaside_cgi,
|
self.lookaside,
|
||||||
self.repo_name,
|
self.lookaside_cgi,
|
||||||
self.branch_merge)
|
)
|
||||||
|
else:
|
||||||
|
return SIGLookasideCache(self.lookasidehash,
|
||||||
|
self.lookaside,
|
||||||
|
self.lookaside_cgi,
|
||||||
|
self.repo_name,
|
||||||
|
self.branch_merge)
|
||||||
|
|
||||||
# redefined loaders
|
# redefined loaders
|
||||||
def load_rpmdefines(self):
|
def load_rpmdefines(self):
|
||||||
|
@ -142,16 +148,6 @@ class Commands(Commands):
|
||||||
|
|
||||||
self._target = self.distgitdir.target
|
self._target = self.distgitdir.target
|
||||||
|
|
||||||
def load_user(self):
|
|
||||||
try:
|
|
||||||
self._user = centos_cert.CentOSUserCert().CN
|
|
||||||
except Exception:
|
|
||||||
print >>sys.stderr, "Could not load user from cert file"
|
|
||||||
super(Commands, self).load_user()
|
|
||||||
|
|
||||||
# These are the commands defined in the base pyrpkg.Commands class
|
|
||||||
# and have been implemented here
|
|
||||||
|
|
||||||
def upload(self, *args, **kwargs):
|
def upload(self, *args, **kwargs):
|
||||||
if not self.distgitdir.distrobranch:
|
if not self.distgitdir.distrobranch:
|
||||||
self.source_entry_type = 'bsd'
|
self.source_entry_type = 'bsd'
|
||||||
|
|
|
@ -16,50 +16,66 @@
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import logging
|
import logging
|
||||||
import ConfigParser
|
|
||||||
import argparse
|
|
||||||
|
|
||||||
import fedpkg
|
import six.moves.configparser as ConfigParser
|
||||||
|
|
||||||
import pyrpkg
|
import pyrpkg
|
||||||
import centpkg
|
import pyrpkg.utils
|
||||||
from pyrpkg.layout import Layout, ExplodedSRPMLayout, DistGitLayout
|
import centpkg.cli
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
'''
|
# Setup an argparser and parse the known commands to get the config file
|
||||||
Where things actually happen
|
program_name = os.path.basename(sys.argv[0])
|
||||||
'''
|
|
||||||
parser = argparse.ArgumentParser(add_help=False)
|
# Modified ArgumentParser provides parameter "allow_abbrev=False" (which affects processing
|
||||||
parser.add_argument('-C', '--config', help='The rpkg config file to use',
|
# of commandline arguments with common prefix). Generaly it is available since python3.6.
|
||||||
default='/etc/rpkg/centpkg.conf')
|
# This enables "allow_abbrev" for older python versions.
|
||||||
|
parser = pyrpkg.cli.ArgumentParser(add_help=False)
|
||||||
|
parser.add_argument('-S', '--sig', help='Operate as a CentOS SIG user instead of using the Stream distro environment',
|
||||||
|
default=False,
|
||||||
|
action='store_true')
|
||||||
|
|
||||||
(args, other) = parser.parse_known_args()
|
(args, other) = parser.parse_known_args()
|
||||||
|
|
||||||
|
if args.sig:
|
||||||
|
args.config = '/etc/rpkg/centpkg-sig.conf'
|
||||||
|
else:
|
||||||
|
args.config = '/etc/rpkg/centpkg.conf'
|
||||||
|
|
||||||
# Make sure we have a sane config file
|
# Make sure we have a sane config file
|
||||||
if not os.path.exists(args.config) and not other[-1] in ['--help', '-h']:
|
if not os.path.exists(args.config) and not other[-1] in ['--help', '-h', 'help']:
|
||||||
sys.stderr.write('Invalid config file %s\n' % args.config)
|
sys.stderr.write('Invalid config file %s\n' % args.config)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
# Setup a configuration object and read config file data
|
||||||
config = ConfigParser.SafeConfigParser()
|
config = ConfigParser.SafeConfigParser()
|
||||||
config.read(args.config)
|
config.read(args.config)
|
||||||
|
|
||||||
layout = Layout.load()
|
client = centpkg.cli.centpkgClient(config)
|
||||||
if isinstance(layout, DistGitLayout):
|
client.do_imports(site='centpkg')
|
||||||
config.read('/etc/rpkg/fedpkg.conf')
|
|
||||||
client = fedpkg.cli.fedpkgClient(config, name='fedpkg')
|
|
||||||
else:
|
|
||||||
client = centpkg.cli.centpkgClient(config)
|
|
||||||
|
|
||||||
client.do_imports(site=client.DEFAULT_CLI_NAME)
|
|
||||||
client.parse_cmdline()
|
client.parse_cmdline()
|
||||||
|
|
||||||
|
# This is due to a difference argparse behavior to Python 2 version.
|
||||||
|
# In Python 3, argparse will proceed to here without reporting
|
||||||
|
# "too few arguments". Instead, client.args does not have attribute
|
||||||
|
# command.
|
||||||
|
if not hasattr(client.args, 'command'):
|
||||||
|
client.parser.print_help()
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
if not client.args.path:
|
if not client.args.path:
|
||||||
try:
|
try:
|
||||||
client.args.path = os.getcwd()
|
client.args.path = pyrpkg.utils.getcwd()
|
||||||
except OSError as err_msg:
|
except Exception:
|
||||||
print('Could not get current path')
|
print('Could not get current path, have you deleted it?')
|
||||||
print(err_msg)
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
# setup the logger -- This logger will take things of INFO or DEBUG and
|
||||||
|
# log it to stdout. Anything above that (WARN, ERROR, CRITICAL) will go
|
||||||
|
# to stderr. Normal operation will show anything INFO and above.
|
||||||
|
# Quiet hides INFO, while Verbose exposes DEBUG. In all cases WARN or
|
||||||
|
# higher are exposed (via stderr).
|
||||||
log = pyrpkg.log
|
log = pyrpkg.log
|
||||||
client.setupLogging(log)
|
client.setupLogging(log)
|
||||||
|
|
||||||
|
@ -75,9 +91,12 @@ def main():
|
||||||
sys.exit(client.args.command())
|
sys.exit(client.args.command())
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
pass
|
pass
|
||||||
except Exception, e:
|
except Exception as e:
|
||||||
|
if getattr(client.args, 'debug', False):
|
||||||
|
raise
|
||||||
log.error('Could not execute %s: %s' % (client.args.command.__name__, e))
|
log.error('Could not execute %s: %s' % (client.args.command.__name__, e))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -21,3 +21,14 @@ class centpkgClient(cliClient):
|
||||||
def __init__(self, config, name=None):
|
def __init__(self, config, name=None):
|
||||||
self.DEFAULT_CLI_NAME = 'centpkg'
|
self.DEFAULT_CLI_NAME = 'centpkg'
|
||||||
super(centpkgClient, self).__init__(config, name)
|
super(centpkgClient, self).__init__(config, name)
|
||||||
|
|
||||||
|
self.setup_centos_subparsers()
|
||||||
|
|
||||||
|
def setup_centos_subparsers(self):
|
||||||
|
self.register_parser()
|
||||||
|
|
||||||
|
def register_parser(self):
|
||||||
|
self.parser.add_argument('-S', '--sig', help='Operate as a CentOS SIG user instead of using the Stream distro environment',
|
||||||
|
default=False,
|
||||||
|
action='store_true')
|
||||||
|
|
||||||
|
|
|
@ -7,29 +7,35 @@
|
||||||
# the full text of the license.
|
# the full text of the license.
|
||||||
|
|
||||||
|
|
||||||
"""Interact with the CentOS lookaside cache
|
"""Interact with the Red Hat lookaside cache
|
||||||
|
|
||||||
We need to override the pyrpkg.lookasidecache module to handle our custom
|
We need to override the pyrpkg.lookasidecache module to handle our custom
|
||||||
download path.
|
download path.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import hashlib
|
|
||||||
import io
|
import io
|
||||||
import logging
|
|
||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
|
|
||||||
import pycurl
|
import pycurl
|
||||||
import six
|
import six
|
||||||
|
import sys
|
||||||
|
|
||||||
from pyrpkg.errors import DownloadError, InvalidHashType, UploadError
|
|
||||||
|
from pyrpkg.errors import InvalidHashType, UploadError
|
||||||
from pyrpkg.lookaside import CGILookasideCache
|
from pyrpkg.lookaside import CGILookasideCache
|
||||||
from six.moves import http_client
|
|
||||||
|
|
||||||
|
|
||||||
class CentOSLookasideCache(CGILookasideCache):
|
class StreamLookasideCache(CGILookasideCache):
|
||||||
|
def __init__(self, hashtype, download_url, upload_url):
|
||||||
|
super(StreamLookasideCache, self).__init__(
|
||||||
|
hashtype, download_url, upload_url)
|
||||||
|
|
||||||
|
self.download_path = (
|
||||||
|
'%(name)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s')
|
||||||
|
|
||||||
|
|
||||||
|
class SIGLookasideCache(CGILookasideCache):
|
||||||
def __init__(self, hashtype, download_url, upload_url, name, branch):
|
def __init__(self, hashtype, download_url, upload_url, name, branch):
|
||||||
super(CentOSLookasideCache, self).__init__(
|
super(SIGLookasideCache, self).__init__(
|
||||||
hashtype, download_url, upload_url, client_cert="/home/bstinson/.centos.cert")
|
hashtype, download_url, upload_url, client_cert="/home/bstinson/.centos.cert")
|
||||||
self.branch = branch
|
self.branch = branch
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue