Commit 4937507e authored by akwizgran's avatar akwizgran

Move JAR and POM creation to subroutines.

parent d20d9cfe
Pipeline #1890 canceled with stages
......@@ -39,24 +39,10 @@ def main():
check_call(['zip', '-D', '-X', zip_name] + file_list, cwd=REPO_DIR)
# create sources jar
external_dir = os.path.join(REPO_DIR, 'external')
check_call(['git', 'clean', '-dfx'], cwd=external_dir)
jar_files = []
for root, dirnames, filenames in os.walk(external_dir):
for f in filenames: jar_files.append(os.path.join(root, f))
for file in jar_files: reset_time(file)
jar_name = get_sources_file_name(versions)
jar_path = os.path.abspath(os.path.join(REPO_DIR, jar_name))
rel_paths = [os.path.relpath(f, external_dir) for f in sorted(jar_files)]
check_call(['jar', 'cf', jar_path] + rel_paths, cwd=external_dir)
create_sources_jar(versions)
# create POM file from template
tor_version = get_tor_version(versions)
pom_name = get_pom_file_name(versions)
with open('template.pom', 'rt') as infile:
with open(os.path.join(REPO_DIR, pom_name), 'wt') as outfile:
for line in infile:
outfile.write(line.replace('VERSION', tor_version))
create_pom_file(versions)
# print hashes for debug purposes
for file in file_list + [zip_name, jar_name, pom_name]:
......@@ -172,5 +158,27 @@ def reset_time(filename):
check_call(['touch', '--no-dereference', '-t', '197001010000.00', filename])
def create_sources_jar(versions):
external_dir = os.path.join(REPO_DIR, 'external')
check_call(['git', 'clean', '-dfx'], cwd=external_dir)
jar_files = []
for root, dirnames, filenames in os.walk(external_dir):
for f in filenames: jar_files.append(os.path.join(root, f))
for file in jar_files: reset_time(file)
jar_name = get_sources_file_name(versions)
jar_path = os.path.abspath(os.path.join(REPO_DIR, jar_name))
rel_paths = [os.path.relpath(f, external_dir) for f in sorted(jar_files)]
check_call(['jar', 'cf', jar_path] + rel_paths, cwd=external_dir)
def create_pom_file(versions):
tor_version = get_tor_version(versions)
pom_name = get_pom_file_name(versions)
with open('template.pom', 'rt') as infile:
with open(os.path.join(REPO_DIR, pom_name), 'wt') as outfile:
for line in infile:
outfile.write(line.replace('VERSION', tor_version))
if __name__ == "__main__":
main()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment