Merge branch 'v4-0-stable' into newmaster
[nivanova/samba-autobuild/.git] / buildtools / wafsamba / samba_version.py
index f2e26ec4e23d77a47c818c5e3e84c552d4747ac8..82f882f64626faf399bc0615823550fc98407e79 100644 (file)
@@ -78,6 +78,13 @@ also accepted as dictionary entries here
 
                 SAMBA_VERSION_STRING += ("-GIT-" + self.GIT_COMMIT_ABBREV)
 
+                clean = Utils.cmd_output('git diff HEAD | wc -l', silent=True)
+                if clean == "0\n":
+                    self.GIT_COMMIT_IS_CLEAN = True
+                else:
+                    self.GIT_COMMIT_IS_CLEAN = False
+                    SAMBA_VERSION_STRING += "+"
+
         self.OFFICIAL_STRING=SAMBA_VERSION_STRING
 
         if self.VENDOR_SUFFIX is not None:
@@ -117,10 +124,12 @@ also accepted as dictionary entries here
             string+="#define SAMBA_VERSION_RC_RELEASE %u\n" % self.RC_RELEASE
 
         try:
-            string+="#define SAMBA_VERSION_GIT_COMMIT_ABBREV " + self.GIT_COMMIT_ABBREV + "\n"
+            string+="#define SAMBA_VERSION_GIT_COMMIT_ABBREV \"" + self.GIT_COMMIT_ABBREV + "\"\n"
+            string+="#define SAMBA_VERSION_GIT_COMMIT_FULLREV \"" + self.GIT_COMMIT_FULLREV + "\"\n"
+            string+="#define SAMBA_VERSION_GIT_COMMIT_DATE \"" + self.GIT_COMMIT_DATE + "\"\n"
             string+="#define SAMBA_VERSION_GIT_COMMIT_TIME " + self.GIT_COMMIT_TIME + "\n"
-            string+="#define SAMBA_VERSION_GIT_COMMIT_FULLREV " + self.GIT_COMMIT_TIME + "\n"
-            string+="#define SAMBA_VERSION_GIT_COMMIT_DATE " + self.GIT_COMMIT_DATA + "\n"
+            if self.GIT_COMMIT_IS_CLEAN:
+                string+="#define SAMBA_VERSION_GIT_COMMIT_IS_CLEAN 1\n"
         except AttributeError:
             pass