Description: Force timestamps in generated files to come from the debian
	     changelog time. Also include the source package version in the
             versions report.
Author: Joe Healy <joehealy@gmail.com>
Forwarded: no

--- a/setup.py
+++ b/setup.py
@@ -30,6 +30,11 @@
 from distutils.command.sdist import sdist
 from distutils.command.install_lib import install_lib
 # pylint: enable=E0611
+from debian import changelog
+DEBIAN_CHANGELOG = changelog.Changelog(open("debian/changelog"))
+DEBIAN_VERSION = DEBIAN_CHANGELOG.get_version()
+DEBIAN_DATE = DEBIAN_CHANGELOG._blocks[0].date
+
 
 try:
     import zmq
@@ -154,7 +159,7 @@
             # pylint: disable=E0602
             open(self.distribution.salt_version_hardcoded_path, 'w').write(
                 INSTALL_VERSION_TEMPLATE.format(
-                    date=datetime.utcnow(),
+                    date=DEBIAN_DATE,
                     full_version_info=__saltstack_version__.full_info
                 )
             )
@@ -351,7 +356,7 @@
 
 INSTALL_VERSION_TEMPLATE = '''\
 # This file was auto-generated by salt's setup on \
-{date:%A, %d %B %Y @ %H:%m:%S UTC}.
+{date}. (Date from debian changelog)
 
 from salt.version import SaltStackVersion
 
@@ -361,7 +366,7 @@
 
 INSTALL_SYSPATHS_TEMPLATE = '''\
 # This file was auto-generated by salt's setup on \
-{date:%A, %d %B %Y @ %H:%m:%S UTC}.
+{date}. (Date from debian changelog)
 
 ROOT_DIR = {root_dir!r}
 CONFIG_DIR = {config_dir!r}
@@ -373,6 +378,7 @@
 BASE_MASTER_ROOTS_DIR = {base_master_roots_dir!r}
 LOGS_DIR = {logs_dir!r}
 PIDFILE_DIR = {pidfile_dir!r}
+__source_package_version__ = "{package_version}"
 '''
 
 
@@ -393,7 +399,7 @@
             )
             open(system_paths_file_path, 'w').write(
                 INSTALL_SYSPATHS_TEMPLATE.format(
-                    date=datetime.utcnow(),
+                    date=DEBIAN_DATE,
                     root_dir=self.distribution.salt_root_dir,
                     config_dir=self.distribution.salt_config_dir,
                     cache_dir=self.distribution.salt_cache_dir,
@@ -404,6 +410,7 @@
                     base_master_roots_dir=self.distribution.salt_base_master_roots_dir,
                     logs_dir=self.distribution.salt_logs_dir,
                     pidfile_dir=self.distribution.salt_pidfile_dir,
+                    package_version=DEBIAN_VERSION,
                 )
             )
 
--- a/salt/version.py
+++ b/salt/version.py
@@ -571,6 +571,9 @@
     '''
     libs = list(versions_information(include_salt_cloud=include_salt_cloud))
 
+    from salt._syspaths import __source_package_version__
+    libs.append(("Debian source package", __source_package_version__))
+
     padding = max(len(lib[0]) for lib in libs) + 1
 
     fmt = '{0:>{pad}}: {1}'
