Make the full-tarball script collect nested submodules.
This commit is contained in:
parent
9c6ffa0101
commit
22235226d6
|
@ -63,20 +63,11 @@ def getOutput(command):
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
return output.decode('utf-8')
|
return output.decode('utf-8')
|
||||||
|
|
||||||
def prepareSources():
|
def invoke(command):
|
||||||
workpath = os.getcwd()
|
return call(command.split()) == 0
|
||||||
os.chdir('../..')
|
|
||||||
rootpath = os.getcwd()
|
def appendSubmodules(appendTo, root, rootRevision):
|
||||||
finalpath = rootpath + '/out/Release/sources.tar'
|
startpath = os.getcwd()
|
||||||
if os.path.exists(finalpath):
|
|
||||||
os.remove(finalpath)
|
|
||||||
if os.path.exists(finalpath + '.gz'):
|
|
||||||
os.remove(finalpath + '.gz')
|
|
||||||
tmppath = rootpath + '/out/Release/tmp.tar'
|
|
||||||
print('Preparing source tarball...')
|
|
||||||
if (call(('git archive --prefix=tdesktop-' + version + '-full/ -o ' + finalpath + ' v' + version).split()) != 0):
|
|
||||||
os.remove(finalpath)
|
|
||||||
sys.exit(1)
|
|
||||||
lines = getOutput('git submodule foreach').split('\n')
|
lines = getOutput('git submodule foreach').split('\n')
|
||||||
for line in lines:
|
for line in lines:
|
||||||
if len(line) == 0:
|
if len(line) == 0:
|
||||||
|
@ -84,23 +75,48 @@ def prepareSources():
|
||||||
match = re.match(r"^Entering '([^']+)'$", line)
|
match = re.match(r"^Entering '([^']+)'$", line)
|
||||||
if not match:
|
if not match:
|
||||||
print('Bad line: ' + line)
|
print('Bad line: ' + line)
|
||||||
sys.exit(1)
|
return False
|
||||||
path = match.group(1)
|
path = match.group(1)
|
||||||
revision = getOutput('git rev-parse v' + version + ':' + path).split('\n')[0]
|
subroot = root + '/' + path
|
||||||
|
revision = getOutput('git rev-parse ' + rootRevision + ':' + path).split('\n')[0]
|
||||||
print('Adding submodule ' + path + '...')
|
print('Adding submodule ' + path + '...')
|
||||||
os.chdir(path)
|
os.chdir(path)
|
||||||
if (call(('git archive --prefix=tdesktop-' + version + '-full/' + path + '/ ' + revision + ' -o ' + tmppath).split()) != 0):
|
tmppath = appendTo + '_tmp'
|
||||||
os.remove(finalpath)
|
if not invoke('git archive --prefix=' + subroot + '/ ' + revision + ' -o ' + tmppath + '.tar'):
|
||||||
os.remove(tmppath)
|
os.remove(appendTo + '.tar')
|
||||||
sys.exit(1)
|
os.remove(tmppath + '.tar')
|
||||||
if (call(('gtar --concatenate --file=' + finalpath + ' ' + tmppath).split()) != 0):
|
return False
|
||||||
os.remove(finalpath)
|
if not appendSubmodules(tmppath, subroot, revision):
|
||||||
os.remove(tmppath)
|
return False
|
||||||
sys.exit(1)
|
if not invoke('gtar --concatenate --file=' + appendTo + '.tar ' + tmppath + '.tar'):
|
||||||
os.remove(tmppath)
|
os.remove(appendTo + '.tar')
|
||||||
os.chdir(rootpath)
|
os.remove(tmppath + '.tar')
|
||||||
|
return False
|
||||||
|
os.remove(tmppath + '.tar')
|
||||||
|
os.chdir(startpath)
|
||||||
|
return True
|
||||||
|
|
||||||
|
def prepareSources():
|
||||||
|
workpath = os.getcwd()
|
||||||
|
os.chdir('../..')
|
||||||
|
rootpath = os.getcwd()
|
||||||
|
finalpart = rootpath + '/out/Release/sources'
|
||||||
|
finalpath = finalpart + '.tar'
|
||||||
|
if os.path.exists(finalpath):
|
||||||
|
os.remove(finalpath)
|
||||||
|
if os.path.exists(finalpath + '.gz'):
|
||||||
|
os.remove(finalpath + '.gz')
|
||||||
|
tmppath = rootpath + '/out/Release/tmp.tar'
|
||||||
|
print('Preparing source tarball...')
|
||||||
|
revision = 'v' + version
|
||||||
|
targetRoot = 'tdesktop-' + version + '-full';
|
||||||
|
if not invoke('git archive --prefix=' + targetRoot + '/ -o ' + finalpath + ' ' + revision):
|
||||||
|
os.remove(finalpath)
|
||||||
|
sys.exit(1)
|
||||||
|
if not appendSubmodules(finalpart, targetRoot, revision):
|
||||||
|
sys.exit(1)
|
||||||
print('Compressing...')
|
print('Compressing...')
|
||||||
if (call(('gzip -9 ' + finalpath).split()) != 0):
|
if not invoke('gzip -9 ' + finalpath):
|
||||||
os.remove(finalpath)
|
os.remove(finalpath)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
os.chdir(workpath)
|
os.chdir(workpath)
|
||||||
|
@ -254,12 +270,12 @@ if r.status_code == 404:
|
||||||
checkResponseCode(r, 201)
|
checkResponseCode(r, 201)
|
||||||
|
|
||||||
tagname = 'v' + version
|
tagname = 'v' + version
|
||||||
call("git fetch origin".split())
|
invoke("git fetch origin")
|
||||||
if stable == 1:
|
if stable == 1:
|
||||||
call("git push launchpad {}:master".format(tagname).split())
|
invoke("git push launchpad {}:master".format(tagname))
|
||||||
else:
|
else:
|
||||||
call("git push launchpad {}:beta".format(tagname).split())
|
invoke("git push launchpad {}:beta".format(tagname))
|
||||||
call("git push --tags launchpad".split())
|
invoke("git push --tags launchpad")
|
||||||
|
|
||||||
r = requests.get(url + 'repos/telegramdesktop/tdesktop/releases/tags/v' + version)
|
r = requests.get(url + 'repos/telegramdesktop/tdesktop/releases/tags/v' + version)
|
||||||
checkResponseCode(r, 200)
|
checkResponseCode(r, 200)
|
||||||
|
@ -307,9 +323,8 @@ for file in files:
|
||||||
checkResponseCode(r, 201)
|
checkResponseCode(r, 201)
|
||||||
|
|
||||||
print('Success! Removing.')
|
print('Success! Removing.')
|
||||||
return_code = call(["rm", file_path])
|
if not invoke('rm ' + file_path):
|
||||||
if return_code != 0:
|
print('Bad rm return code :(')
|
||||||
print('Bad rm code: ' + str(return_code))
|
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
Loading…
Reference in New Issue