Last-Update: 2019-04-22
Forwarded: not-needed
Author: Dmitry Smirnov <onlyjob@member.fsf.org>
Reviewed-By: Reiner Herrmann <reiner@reiner-h.de>
Description: customise build info
 * get build date/time from changelog.
 * get revision from "svn-version" file.
 * reduce determinism (reproducible build).

--- a/add_build_info.py
+++ b/add_build_info.py
@@ -217,9 +217,9 @@
     try:
         from xpra.os_util import get_linux_distribution
         ld = get_linux_distribution()
         if ld:
-            return "Linux %s" % (" ".join(ld))
+            return "%s" % (" ".join(ld))
     except:
         pass
     return sys.platform
 
@@ -238,18 +238,15 @@
             #win32, macos and older build environments:
             build_time = datetime.datetime.now()
             build_date = datetime.date.today()
             #also record username and hostname:
-            try:
-                import getpass
-                set_prop(props, "BUILT_BY", getpass.getuser())
-            except:
-                set_prop(props, "BUILT_BY", os.environ.get("USER"))
-            set_prop(props, "BUILT_ON", socket.gethostname())
-        set_prop(props, "BUILD_DATE", build_date.isoformat())
-        set_prop(props, "BUILD_TIME", build_time.strftime("%H:%M"))
+            set_prop(props, "BUILT_BY", "Debian")
+            set_prop(props, "BUILT_ON", "Debian")
+        set_prop(props, "DEBIAN_PACKAGE", subprocess.Popen("dpkg-parsechangelog -SVersion", stdin=None, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True).stdout.read()[:-1])
+        set_prop(props, "BUILD_DATE", subprocess.Popen("date -u --date=\"$(dpkg-parsechangelog -SDate)\" +%F", stdin=None, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True).stdout.read()[:-1])
+        set_prop(props, "BUILD_TIME", subprocess.Popen("date -u --date=\"$(dpkg-parsechangelog -SDate)\" +%R", stdin=None, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True).stdout.read()[:-1])
         set_prop(props, "BUILD_MACHINE", get_machineinfo())
-        set_prop(props, "BUILD_CPU", get_cpuinfo())
+        set_prop(props, "BUILD_CPU", "Generic CPU")
         set_prop(props, "BUILD_BIT", platform.architecture()[0])
         set_prop(props, "BUILD_OS", get_platform_name())
         try:
             from Cython import __version__ as cython_version
@@ -296,9 +293,9 @@
                 "REVISION" : "unknown",
                 "LOCAL_MODIFICATIONS" : "unknown"
             }
     #find revision:
-    proc = subprocess.Popen("svnversion -n ..", stdin=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
+    proc = subprocess.Popen("cat svn-version", stdin=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
     (out, _) = proc.communicate()
     if proc.returncode!=0:
         print("'svnversion -n' failed with return code %s" % proc.returncode)
         return  props
@@ -323,9 +320,9 @@
     rev = int(rev_str)
     props["REVISION"] = rev
     #find number of local files modified:
     changes = 0
-    proc = subprocess.Popen("svn status", stdin=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
+    proc = subprocess.Popen("echo 0", stdin=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
     (out, _) = proc.communicate()
     if proc.poll()!=0:
         print("could not get status of local files")
         return  props
