File: debianize-dconv.patch

package info (click to toggle)
haproxy 3.2.10-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 23,924 kB
  • sloc: ansic: 267,927; sh: 3,466; xml: 1,756; python: 1,345; makefile: 1,155; perl: 168; cpp: 21
file content (97 lines) | stat: -rw-r--r-- 4,242 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
diff --git a/debian/dconv/dconv.py b/debian/dconv/dconv.py
index 0c7296b0b009..76282ed0975d 100644
--- a/debian/dconv/dconv.py
+++ b/debian/dconv/dconv.py
@@ -56,15 +56,9 @@ def main():
         option.git_directory = os.path.abspath(option.git_directory)
 
     os.chdir(os.path.dirname(__file__))
-    # check the haproxy-dconv repository version
-    dconv_version = git_parser.get_git_version_from_cwd()
-    if not dconv_version:
-        sys.exit(1)
-    haproxy_version = git_parser.get_git_version_in_path(
-                            option.git_directory
-                      )
+    haproxy_version = git_parser.get_debian_version_from_cwd()
     converter.convert_all(files, option.output_directory, option.base,
-                          version=dconv_version, haproxy_version=haproxy_version)
+                          version="0", haproxy_version=haproxy_version)
 
 
 if __name__ == '__main__':
diff --git a/debian/dconv/parser/git_parser.py b/debian/dconv/parser/git_parser.py
index 7791f963c6e3..d2601853813b 100644
--- a/debian/dconv/parser/git_parser.py
+++ b/debian/dconv/parser/git_parser.py
@@ -40,4 +40,15 @@ def get_git_version_in_path(path):
 
     version = version.decode().lstrip('v').rstrip()  # remove the 'v' tag and the EOL char
     version = re.sub(r'-g.*', '', version)
-    return version
\ No newline at end of file
+    return version
+
+
+def get_debian_version_from_cwd():
+    path = os.getcwd()
+    try:
+        version = subprocess.check_output(["dpkg-parsechangelog", "-Sversion"],
+                                          cwd=os.path.join(path, "..", ".."))
+    except subprocess.CalledProcessError:
+        return False
+
+    return version.decode("utf-8").strip()
diff --git a/debian/dconv/templates/template.html b/debian/dconv/templates/template.html
index 184521919957..8b9791b7d81c 100644
--- a/debian/dconv/templates/template.html
+++ b/debian/dconv/templates/template.html
@@ -3,8 +3,7 @@
 	<head>
 		<meta charset="utf-8" />
 		<title>${headers['title']} ${headers['version']} - ${headers['subtitle']}</title>
-		<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
-		<link href="https://raw.githubusercontent.com/thomaspark/bootswatch/v3.3.7/cerulean/bootstrap.min.css" rel="stylesheet" />
+		<link href="${base}css/bootstrap.min.css" rel="stylesheet" />
 		<link href="${base}css/page.css?${version}" rel="stylesheet" />
 	</head>
 	<body>
@@ -75,7 +74,7 @@
 					You can use <strong>left</strong> and <strong>right</strong> arrow keys to navigate between chapters.<br>
 				</p>
 				<p class="text-right">
-					<small>Converted with <a href="https://github.com/cbonte/haproxy-dconv">haproxy-dconv</a> v<b>${version}</b> on <b>${date}</b></small>
+					<small>Converted with <a href="https://github.com/cbonte/haproxy-dconv">haproxy-dconv</a></small>
 				</p>
 			</div>
 			<!-- /.sidebar -->
@@ -89,7 +88,7 @@ <h1><a href="http://www.haproxy.org/" title="HAProxy"><img src="${base}img/HAPro
 							<h1>${headers['title']}</h1>
 							%endif
 							<h2>${headers['subtitle']}</h2>
-							<p><strong>${headers['version']}</strong></p>
+							<p><strong>${headers['version']} (Debian)</strong></p>
 							<p>
 								${headers['author']}<br>
 								${headers['date']}
@@ -100,8 +99,7 @@ <h2>${headers['subtitle']}</h2>
 						<br>
 						<hr>
 						<div class="text-right">
-							${headers['title']} ${headers['version'].replace("version ", "")} &ndash; ${headers['subtitle']}<br>
-							<small>${headers['date']}, ${headers['author']}</small>
+							${headers['title']} ${headers['version'].replace("version ", "")} &ndash; ${headers['subtitle']}
 						</div>
 					</div>
 					<!-- /.col-lg-12 -->
@@ -113,8 +111,8 @@ <h2>${headers['subtitle']}</h2>
 		</div>
 		<!-- /#wrapper -->
 
-		<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
-		<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/js/bootstrap.min.js"></script>
+		<script src="${base}js/jquery.min.js"></script>
+		<script src="${base}js/bootstrap.min.js"></script>
 		<script>
 			function filterKeywords(text) {
 				$('.letter').each(function(idx1, letter) {