ports/sysutils/firmware/vmm/patches/patch-scripts_buildversion_py

37 lines
1.5 KiB
Text
Raw Normal View History

2023-08-16 22:26:55 +00:00
Fixup "clean version" strings for packaging; it only allows this if there's
a consistent version number detected for all binutils tools, however this
detection is too simplistic to cope with older binutils (mix of
"GNU assembler 2.17" and "GNU ld version 2.17" etc).
Omit datetime and hostname from dmesg visible version string.
Index: scripts/buildversion.py
--- scripts/buildversion.py.orig
+++ scripts/buildversion.py
@@ -4,7 +4,7 @@
# Copyright (C) 2015 Kevin O'Connor <kevin@koconnor.net>
#
# This file may be distributed under the terms of the GNU GPLv3 license.
-import sys, os, subprocess, shlex, time, socket, optparse, logging, traceback
+import sys, os, subprocess, shlex, time, socket, optparse, logging, traceback, re
VERSION_FORMAT = """
/* DO NOT EDIT! This is an autogenerated file. See scripts/buildversion.py. */
@@ -74,6 +74,8 @@ def tool_versions(tools):
verstr = check_output("%s --version" % (tool,)).split('\n')[0]
# Check if this tool looks like a binutils program
isbinutils = 0
+ if verstr.startswith('GNU ld version'):
+ verstr = re.sub('ld version', 'version', verstr)
if verstr.startswith('GNU '):
isbinutils = 1
verstr = verstr[4:]
@@ -124,6 +126,7 @@ def main():
cleanbuild = cleanbuild and ver and options.extra != ""
if not ver:
ver = "?"
+ cleanbuild = True # XXX omit useless information
if not cleanbuild:
btime = time.strftime("%Y%m%d_%H%M%S")
hostname = socket.gethostname()