serve-mar command added

This commit is contained in:
Bert van der Weerd 2022-04-27 14:33:54 +02:00
parent 44773d461d
commit c5364490f2
No known key found for this signature in database
GPG key ID: 4CFABB96ADE0F5B1
2 changed files with 41 additions and 5 deletions

View file

@ -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)

34
mk.py
View file

@ -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()
@ -28,10 +31,36 @@ def full_mar():
channel = 'default'
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))
# 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 = '''<?xml version="1.0" encoding="UTF-8"?>
<updates>
<update type="minor" displayVersion="{}" appVersion="{}" platformVersion="{}" buildID="{}">
<patch type="complete" URL="{}/{}" hashFunction="sha512" hashValue="{}" size="{}"/>
</update>
</updates>
'''.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: