summaryrefslogtreecommitdiffstats
path: root/utils/common/tarball.py
blob: 3fda2060021cb63cc1b7c918711b789e02731c79 (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
#!/usr/bin/python

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.dirname(os.path.abspath(__file__)) + "/../..")
if '.' in sys.argv[1]:
    version = sys.argv[1]
    basename = "rockbox-" + version
    ref = "refs/tags/v" + version + "-final"
    refs = gitscraper.get_refs(repository)
    if ref in refs:
        tree = refs[ref]
    else:
        print("Could not find hash for version!")
        sys.exit()
else:
    tree = sys.argv[1]
    basename = "rockbox-" + tree

gitscraper.archive_files(repository, tree, [], basename, archive="7z")

print("done.")