1#!/usr/bin/python 2 3#************************************************************************* 4# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5# 6# Copyright 2000, 2010 Oracle and/or its affiliates. 7# 8# OpenOffice.org - a multi-platform office productivity suite 9# 10# This file is part of OpenOffice.org. 11# 12# OpenOffice.org is free software: you can redistribute it and/or modify 13# it under the terms of the GNU Lesser General Public License version 3 14# only, as published by the Free Software Foundation. 15# 16# OpenOffice.org is distributed in the hope that it will be useful, 17# but WITHOUT ANY WARRANTY; without even the implied warranty of 18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19# GNU Lesser General Public License version 3 for more details 20# (a copy is included in the LICENSE file that accompanied this code). 21# 22# You should have received a copy of the GNU Lesser General Public License 23# version 3 along with OpenOffice.org. If not, see 24# <http://www.openoffice.org/license.html> 25# for a copy of the LGPLv3 License. 26# 27#***********************************************************************/ 28 29import os 30import sys 31import string 32from os import path 33 34def getCurrPath(): 35 currPath = sys.path[0] or os.getcwd() 36 currPath = path.abspath(currPath) 37 return currPath 38 39def getCwsWorkStamp(): 40 cwsWorkStamp=os.getenv('CWS_WORK_STAMP') 41 42 if not cwsWorkStamp: 43 currPath=getCurrPath() 44 45 os.chdir(os.getenv('SOLARENV')) 46 47 (input, output) = os.popen4("svn info") 48 49 for outline in output.readlines(): 50 if outline.startswith("URL:"): 51 cwsWorkStamp = outline[outline.index("svn.services"):outline.index("solenv")-1] 52 cwsWorkStamp = cwsWorkStamp[cwsWorkStamp.rfind("/")+1:len(cwsWorkStamp)] 53 break 54 55 os.putenv("CWS_WORK_STAMP",cwsWorkStamp); 56 os.chdir(currPath) 57 58 return string.strip(cwsWorkStamp) 59 60def getMinor(cwsWorkStamp): 61 minor = os.getenv('UPDMINOR') 62 63 if not minor: 64 if (os.getenv('OSTYPE') == "cygwin"): 65 bash=os.getenv("SHELL") 66 (input, output) = os.popen4("cygpath -w "+bash) 67 winbash=string.strip(output.readlines()[0]) 68 cws=winbash+" -c 'cws query -c "+cwsWorkStamp+" current'" 69 else: 70 cws="cws query -c "+cwsWorkStamp+" current" 71 72 (input, output) = os.popen4(cws) 73 74 found=0 75 for outline in output.readlines(): 76 if found: 77 minor=outline 78 break 79 elif outline.find("Current milestone:") != -1: 80 found=1 81 82 return string.strip(minor) 83 84 85workstamp = os.getenv('WORK_STAMP') 86solenv= os.getenv('SOLARENV') 87cwsWorkStamp=getCwsWorkStamp() 88minor = getMinor(cwsWorkStamp) 89 90oldWorkStamp = workstamp + "_" + minor 91diff="svn diff --summarize --old=svn://svn.services.openoffice.org/ooo/tags/"+oldWorkStamp+" --new=svn://svn.services.openoffice.org/ooo/cws/"+cwsWorkStamp 92 93modules=[] 94(input, output) = os.popen4(diff) 95 96for outline in output.readlines(): 97 if outline.find("svn://svn.services.openoffice.org"): 98 index = outline.index(oldWorkStamp)+len(oldWorkStamp)+1 99 newModule="" 100 if outline.find("/",index) != -1: 101 # seems to be a file 102 newModule=string.strip(outline[index:outline.index("/",index)]) 103 else: 104 #seems to be a folder 105 if len(outline[index:]) > 0: 106 newModule=string.strip(outline[index:]) 107 if newModule != "" and not modules.count(newModule): 108 modules.append(newModule) 109 110for module in modules: 111 print module