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
43319739
Commit
43319739
authored
Jun 05, 2023
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for slapos.recipe.build:gitclone
parent
61fd444f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
1 deletion
+29
-1
nxdbom/__init__.py
nxdbom/__init__.py
+19
-1
nxdbom/nxdbom_test.py
nxdbom/nxdbom_test.py
+10
-0
No files found.
nxdbom/__init__.py
View file @
43319739
...
@@ -48,8 +48,12 @@ PkgInfo = namedtuple('PkgInfo', [
...
@@ -48,8 +48,12 @@ PkgInfo = namedtuple('PkgInfo', [
# 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_software_path
):
# -> {} name -> PkgInfo
def
bom_software
(
installed_software_path
):
# -> {} name -> PkgInfo
bom
=
{}
bom
=
{}
def
addbom
(
urlpath
,
kind
):
def
addbom
(
urlpath
,
kind
,
version
=
None
):
name
,
ver
=
namever
(
urlpath
)
name
,
ver
=
namever
(
urlpath
)
if
version
is
not
None
:
assert
ver
is
None
ver
=
version
ver
=
removeprefix
(
ver
,
name
+
'-'
)
# wendelin.core-2.0.alpha3-0-g6315384 -> 2.0.alpha3-0-g6315384
if
'//'
in
urlpath
:
if
'//'
in
urlpath
:
url
=
urlpath
url
=
urlpath
else
:
else
:
...
@@ -145,6 +149,15 @@ def bom_software(installed_software_path): # -> {} name -> PkgInfo
...
@@ -145,6 +149,15 @@ def bom_software(installed_software_path): # -> {} name -> PkgInfo
raise
ValueError
(
'egg %s is present multiple times: %s'
%
(
egg
,
eggv
))
raise
ValueError
(
'egg %s is present multiple times: %s'
%
(
egg
,
eggv
))
addbom
(
eggv
[
0
],
'egg'
)
addbom
(
eggv
[
0
],
'egg'
)
elif
recipe
==
'slapos.recipe.build:gitclone'
:
repo
=
part
[
'repository'
]
ver
=
part
.
get
(
'revision'
)
if
ver
is
None
:
ver
=
part
.
get
(
'branch'
)
if
ver
is
None
:
ver
=
'HEAD'
addbom
(
repo
,
'git'
,
ver
)
else
:
else
:
raise
NotImplementedError
(
'TODO: add support for recipe %s'
%
recipe
)
raise
NotImplementedError
(
'TODO: add support for recipe %s'
%
recipe
)
...
@@ -198,6 +211,7 @@ _gitweb_re = re.compile(r'/gitweb/\?p=(?P<name>\w+)\.git;a=snapshot;h=(?P<rev>\w
...
@@ -198,6 +211,7 @@ _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
/
(
refs
/
tags
/
)
?
(
?
P
<
rev
>
.
+
)
$
')
_github_re = re.compile(r'
/
github
.
com
/
[
\
w
\
-
]
+/
(
?
P
<
name
>
[
\
w
\
-
]
+
)
/
archive
/
(
refs
/
tags
/
)
?
(
?
P
<
rev
>
.
+
)
$
')
_github_rre= re.compile(r'
/
raw
.
githubusercontent
.
com
/
[
\
w
\
-
]
+/
(
?
P
<
name
>
[
\
w
\
-
]
+
)
/
(
?
P
<
rev
>
[
\
w
\
.
\
-
]
+
)
/
')
_github_rre= re.compile(r'
/
raw
.
githubusercontent
.
com
/
[
\
w
\
-
]
+/
(
?
P
<
name
>
[
\
w
\
-
]
+
)
/
(
?
P
<
rev
>
[
\
w
\
.
\
-
]
+
)
/
')
_SF_re = re.compile(r'
/
sourceforge
.
net
/
.
+/
(
?
P
<
name
>
[
\
w
\
_
]
+
)
-
(
?
P
<
rev
>
[
\
w
\
.]
+
)
/
download
$
')
_SF_re = re.compile(r'
/
sourceforge
.
net
/
.
+/
(
?
P
<
name
>
[
\
w
\
_
]
+
)
-
(
?
P
<
rev
>
[
\
w
\
.]
+
)
/
download
$
')
_git_re = re.compile(r'
/
(
?
P
<
name
>
[
\
w
\
.
\
-
]
+
)
\
.
git
$
')
_go_re = re.compile(r'
/
golang
.
org
/
dl
/
(
?
P
<
name
>
go
)(
?
P
<
rev
>
[
\
w
\
.]
+
).
src
$
')
_go_re = re.compile(r'
/
golang
.
org
/
dl
/
(
?
P
<
name
>
go
)(
?
P
<
rev
>
[
\
w
\
.]
+
).
src
$
')
_osdn_f = re.compile(r'
/
osdn
.
net
/
frs
/
redir
.
php
\
?
f
=
(
?
P
<
f
>
.
+
)
$
')
_osdn_f = re.compile(r'
/
osdn
.
net
/
frs
/
redir
.
php
\
?
f
=
(
?
P
<
f
>
.
+
)
$
')
def namever(url): # -> (name, ver)
def namever(url): # -> (name, ver)
...
@@ -223,6 +237,10 @@ def _namever(url):
...
@@ -223,6 +237,10 @@ def _namever(url):
if m is not None:
if m is not None:
return m.group('
name
'), m.group('
rev
')
return m.group('
name
'), m.group('
rev
')
m = _git_re.search(url)
if m is not None:
return m.group('
name
'), None
m = _osdn_f.search(url)
m = _osdn_f.search(url)
if m is not None:
if m is not None:
url = unquote(m.group('f'))
url = unquote(m.group('f'))
...
...
nxdbom/nxdbom_test.py
View file @
43319739
...
@@ -34,6 +34,7 @@ from os.path import dirname
...
@@ -34,6 +34,7 @@ from os.path import dirname
(
'https://raw.githubusercontent.com/zuphilip/ocropy-models/master/en-default.pyrnn.gz'
,
'ocropy-models'
,
'master'
),
(
'https://raw.githubusercontent.com/zuphilip/ocropy-models/master/en-default.pyrnn.gz'
,
'ocropy-models'
,
'master'
),
(
'https://sourceforge.net/projects/swig/files/swig/swig-3.0.12/swig-3.0.12.tar.gz/download'
,
'swig'
,
'3.0.12'
),
(
'https://sourceforge.net/projects/swig/files/swig/swig-3.0.12/swig-3.0.12.tar.gz/download'
,
'swig'
,
'3.0.12'
),
(
'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://lab.nexedi.com/nexedi/wendelin.core.git'
,
'wendelin.core'
,
None
),
(
'/ROOT/develop-eggs/mysqlclient-1.3.12-py2.7-linux-x86_64.egg'
,
'mysqlclient'
,
'1.3.12'
),
(
'/ROOT/develop-eggs/mysqlclient-1.3.12-py2.7-linux-x86_64.egg'
,
'mysqlclient'
,
'1.3.12'
),
(
'https://osdn.net/frs/redir.php?f=ipafonts%2F57330%2FIPAexfont00201.zip'
,
'IPAexfont'
,
'00201'
),
(
'https://osdn.net/frs/redir.php?f=ipafonts%2F57330%2FIPAexfont00201.zip'
,
'IPAexfont'
,
'00201'
),
(
'https://osdn.net/frs/redir.php?f=ipafonts%2F51868%2FIPAfont00303.zip'
,
'IPAfont'
,
'00303'
),
(
'https://osdn.net/frs/redir.php?f=ipafonts%2F51868%2FIPAfont00303.zip'
,
'IPAfont'
,
'00303'
),
...
@@ -76,6 +77,15 @@ url = http://ftp.gnu.org/gnu/ncurses/ncurses-6.2.tar.gz
...
@@ -76,6 +77,15 @@ url = http://ftp.gnu.org/gnu/ncurses/ncurses-6.2.tar.gz
ncurses 6.2 http://ftp.gnu.org/gnu/ncurses/ncurses-6.2.tar.gz
ncurses 6.2 http://ftp.gnu.org/gnu/ncurses/ncurses-6.2.tar.gz
"""
)
"""
)
case1
(
"""
\
[neoppod-repository]
recipe = slapos.recipe.build:gitclone
repository = https://lab.nexedi.com/nexedi/neoppod.git
"""
,
"""
>>> gits:
neoppod HEAD https://lab.nexedi.com/nexedi/neoppod.git
"""
)
for
x
in
(
'gcc'
,
'python'
,
'ZODB'
,
'ZEO'
,
'tempstorage'
):
for
x
in
(
'gcc'
,
'python'
,
'ZODB'
,
'ZEO'
,
'tempstorage'
):
case1
(
"""
\
case1
(
"""
\
[%s]
[%s]
...
...
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