From fa1e6cc5bfcf07140808891cf8e49f6dcdcb4b63 Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Sat, 19 Feb 2022 18:31:25 +0100 Subject: rbutil: Replace deploy with tarball script. The old deployment script doesn't work anymore due to the change to cmake, and since we build the distribution packages (zip / dmg / AppImage) with cmake directly there's not much need left for the old deployment. Change-Id: Ide20887c5bc2e22aabbfb47374d70529609fbc3c --- utils/common/deploy-rbutil.py | 88 ------------------------------------------ utils/common/gitscraper.py | 17 ++++++++ utils/common/tarball-rbutil.py | 85 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 102 insertions(+), 88 deletions(-) delete mode 100755 utils/common/deploy-rbutil.py create mode 100755 utils/common/tarball-rbutil.py diff --git a/utils/common/deploy-rbutil.py b/utils/common/deploy-rbutil.py deleted file mode 100755 index 0c98575843..0000000000 --- a/utils/common/deploy-rbutil.py +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/python -# __________ __ ___. -# Open \______ \ ____ ____ | | _\_ |__ _______ ___ -# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / -# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < -# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ -# \/ \/ \/ \/ \/ -# $Id$ -# -# Copyright (c) 2010 Dominik Riebeling -# -# All files in this archive are subject to the GNU General Public License. -# See the file COPYING in the source tree root for full license agreement. -# -# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY -# KIND, either express or implied. -# - -import deploy - -deploy.program = "RockboxUtility" -deploy.project = "rbutil/rbutilqt/rbutilqt.pro" -deploy.svnserver = "svn://svn.rockbox.org/rockbox/" -deploy.svnpaths = \ - ["rbutil/", - "tools/ucl", - "tools/rbspeex", - "utils/imxtools", - "utils/nwztools", - "utils/tomcrypt", - "lib/rbcodec/codecs/libspeex", - "docs/COPYING", - "docs/gpl-2.0.html", - "docs/logo/rockbox-clef.svg", - "docs/logo/rockbox-logo.svg", - "docs/CREDITS", - "tools/iriver.c", - "tools/Makefile", - "tools/mkboot.h", - "tools/voicefont.c", - "tools/VOICE_PAUSE.wav", - "tools/voice-corrections.txt", - "tools/wavtrim.h", - "tools/iriver.h", - "tools/mkboot.c", - "tools/telechips.c", - "tools/telechips.h", - "tools/voicefont.h", - "tools/wavtrim.c", - "tools/sapi_voice.vbs"] -deploy.useupx = False -deploy.bundlecopy = { - "icons/rbutilqt.icns" : "Contents/Resources/", - "Info.plist" : "Contents/" -} -deploy.progexe = { - "win32" : "release/RockboxUtility.exe", - "darwin" : "RockboxUtility.app", - "linux2" : "RockboxUtility", - "linux" : "RockboxUtility" -} -deploy.regreplace = { - "rbutil/rbutilqt/version.h" : [["\$Rev\$", "%REVISION%"], - ["(^#define BUILDID).*", "\\1 \"%BUILDID%\""]], - "rbutil/rbutilqt/Info.plist" : [["\$Rev\$", "%REVISION%"]], -} -# OS X 10.6 defaults to gcc 4.2. Building universal binaries that are -# compatible with 10.4 requires using gcc-4.0. -deploy.qmakespec = { - "win32" : "", - "darwin" : "macx-g++40", - "linux2" : "", - "linux" : "" -} -deploy.make = { - "win32" : "mingw32-make", - "darwin" : "make", - "linux2" : "make", - "linux" : "make" -} - -# all files of the program. Will get put into an archive after building -# (zip on w32, tar.bz2 on Linux). Does not apply on Mac which uses dmg. -# progexe will get added automatically. -deploy.programfiles = list() -deploy.nsisscript = "" - -deploy.deploy() diff --git a/utils/common/gitscraper.py b/utils/common/gitscraper.py index 5b3b316115..8d162155d9 100755 --- a/utils/common/gitscraper.py +++ b/utils/common/gitscraper.py @@ -142,6 +142,23 @@ def get_object(repo, blob, destfile): return True +def parse_rev(repo, hash): + '''Retrieve output of git rev-parse for a given hash. + @param repo Path to repository root. + @param hash Hash identifying the tree / commit to describe. + @return Description string. + ''' + output = subprocess.Popen( + ["git", "rev-parse", "--verify", "--short=10", hash], + stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=repo) + cmdout = output.communicate() + if len(cmdout[1]) > 0: + print("An error occured!\n") + print(cmdout[1]) + return "" + return cmdout[0].decode().rstrip() + + def describe_treehash(repo, treehash): '''Retrieve output of git-describe for a given hash. @param repo Path to repository root. diff --git a/utils/common/tarball-rbutil.py b/utils/common/tarball-rbutil.py new file mode 100755 index 0000000000..ccc413ca59 --- /dev/null +++ b/utils/common/tarball-rbutil.py @@ -0,0 +1,85 @@ +#!/usr/bin/python3 +# __________ __ ___. +# Open \______ \ ____ ____ | | _\_ |__ _______ ___ +# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / +# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < +# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ +# \/ \/ \/ \/ \/ +# +# Copyright (c) 2022 Dominik Riebeling +# +# All files in this archive are subject to the GNU General Public License. +# See the file COPYING in the source tree root for full license agreement. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# + +import os +import sys +import gitscraper + +if len(sys.argv) < 2: + print("Usage: %s " % sys.argv[0]) + sys.exit() + +repository = os.path.abspath( + os.path.join(os.path.dirname(os.path.abspath(__file__)), "../..")) + +if '.' in sys.argv[1]: + version = sys.argv[1] + basename = f"RockboxUtility-v{version}-src" + ref = f"refs/tags/rbutil_{version}" + refs = gitscraper.get_refs(repository) + if ref in refs: + tree = refs[ref] + else: + print("Could not find hash for version!") + sys.exit() +else: + tree = gitscraper.parse_rev(repository, sys.argv[1]) + basename = f"RockboxUtility-{tree}" + +filelist = ["utils/rbutilqt", + "utils/ipodpatcher", + "utils/sansapatcher", + "utils/mkamsboot", + "utils/chinachippatcher", + "utils/mks5lboot", + "utils/mkmpioboot", + "utils/mkimxboot", + "utils/mktccboot", + "utils/bspatch", + "utils/bzip2", + "utils/cmake", + "utils/CMakeLists.txt", + "tools/ucl", + "tools/rbspeex", + "utils/imxtools", + "utils/nwztools", + "utils/tomcrypt", + "lib/rbcodec/codecs/libspeex", + "docs/COPYING", + "docs/gpl-2.0.html", + "docs/logo/rockbox-clef.svg", + "docs/logo/rockbox-logo.svg", + "docs/CREDITS", + "tools/iriver.c", + "tools/Makefile", + "tools/mkboot.h", + "tools/voicefont.c", + "tools/VOICE_PAUSE.wav", + "tools/voice-corrections.txt", + "tools/wavtrim.h", + "tools/iriver.h", + "tools/mkboot.c", + "tools/telechips.c", + "tools/telechips.h", + "tools/voicefont.h", + "tools/wavtrim.c", + "tools/sapi_voice.vbs"] + +print(f"Getting git revision {tree}") +gitscraper.archive_files(repository, tree, filelist, basename, archive="tbz") + +print(f"Created {basename}.tar.bz2.") -- cgit v1.2.3