Update ooo320-m1
[ooovba.git] / solenv / bin / cwstouched.py
blob6ed3e67757b2137bdffcb83b296ad904c25e4cc4
1 #!/usr/bin/python
3 #*************************************************************************
4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 #
6 # Copyright 2008 by Sun Microsystems, Inc.
8 # OpenOffice.org - a multi-platform office productivity suite
10 # This file is part of OpenOffice.org.
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.
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).
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 #***********************************************************************/
28 import os
29 import sys
30 import string
31 from os import path
33 def getCurrPath():
34 currPath = sys.path[0] or os.getcwd()
35 currPath = path.abspath(currPath)
36 return currPath
38 def getCwsWorkStamp():
39 cwsWorkStamp=os.getenv('CWS_WORK_STAMP')
41 if not cwsWorkStamp:
42 currPath=getCurrPath()
44 os.chdir(os.getenv('SOLARENV'))
46 (input, output) = os.popen4("svn info")
48 for outline in output.readlines():
49 if outline.startswith("URL:"):
50 cwsWorkStamp = outline[outline.index("svn.services"):outline.index("solenv")-1]
51 cwsWorkStamp = cwsWorkStamp[cwsWorkStamp.rfind("/")+1:len(cwsWorkStamp)]
52 break
54 os.putenv("CWS_WORK_STAMP",cwsWorkStamp);
55 os.chdir(currPath)
57 return string.strip(cwsWorkStamp)
59 def getMinor(cwsWorkStamp):
60 minor = os.getenv('UPDMINOR')
62 if not minor:
63 if (os.getenv('OSTYPE') == "cygwin"):
64 bash=os.getenv("SHELL")
65 (input, output) = os.popen4("cygpath -w "+bash)
66 winbash=string.strip(output.readlines()[0])
67 cws=winbash+" -c 'cws query -c "+cwsWorkStamp+" current'"
68 else:
69 cws="cws query -c "+cwsWorkStamp+" current"
71 (input, output) = os.popen4(cws)
73 found=0
74 for outline in output.readlines():
75 if found:
76 minor=outline
77 break
78 elif outline.find("Current milestone:") != -1:
79 found=1
81 return string.strip(minor)
84 workstamp = os.getenv('WORK_STAMP')
85 solenv= os.getenv('SOLARENV')
86 cwsWorkStamp=getCwsWorkStamp()
87 minor = getMinor(cwsWorkStamp)
89 oldWorkStamp = workstamp + "_" + minor
90 diff="svn diff --summarize --old=svn://svn.services.openoffice.org/ooo/tags/"+oldWorkStamp+" --new=svn://svn.services.openoffice.org/ooo/cws/"+cwsWorkStamp
92 modules=[]
93 (input, output) = os.popen4(diff)
95 for outline in output.readlines():
96 if outline.find("svn://svn.services.openoffice.org"):
97 index = outline.index(oldWorkStamp)+len(oldWorkStamp)+1
98 newModule=""
99 if outline.find("/",index) != -1:
100 # seems to be a file
101 newModule=string.strip(outline[index:outline.index("/",index)])
102 else:
103 #seems to be a folder
104 if len(outline[index:]) > 0:
105 newModule=string.strip(outline[index:])
106 if newModule != "" and not modules.count(newModule):
107 modules.append(newModule)
109 for module in modules:
110 print module