Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
gitlab-ci
Manage
Activity
Members
Labels
Plan
Jira
Code
Merge requests
3
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SECO Northern Europe
Yocto
infrastructure
gitlab-ci
Commits
7ab6b720
Commit
7ab6b720
authored
3 years ago
by
Tobias Kahlki
Browse files
Options
Downloads
Patches
Plain Diff
metadata: Added generation of metainfo to package_release
BCS DevOps-000032
parent
77ada04c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!77
metadata: Added generation of metainfo to package_release
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
package_release.py
+55
-0
55 additions, 0 deletions
package_release.py
with
55 additions
and
0 deletions
package_release.py
+
55
−
0
View file @
7ab6b720
...
@@ -72,6 +72,51 @@ def copy_files(files, input_dir, subdir, output_dir, outlocal_dir):
...
@@ -72,6 +72,51 @@ def copy_files(files, input_dir, subdir, output_dir, outlocal_dir):
return
md5sums
return
md5sums
def
generate_metadata
(
machine
,
version
,
artifacts_image
,
sdk
,
output_dir
,
outlocal_dir
,
):
"""
Generates a metainfo.json for the release
"""
# Join filepath for metadata
if
output_dir
is
not
None
:
filepath
=
os
.
path
.
join
(
output_dir
,
machine
,
"
metainfo.json
"
)
elif
outlocal_dir
is
not
None
:
filepath
=
os
.
path
.
join
(
outlocal_dir
,
machine
,
"
metainfo.json
"
)
else
:
print
(
"
Error: Filepath is empty
"
)
return
-
1
# Collect metadata and write to metainfo.json
for
artifact
in
artifacts_image
:
if
artifact
.
endswith
(
machine
+
"
.tar.gz
"
):
image_general
=
artifact
elif
artifact
.
endswith
(
machine
+
"
.wic
"
):
image_wic
=
artifact
metadata
=
dict
()
metadata
[
"
images
"
]
=
dict
()
metadata
[
"
version
"
]
=
version
metadata
[
"
machine
"
]
=
machine
metadata
[
"
sdk
"
]
=
sdk
if
image_general
is
not
None
:
metadata
[
"
images
"
][
"
general
"
]
=
image_general
if
image_wic
is
not
None
:
metadata
[
"
images
"
][
"
wic
"
]
=
image_wic
with
open
(
filepath
,
"
w
"
,
encoding
=
"
utf-8
"
)
as
file
:
file
.
write
(
json
.
dumps
(
metadata
))
def
main
():
def
main
():
parser
=
argparse
.
ArgumentParser
()
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
parser
.
add_argument
(
...
@@ -188,6 +233,16 @@ def main():
...
@@ -188,6 +233,16 @@ def main():
md5sums
,
md5sums
,
)
)
# Generate metadata
generate_metadata
(
machine
,
version
,
artifacts_image
,
sdkname
,
output_dir
,
outlocal_dir
,
)
# Handle SDK if available
# Handle SDK if available
if
args
.
sdk_dir
is
not
None
:
if
args
.
sdk_dir
is
not
None
:
sdkfiles
=
glob
.
glob
(
os
.
path
.
join
(
args
.
sdk_dir
,
sdkname
+
"
*
"
))
sdkfiles
=
glob
.
glob
(
os
.
path
.
join
(
args
.
sdk_dir
,
sdkname
+
"
*
"
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment