1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #include "minormk.hxx"
29 #include "prodmap.hxx"
31 #include <tools/fsys.hxx>
32 #include <tools/geninfo.hxx>
38 /*****************************************************************************/
40 GenericInformationList
*pList
,
41 const ByteString
&rVersion
,
42 const ByteString
&rWorkStamp
,
43 const ByteString
&rEnvironment
,
44 const ByteString
&rMinor
46 /*****************************************************************************/
48 String
sRoot( ProductMapper::GetVersionRoot( pList
, rVersion
));
50 ByteString
sPath( sRoot
, RTL_TEXTENCODING_ASCII_US
);
52 sPath
+= rEnvironment
;
60 sPath
.SearchAndReplaceAll( "\\", "/" );
61 while( sPath
.SearchAndReplace( "//", "/" ) != STRING_NOTFOUND
) {};
63 sPath
.SearchAndReplaceAll( "/", "\\" );
64 while( sPath
.SearchAndReplace( "\\\\", "\\" ) != STRING_NOTFOUND
) {};
66 DirEntry
aPath( String( sPath
, RTL_TEXTENCODING_ASCII_US
));
68 ByteString
sFile( rWorkStamp
);
71 DirEntry
aFile( aPath
);
72 aFile
+= DirEntry( String( sFile
, RTL_TEXTENCODING_ASCII_US
));
73 if ( !aFile
.Exists()) {
74 sFile
= sFile
.Copy( 3 );
76 aFile
+= DirEntry( String( sFile
, RTL_TEXTENCODING_ASCII_US
));
78 ReadMinorMk( aFile
.GetFull());
82 /*****************************************************************************/
83 MinorMk::MinorMk( GenericInformationList
*pList
, const ByteString rVersion
)
84 /*****************************************************************************/
86 String
sRoot( ProductMapper::GetVersionRoot( pList
, rVersion
));
88 ByteString
sPath( sRoot
, RTL_TEXTENCODING_ASCII_US
);
89 sPath
+= "/src/solenv/inc";
91 sPath
.SearchAndReplaceAll( "\\", "/" );
92 while( sPath
.SearchAndReplace( "//", "/" ) != STRING_NOTFOUND
) {};
94 sPath
.SearchAndReplaceAll( "/", "\\" );
95 while( sPath
.SearchAndReplace( "\\\\", "\\" ) != STRING_NOTFOUND
) {};
97 DirEntry
aPath( String( sPath
, RTL_TEXTENCODING_ASCII_US
));
99 ByteString
sFile( "minor.mk" );
101 DirEntry
aFile( aPath
);
102 aFile
+= DirEntry( String( sFile
, RTL_TEXTENCODING_ASCII_US
));
104 ReadMinorMk( aFile
.GetFull());
108 /*****************************************************************************/
109 MinorMk::MinorMk( const ByteString
&rMinor
, const ByteString
&rEnvironment
)
110 /*****************************************************************************/
113 ByteString
sDelimiter( DirEntry::GetAccessDelimiter(), RTL_TEXTENCODING_ASCII_US
);
116 ByteString
sSolver( GetEnv( "SOLARVERSION" ));
118 if ( !sSolver
.Len()) {
119 sSolver
= GetEnv( "SOLARVER" );
122 ByteString
sUPD( GetEnv( "UPD" ));
124 ByteString
sMinorMk( sSolver
);
125 sMinorMk
+= sDelimiter
;
128 sMinorMk
+= sDelimiter
;
131 if ( rEnvironment
.Len()) {
132 sMinorMk
+= rEnvironment
;
133 sMinorMk
+= sDelimiter
;
139 sMinorMk
+= sDelimiter
;
143 sMinorMk
+= "minor.mk";
145 String
sFile( sMinorMk
, RTL_TEXTENCODING_ASCII_US
);
147 ReadMinorMk( sFile
);
150 /*****************************************************************************/
151 void MinorMk::ReadMinorMk( const String
&rFileName
)
152 /*****************************************************************************/
154 if ( DirEntry( rFileName
).Exists()) {
156 SvFileStream
aStream( rFileName
, STREAM_STD_READ
);
157 while ( !aStream
.IsOpen())
158 aStream
.Open( rFileName
, STREAM_STD_READ
);
161 while ( !aStream
.IsEof()) {
162 aStream
.ReadLine( sLine
);
164 if ( sLine
.GetToken( 0, '=' ) == "RSCVERSION" )
165 sRSCVERSION
= sLine
.GetToken( 1, '=' );
166 else if ( sLine
.GetToken( 0, '=' ) == "RSCREVISION" )
167 sRSCREVISION
= sLine
.GetToken( 1, '=' );
168 else if ( sLine
.GetToken( 0, '=' ) == "BUILD" )
169 sBUILD
= sLine
.GetToken( 1, '=' );
170 else if ( sLine
.GetToken( 0, '=' ) == "LAST_MINOR" )
171 sLAST_MINOR
= sLine
.GetToken( 1, '=' );
175 sRSCVERSION
.EraseTrailingChars();
176 sRSCREVISION
.EraseTrailingChars();
177 sBUILD
.EraseTrailingChars();
178 sLAST_MINOR
.EraseTrailingChars();
182 /*****************************************************************************/
184 /*****************************************************************************/