1cdf0e10cSrcweir#!/usr/bin/python 2cdf0e10cSrcweir 3a0428e9eSAndrew Rist#************************************************************** 4a0428e9eSAndrew Rist# 5a0428e9eSAndrew Rist# Licensed to the Apache Software Foundation (ASF) under one 6a0428e9eSAndrew Rist# or more contributor license agreements. See the NOTICE file 7a0428e9eSAndrew Rist# distributed with this work for additional information 8a0428e9eSAndrew Rist# regarding copyright ownership. The ASF licenses this file 9a0428e9eSAndrew Rist# to you under the Apache License, Version 2.0 (the 10a0428e9eSAndrew Rist# "License"); you may not use this file except in compliance 11a0428e9eSAndrew Rist# with the License. You may obtain a copy of the License at 12a0428e9eSAndrew Rist# 13a0428e9eSAndrew Rist# http://www.apache.org/licenses/LICENSE-2.0 14a0428e9eSAndrew Rist# 15a0428e9eSAndrew Rist# Unless required by applicable law or agreed to in writing, 16a0428e9eSAndrew Rist# software distributed under the License is distributed on an 17a0428e9eSAndrew Rist# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 18a0428e9eSAndrew Rist# KIND, either express or implied. See the License for the 19a0428e9eSAndrew Rist# specific language governing permissions and limitations 20a0428e9eSAndrew Rist# under the License. 21a0428e9eSAndrew Rist# 22a0428e9eSAndrew Rist#************************************************************** 23cdf0e10cSrcweir 24cdf0e10cSrcweirimport os 25cdf0e10cSrcweirimport sys 26cdf0e10cSrcweirimport string 27cdf0e10cSrcweirfrom os import path 28cdf0e10cSrcweir 29cdf0e10cSrcweirdef getCurrPath(): 30cdf0e10cSrcweir currPath = sys.path[0] or os.getcwd() 31cdf0e10cSrcweir currPath = path.abspath(currPath) 32cdf0e10cSrcweir return currPath 33cdf0e10cSrcweir 34cdf0e10cSrcweirdef getCwsWorkStamp(): 35cdf0e10cSrcweir cwsWorkStamp=os.getenv('CWS_WORK_STAMP') 36cdf0e10cSrcweir 37cdf0e10cSrcweir if not cwsWorkStamp: 38cdf0e10cSrcweir currPath=getCurrPath() 39cdf0e10cSrcweir 40cdf0e10cSrcweir os.chdir(os.getenv('SOLARENV')) 41cdf0e10cSrcweir 42cdf0e10cSrcweir (input, output) = os.popen4("svn info") 43cdf0e10cSrcweir 44cdf0e10cSrcweir for outline in output.readlines(): 45cdf0e10cSrcweir if outline.startswith("URL:"): 46cdf0e10cSrcweir cwsWorkStamp = outline[outline.index("svn.services"):outline.index("solenv")-1] 47cdf0e10cSrcweir cwsWorkStamp = cwsWorkStamp[cwsWorkStamp.rfind("/")+1:len(cwsWorkStamp)] 48cdf0e10cSrcweir break 49cdf0e10cSrcweir 50cdf0e10cSrcweir os.putenv("CWS_WORK_STAMP",cwsWorkStamp); 51cdf0e10cSrcweir os.chdir(currPath) 52cdf0e10cSrcweir 53cdf0e10cSrcweir return string.strip(cwsWorkStamp) 54cdf0e10cSrcweir 55cdf0e10cSrcweirdef getMinor(cwsWorkStamp): 56cdf0e10cSrcweir minor = os.getenv('UPDMINOR') 57cdf0e10cSrcweir 58cdf0e10cSrcweir if not minor: 59cdf0e10cSrcweir if (os.getenv('OSTYPE') == "cygwin"): 60cdf0e10cSrcweir bash=os.getenv("SHELL") 61cdf0e10cSrcweir (input, output) = os.popen4("cygpath -w "+bash) 62cdf0e10cSrcweir winbash=string.strip(output.readlines()[0]) 63cdf0e10cSrcweir cws=winbash+" -c 'cws query -c "+cwsWorkStamp+" current'" 64cdf0e10cSrcweir else: 65cdf0e10cSrcweir cws="cws query -c "+cwsWorkStamp+" current" 66cdf0e10cSrcweir 67cdf0e10cSrcweir (input, output) = os.popen4(cws) 68cdf0e10cSrcweir 69cdf0e10cSrcweir found=0 70cdf0e10cSrcweir for outline in output.readlines(): 71cdf0e10cSrcweir if found: 72cdf0e10cSrcweir minor=outline 73cdf0e10cSrcweir break 74cdf0e10cSrcweir elif outline.find("Current milestone:") != -1: 75cdf0e10cSrcweir found=1 76cdf0e10cSrcweir 77cdf0e10cSrcweir return string.strip(minor) 78cdf0e10cSrcweir 79cdf0e10cSrcweir 80cdf0e10cSrcweirworkstamp = os.getenv('WORK_STAMP') 81cdf0e10cSrcweirsolenv= os.getenv('SOLARENV') 82cdf0e10cSrcweircwsWorkStamp=getCwsWorkStamp() 83cdf0e10cSrcweirminor = getMinor(cwsWorkStamp) 84cdf0e10cSrcweir 85cdf0e10cSrcweiroldWorkStamp = workstamp + "_" + minor 86cdf0e10cSrcweirdiff="svn diff --summarize --old=svn://svn.services.openoffice.org/ooo/tags/"+oldWorkStamp+" --new=svn://svn.services.openoffice.org/ooo/cws/"+cwsWorkStamp 87cdf0e10cSrcweir 88cdf0e10cSrcweirmodules=[] 89cdf0e10cSrcweir(input, output) = os.popen4(diff) 90cdf0e10cSrcweir 91cdf0e10cSrcweirfor outline in output.readlines(): 92cdf0e10cSrcweir if outline.find("svn://svn.services.openoffice.org"): 93cdf0e10cSrcweir index = outline.index(oldWorkStamp)+len(oldWorkStamp)+1 94cdf0e10cSrcweir newModule="" 95cdf0e10cSrcweir if outline.find("/",index) != -1: 96cdf0e10cSrcweir # seems to be a file 97cdf0e10cSrcweir newModule=string.strip(outline[index:outline.index("/",index)]) 98cdf0e10cSrcweir else: 99cdf0e10cSrcweir #seems to be a folder 100cdf0e10cSrcweir if len(outline[index:]) > 0: 101cdf0e10cSrcweir newModule=string.strip(outline[index:]) 102cdf0e10cSrcweir if newModule != "" and not modules.count(newModule): 103cdf0e10cSrcweir modules.append(newModule) 104cdf0e10cSrcweir 105cdf0e10cSrcweirfor module in modules: 106*b0ad9294SPedro Giffuni print(module) 107