diff options
author | Jürgen Schmidt <jsc@apache.org> | 2012-03-01 14:58:24 +0000 |
---|---|---|
committer | Jürgen Schmidt <jsc@apache.org> | 2012-03-01 14:58:24 +0000 |
commit | a68cb56ebe40cf499ff16b661f86d44e744572db (patch) | |
tree | 29f0982962683f4c996b91c2942e939930c7848c | |
parent | 6c15b8fad442596e08d04f90a944ea7a7589a66f (diff) |
add revision to version file, add revision info to about independent of --with-build-version, increase buildid, adapt SOURCEVERSION
-rw-r--r-- | cui/source/dialogs/about.cxx | 57 | ||||
-rw-r--r-- | scp2/source/ooo/common_brand.scp | 8 | ||||
-rw-r--r-- | scp2/source/ooo/profileitem_ooo.scp | 8 | ||||
-rw-r--r-- | solenv/bin/modules/SvnRevision.pm | 82 | ||||
-rw-r--r-- | solenv/bin/modules/installer/scriptitems.pm | 6 | ||||
-rw-r--r-- | solenv/inc/minor.mk | 6 | ||||
-rw-r--r-- | unotools/inc/unotools/bootstrap.hxx | 3 | ||||
-rw-r--r-- | unotools/source/config/bootstrap.cxx | 17 |
8 files changed, 138 insertions, 49 deletions
diff --git a/cui/source/dialogs/about.cxx b/cui/source/dialogs/about.cxx index 4f1020d63ee3..7b8910530bf3 100644 --- a/cui/source/dialogs/about.cxx +++ b/cui/source/dialogs/about.cxx @@ -72,20 +72,9 @@ static void layoutText( FixedInfo &rText, long &nY, long nTextWidth, Size a6Size 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" ); @@ -107,33 +96,6 @@ String InitDevVersionStr() 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* pParent, const ResId& rId ) : // 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* pParent, const ResId& rId ) : 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* pParent, const ResId& rId ) : 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(); diff --git a/scp2/source/ooo/common_brand.scp b/scp2/source/ooo/common_brand.scp index a42a6a204cfa..d6489d951f71 100644 --- a/scp2/source/ooo/common_brand.scp +++ b/scp2/source/ooo/common_brand.scp @@ -916,6 +916,14 @@ ProfileItem gid_Brand_Profileitem_Version_Buildid 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; diff --git a/scp2/source/ooo/profileitem_ooo.scp b/scp2/source/ooo/profileitem_ooo.scp index 8ea6a4f9606a..e8dbda191426 100644 --- a/scp2/source/ooo/profileitem_ooo.scp +++ b/scp2/source/ooo/profileitem_ooo.scp @@ -441,6 +441,14 @@ ProfileItem gid_Basis_Profileitem_Version_Buildid 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; diff --git a/solenv/bin/modules/SvnRevision.pm b/solenv/bin/modules/SvnRevision.pm new file mode 100644 index 000000000000..d15c84f88be5 --- /dev/null +++ b/solenv/bin/modules/SvnRevision.pm @@ -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; diff --git a/solenv/bin/modules/installer/scriptitems.pm b/solenv/bin/modules/installer/scriptitems.pm index 21872996189b..8ba010d004fb 100644 --- a/solenv/bin/modules/installer/scriptitems.pm +++ b/solenv/bin/modules/installer/scriptitems.pm @@ -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/; diff --git a/solenv/inc/minor.mk b/solenv/inc/minor.mk index c748d9d700ad..84f193a3a478 100644 --- a/solenv/inc/minor.mk +++ b/solenv/inc/minor.mk @@ -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 diff --git a/unotools/inc/unotools/bootstrap.hxx b/unotools/inc/unotools/bootstrap.hxx index 6d80101cf944..98beacf30e25 100644 --- a/unotools/inc/unotools/bootstrap.hxx +++ b/unotools/inc/unotools/bootstrap.hxx @@ -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); diff --git a/unotools/source/config/bootstrap.cxx b/unotools/source/config/bootstrap.cxx index cf636567e1bf..a333e4bf588b 100644 --- a/unotools/source/config/bootstrap.cxx +++ b/unotools/source/config/bootstrap.cxx @@ -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(OUString const& _sDefault) } // --------------------------------------------------------------------------------------- +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)); |