Commit 168d7921 authored by Nico's avatar Nico
Browse files

fix symlinks in zip archives not being extracted correctly

parent ee937b7a
...@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment