adapt localize to LibreOffice directory structure

This commit is contained in:
Andras Timar 2011-03-08 22:48:09 +01:00
parent 1acfb268fd
commit 9849827a5b
4 changed files with 78 additions and 16 deletions

View file

@ -170,11 +170,11 @@ sub splitfile{
}
close( MYFILE );
if( !defined $ENV{SOURCE_ROOT_DIR} ){
print "Error, no SOURCE_ROOT_DIR in env found.\n";
if( !defined $ENV{SRC_ROOT} ){
print "Error, no SRC_ROOT in env found.\n";
exit( -1 );
}
my $src_root = $ENV{SOURCE_ROOT_DIR};
my $src_root = $ENV{SRC_ROOT};
my $ooo_src_root = $ENV{SRC_ROOT};
my $so_l10n_path = $src_root."/sun/l10n_so/source";
my $ooo_l10n_path = $ooo_src_root."/l10n/source";
@ -387,7 +387,7 @@ sub collectfiles{
STDOUT->autoflush( 1 );
my $working_path = getcwd();
chdir $ENV{SOURCE_ROOT_DIR}, if defined $ENV{SOURCE_ROOT_DIR};
chdir $ENV{SRC_ROOT}, if defined $ENV{SRC_ROOT};
add_paths( $langhash_ref );
my ( $LOCALIZEPARTICLE , $localizeSDF ) = File::Temp::tempfile();

View file

@ -122,6 +122,56 @@ const char *PositiveList[] = {
"NULL"
};
const char *ModuleList[] = {
"accessibility",
"avmedia",
"basctl",
"basic",
"chart2",
"connectivity",
"crashrep",
"cui",
"dbaccess",
"desktop",
"editeng",
"extensions",
"filter",
"forms",
"formula",
"fpicker",
"framework",
"helpcontent2",
"instsetoo_native",
"mysqlc",
"officecfg",
"padmin",
"readlicense_oo",
"reportbuilder",
"reportdesign",
"sc",
"scaddins",
"sccomp",
"scp2",
"sd",
"sdext",
"setup_native",
"sfx2",
"shell",
"starmath",
"svl",
"svtools",
"svx",
"sw",
"swext",
"sysui",
"ucbhelper",
"uui",
"vcl",
"wizards",
"xmlsecurity",
"NULL",
};
const char PRJ_DIR_NAME[] = "prj";
const char DLIST_NAME[] = "d.lst";
@ -263,8 +313,16 @@ const ByteString SourceTreeLocalizer::GetProjectRootRel()
bool skipProject( ByteString sPrj )
{
static const ByteString READLICENSE( "readlicense" );
return sPrj.EqualsIgnoreCaseAscii( READLICENSE );
int nIndex = 0;
bool bReturn = TRUE;
ByteString sModule( ModuleList[ nIndex ] );
while( !sModule.Equals( "NULL" ) && bReturn ) {
if( sPrj.Equals ( sModule ) )
bReturn = FALSE;
nIndex++;
sModule = ModuleList[ nIndex ];
}
return bReturn;
}
/*****************************************************************************/
@ -937,9 +995,9 @@ int _cdecl main( int argc, char *argv[] )
{
string curRepository;
if( has_minor_ext )
curRepository = string( Export::GetEnv("SOURCE_ROOT_DIR") ) + "/" + *iter + minor_ext;
curRepository = string( Export::GetEnv("SRC_ROOT") ) + "/" + *iter + minor_ext;
else
curRepository = string( Export::GetEnv("SOURCE_ROOT_DIR") ) + "/" + *iter;
curRepository = string( Export::GetEnv("SRC_ROOT") ) + "/" + *iter;
cout << "Localizing repository " << curRepository << "\n";
SourceTreeLocalizer aIter( ByteString( curRepository.c_str() ) , sVersion , (sOutput.Len() > 0) , bSkipLinks );
aIter.SetLanguageRestriction( sLanguages );

View file

@ -70,7 +70,9 @@ void SourceTreeIterator::ExecuteDirectory( transex::Directory& aDirectory )
static rtl::OUString WCARD4 ( RTL_CONSTASCII_USTRINGPARAM("common") );
static rtl::OUString WCARD5 ( RTL_CONSTASCII_USTRINGPARAM("unxmac") );
static rtl::OUString WCARD6 ( RTL_CONSTASCII_USTRINGPARAM("unxubt") );
static rtl::OUString WCARD7 ( RTL_CONSTASCII_USTRINGPARAM(".svn") );
static rtl::OUString WCARD7 ( RTL_CONSTASCII_USTRINGPARAM(".git") );
static rtl::OUString WCARD8 ( RTL_CONSTASCII_USTRINGPARAM("clone") );
static rtl::OUString WCARD9 ( RTL_CONSTASCII_USTRINGPARAM("install") );
if( sDirName.indexOf( WCARD1 , 0 ) > -1 ||
@ -79,7 +81,9 @@ void SourceTreeIterator::ExecuteDirectory( transex::Directory& aDirectory )
sDirName.indexOf( WCARD4 , 0 ) > -1 ||
sDirName.indexOf( WCARD5 , 0 ) > -1 ||
sDirName.indexOf( WCARD6 , 0 ) > -1 ||
sDirName.indexOf( WCARD7 , 0 ) > -1
sDirName.indexOf( WCARD7 , 0 ) > -1 ||
sDirName.indexOf( WCARD8 , 0 ) > -1 ||
sDirName.indexOf( WCARD9 , 0 ) > -1
) return;
//printf("**** %s \n", OUStringToOString( sDirName , RTL_TEXTENCODING_UTF8 , sDirName.getLength() ).getStr() );

View file

@ -22,7 +22,7 @@ namespace transex3
bool Treeconfig::parseConfig(){
string source_config_file = string( static_cast<ByteString>( Export::GetEnv("SOURCE_ROOT_DIR") ).GetBuffer() );
string source_config_file = string( static_cast<ByteString>( Export::GetEnv("SRC_ROOT") ).GetBuffer() );
if( source_config_file.empty() )
{
cerr << "Error: no suitable environment set?!?";
@ -50,13 +50,13 @@ bool Treeconfig::getActiveRepositories( vector<string>& active_repos ){
string pwd;
string guessedRepo;
Export::getCurrentDir( pwd );
string source_root = Export::GetEnv( "SOURCE_ROOT_DIR" );
string source_root = Export::GetEnv( "SRC_ROOT" );
string solarsrc = Export::GetEnv( "SOLARSRC" );
string partial;
// if we are inside of a repository root then active it otherwise let the app handle the return!
string::size_type pos = pwd.find_first_of( source_root );
if( pos != string::npos && ( pos + source_root.length() +1 ) < pwd.length()){ // I am within SOURCE_ROOT_DIR
if( pos != string::npos && ( pos + source_root.length() +1 ) < pwd.length()){ // I am within SRC_ROOT
partial = pwd.substr( pos + source_root.length() +1 , pwd.length());
string::size_type nextPart = partial.find_first_of( "/" );
if( nextPart != string::npos )
@ -64,7 +64,7 @@ bool Treeconfig::getActiveRepositories( vector<string>& active_repos ){
else
guessedRepo = partial;
}
else // I am NOT within SOURCE_ROOT_DIR
else // I am NOT within SRC_ROOT
hasPath = true;
if( isPresent )
@ -94,7 +94,7 @@ bool Treeconfig::getActiveRepositories( vector<string>& active_repos ){
if( !guessedRepo.empty() ){
active_repos.push_back( guessedRepo ); // add myrepo
}
return hasPath; // are we deep inside of a source tree or outside of SOURCE_ROOT_DIR?
return hasPath; // are we deep inside of a source tree or outside of SRC_ROOT?
}
void Treeconfig::getCurrentDir( string& dir )
@ -109,7 +109,7 @@ void Treeconfig::getCurrentDir( string& dir )
bool Treeconfig::isConfigFilePresent()
{
string config_file = Export::GetEnv( "SOURCE_ROOT_DIR" );
string config_file = Export::GetEnv( "SRC_ROOT" );
config_file += "/source_config";
struct stat status;