Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFS Firmware Downloader
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
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
firmware
FFS Firmware Downloader
Commits
168d7921
Commit
168d7921
authored
4 years ago
by
Nico
Browse files
Options
Downloads
Patches
Plain Diff
fix symlinks in zip archives not being extracted correctly
parent
ee937b7a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
download-latest-firmware-build.py
+4
-1
4 additions, 1 deletion
download-latest-firmware-build.py
with
4 additions
and
1 deletion
download-latest-firmware-build.py
+
4
−
1
View file @
168d7921
...
@@ -10,6 +10,7 @@ import os.path
...
@@ -10,6 +10,7 @@ import os.path
import
re
import
re
import
tempfile
import
tempfile
import
sys
import
sys
import
subprocess
GITLAB_API_BASE
=
"
https://gitlab.freifunk-stuttgart.de/api/v4
"
GITLAB_API_BASE
=
"
https://gitlab.freifunk-stuttgart.de/api/v4
"
PROJECT_ID
=
1
PROJECT_ID
=
1
...
@@ -34,7 +35,9 @@ def extract_zip(artifact_zipfile):
...
@@ -34,7 +35,9 @@ def extract_zip(artifact_zipfile):
with
zipfile
.
ZipFile
(
artifact_zipfile
)
as
artifact_zip
:
with
zipfile
.
ZipFile
(
artifact_zipfile
)
as
artifact_zip
:
version
=
find_version_from_archive
(
artifact_zip
.
infolist
())
version
=
find_version_from_archive
(
artifact_zip
.
infolist
())
with
tempfile
.
TemporaryDirectory
(
dir
=
os
.
getcwd
())
as
tempdir
:
with
tempfile
.
TemporaryDirectory
(
dir
=
os
.
getcwd
())
as
tempdir
:
artifact_zip
.
extractall
(
tempdir
)
# Python ZipFile doesn't support symlinks
# https://bugs.python.org/issue27318
subprocess
.
check_call
([
'
unzip
'
,
artifact_zipfile
.
name
,
'
-d{}
'
.
format
(
tempdir
)],
stdin
=
artifact_zipfile
)
outputdir
=
os
.
path
.
join
(
tempdir
,
"
gluon
"
,
"
output
"
)
outputdir
=
os
.
path
.
join
(
tempdir
,
"
gluon
"
,
"
output
"
)
os
.
rename
(
outputdir
,
version
)
os
.
rename
(
outputdir
,
version
)
return
version
return
version
...
...
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