diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2022-02-19 18:31:25 +0100 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2022-02-28 20:37:23 +0100 |
commit | fa1e6cc5bfcf07140808891cf8e49f6dcdcb4b63 (patch) | |
tree | 446e66b7e649ea60db08f79ec6325454b4776c52 | |
parent | 045f52d475f57053329b90e97dba7deb1676b5ec (diff) | |
download | rockbox-fa1e6cc5bfcf07140808891cf8e49f6dcdcb4b63.tar.gz rockbox-fa1e6cc5bfcf07140808891cf8e49f6dcdcb4b63.zip |
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
-rwxr-xr-x | utils/common/gitscraper.py | 17 | ||||
-rwxr-xr-x | utils/common/tarball-rbutil.py (renamed from utils/common/deploy-rbutil.py) | 87 |
2 files changed, 59 insertions, 45 deletions
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): | |||
142 | return True | 142 | return True |
143 | 143 | ||
144 | 144 | ||
145 | def parse_rev(repo, hash): | ||
146 | '''Retrieve output of git rev-parse for a given hash. | ||
147 | @param repo Path to repository root. | ||
148 | @param hash Hash identifying the tree / commit to describe. | ||
149 | @return Description string. | ||
150 | ''' | ||
151 | output = subprocess.Popen( | ||
152 | ["git", "rev-parse", "--verify", "--short=10", hash], | ||
153 | stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=repo) | ||
154 | cmdout = output.communicate() | ||
155 | if len(cmdout[1]) > 0: | ||
156 | print("An error occured!\n") | ||
157 | print(cmdout[1]) | ||
158 | return "" | ||
159 | return cmdout[0].decode().rstrip() | ||
160 | |||
161 | |||
145 | def describe_treehash(repo, treehash): | 162 | def describe_treehash(repo, treehash): |
146 | '''Retrieve output of git-describe for a given hash. | 163 | '''Retrieve output of git-describe for a given hash. |
147 | @param repo Path to repository root. | 164 | @param repo Path to repository root. |
diff --git a/utils/common/deploy-rbutil.py b/utils/common/tarball-rbutil.py index 0c98575843..ccc413ca59 100755 --- a/utils/common/deploy-rbutil.py +++ b/utils/common/tarball-rbutil.py | |||
@@ -1,13 +1,12 @@ | |||
1 | #!/usr/bin/python | 1 | #!/usr/bin/python3 |
2 | # __________ __ ___. | 2 | # __________ __ ___. |
3 | # Open \______ \ ____ ____ | | _\_ |__ _______ ___ | 3 | # Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
4 | # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | 4 | # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
5 | # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | 5 | # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
6 | # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | 6 | # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
7 | # \/ \/ \/ \/ \/ | 7 | # \/ \/ \/ \/ \/ |
8 | # $Id$ | ||
9 | # | 8 | # |
10 | # Copyright (c) 2010 Dominik Riebeling | 9 | # Copyright (c) 2022 Dominik Riebeling |
11 | # | 10 | # |
12 | # All files in this archive are subject to the GNU General Public License. | 11 | # All files in this archive are subject to the GNU General Public License. |
13 | # See the file COPYING in the source tree root for full license agreement. | 12 | # See the file COPYING in the source tree root for full license agreement. |
@@ -16,13 +15,44 @@ | |||
16 | # KIND, either express or implied. | 15 | # KIND, either express or implied. |
17 | # | 16 | # |
18 | 17 | ||
19 | import deploy | 18 | import os |
19 | import sys | ||
20 | import gitscraper | ||
20 | 21 | ||
21 | deploy.program = "RockboxUtility" | 22 | if len(sys.argv) < 2: |
22 | deploy.project = "rbutil/rbutilqt/rbutilqt.pro" | 23 | print("Usage: %s <version|hash>" % sys.argv[0]) |
23 | deploy.svnserver = "svn://svn.rockbox.org/rockbox/" | 24 | sys.exit() |
24 | deploy.svnpaths = \ | 25 | |
25 | ["rbutil/", | 26 | repository = os.path.abspath( |
27 | os.path.join(os.path.dirname(os.path.abspath(__file__)), "../..")) | ||
28 | |||
29 | if '.' in sys.argv[1]: | ||
30 | version = sys.argv[1] | ||
31 | basename = f"RockboxUtility-v{version}-src" | ||
32 | ref = f"refs/tags/rbutil_{version}" | ||
33 | refs = gitscraper.get_refs(repository) | ||
34 | if ref in refs: | ||
35 | tree = refs[ref] | ||
36 | else: | ||
37 | print("Could not find hash for version!") | ||
38 | sys.exit() | ||
39 | else: | ||
40 | tree = gitscraper.parse_rev(repository, sys.argv[1]) | ||
41 | basename = f"RockboxUtility-{tree}" | ||
42 | |||
43 | filelist = ["utils/rbutilqt", | ||
44 | "utils/ipodpatcher", | ||
45 | "utils/sansapatcher", | ||
46 | "utils/mkamsboot", | ||
47 | "utils/chinachippatcher", | ||
48 | "utils/mks5lboot", | ||
49 | "utils/mkmpioboot", | ||
50 | "utils/mkimxboot", | ||
51 | "utils/mktccboot", | ||
52 | "utils/bspatch", | ||
53 | "utils/bzip2", | ||
54 | "utils/cmake", | ||
55 | "utils/CMakeLists.txt", | ||
26 | "tools/ucl", | 56 | "tools/ucl", |
27 | "tools/rbspeex", | 57 | "tools/rbspeex", |
28 | "utils/imxtools", | 58 | "utils/imxtools", |
@@ -48,41 +78,8 @@ deploy.svnpaths = \ | |||
48 | "tools/voicefont.h", | 78 | "tools/voicefont.h", |
49 | "tools/wavtrim.c", | 79 | "tools/wavtrim.c", |
50 | "tools/sapi_voice.vbs"] | 80 | "tools/sapi_voice.vbs"] |
51 | deploy.useupx = False | ||
52 | deploy.bundlecopy = { | ||
53 | "icons/rbutilqt.icns" : "Contents/Resources/", | ||
54 | "Info.plist" : "Contents/" | ||
55 | } | ||
56 | deploy.progexe = { | ||
57 | "win32" : "release/RockboxUtility.exe", | ||
58 | "darwin" : "RockboxUtility.app", | ||
59 | "linux2" : "RockboxUtility", | ||
60 | "linux" : "RockboxUtility" | ||
61 | } | ||
62 | deploy.regreplace = { | ||
63 | "rbutil/rbutilqt/version.h" : [["\$Rev\$", "%REVISION%"], | ||
64 | ["(^#define BUILDID).*", "\\1 \"%BUILDID%\""]], | ||
65 | "rbutil/rbutilqt/Info.plist" : [["\$Rev\$", "%REVISION%"]], | ||
66 | } | ||
67 | # OS X 10.6 defaults to gcc 4.2. Building universal binaries that are | ||
68 | # compatible with 10.4 requires using gcc-4.0. | ||
69 | deploy.qmakespec = { | ||
70 | "win32" : "", | ||
71 | "darwin" : "macx-g++40", | ||
72 | "linux2" : "", | ||
73 | "linux" : "" | ||
74 | } | ||
75 | deploy.make = { | ||
76 | "win32" : "mingw32-make", | ||
77 | "darwin" : "make", | ||
78 | "linux2" : "make", | ||
79 | "linux" : "make" | ||
80 | } | ||
81 | 81 | ||
82 | # all files of the program. Will get put into an archive after building | 82 | print(f"Getting git revision {tree}") |
83 | # (zip on w32, tar.bz2 on Linux). Does not apply on Mac which uses dmg. | 83 | gitscraper.archive_files(repository, tree, filelist, basename, archive="tbz") |
84 | # progexe will get added automatically. | ||
85 | deploy.programfiles = list() | ||
86 | deploy.nsisscript = "" | ||
87 | 84 | ||
88 | deploy.deploy() | 85 | print(f"Created {basename}.tar.bz2.") |