885db72b8b
Make gitscraper and tarball script work with both Python 2 and Python 3. Tested with 2.7 and 3.2. Change-Id: I31b2580660d764d013bca6fe59d5663ae9f7f5aa
30 lines
682 B
Python
Executable file
30 lines
682 B
Python
Executable file
#!/usr/bin/python
|
|
|
|
import gitscraper
|
|
import os
|
|
import sys
|
|
|
|
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.")
|
|
|
|
|