File: update_root_pom_versions.py

package info (click to toggle)
eclipse-tracecompass 6.2.0%2Brepack-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 77,440 kB
  • sloc: java: 316,465; xml: 99,829; perl: 400; sh: 353; makefile: 43; javascript: 29; python: 18
file content (33 lines) | stat: -rw-r--r-- 1,514 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
###############################################################################
# Copyright (c) 2016 Ericsson
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
# which accompanies this distribution, and is available at
# https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
###############################################################################

#args: filename oldversion newversion

#Update root pom.xml versions. For example
#   <artifactId>org.eclipse.tracecompass</artifactId>
#-  <version>2.0.0-SNAPSHOT</version>
#+  <version>2.0.1-SNAPSHOT</version>
#
# Also the target plarform:
#
#               <classifier>${target-platform}</classifier>
#-              <version>2.0.0-SNAPSHOT</version>
#+              <version>2.0.1-SNAPSHOT</version>
#             </artifact>

import sys, re
if len(sys.argv) < 4:
    sys.exit('Usage: python update_root_pom_versions.py [file] [old version] [new version]')
fileContent = open(sys.argv[1]).read()
fileContent = re.sub("(<artifactId>org.eclipse.tracecompass.*</artifactId>\n\s+)<version>" + sys.argv[2] + "-SNAPSHOT</version>", "\g<1><version>" + sys.argv[3] + "-SNAPSHOT</version>", fileContent)
# Also the target platform version being used
fileContent = re.sub("<version>" + sys.argv[2] + "-SNAPSHOT</version>(\n\s+</artifact>)", "<version>" + sys.argv[3] + "-SNAPSHOT</version>\g<1>", fileContent)
open(sys.argv[1], "w").write(fileContent)