From 5fd44e22af0d80ad19f69dba65ba304e63e4a0f5 Mon Sep 17 00:00:00 2001 From: Bert van der Weerd Date: Sat, 18 Feb 2023 22:00:00 +0100 Subject: [PATCH] now using ohfp package method with curl --- winbuild/mk.py | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/winbuild/mk.py b/winbuild/mk.py index b99710d..75c5a90 100644 --- a/winbuild/mk.py +++ b/winbuild/mk.py @@ -213,13 +213,28 @@ def artifacts(): # Utility function to upload() function. -def do_upload(filename,token): +def do_upload1(filename,token): exec('curl --request POST --header \"PRIVATE-TOKEN: {}\" --form \"file=@{}\" \"https://gitlab.com/api/v4/projects/13852981/uploads\" > tmp.json'.format(token,filename), False) exec('echo $(cat tmp.json | jq .alt | cut -c 2- | sed \'s/.$//\') \'--->\' https://gitlab.com$(cat tmp.json | jq .full_path | cut -c 2- | sed \'s/.$//\') ') exec('cat tmp.json') exec('echo "" && rm -f tmp.json') +# Utility function to upload() function. +# +#curl --request PUT \ +# --upload-file whatever.tar.bz2 \ +# --header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" \ +# https://gitlab.com/api/v4/projects/${PROJECT_ID}/packages/generic/librewolf/latest/whatever.tar.bz2 +# +def do_upload2(filename,token): + project_id='13852981' + exec('curl --request PUT --upload-file "{}" --header "PRIVATE-TOKEN: {}" "https://gitlab.com/api/v4/projects/{}/packages/generic/librewolf/latest/{}" > tmp.json'.format(filename, token, project_id, filename), False) + exec('echo $(cat tmp.json | jq .alt | cut -c 2- | sed \'s/.$//\') \'--->\' https://gitlab.com$(cat tmp.json | jq .full_path | cut -c 2- | sed \'s/.$//\') ') + exec('cat tmp.json') + exec('echo "" && rm -f tmp.json') + + def upload(token): with open('version','r') as file1: @@ -246,18 +261,23 @@ def upload(token): else: exec('sha256sum {} {} > sha256sums.txt'.format(setup_filename,pazip_filename)) + # # create signatures + # + exec('gpg --yes --detach-sign {}'.format(setup_filename)) exec('echo "Press Control-D to continue (is this still needed?)..." ; cat > /dev/null') exec('gpg --yes --detach-sign {}'.format(pazip_filename)) + # # upload everything - exec('rm -f upload.txt') - do_upload(setup_filename,token) - do_upload(pazip_filename,token) - do_upload('{}.sig'.format(setup_filename),token) - do_upload('{}.sig'.format(pazip_filename),token) - do_upload('sha256sums.txt',token) + # + + do_upload1('{}.sig'.format(setup_filename),token) + do_upload1('{}.sig'.format(pazip_filename),token) + do_upload1('sha256sums.txt',token) + do_upload2(setup_filename,token) + do_upload2(pazip_filename,token) #