summaryrefslogtreecommitdiffstats
path: root/utils/common/tarball-rbutil.py
blob: ccc413ca59aa0b2ed0b41bb17be1234741658867 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
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 <version|hash>" % 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.")