summaryrefslogtreecommitdiffstats
path: root/solenv/maven/mvn.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
commited5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch)
tree7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /solenv/maven/mvn.py
parentInitial commit. (diff)
downloadlibreoffice-cb75148ebd0135178ff46f89a30139c44f8d2040.tar.xz
libreoffice-cb75148ebd0135178ff46f89a30139c44f8d2040.zip
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'solenv/maven/mvn.py')
-rwxr-xr-xsolenv/maven/mvn.py78
1 files changed, 78 insertions, 0 deletions
diff --git a/solenv/maven/mvn.py b/solenv/maven/mvn.py
new file mode 100755
index 000000000..5b45447da
--- /dev/null
+++ b/solenv/maven/mvn.py
@@ -0,0 +1,78 @@
+#!/usr/bin/python
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+from __future__ import print_function
+from optparse import OptionParser
+from os import path, environ
+from subprocess import check_output
+from sys import stderr
+
+M = {
+ 'juh': 'javaunohelper',
+ 'jurt': 'jurt',
+ 'officebean': 'bean',
+ 'ridl': 'ridljar',
+ 'unoil': 'unoil',
+ 'unoloader': 'ridljar',
+ 'libreoffice': 'ridljar',
+}
+
+opts = OptionParser()
+opts.add_option('--repository', help='maven repository id')
+opts.add_option('--url', help='maven repository url')
+opts.add_option('-o')
+opts.add_option('-a', help='action (valid actions are: install,deploy)')
+opts.add_option('-v', help='gerrit version')
+opts.add_option('-s', action='append', help='triplet of artifactId:type:path')
+
+args, ctx = opts.parse_args()
+if not args.v:
+ print('version is empty', file=stderr)
+ exit(1)
+
+root = path.abspath(__file__)
+while not path.exists(path.join(root, '.buckconfig')):
+ root = path.dirname(root)
+
+if 'install' == args.a:
+ cmd = [
+ 'mvn',
+ 'install:install-file',
+ '-Dversion=%s' % args.v,
+ ]
+elif 'deploy' == args.a:
+ cmd = [
+ 'mvn',
+ 'gpg:sign-and-deploy-file',
+ '-DrepositoryId=%s' % args.repository,
+ '-Durl=%s' % args.url,
+ ]
+else:
+ print("unknown action -a %s" % args.a, file=stderr)
+ exit(1)
+
+for spec in args.s:
+ artifact, packaging_type, src = spec.split(':')
+ exe = cmd + [
+ '-DpomFile=%s' % path.join(root, '%s/pom.%s.xml' % (M[artifact], artifact)),
+ '-Dpackaging=%s' % packaging_type,
+ '-Dfile=%s' % src,
+ ]
+ try:
+ if environ.get('VERBOSE'):
+ print(' '.join(exe), file=stderr)
+ check_output(exe)
+ except Exception as e:
+ print('%s command failed: %s' % (args.a, e), file=stderr)
+ exit(1)
+
+with open(args.o, 'w') as fd:
+ if args.repository:
+ print('Repository: %s' % args.repository, file=fd)
+ if args.url:
+ print('URL: %s' % args.url, file=fd)
+ print('Version: %s' % args.v, file=fd)