sources/curl: remove export functionality

Since the `sources.SourcesServer` has been removed, nothing is
using the export functionality anymore. Inputs are now used to
make content in the store available to stages. Remove all the
export logic from org.osbuild.curl.
This commit is contained in:
Christian Kellner 2021-04-28 10:28:49 +00:00
parent aa19a1c4c0
commit 5c19360cbe

View file

@ -24,6 +24,8 @@ import sys
import tempfile
import time
from typing import Dict
SCHEMA = """
"additionalProperties": false,
@ -214,57 +216,23 @@ def download(checksums, urls, cache):
return 0
def export(checksums, cache, output):
for checksum in checksums:
try:
subprocess.run(
[
"cp",
"--reflink=auto",
f"{cache}/{checksum}",
f"{output}/{checksum}",
],
check=True,
)
except subprocess.CalledProcessError as e:
json.dump({"error": e.output}, sys.stdout)
return 1
def main(urls: Dict, cache: str):
cache = os.path.join(cache, "org.osbuild.files")
if not urls:
json.dump({}, sys.stdout)
return 0
os.makedirs(cache, exist_ok=True)
res = download(urls.keys(), urls, cache)
if res != 0:
return res
json.dump({}, sys.stdout)
return 0
def main(urls, options, checksums, cache, output):
cache = os.path.join(cache, "org.osbuild.files")
download_only = not output
if not urls:
urls = options.get("urls", [])
if urls:
if not checksums and download_only:
checksums = [k for k, _ in urls.items()]
os.makedirs(cache, exist_ok=True)
res = download(checksums, urls, cache)
if res != 0:
return res
if download_only:
json.dump({}, sys.stdout)
return 0
os.makedirs(output, exist_ok=True)
res = export(checksums, cache, output)
return res
if __name__ == '__main__':
args = json.load(sys.stdin)
r = main(args["items"],
args["options"],
args["checksums"],
args["cache"],
args.get("output"))
r = main(args["items"], args["cache"])
sys.exit(r)