Changes to propagate PACKAGE_VERSION from build to deb template generation scripts
This commit is contained in:
parent
b63af7e649
commit
4971df9f9a
3 changed files with 18 additions and 10 deletions
|
@ -160,7 +160,7 @@ package_docs(){
|
||||||
|
|
||||||
## Generation Functions ##
|
## Generation Functions ##
|
||||||
generate_config_templates(){
|
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(){
|
generate_manpages(){
|
||||||
|
|
|
@ -29,9 +29,9 @@ class UTC(datetime.tzinfo):
|
||||||
return datetime.timedelta(0)
|
return datetime.timedelta(0)
|
||||||
|
|
||||||
# Generation Functions
|
# 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:
|
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)
|
control_contents = generate_control(config_data, template_dir)
|
||||||
copyright_contents = generate_copyright(config_data, template_dir)
|
copyright_contents = generate_copyright(config_data, template_dir)
|
||||||
symlink_contents = generate_symlinks(config_data)
|
symlink_contents = generate_symlinks(config_data)
|
||||||
|
@ -50,13 +50,18 @@ def generate_and_write_all(config_data, template_dir, output_dir):
|
||||||
|
|
||||||
return
|
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)
|
template = get_template(template_dir, FILE_CHANGELOG)
|
||||||
|
|
||||||
release_data = config_data["release"]
|
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(\
|
template_dict = dict(\
|
||||||
PACKAGE_VERSION=release_data["package_version"],
|
PACKAGE_VERSION=package_version,
|
||||||
PACKAGE_REVISION=release_data["package_revision"],
|
PACKAGE_REVISION=release_data["package_revision"],
|
||||||
CHANGELOG_MESSAGE=release_data["changelog_message"],
|
CHANGELOG_MESSAGE=release_data["changelog_message"],
|
||||||
URGENCY=release_data.get("urgency", "low"),
|
URGENCY=release_data.get("urgency", "low"),
|
||||||
|
@ -188,7 +193,7 @@ def help_and_exit(msg):
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
def print_usage():
|
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():
|
def parse_and_validate_args():
|
||||||
if len(sys.argv) < 4:
|
if len(sys.argv) < 4:
|
||||||
|
@ -198,6 +203,10 @@ def parse_and_validate_args():
|
||||||
config_path = sys.argv[1]
|
config_path = sys.argv[1]
|
||||||
template_dir = sys.argv[2]
|
template_dir = sys.argv[2]
|
||||||
output_dir = sys.argv[3]
|
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):
|
if not os.path.isfile(config_path):
|
||||||
help_and_exit("Error: Invalid config file 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):
|
if not os.path.isdir(output_dir):
|
||||||
help_and_exit("Error: Invalid output directory path")
|
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():
|
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)
|
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__":
|
if __name__ == "__main__":
|
||||||
execute()
|
execute()
|
|
@ -3,7 +3,6 @@
|
||||||
#
|
#
|
||||||
# Relies on these environment variables:
|
# Relies on these environment variables:
|
||||||
# PACKAGE_SOURCE_DIR :: Package Source Staging Directory
|
# PACKAGE_SOURCE_DIR :: Package Source Staging Directory
|
||||||
# PACKAGE_DIR :: Package Build Directory
|
|
||||||
# INSTALL_ROOT :: Absolute path of package installation root
|
# INSTALL_ROOT :: Absolute path of package installation root
|
||||||
|
|
||||||
# write_debian_install_file
|
# write_debian_install_file
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue