Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nxd-bom
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
nxd-bom
Commits
f2d5abea
Commit
f2d5abea
authored
Jul 21, 2022
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
6d501411
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
9 deletions
+25
-9
bom
bom
+25
-9
No files found.
bom
View file @
f2d5abea
...
...
@@ -31,12 +31,14 @@ from os.path import basename
# bom_software retrieves BOM from .installed.cfg generated by buildout along the build.
def
bom_software
(
installed_cfg
):
# -> set of 'name-version'
bom
=
set
()
def
bom_software
(
installed_cfg
):
# -> set of 'name-version'
XXX
bom
=
{}
# name -> ver + ... XXX
inst
=
configparser
.
ConfigParser
()
inst
.
read
(
installed_cfg
)
eggs_todo
=
set
()
# eggs listed in zc.recipe.egg - XXX
for
s
in
inst
.
sections
():
if
s
==
'buildout'
:
continue
# [buildout] is used internally
...
...
@@ -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
elif
recipe
==
'zc.recipe.egg'
:
# XXX
eggs
=
part
[
'eggs'
].
split
()
for
_
in
eggs
:
eggs_todo
.
add
(
_
)
else
:
...
...
@@ -83,6 +87,11 @@ def bom_software(installed_cfg): # -> set of 'name-version'
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
):
1
/
0
...
...
@@ -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')
# 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+)
')
_github_re = re.compile(r'
github
.
com
/
\
w
+/
(
?
P
<
name
>
\
w
+
)
/
archive
/
(
?
P
<
rev
>
\
w
+
)
')
def namever(url): # -> (name, ver)
m = _gitweb_re.search(url)
name, ver = _namever(url)
for tail in ('
tgz
', '
tar
.
gz
', '
tbz
', '
tar
.
bz2
', '
tar
.
xz
', '
tar
.
lz
'):
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)
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment