This commit is contained in:
Bert van der Weerd 2022-01-10 13:33:59 +01:00
parent 4f8e6031b0
commit c36d0f808c
No known key found for this signature in database
GPG key ID: 4CFABB96ADE0F5B1
2 changed files with 24 additions and 26 deletions

View file

@ -19,9 +19,11 @@ help :
all : fetch build artifacts all : fetch build artifacts
clean : clean :
rm -rf librewolf-$(shell cat version) rm -rf work
rm -f librewolf-$(shell cat version).*.en-US.win64* md5sums.txt upload.txt
veryclean : veryclean :
rm -rf librewolf-$(shell cat version)
rm -f source_release librewolf-$(shell cat version)-*.source.tar.gz rm -f source_release librewolf-$(shell cat version)-*.source.tar.gz
fetch : fetch :

34
mk.py
View file

@ -3,8 +3,9 @@
import os,sys,subprocess import os,sys,subprocess
# native()/bash()/exec() utility functions # native()/bash()/exec() utility functions
def native(cmd): def native(cmd,do_print=True):
sys.stdout.flush() sys.stdout.flush()
if do_print:
print(cmd) print(cmd)
sys.stdout.flush() sys.stdout.flush()
@ -12,26 +13,23 @@ def native(cmd):
if retval != 0: if retval != 0:
sys.exit(retval) sys.exit(retval)
_no_exit = False def bash(cmd,do_print=True):
def bash(cmd):
tmp = [] tmp = []
tmp += ['c:/mozilla-build/msys/bin/bash.exe', '-c', cmd] tmp += ['c:/mozilla-build/msys/bin/bash.exe', '-c', cmd]
sys.stdout.flush() sys.stdout.flush()
if do_print:
print(cmd) print(cmd)
sys.stdout.flush() sys.stdout.flush()
retval = subprocess.run(tmp).returncode retval = subprocess.run(tmp).returncode
if _no_exit:
return
if retval != 0: if retval != 0:
sys.exit(retval) sys.exit(retval)
_native = False _native = False # set to True if you don't want the win-specific bash.exe
_no_exit = False def exec(cmd,do_print=True):
def exec(cmd):
if _native: if _native:
return native(cmd) return native(cmd,do_print)
return bash(cmd) return bash(cmd,do_print)
def patch(patchfile): def patch(patchfile):
cmd = "patch -p1 -i {}".format(patchfile) cmd = "patch -p1 -i {}".format(patchfile)
@ -54,16 +52,14 @@ def patch(patchfile):
def fetch(): def fetch():
print('mk.py: fetch(): Disabled due to "artifacts" now has priority.')
sys.exit(1)
exec('wget -q -O version https://gitlab.com/librewolf-community/browser/source/-/raw/main/version') exec('wget -q -O version https://gitlab.com/librewolf-community/browser/source/-/raw/main/version')
exec('wget -q -O source_release https://gitlab.com/librewolf-community/browser/source/-/raw/main/release') exec('wget -q -O source_release https://gitlab.com/librewolf-community/browser/source/-/raw/main/release')
exec('wget -O librewolf-$(cat version)-$(cat source_release).source.tar.gz https://gitlab.com/librewolf-community/browser/source/-/jobs/artifacts/main/raw/librewolf-$(cat version)-$(cat source_release).source.tar.gz?job=build-job') exec('wget -O librewolf-$(cat version)-$(cat source_release).source.tar.gz https://gitlab.com/librewolf-community/browser/source/-/jobs/artifacts/main/raw/librewolf-$(cat version)-$(cat source_release).source.tar.gz?job=build-job')
def build(): def build():
print('mk.py: build(): Disabled due to "artifacts" now has priority.')
sys.exit(1)
exec('rm -rf librewolf-$(cat version)') exec('rm -rf librewolf-$(cat version)')
exec('tar xf librewolf-$(cat version)-$(cat source_release).source.tar.gz') exec('tar xf librewolf-$(cat version)-$(cat source_release).source.tar.gz')
@ -76,11 +72,9 @@ def build():
exec('cp -v ../assets/mozconfig.windows mozconfig') exec('cp -v ../assets/mozconfig.windows mozconfig')
patch('../assets/package-manifest.patch') patch('../assets/package-manifest.patch')
# perform the build and package
exec('MACH_USE_SYSTEM_PYTHON=1 ./mach build') exec('MACH_USE_SYSTEM_PYTHON=1 ./mach build')
_no_exit = True
exec('MACH_USE_SYSTEM_PYTHON=1 ./mach package') exec('MACH_USE_SYSTEM_PYTHON=1 ./mach package')
_no_exit = False
exec('cp -v obj-x86_64-pc-mingw32/dist/firefox-{}.en-US.win64.zip ..'.format(version))
os.chdir('..') os.chdir('..')
@ -131,12 +125,13 @@ def artifacts():
# utility function
def do_upload(filename,token): def do_upload(filename,token):
exec('echo _ >> upload.txt') exec('echo _ >> upload.txt')
exec('curl --request POST --header \"PRIVATE-TOKEN: {}\" --form \"file=@{}\" \"https://gitlab.com/api/v4/projects/13852981/uploads\" >> upload.txt'.format(token,filename)) exec('curl --request POST --header \"PRIVATE-TOKEN: {}\" --form \"file=@{}\" \"https://gitlab.com/api/v4/projects/13852981/uploads\" >> upload.txt'.format(token,filename),False)
exec('echo _ >> upload.txt') exec('echo _ >> upload.txt')
def upload(token): def upload(token):
with open('version','r') as file1: with open('version','r') as file1:
@ -154,6 +149,7 @@ def upload(token):
do_upload(zip_filename,token) do_upload(zip_filename,token)
do_upload('md5sums.txt',token) do_upload('md5sums.txt',token)
# #
# parse commandline for commands # parse commandline for commands
# #