From: Apollon Oikonomopoulos
Date: Wed, 29 Apr 2015 13:51:49 +0300
Subject: [PATCH] dconv: debianize
- Use Debian bootstrap and jquery packages
- Add Debian-related resources to the template
- Use the package's version instead of HAProxy's git version
- Strip the conversion date from the output to ensure reproducible
build.
- 2020-01-17: make get_haproxy_debian_version() return a string, for py3
compatibility
diff --git a/debian/dconv/haproxy-dconv.py b/debian/dconv/haproxy-dconv.py
index fe2b96dce325..702eefac6a3b 100755
--- a/debian/dconv/haproxy-dconv.py
+++ b/debian/dconv/haproxy-dconv.py
@@ -44,12 +44,11 @@ VERSION = ""
HAPROXY_GIT_VERSION = False
def main():
- global VERSION, HAPROXY_GIT_VERSION
+ global HAPROXY_GIT_VERSION
usage="Usage: %prog --infile --outfile "
optparser = OptionParser(description='Generate HTML Document from HAProxy configuation.txt',
- version=VERSION,
usage=usage)
optparser.add_option('--infile', '-i', help='Input file mostly the configuration.txt')
optparser.add_option('--outfile','-o', help='Output file')
@@ -65,11 +64,7 @@ def main():
os.chdir(os.path.dirname(__file__))
- VERSION = get_git_version()
- if not VERSION:
- sys.exit(1)
-
- HAPROXY_GIT_VERSION = get_haproxy_git_version(os.path.dirname(option.infile))
+ HAPROXY_GIT_VERSION = get_haproxy_debian_version(os.path.dirname(option.infile))
convert(option.infile, option.outfile, option.base)
@@ -114,6 +109,15 @@ def get_haproxy_git_version(path):
version = re.sub(r'-g.*', '', version)
return version
+def get_haproxy_debian_version(path):
+ try:
+ version = subprocess.check_output(["dpkg-parsechangelog", "-Sversion"],
+ cwd=os.path.join(path, ".."))
+ except subprocess.CalledProcessError:
+ return False
+
+ return version.decode("utf-8").strip()
+
def getTitleDetails(string):
array = string.split(".")
@@ -506,7 +510,6 @@ def convert(infile, outfile, base=''):
keywords = keywords,
keywordsCount = keywordsCount,
keyword_conflicts = keyword_conflicts,
- version = VERSION,
date = datetime.datetime.now().strftime("%Y/%m/%d"),
)
except TopLevelLookupException:
@@ -524,7 +527,6 @@ def convert(infile, outfile, base=''):
keywords = keywords,
keywordsCount = keywordsCount,
keyword_conflicts = keyword_conflicts,
- version = VERSION,
date = datetime.datetime.now().strftime("%Y/%m/%d"),
footer = footer
)
diff --git a/debian/dconv/templates/template.html b/debian/dconv/templates/template.html
index c72b3558c2dd..9aefa16dd82d 100644
--- a/debian/dconv/templates/template.html
+++ b/debian/dconv/templates/template.html
@@ -3,8 +3,8 @@
${headers['title']} ${headers['version']} - ${headers['subtitle']}
-
-
+
+
- Converted with haproxy-dconv v${version} on ${date}
+ Converted with haproxy-dconv
@@ -83,7 +68,7 @@
${headers['title']}
${headers['subtitle']}
-
${headers['version']}
+
${headers['version']} (Debian)
${headers['author']}
@@ -114,9 +99,9 @@
-
-
-
+
+
+