[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-3282-g815383a

Stefan Metzmacher metze at samba.org
Thu Jul 17 13:16:10 GMT 2008


The branch, v3-3-test has been updated
       via  815383a4178c51311f3c81632a0fa1d19e7098f4 (commit)
       via  d2682295f55a18d526434062834c033aa18e794b (commit)
       via  8b9301fbc73f28c657ec81c605760a0ff7a1973a (commit)
      from  d9d0cf6411a29d456735e980f9ac8ad75f3edfbd (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test


- Log -----------------------------------------------------------------
commit 815383a4178c51311f3c81632a0fa1d19e7098f4
Author: Andreas Schneider <anschneider at suse.de>
Date:   Thu Jul 17 13:37:31 2008 +0200

    Update the developers documentation for the new vendor version options.
    
    Signed-off-by: Andreas Schneider <anschneider at suse.de>
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit d2682295f55a18d526434062834c033aa18e794b
Author: Andreas Schneider <anschneider at suse.de>
Date:   Thu Jul 17 12:29:02 2008 +0200

    Use the macro to call samba_version_string().
    
    Signed-off-by: Andreas Schneider <anschneider at suse.de>
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 8b9301fbc73f28c657ec81c605760a0ff7a1973a
Author: Andreas Schneider <anschneider at suse.de>
Date:   Thu Jul 17 12:25:31 2008 +0200

    Simplify samba_version_string.
    
    This adds a new macro for a vender version function which will be returned
    by the samba_version_string() function if defined.
    
    Signed-off-by: Andreas Schneider <anschneider at suse.de>
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 docs-xml/Samba3-Developers-Guide/packagers.xml |    8 +++--
 source/VERSION                                 |   30 +++++++++------
 source/lib/version.c                           |   45 ++++++------------------
 source/libsmb/libsmb_context.c                 |    2 +-
 source/script/mkversion.sh                     |    6 +++
 5 files changed, 41 insertions(+), 50 deletions(-)


Changeset truncated at 500 lines:

diff --git a/docs-xml/Samba3-Developers-Guide/packagers.xml b/docs-xml/Samba3-Developers-Guide/packagers.xml
index 8b8ecca..853dad9 100644
--- a/docs-xml/Samba3-Developers-Guide/packagers.xml
+++ b/docs-xml/Samba3-Developers-Guide/packagers.xml
@@ -13,9 +13,11 @@
 <title>Versioning</title>
 
 <para>
-Please, please update the version number in <filename>source/include/version.h</filename> to include the
-versioning of your package. This makes it easier to distinguish standard samba builds from custom-build samba
-builds (distributions often patch packages). For example, a good version would be:
+Please, please set the vendor version suffix and number in <filename>source/VERSION</filename> and call
+<filename>source/script/mkvesion.sh</filename> to include the versioning of your package. There is also
+the possibility to set a function to create the vendor version. This makes it easier to distinguish
+standard samba builds from custom-build samba builds (distributions often patch packages). For example,
+a good version would be:
 </para>
 
 <para><programlisting>
diff --git a/source/VERSION b/source/VERSION
index c8206c8..758956e 100644
--- a/source/VERSION
+++ b/source/VERSION
@@ -72,8 +72,6 @@ SAMBA_VERSION_IS_GIT_SNAPSHOT=yes
 
 ########################################################
 # This can be set by vendors if they want...           #
-# This can be a string constant or a function which    #
-# returns a string (const char *)                      #
 #                                                      #
 # <MAJOR>.<MINOR>.<RELEASE>[...]-<VENDOR_SUFFIX>       #
 #                                                      #
@@ -82,18 +80,26 @@ SAMBA_VERSION_IS_GIT_SNAPSHOT=yes
 # e.g. SAMBA_VERSION_VENDOR_SUFFIX="VendorVersion"     #
 #  ->  "CVS 3.0.0rc2-VendorVersion"                    #
 #                                                      #
-# Note: If you want to use a function,                 #
-#       then patch lib/version.c and add this function #
-#       there, because the symbol must be available in #
-#       binary.                                        #
+# Note: If you want to use a function, take a look at  #
+#       SAMBA_VERSION_VENDOR_FUNCTION                  #
 #                                                      #
-# const char *vendor_version(void)                     #
+########################################################
+SAMBA_VERSION_VENDOR_SUFFIX="test"
+SAMBA_VERSION_VENDOR_PATCH=
+
+########################################################
+# This can be set by vendors if they want..            #
+# This have to be a function which returns a string    #
+# (const char *).                                      #
+#                                                      #
+# Patch for example lib/version.c and add something    #
+# like the following example:                          #
+#                                                      #
+# const char *samba_vendor_version(void)               #
 # {                                                    #
-#	return "VendorVersion";                        #
+#   return SAMBA_VERSION_OFFICIAL_STRING "-ENREDO-1.0" #
 # }                                                    #
 #                                                      #
-# e.g. SAMBA_VERSION_VENDOR_SUFFIX=vendor_version()    #
-#  ->  "CVS 3.0.0rc2-VendorVersion"                    #
+# -> "Version 3.2.0-ENREDO-1.0                         #
 ########################################################
-SAMBA_VERSION_VENDOR_SUFFIX="test"
-SAMBA_VERSION_VENDOR_PATCH=
+SAMBA_VERSION_VENDOR_FUNCTION=
diff --git a/source/lib/version.c b/source/lib/version.c
index 3cae02a..3982646 100644
--- a/source/lib/version.c
+++ b/source/lib/version.c
@@ -23,39 +23,16 @@
 
 const char *samba_version_string(void)
 {
-#ifndef SAMBA_VERSION_VENDOR_SUFFIX
+#ifdef SAMBA_VERSION_VENDOR_FUNCTION
+	return SAMBA_VERSION_VENDOR_FUNCTION;
+#else /* SAMBA_VERSION_VENDOR_FUNCTION */
+ #ifdef SAMBA_VERSION_VENDOR_SUFFIX
+  #ifdef SAMBA_VERSION_VENDOR_PATCH
+	return SAMBA_VERSION_OFFICIAL_STRING "-" SAMBA_VERSION_VENDOR_SUFFIX \
+		"-" SAMBA_VERSION_VENDOR_PATCH;
+  #endif /* SAMBA_VERSION_VENDOR_PATCH */
+	return SAMBA_VERSION_OFFICIAL_STRING "-" SAMBA_VERSION_VENDOR_SUFFIX;
+ #endif /* SAMBA_VERSION_VENDOR_SUFFIX */
+#endif /* SAMBA_VERSION_VENDOR_FUNCTION */
 	return SAMBA_VERSION_OFFICIAL_STRING;
-#else
-	static char *samba_version;
-	int res;
-#ifdef SAMBA_VERSION_VENDOR_PATCH
-	char *tmp_version;
-#endif
-
-	if (samba_version != NULL)
-		return samba_version;
-
-	res = asprintf(&samba_version, "%s-%s",
-		       SAMBA_VERSION_OFFICIAL_STRING,
-		       SAMBA_VERSION_VENDOR_SUFFIX);
-	/*
-	 * Can't use smb_panic here due to dependencies
-	 */
-	assert(res != -1);
-
-#ifdef SAMBA_VERSION_VENDOR_PATCH
-	res = asprintf(&tmp_version, "%s-%d", samba_version,
-		       SAMBA_VERSION_VENDOR_PATCH);
-	/*
-	 * Can't use smb_panic here due to dependencies
-	 */
-	assert(res != -1);
-
-	SAFE_FREE(samba_version);
-
-	samba_version = tmp_version;
-#endif
-
-	return samba_version;
-#endif
 }
diff --git a/source/libsmb/libsmb_context.c b/source/libsmb/libsmb_context.c
index be26a92..a9f0dd1 100644
--- a/source/libsmb/libsmb_context.c
+++ b/source/libsmb/libsmb_context.c
@@ -625,7 +625,7 @@ smbc_init_context(SMBCCTX *context)
 const char *
 smbc_version(void)
 {
-        return samba_version_string();
+        return SAMBA_VERSION_STRING;
 }
 
 
diff --git a/source/script/mkversion.sh b/source/script/mkversion.sh
index b678476..695fc7d 100755
--- a/source/script/mkversion.sh
+++ b/source/script/mkversion.sh
@@ -30,6 +30,8 @@ SAMBA_VERSION_RELEASE_NICKNAME=`sed -n 's/^SAMBA_VERSION_RELEASE_NICKNAME=//p' $
 SAMBA_VERSION_VENDOR_SUFFIX=`sed -n 's/^SAMBA_VERSION_VENDOR_SUFFIX=//p' $SOURCE_DIR$VERSION_FILE`
 SAMBA_VERSION_VENDOR_PATCH=`sed -n 's/^SAMBA_VERSION_VENDOR_PATCH=//p' $SOURCE_DIR$VERSION_FILE`
 
+SAMBA_VERSION_VENDOR_FUNCTION=`sed -n 's/^SAMBA_VERSION_VENDOR_FUNCTION=//p' $SOURCE_DIR$VERSION_FILE`
+
 echo "/* Autogenerated by script/mkversion.sh */" > $OUTPUT_FILE
 
 echo "#define SAMBA_VERSION_MAJOR ${SAMBA_VERSION_MAJOR}" >> $OUTPUT_FILE
@@ -101,6 +103,10 @@ echo "#define SAMBA_VERSION_OFFICIAL_STRING \"${SAMBA_VERSION_STRING}\"" >> $OUT
 ##
 ## Add the vendor string if present
 ##
+if test -n "${SAMBA_VERSION_VENDOR_FUNCTION}"; then
+  echo "#define SAMBA_VERSION_VENDOR_FUNCTION ${SAMBA_VERSION_VENDOR_FUNCTION}" >> $OUTPUT_FILE
+fi
+
 if test -n "${SAMBA_VERSION_VENDOR_SUFFIX}";then
     echo "#define SAMBA_VERSION_VENDOR_SUFFIX ${SAMBA_VERSION_VENDOR_SUFFIX}" >> $OUTPUT_FILE
     SAMBA_VERSION_STRING="${SAMBA_VERSION_STRING}-${SAMBA_VERSION_VENDOR_SUFFIX}"


-- 
Samba Shared Repository


More information about the samba-cvs mailing list