rbutil: Update tarball scripts

Change-Id: I33a42fc2535ddead1780bbceb2c4c048a3aba8de
This commit is contained in:
Solomon Peachy 2025-04-02 07:35:00 -04:00
parent 25c345feac
commit 87e9c3991a
2 changed files with 11 additions and 4 deletions

View file

@ -206,7 +206,7 @@ def scrape_files(repo, treehash, filelist, dest=None, timestamp_files=None):
def archive_files(repo, treehash, filelist, basename, tmpfolder=None, def archive_files(repo, treehash, filelist, basename, tmpfolder=None,
archive="tbz"): archive="txz"):
'''Archive list of files into tarball. '''Archive list of files into tarball.
@param repo Path to repository root. @param repo Path to repository root.
@param treehash Hash identifying the tree. @param treehash Hash identifying the tree.
@ -216,7 +216,7 @@ def archive_files(repo, treehash, filelist, basename, tmpfolder=None,
basename inside of the archive as well (i.e. no tarbomb). basename inside of the archive as well (i.e. no tarbomb).
@param tmpfolder Folder to put intermediate files in. If no folder is given @param tmpfolder Folder to put intermediate files in. If no folder is given
a temporary one will get used. a temporary one will get used.
@param archive Type of archive to create. Supported values are "tbz" and @param archive Type of archive to create. Supported values are "txz", "tbz", and
"7z". The latter requires the 7z binary available in the "7z". The latter requires the 7z binary available in the
system's path. system's path.
@return Output filename. @return Output filename.
@ -243,6 +243,11 @@ def archive_files(repo, treehash, filelist, basename, tmpfolder=None,
tf = tarfile.open(outfile, "w:bz2") tf = tarfile.open(outfile, "w:bz2")
tf.add(workfolder, basename) tf.add(workfolder, basename)
tf.close() tf.close()
elif archive == "txz":
outfile = basename + ".tar.xz"
tf = tarfile.open(outfile, "w:xz")
tf.add(workfolder, basename)
tf.close()
else: else:
print("Files not archived") print("Files not archived")
if tmpfolder != workfolder: if tmpfolder != workfolder:

View file

@ -58,7 +58,9 @@ filelist = ["utils/rbutilqt",
"utils/imxtools", "utils/imxtools",
"utils/nwztools", "utils/nwztools",
"utils/tomcrypt", "utils/tomcrypt",
"utils/themeeditor",
"lib/rbcodec/codecs/libspeex", "lib/rbcodec/codecs/libspeex",
"lib/skin_parser",
"docs/COPYING", "docs/COPYING",
"docs/gpl-2.0.html", "docs/gpl-2.0.html",
"docs/logo/rockbox-clef.svg", "docs/logo/rockbox-clef.svg",
@ -80,6 +82,6 @@ filelist = ["utils/rbutilqt",
"tools/sapi_voice.vbs"] "tools/sapi_voice.vbs"]
print(f"Getting git revision {tree}") print(f"Getting git revision {tree}")
gitscraper.archive_files(repository, tree, filelist, basename, archive="tbz") gitscraper.archive_files(repository, tree, filelist, basename, archive="txz")
print(f"Created {basename}.tar.bz2.") print(f"Created {basename}.tar.xz.")