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
5
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
088bf347
Commit
088bf347
authored
4 years ago
by
Tim Jaacks
Browse files
Options
Downloads
Patches
Plain Diff
Add package_release.py
parent
fc7e8f72
No related branches found
No related tags found
1 merge request
!31
Add package_release.py
Pipeline
#8156
passed with stage
in 24 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
package_release.py
+57
-0
57 additions, 0 deletions
package_release.py
with
57 additions
and
0 deletions
package_release.py
0 → 100755
+
57
−
0
View file @
088bf347
#!/usr/bin/env python3
import
argparse
import
glob
import
json
import
os
import
sys
def
main
():
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"
--images-dir
"
,
help
=
"""
Yocto images directory
"""
,
dest
=
"
images_dir
"
,
required
=
True
,
)
parser
.
add_argument
(
"
--release-dir
"
,
help
=
"""
release directory
"""
,
dest
=
"
release_dir
"
,
required
=
True
,
)
args
,
_
=
parser
.
parse_known_args
()
# Get bitbake variables from testdata.json file
testdata_files
=
glob
.
glob
(
args
.
images_dir
+
"
/*.testdata.json
"
)
if
not
testdata_files
:
sys
.
exit
(
"
ERROR: no *.testdata.json file found in images directory
"
)
with
open
(
testdata_files
[
0
],
"
r
"
)
as
f
:
buildvars
=
json
.
load
(
f
)
machine
=
buildvars
[
"
MACHINE
"
]
version
=
buildvars
[
"
DISTRO_VERSION
"
]
fstypes
=
buildvars
[
"
IMAGE_FSTYPES
"
].
split
()
image
=
buildvars
[
"
IMAGE_NAME
"
]
+
buildvars
[
"
IMAGE_NAME_SUFFIX
"
]
# Set directories (use relative path)
release_name
=
"
GUF-Yocto-%s
"
%
version
output_dir
=
"
%s/%s/prebuilt_images
"
%
(
args
.
release_dir
,
release_name
)
images_dir
=
os
.
path
.
relpath
(
args
.
images_dir
,
output_dir
)
# Create output directory
os
.
makedirs
(
output_dir
,
exist_ok
=
True
)
# Create symlinks for all rootfs images
for
fstype
in
fstypes
:
filename
=
"
%s.%s
"
%
(
image
,
fstype
)
source_file
=
"
%s/%s
"
%
(
images_dir
,
filename
)
target_file
=
"
%s/%s-%s-root.%s
"
%
(
output_dir
,
release_name
,
machine
,
fstype
)
print
(
"
%s -> %s
"
%
(
target_file
,
source_file
))
os
.
symlink
(
source_file
,
target_file
)
if
__name__
==
"
__main__
"
:
main
()
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