You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by js...@apache.org on 2012/03/01 16:58:24 UTC

svn commit: r1295640 - in /incubator/ooo/trunk/main: cui/source/dialogs/ scp2/source/ooo/ solenv/bin/modules/ solenv/bin/modules/installer/ solenv/inc/ unotools/inc/unotools/ unotools/source/config/

Author: jsc
Date: Thu Mar  1 15:58:24 2012
New Revision: 1295640

URL: http://svn.apache.org/viewvc?rev=1295640&view=rev
Log:
add revision to version file, add revision info to about independent of --with-build-version, increase buildid, adapt SOURCEVERSION

Added:
    incubator/ooo/trunk/main/solenv/bin/modules/SvnRevision.pm
Modified:
    incubator/ooo/trunk/main/cui/source/dialogs/about.cxx
    incubator/ooo/trunk/main/scp2/source/ooo/common_brand.scp
    incubator/ooo/trunk/main/scp2/source/ooo/profileitem_ooo.scp
    incubator/ooo/trunk/main/solenv/bin/modules/installer/scriptitems.pm
    incubator/ooo/trunk/main/solenv/inc/minor.mk
    incubator/ooo/trunk/main/unotools/inc/unotools/bootstrap.hxx
    incubator/ooo/trunk/main/unotools/source/config/bootstrap.cxx

Modified: incubator/ooo/trunk/main/cui/source/dialogs/about.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/cui/source/dialogs/about.cxx?rev=1295640&r1=1295639&r2=1295640&view=diff
==============================================================================
--- incubator/ooo/trunk/main/cui/source/dialogs/about.cxx (original)
+++ incubator/ooo/trunk/main/cui/source/dialogs/about.cxx Thu Mar  1 15:58:24 2012
@@ -72,20 +72,9 @@ static void layoutText( FixedInfo &rText
 
 String InitDevVersionStr()
 {
-    const String sCWSSchema( String::CreateFromAscii( "[CWS:" ) );
-    rtl::OUString sDefault;
+    String sDefault;
     String sBuildId( utl::Bootstrap::getBuildIdData( sDefault ) );
     OSL_ENSURE( sBuildId.Len() > 0, "No BUILDID in bootstrap file" );
-    if ( sBuildId.Len() > 0 && sBuildId.Search( sCWSSchema ) == STRING_NOTFOUND )
-    {
-        // no cws part in brand buildid -> try basis buildid
-        rtl::OUString sBasisBuildId( DEFINE_CONST_OUSTRING(
-            "${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("version") ":buildid}" ) );
-        rtl::Bootstrap::expandMacros( sBasisBuildId );
-        sal_Int32 nIndex = sBasisBuildId.indexOf( sCWSSchema );
-        if ( nIndex != -1 )
-            sBuildId += String( sBasisBuildId.copy( nIndex ) );
-    }
 
     String sProductSource( utl::Bootstrap::getProductSource( sDefault ) );
     OSL_ENSURE( sProductSource.Len() > 0, "No ProductSource in bootstrap file" );
@@ -106,34 +95,7 @@ String InitDevVersionStr()
         // prepend the product source
         sBuildId.Insert( sProductSource, 0 );
     }
-
-    // --> PB 2008-10-30 #i94693#
-    // if the build ids of the basis or ure layer are different from the build id
-    // of the brand layer then show them
-    rtl::OUString aBasisProductBuildId( DEFINE_CONST_OUSTRING(
-        "${$OOO_BASE_DIR/program/" SAL_CONFIGFILE("version") ":ProductBuildid}" ) );
-    rtl::Bootstrap::expandMacros( aBasisProductBuildId );
-    rtl::OUString aUREProductBuildId( DEFINE_CONST_OUSTRING(
-        "${$URE_BIN_DIR/" SAL_CONFIGFILE("version") ":ProductBuildid}" ) );
-    rtl::Bootstrap::expandMacros( aUREProductBuildId );
-    if ( sBuildId.Search( String( aBasisProductBuildId ) ) == STRING_NOTFOUND
-        || sBuildId.Search( String( aUREProductBuildId ) ) == STRING_NOTFOUND )
-    {
-        String sTemp( '-' );
-        sTemp += String( aBasisProductBuildId );
-        sTemp += '-';
-        sTemp += String( aUREProductBuildId );
-        sBuildId.Insert( sTemp, sBuildId.Search( ')' ) );
-    }
-    // <--
-
-    // the build id format is "milestone(build)[cwsname]". For readability, it would
-    // be nice to have some more spaces in there.
-    xub_StrLen nPos = 0;
-    if ( ( nPos = sBuildId.Search( sal_Unicode( '(' ) ) ) != STRING_NOTFOUND )
-        sBuildId.Insert( sal_Unicode( ' ' ), nPos );
-    if ( ( nPos = sBuildId.Search( sal_Unicode( '[' ) ) ) != STRING_NOTFOUND )
-        sBuildId.Insert( sal_Unicode( ' ' ), nPos );
+    
     return sBuildId;
 }
 
@@ -178,8 +140,6 @@ AboutDialog::AboutDialog( Window* pParen
     // if necessary more info
     String sVersion = aVersionText.GetText();
     sVersion.SearchAndReplaceAscii( "$(VER)", Application::GetDisplayName() );
-    sVersion += '\n';
-    sVersion += aDevVersionStr;
     aVersionText.SetText( sVersion );
 
 	// Initialisierung fuer Aufruf Entwickler
@@ -221,7 +181,7 @@ AboutDialog::AboutDialog( Window* pParen
 	Color aTextColor( rSettings.GetWindowTextColor() );
 	aVersionText.SetControlForeground( aTextColor );
 	aCopyrightText.SetControlForeground( aTextColor );
-	aBuildData.SetBackground( aWall );
+	aBuildData.SetBackground( );
 
 	Font aSmallFont = rSettings.GetInfoFont();
 	Size aSmaller = aNewFont.GetSize();
@@ -229,13 +189,18 @@ AboutDialog::AboutDialog( Window* pParen
 	aSmaller.Height() = (long) (aSmaller.Height() * 0.75);
 	aNewFont.SetSize( aSmaller );
 	aBuildData.SetFont( aNewFont );
-	aBuildData.SetBackground( aWall );
+
+    String sRevision( utl::Bootstrap::getRevisionInfo() );
+
+    String aBuildString(aDevVersionStr);
+    aBuildString += (DEFINE_CONST_UNICODE("  -  Rev. "));
+    aBuildString += sRevision;
+
 #ifdef BUILD_VER_STRING
 #define _STRINGIFY(x) #x
 #define STRINGIFY(x) _STRINGIFY(x)
-	String aBuildString( DEFINE_CONST_UNICODE( STRINGIFY( BUILD_VER_STRING ) ) );
-#else
-	String aBuildString;
+    aBuildString += '\n';
+	aBuildString += ( DEFINE_CONST_UNICODE( STRINGIFY( BUILD_VER_STRING ) ) );
 #endif
 	aBuildData.SetText( aBuildString );
 	aBuildData.Show();

Modified: incubator/ooo/trunk/main/scp2/source/ooo/common_brand.scp
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/scp2/source/ooo/common_brand.scp?rev=1295640&r1=1295639&r2=1295640&view=diff
==============================================================================
--- incubator/ooo/trunk/main/scp2/source/ooo/common_brand.scp (original)
+++ incubator/ooo/trunk/main/scp2/source/ooo/common_brand.scp Thu Mar  1 15:58:24 2012
@@ -916,6 +916,14 @@ ProfileItem gid_Brand_Profileitem_Versio
     Value = "<buildid>";
 End
 
+ProfileItem gid_Brand_Profileitem_Version_ScsRevision
+    ProfileID = gid_Brand_Profile_Version_Ini;
+    ModuleID = gid_Module_Root;
+    Section = "Version";
+    Key = "Revision";
+    Value = "<scsrevision>";
+End
+
 ProfileItem gid_Brand_Profileitem_Version_Productsource
     ProfileID = gid_Brand_Profile_Version_Ini;
     ModuleID = gid_Module_Root_Brand;

Modified: incubator/ooo/trunk/main/scp2/source/ooo/profileitem_ooo.scp
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/scp2/source/ooo/profileitem_ooo.scp?rev=1295640&r1=1295639&r2=1295640&view=diff
==============================================================================
--- incubator/ooo/trunk/main/scp2/source/ooo/profileitem_ooo.scp (original)
+++ incubator/ooo/trunk/main/scp2/source/ooo/profileitem_ooo.scp Thu Mar  1 15:58:24 2012
@@ -441,6 +441,14 @@ ProfileItem gid_Basis_Profileitem_Versio
     Value = "<buildid>";
 End
 
+ProfileItem gid_Basis_Profileitem_Version_ScsRevision
+    ProfileID = gid_Profile_Version_Ini_Basis;
+    ModuleID = gid_Module_Root;
+    Section = "Version";
+    Key = "Revision";
+    Value = "<scsrevision>";
+End
+
 ProfileItem gid_Basis_Profileitem_Version_Productsource
     ProfileID = gid_Profile_Version_Ini_Basis;
     ModuleID = gid_Module_Root;

Added: incubator/ooo/trunk/main/solenv/bin/modules/SvnRevision.pm
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/solenv/bin/modules/SvnRevision.pm?rev=1295640&view=auto
==============================================================================
--- incubator/ooo/trunk/main/solenv/bin/modules/SvnRevision.pm (added)
+++ incubator/ooo/trunk/main/solenv/bin/modules/SvnRevision.pm Thu Mar  1 15:58:24 2012
@@ -0,0 +1,82 @@
+#**************************************************************
+#  
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#  
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#  
+#**************************************************************
+
+package SvnRevision;
+
+
+sub DetectRevisionIdFromGit ($)
+{
+    my $path = shift;
+    
+    my $id = undef;
+
+    open my $proc, "cd $path && git show HEAD 2>\&1|";
+    while (<$proc>)
+    {
+        if (/^fatal: Not a git repository/)
+        {
+            # Not in a GIT repository.
+            last;
+        }
+        elsif (/^\s*git-svn-id:.*?trunk@([0-9]+)\s+/)
+        {
+            $id = $1;
+            last;
+        }
+    }
+    close $proc;
+
+    return $id;
+}
+
+
+
+
+sub DetectRevisionId ($)
+{
+    my $path = shift;
+
+    my $id = undef;
+    
+    open my $proc, "cd $path && svn info 2>\&1 |";
+    while (<$proc>)
+    {
+        if (/svn: E155007:/)
+        {
+            # Not in an SVN repository.
+            $id = DetectRevisionIdFromGit($path);
+            last;
+        }
+        else
+        {
+            if (/Last Changed Rev:\s+([0-9]+)/)
+            {
+                $id = $1;
+                last;
+            }
+        }
+    }
+    close $proc;
+
+    return $id;
+}
+
+1;

Modified: incubator/ooo/trunk/main/solenv/bin/modules/installer/scriptitems.pm
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/solenv/bin/modules/installer/scriptitems.pm?rev=1295640&r1=1295639&r2=1295640&view=diff
==============================================================================
--- incubator/ooo/trunk/main/solenv/bin/modules/installer/scriptitems.pm (original)
+++ incubator/ooo/trunk/main/solenv/bin/modules/installer/scriptitems.pm Thu Mar  1 15:58:24 2012
@@ -33,6 +33,9 @@ use installer::pathanalyzer;
 use installer::remover;
 use installer::systemactions;
 
+use File::Spec;
+use SvnRevision;
+
 ################################################################
 # Resolving the GID for the directories defined in setup script
 ################################################################
@@ -803,6 +806,8 @@ sub replace_setup_variables
 	if ( $hashref->{'USERDIRPRODUCTVERSION'} ) { $userdirproductversion = $hashref->{'USERDIRPRODUCTVERSION'}; }
 	my $productkey = $productname . " " . $productversion;
 
+	my $scsrevision = SvnRevision::DetectRevisionId(File::Spec->catfile($ENV{'SRC_ROOT'}, File::Spec->updir()));
+
 	# string $buildid, which is used to replace the setup variable <buildid>
 	
 	my $localminor = "flat";
@@ -830,6 +835,7 @@ sub replace_setup_variables
 		my $value = $oneitem->{'Value'};
 		
 		$value =~ s/\<buildid\>/$buildidstring/;
+		$value =~ s/\<scsrevision\>/$scsrevision/;
 		$value =~ s/\<sequence_languages\>/$languagesstring/;
 		$value =~ s/\<productkey\>/$productkey/;
 		$value =~ s/\<productcode\>/$installer::globals::productcode/;

Modified: incubator/ooo/trunk/main/solenv/inc/minor.mk
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/solenv/inc/minor.mk?rev=1295640&r1=1295639&r2=1295640&view=diff
==============================================================================
--- incubator/ooo/trunk/main/solenv/inc/minor.mk (original)
+++ incubator/ooo/trunk/main/solenv/inc/minor.mk Thu Mar  1 15:58:24 2012
@@ -1,5 +1,5 @@
 RSCVERSION=340
-RSCREVISION=340m1(Build:9586)
-BUILD=9586
+RSCREVISION=340m1(Build:9587)
+BUILD=9587
 LAST_MINOR=m1
-SOURCEVERSION=OOO340
+SOURCEVERSION=AOO340

Modified: incubator/ooo/trunk/main/unotools/inc/unotools/bootstrap.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/unotools/inc/unotools/bootstrap.hxx?rev=1295640&r1=1295639&r2=1295640&view=diff
==============================================================================
--- incubator/ooo/trunk/main/unotools/inc/unotools/bootstrap.hxx (original)
+++ incubator/ooo/trunk/main/unotools/inc/unotools/bootstrap.hxx Thu Mar  1 15:58:24 2012
@@ -56,6 +56,9 @@ namespace utl
         /// retrieve the BUILDID information item; uses the given default, if not found
         static rtl::OUString getBuildIdData(rtl::OUString const& _sDefault);
 
+        /// retrieve the SCS Revision information item
+        static rtl::OUString getRevisionInfo();
+
 		/// retrieve the ALLUSERS information item from setup.ini file; uses the given default, if not found
 		static rtl::OUString getAllUsersValue(rtl::OUString const& _sDefault);
 

Modified: incubator/ooo/trunk/main/unotools/source/config/bootstrap.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/unotools/source/config/bootstrap.cxx?rev=1295640&r1=1295639&r2=1295640&view=diff
==============================================================================
--- incubator/ooo/trunk/main/unotools/source/config/bootstrap.cxx (original)
+++ incubator/ooo/trunk/main/unotools/source/config/bootstrap.cxx Thu Mar  1 15:58:24 2012
@@ -63,6 +63,7 @@
 #define BOOTSTRAP_DIRNAME_USERDIR		    "user"
 
 #define VERSIONFILE_SECTION         		"Versions"
+#define VERSIONFILE_ITEM_SCSREVISION        "Revision"
 
 #define SETUP_DATA_NAME                 	SAL_CONFIGFILE("setup")
 #define SETUP_ITEM_ALLUSERS         		"ALLUSERS"
@@ -672,6 +673,22 @@ OUString Bootstrap::getBuildIdData(OUStr
 }
 // ---------------------------------------------------------------------------------------
 
+OUString Bootstrap::getRevisionInfo()
+{
+    OUString const _sDefault;
+    OUString const csRevisionItem(RTL_CONSTASCII_USTRINGPARAM(VERSIONFILE_ITEM_SCSREVISION));
+
+    OUString sRevisionNumber;
+    // read buildid from version.ini (versionrc), if it doesn't exist or buildid is empty
+    if ( data().getVersionValue( csRevisionItem, sRevisionNumber, _sDefault ) != sal_True ||
+         sRevisionNumber.getLength() == 0 )
+         // read buildid from bootstrap.ini (bootstraprc)
+        sRevisionNumber = data().getBootstrapValue( csRevisionItem, _sDefault );
+    return sRevisionNumber;
+}
+
+// ---------------------------------------------------------------------------------------
+
 OUString Bootstrap::getAllUsersValue(OUString const& _sDefault)
 {
     OUString const csAllUsersItem(RTL_CONSTASCII_USTRINGPARAM(SETUP_ITEM_ALLUSERS));