diff --git a/package_tool/package_tool b/package_tool/package_tool index aa9a5f08f..72bd79422 100755 --- a/package_tool/package_tool +++ b/package_tool/package_tool @@ -160,7 +160,7 @@ package_docs(){ ## Generation Functions ## generate_config_templates(){ - python ${SCRIPT_DIR}/scripts/config_template_generator.py $CONFIG $SCRIPT_DIR/templates/debian $DEBIAN_DIR + python ${SCRIPT_DIR}/scripts/config_template_generator.py $CONFIG $SCRIPT_DIR/templates/debian $DEBIAN_DIR $PACKAGE_VERSION } generate_manpages(){ diff --git a/package_tool/scripts/config_template_generator.py b/package_tool/scripts/config_template_generator.py index 1ce61d734..4da935fcd 100644 --- a/package_tool/scripts/config_template_generator.py +++ b/package_tool/scripts/config_template_generator.py @@ -29,9 +29,9 @@ class UTC(datetime.tzinfo): return datetime.timedelta(0) # Generation Functions -def generate_and_write_all(config_data, template_dir, output_dir): +def generate_and_write_all(config_data, template_dir, output_dir, package_version=None): try: - changelog_contents = generate_changelog(config_data, template_dir) + changelog_contents = generate_changelog(config_data, template_dir, package_version=package_version) control_contents = generate_control(config_data, template_dir) copyright_contents = generate_copyright(config_data, template_dir) symlink_contents = generate_symlinks(config_data) @@ -50,13 +50,18 @@ def generate_and_write_all(config_data, template_dir, output_dir): return -def generate_changelog(config_data, template_dir): +def generate_changelog(config_data, template_dir, package_version=None): template = get_template(template_dir, FILE_CHANGELOG) release_data = config_data["release"] + + # Allow for Version Override + config_package_version = release_data["package_version"] + if package_version is None: + package_version = config_package_version template_dict = dict(\ - PACKAGE_VERSION=release_data["package_version"], + PACKAGE_VERSION=package_version, PACKAGE_REVISION=release_data["package_revision"], CHANGELOG_MESSAGE=release_data["changelog_message"], URGENCY=release_data.get("urgency", "low"), @@ -188,7 +193,7 @@ def help_and_exit(msg): sys.exit(1) def print_usage(): - print "Usage: config_template_generator.py [config file path] [template directory path] [output directory]" + print "Usage: config_template_generator.py [config file path] [template directory path] [output directory] (package version)" def parse_and_validate_args(): if len(sys.argv) < 4: @@ -198,6 +203,10 @@ def parse_and_validate_args(): config_path = sys.argv[1] template_dir = sys.argv[2] output_dir = sys.argv[3] + version_override = None + + if len(sys.argv) >= 5: + version_override = sys.argv[4] if not os.path.isfile(config_path): help_and_exit("Error: Invalid config file path") @@ -208,16 +217,16 @@ def parse_and_validate_args(): if not os.path.isdir(output_dir): help_and_exit("Error: Invalid output directory path") - return (config_path, template_dir, output_dir) + return (config_path, template_dir, output_dir, version_override) def execute(): - config_path, template_dir, output_dir = parse_and_validate_args() + config_path, template_dir, output_dir, version_override = parse_and_validate_args() config_data = load_json(config_path) - generate_and_write_all(config_data, template_dir, output_dir) + generate_and_write_all(config_data, template_dir, output_dir, package_version=version_override) if __name__ == "__main__": execute() \ No newline at end of file diff --git a/package_tool/scripts/debian_build_lib.sh b/package_tool/scripts/debian_build_lib.sh index 14ddbc35a..225db05bd 100644 --- a/package_tool/scripts/debian_build_lib.sh +++ b/package_tool/scripts/debian_build_lib.sh @@ -3,7 +3,6 @@ # # Relies on these environment variables: # PACKAGE_SOURCE_DIR :: Package Source Staging Directory -# PACKAGE_DIR :: Package Build Directory # INSTALL_ROOT :: Absolute path of package installation root # write_debian_install_file