Commit f2d5abea authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 6d501411
...@@ -31,12 +31,14 @@ from os.path import basename ...@@ -31,12 +31,14 @@ from os.path import basename
# bom_software retrieves BOM from .installed.cfg generated by buildout along the build. # bom_software retrieves BOM from .installed.cfg generated by buildout along the build.
def bom_software(installed_cfg): # -> set of 'name-version' def bom_software(installed_cfg): # -> set of 'name-version' XXX
bom = set() bom = {} # name -> ver + ... XXX
inst = configparser.ConfigParser() inst = configparser.ConfigParser()
inst.read(installed_cfg) inst.read(installed_cfg)
eggs_todo = set() # eggs listed in zc.recipe.egg - XXX
for s in inst.sections(): for s in inst.sections():
if s == 'buildout': if s == 'buildout':
continue # [buildout] is used internally continue # [buildout] is used internally
...@@ -72,7 +74,9 @@ def bom_software(installed_cfg): # -> set of 'name-version' ...@@ -72,7 +74,9 @@ def bom_software(installed_cfg): # -> set of 'name-version'
name, ver = namever(eggpath) # XXX strip egg and py2.7-linux-x86_64 name, ver = namever(eggpath) # XXX strip egg and py2.7-linux-x86_64
elif recipe == 'zc.recipe.egg': elif recipe == 'zc.recipe.egg':
# XXX eggs = part['eggs'].split()
for _ in eggs:
eggs_todo.add(_)
else: else:
...@@ -83,6 +87,11 @@ def bom_software(installed_cfg): # -> set of 'name-version' ...@@ -83,6 +87,11 @@ def bom_software(installed_cfg): # -> set of 'name-version'
print('(%s)\t%s-%s' % (s, name, ver)) print('(%s)\t%s-%s' % (s, name, ver))
# verify that every egg listed in zc.recipe.egg was actally insalled one way or another
for egg in eggs_todo:
assert egg in bom, (egg, bom)
def bom_node(XXX): def bom_node(XXX):
1/0 1/0
...@@ -93,17 +102,24 @@ def bom_node(XXX): ...@@ -93,17 +102,24 @@ def bom_node(XXX):
# #
# http://www.python.org/ftp/python/2.7.18/Python-2.7.18.tar.xz -> ('Python', '2.7.18') # http://www.python.org/ftp/python/2.7.18/Python-2.7.18.tar.xz -> ('Python', '2.7.18')
# https://git.savannah.gnu.org/gitweb/?p=config.git;a=snapshot;h=5e531d39;sf=tgz -> ('config', '5e531d39') # https://git.savannah.gnu.org/gitweb/?p=config.git;a=snapshot;h=5e531d39;sf=tgz -> ('config', '5e531d39')
# https://github.com/nghttp2/nghttp2/archive/v1.40.0.tar.gz -> ('nghttp2', '1.40.0')
_gitweb_re = re.compile(r'/gitweb/\?p=(?P<name>\w+)\.git;a=snapshot;h=(?P<rev>\w+)') _gitweb_re = re.compile(r'/gitweb/\?p=(?P<name>\w+)\.git;a=snapshot;h=(?P<rev>\w+)')
_github_re = re.compile(r'github.com/\w+/(?P<name>\w+)/archive/(?P<rev>\w+)')
def namever(url): # -> (name, ver) def namever(url): # -> (name, ver)
m = _gitweb_re.search(url) name, ver = _namever(url)
if m is not None: for tail in ('tgz', 'tar.gz', 'tbz', 'tar.bz2', 'tar.xz', 'tar.lz'):
return m.group('name'), m.group('rev') ver = ver.removesuffix('.'+tail)
ver.removeprefix('v')
return name, ver
def _namever(url):
for r in (_gitweb_re, _github_re):
m = r.search(url)
if m is not None:
return m.group('name'), m.group('rev')
filename = basename(url) filename = basename(url)
name, ver = filename.split('-', 1) name, ver = filename.split('-', 1)
for tail in ('tgz', 'tar.gz', 'tbz', 'tar.bz2', 'tar.xz', 'tar.lz'):
if ver.endswith('.'+tail):
ver = ver.removesuffix('.'+tail)
return name, ver return name, ver
......
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