Kaydet (Commit) a68cb56e authored tarafından Jürgen Schmidt's avatar Jürgen Schmidt

add revision to version file, add revision info to about independent of…

add revision to version file, add revision info to about independent of --with-build-version, increase buildid, adapt SOURCEVERSION
üst 6c15b8fa
......@@ -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();
......
......@@ -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;
......
......@@ -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;
......
#**************************************************************
#
# 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;
......@@ -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/;
......
RSCVERSION=340
RSCREVISION=340m1(Build:9586)
BUILD=9586
RSCREVISION=340m1(Build:9587)
BUILD=9587
LAST_MINOR=m1
SOURCEVERSION=OOO340
SOURCEVERSION=AOO340
......@@ -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);
......
......@@ -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));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment