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
21bad144
Commit
21bad144
authored
Jul 21, 2022
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
40c4ed81
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
8 deletions
+19
-8
nxd-bom
nxd-bom
+19
-8
No files found.
nxd-bom
View file @
21bad144
...
...
@@ -20,7 +20,7 @@
# See https://www.nexedi.com/licensing for rationale and options.
"""Program nxd-bom generates bill of material for a software-release or slapos node
Usage: nxd-bom software <
.installed.cfg
>
Usage: nxd-bom software <
path-to-installed-software
>
nxd-bom node <slapos deploy-script>
"""
...
...
@@ -31,21 +31,21 @@ 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'
XXX
def
bom_software
(
installed_
software_path
):
# -> {} name -> version +
XXX
bom
=
{}
# name -> ver + ... XXX
i
nst
=
configparser
.
ConfigParser
()
i
nst
.
read
(
installed_cfg
)
i
db
=
configparser
.
ConfigParser
()
i
db
.
read
(
'%s/.installed.cfg'
%
installed_software_path
)
eggs_todo
=
set
()
# eggs listed in zc.recipe.egg - XXX
for
s
in
i
nst
.
sections
():
for
s
in
i
db
.
sections
():
if
s
==
'buildout'
:
continue
# [buildout] is used internally
#print(s)
part
=
i
nst
[
s
]
part
=
i
db
[
s
]
recipe
=
part
[
'recipe'
]
if
recipe
==
'slapos.recipe.cmmi'
:
...
...
@@ -132,8 +132,8 @@ _github_re = re.compile(r'github.com/\w+/(?P<name>\w+)/archive/(?P<rev>\w+)')
def namever(url): # -> (name, ver)
name, ver = _namever(url)
for tail in ('
tgz
', '
tar
.
gz
', '
tbz
', '
tar
.
bz2
', '
tar
.
xz
', '
tar
.
lz
'):
ver =
ver.removesuffix(
'
.
'+tail)
ver
.removeprefix(
'
v
')
ver =
removesuffix(ver,
'
.
'+tail)
ver
= removeprefix(ver,
'
v
')
return name, ver
def _namever(url):
...
...
@@ -163,6 +163,17 @@ def isconf(url):
return True
return False
# removeprefix/removesuffix provides fallbacks similarly-named str methods.
def removeprefix(s, prefix):
if s.startswith(prefix):
s = s[len(prefix):]
return s
def removesuffix(s, suffix):
if s.endswith(suffix):
s = s[:len(s)-len(suffix)]
return s
# ----------------------------------------
def main():
...
...
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