diff --git a/Makefile b/Makefile index ebf187a..071c61e 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY : help all clean veryclean fetch build artifacts update full-mar +.PHONY : help all clean veryclean fetch build artifacts update full-mar serve-mar help : @echo "Use: make [all] [clean] [veryclean] [check] ..." @@ -7,7 +7,8 @@ help : @echo " clean - Remove output files and temporary files." @echo " veryclean - Like 'clean', but also remove all downloaded files." @echo " update - update 'version' and 'source_release' files." - @echo " full-mar - create mar setup file." + @echo " full-mar - create mar setup file, and update.xml." + @echo " serve-mar - serve the update files" @echo "" @echo " fetch - Fetch the latest librewolf source." @echo " build - Perform './mach build && ./mach package' on it." @@ -51,3 +52,6 @@ artifacts : full-mar : python3 mk.py full-mar + +serve-mar : + (cd librewolf-$(shell cat version)-$(shell cat source_release)/MAR && python3 -m http.server 8000) diff --git a/mk.py b/mk.py index cc1a0cd..25434e8 100644 --- a/mk.py +++ b/mk.py @@ -13,6 +13,9 @@ from assets.tools import exec, patch def deps_win32(): exec('rustup target add i686-pc-windows-msvc') +def serve_mar(): + pass + def full_mar(): with open('version','r') as file: version = file.read().rstrip() @@ -27,12 +30,38 @@ def full_mar(): # version already set channel = 'default' - exec('mkdir -p MAR') # output folder - + exec('mkdir -p MAR') # output folder exec('touch {}/dist/firefox/precomplete'.format(objdir)) exec('MAR={}/dist/host/bin/mar.exe MOZ_PRODUCT_VERSION={}-{} MAR_CHANNEL_ID={} ./tools/update-packaging/make_full_update.sh {} {}/dist/firefox'.format(objdir,version,source_release,channel,mar_output_path,objdir)) - # restore state + # create config.xml + mar_name = 'output.mar' + + # sha512sum + hash_sha512 = '' + exec("cat MAR/{} | sha512sum | awk '{}' > tmpfile78419".format(mar_name,'{print $1}')) + with open('tmpfile78419', 'r') as tmpfile: + data = tmpfile.read().rstrip() + hash_sha512 = data + exec('rm -f tmpfile78419') + + # size in bytes + size = os.path.getsize('MAR/{}'.format(mar_name)) + mar_version = '2000.0a1' + build_id = '21181002100236' + update_url = 'http://127.0.0.1:8000' # no trailing slash + config_xml = ''' + + + + + +'''.format(mar_version,mar_version,mar_version,build_id,update_url,mar_name,hash_sha512,size) + textfile = open('MAR/update.xml','w') + textfile.write(config_xml) + textfile.close() + +# restore state os.chdir('..') pass @@ -240,6 +269,9 @@ for arg in sys.argv: elif arg == 'full-mar': full_mar() done_something = True + elif arg == 'serve-mar': + serve_mar() + done_something = True elif arg == 'upload': in_upload = True else: