create-tarball: Make it more comfortable to use the --copy-docs option.
[samba.git] / release-scripts / create-tarball
index 3463f012a5bc466aa27ff3763300629fc8297319..9e6b8fe0ff5d4f2f805c071db22599b88b57f59b 100755 (executable)
@@ -7,7 +7,7 @@ OPT_TAG=""
 OPT_KEYID=""
 
 TOPDIR="`dirname $0`/.."
-VER_H="${TOPDIR}/source/include/version.h"
+VER_H="${TOPDIR}/source3/include/version.h"
 
 function exitOnError
 {
@@ -38,7 +38,7 @@ function printUsage
 }
 
 ##
-## Parse the command line options 
+## Parse the command line options
 ##
 
 function parseOptions
@@ -115,7 +115,20 @@ function buildDocs
 
        rsync -av "${OPT_DOCSDIR}"/ docs/
        exitOnError $? "Failed top copy docs from ${OPT_DOCSDIR}"
-       
+
+       cd docs/
+       /bin/rm -rf test.pdf Samba4*pdf htmldocs/Samba4* htmldocs/test
+       if [ -d manpages-3 ]; then
+               mv manpages-3 manpages
+       fi
+       if [ -d htmldocs/manpages-3 ]; then
+               mv htmldocs/manpages-3 htmldocs/manpages
+       fi
+       # Sync thanks, history and registry/ into the docs dir
+       rsync -Ca --exclude=.svn ../../$OPT_BRANCH/docs-xml/registry ../docs/
+       rsync -Ca --exclude=.svn ../../$OPT_BRANCH/docs-xml/archives/ ../docs/
+       cd ../
+
        return 0
     fi
 
@@ -137,7 +150,7 @@ function createReleaseTag
        return 0
     fi
 
-    if [ "x`git-tag -l ${OPT_TAG}`" != "x" ]; then
+    if [ "x`git tag -l ${OPT_TAG}`" != "x" ]; then
        echo -n "Tag exists.  Do you wish to overwrite? (y/N): "
        read answer
 
@@ -155,7 +168,7 @@ function createReleaseTag
        fi
     fi
 
-    git-tag -u ${OPT_KEYID} ${OPT_TAG}
+    git tag -u ${OPT_KEYID} ${OPT_TAG}
     exitOnError $? "Failed to create tag"
 
     return 0
@@ -163,42 +176,56 @@ function createReleaseTag
 ##
 ## Main driver
 ##
-function main 
+function main
 {
     parseOptions "$@"
     exitOnError $? "Failed to parse options"
-    
+
     cd $TOPDIR
 
-    git-checkout ${OPT_BRANCH}
+    git checkout ${OPT_BRANCH}
     exitOnError $? "Invalid branch name \"${OPT_BRANCH}\""
 
-    (cd source && ./script/mkversion.sh)
+    (cd source3 && ./script/mkversion.sh)
     if [ ! -f $VER_H ]; then
        exitOnError 1 "Failed to find ${VER_H}!"
     fi
 
-    version=`grep SAMBA_VERSION_OFFICIAL_STRING $VER_H | awk '{print $3}'`
-    vendor_version=`grep SAMBA_VERSION_VENDOR_SUFFIX $VER_H | awk '{print $3}'`
+    version=`grep "define SAMBA_VERSION_OFFICIAL_STRING" $VER_H | awk '{print $3}'`
+    vendor_version=`grep "define SAMBA_VERSION_VENDOR_SUFFIX" $VER_H | awk '{print $3}'`
     if [ -n "$vendor_version" ]; then
        version="$version-$vendor_version"
     fi
+    vendor_patch=`grep "define SAMBA_VERSION_VENDOR_PATCH" $VER_H | awk '{print $3}'`
+    if [ -n "$vendor_patch" ]; then
+       version="$version-$vendor_patch"
+    fi
     version=`echo $version | sed 's/\"//g'`
 
     echo "Creating release tarball for Samba $version"
 
     /bin/rm -rf ../samba-${version}
-    git-archive --format=tar --prefix=samba-${version}/ HEAD | (cd .. && tar xf -)
+    git archive --format=tar --prefix=samba-${version}/ HEAD | (cd .. && tar xf -)
     exitOnError $? "Failed to create release directory tree"
 
     pushd ../samba-${version}
 
+    # Remove RFCs as they are non-free content (with a strict interpretation of
+    # the DFSG)
+
+    if [ -d source4 ]; then
+       echo "Removing RFCs"
+       find source4/ -name "rfc*.txt" -exec rm -f {} \;
+       rm -f source4/ldap_server/devdocs/draft-armijo-ldap-syntax-00.txt
+       rm -f source4/ldap_server/devdocs/ldapext-ldapv3-vlv-04.txt
+    fi
+
     packaging/bin/update-pkginfo ${version} 1 ""
 
     buildDocs
     exitOnError $? "Failed to build documentation"
 
-    ( cd source && ./autogen.sh )
+    ( cd source3 && ./autogen.sh )
 
     cd ..
     tar cf samba-${version}.tar --exclude=.git* --exclude=CVS --exclude=.svn samba-${version}