Commit 9bfc1be0 authored by Robin Sonnabend's avatar Robin Sonnabend

Upload built packages as artifacts

parent 5a65b174
Pipeline #494 failed with stage
in 4 minutes and 56 seconds
...@@ -18,3 +18,7 @@ stages: ...@@ -18,3 +18,7 @@ stages:
test: test:
stage: test stage: test
script: scripts/build.py script: scripts/build.py
artifacts:
paths:
- packages
expire_in: 1 day
...@@ -6,6 +6,7 @@ locale.setlocale(locale.LC_ALL, "en_US.UTF-8") ...@@ -6,6 +6,7 @@ locale.setlocale(locale.LC_ALL, "en_US.UTF-8")
import os import os
import subprocess as sp import subprocess as sp
import re import re
import shutil
import tempfile import tempfile
import yaml import yaml
...@@ -34,7 +35,8 @@ def run_checked(command, **kwargs): ...@@ -34,7 +35,8 @@ def run_checked(command, **kwargs):
raise raise
def build_package(repo_dir, name, patch_dir=None, version=None, changelog=None): def build_package(repo_dir, package_dir, name,
patch_dir=None, version=None, changelog=None):
with tempfile.TemporaryDirectory(dir=os.path.abspath(".")) as tempdir: with tempfile.TemporaryDirectory(dir=os.path.abspath(".")) as tempdir:
os.chdir(tempdir) os.chdir(tempdir)
result = run_checked(["apt-get", "source", name]) result = run_checked(["apt-get", "source", name])
...@@ -82,9 +84,10 @@ def build_package(repo_dir, name, patch_dir=None, version=None, changelog=None): ...@@ -82,9 +84,10 @@ def build_package(repo_dir, name, patch_dir=None, version=None, changelog=None):
for filename in os.listdir(tempdir) for filename in os.listdir(tempdir)
if filename.endswith(".deb") if filename.endswith(".deb")
] ]
print(deb_packages) for filename in os.listdir(tempdir):
if not filename.endswith(".deb"):
#input("Waiting for you, do your thing…") continue
shutil.move(os.path.join(tempdir, filename), package_dir)
def main(): def main():
...@@ -99,8 +102,11 @@ def main(): ...@@ -99,8 +102,11 @@ def main():
if mail: if mail:
os.environ["DEBEMAIL"] = mail os.environ["DEBEMAIL"] = mail
package_dir = "packages"
os.makedirs(package_dir, exist_ok=True)
for package in config["packages"]: for package in config["packages"]:
build_package(repo_dir=repo_dir, **package) build_package(repo_dir=repo_dir, package_dir=package_dir, **package)
os.chdir(repo_dir) os.chdir(repo_dir)
......
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