From e6ba3ff8d71e5e946d986253e43777681a5ca170160ba68db207681299653f34 Mon Sep 17 00:00:00 2001 From: Fridrich Strba Date: Mon, 28 Jan 2019 06:38:37 +0000 Subject: [PATCH 1/6] OBS-URL: https://build.opensuse.org/package/show/Java:packages/apache-commons-cli?expand=0&rev=21 --- CLI-253-workaround.patch | 96 ++++++++++++++++++++++++++++++++++++++++ apache-commons-cli.spec | 46 +++++++------------ 2 files changed, 113 insertions(+), 29 deletions(-) create mode 100644 CLI-253-workaround.patch diff --git a/CLI-253-workaround.patch b/CLI-253-workaround.patch new file mode 100644 index 0000000..213e9b8 --- /dev/null +++ b/CLI-253-workaround.patch @@ -0,0 +1,96 @@ +commit 77218790904f40395304669f5d79740f459c0a90 (HEAD -> cli-253, origin/cli-253) +Author: Michal Srb +AuthorDate: Mon Jun 22 15:01:30 2015 +0200 +Commit: Michal Srb +CommitDate: Mon Jun 22 15:04:05 2015 +0200 + + [CLI-253] Prevent "Unrecognized option: --null" when handling long opts in PosixParser + +diff --git a/src/main/java/org/apache/commons/cli/Options.java b/src/main/java/org/apache/commons/cli/Options.java +index 0ee4eea..1c38194 100644 +--- a/src/main/java/org/apache/commons/cli/Options.java ++++ b/src/main/java/org/apache/commons/cli/Options.java +@@ -224,6 +224,20 @@ public class Options implements Serializable + } + + /** ++ * Retrieve the {@link Option} matching the long name specified. ++ * The leading hyphens in the name are ignored (up to 2). ++ * ++ * @param opt long name of the {@link Option} ++ * @return the option represented by opt ++ */ ++ Option getLongOption(String opt) ++ { ++ opt = Util.stripLeadingHyphens(opt); ++ ++ return longOpts.get(opt); ++ } ++ ++ /** + * Returns the options with a long name starting with the name specified. + * + * @param opt the partial name of the option +diff --git a/src/main/java/org/apache/commons/cli/PosixParser.java b/src/main/java/org/apache/commons/cli/PosixParser.java +index c13a65e..14d2936 100644 +--- a/src/main/java/org/apache/commons/cli/PosixParser.java ++++ b/src/main/java/org/apache/commons/cli/PosixParser.java +@@ -131,7 +131,7 @@ public class PosixParser extends Parser + } + else + { +- currentOption = options.getOption(matchingOpts.get(0)); ++ currentOption = options.getLongOption(matchingOpts.get(0)); + + tokens.add("--" + currentOption.getLongOpt()); + if (pos != -1) +diff --git a/src/test/java/org/apache/commons/cli/bug/BugCLI253Test.java b/src/test/java/org/apache/commons/cli/bug/BugCLI253Test.java +new file mode 100644 +index 0000000..e37b7bc +--- /dev/null ++++ b/src/test/java/org/apache/commons/cli/bug/BugCLI253Test.java +@@ -0,0 +1,44 @@ ++/* ++ * Licensed to the Apache Software Foundation (ASF) under one or more ++ * contributor license agreements. See the NOTICE file distributed with ++ * this work for additional information regarding copyright ownership. ++ * The ASF licenses this file to You under the Apache License, Version 2.0 ++ * (the "License"); you may not use this file except in compliance with ++ * the License. You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++package org.apache.commons.cli.bug; ++ ++import static org.junit.Assert.assertTrue; ++ ++import org.apache.commons.cli.CommandLine; ++import org.apache.commons.cli.Option; ++import org.apache.commons.cli.Options; ++import org.apache.commons.cli.ParseException; ++import org.apache.commons.cli.PosixParser; ++import org.junit.Test; ++ ++@SuppressWarnings("deprecation") // tests some deprecated classes ++public class BugCLI253Test { ++ ++ @Test ++ public void testGroovyUseCase() throws ParseException { ++ CommandLine cli = new PosixParser().parse(getOptions(), new String[] { "--classpath" }); ++ assertTrue(cli.hasOption("--classpath")); ++ } ++ ++ private Options getOptions() { ++ Options options = new Options(); ++ options.addOption(Option.builder("classpath").build()); ++ options.addOption(Option.builder("cp").longOpt("classpath").build()); ++ return options; ++ } ++} diff --git a/apache-commons-cli.spec b/apache-commons-cli.spec index 5ca0af2..9769703 100644 --- a/apache-commons-cli.spec +++ b/apache-commons-cli.spec @@ -1,7 +1,7 @@ # # spec file for package apache-commons-cli # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -24,25 +24,25 @@ Release: 0 Summary: Command Line Interface Library for Java License: Apache-2.0 Group: Development/Libraries/Java -Url: http://commons.apache.org/%{base_name}/ +URL: http://commons.apache.org/%{base_name}/ Source0: http://www.apache.org/dist/commons/%{base_name}/source/%{short_name}-%{version}-src.tar.gz Source1: build.xml.tar.bz2 -Patch0: commons-cli-1.4-jdk9.patch -BuildRoot: %{_tmppath}/%{name}-%{version}-build -BuildArch: noarch +Patch0: CLI-253-workaround.patch BuildRequires: ant +BuildRequires: apache-commons-parent BuildRequires: fdupes BuildRequires: java-devel >= 1.8 BuildRequires: javapackages-local -BuildRequires: javapackages-tools +Requires: apache-commons-parent Requires: java >= 1.8 Provides: jakarta-%{short_name} = %{version}-%{release} Obsoletes: jakarta-%{short_name} < %{version} Provides: apache-cli = %{version} Obsoletes: apache-cli < %{version} +BuildArch: noarch %description -The CLI library provides a simple and easy to use API for working with the +The CLI library provides a simple and easy to use API for working with the command line arguments and options. %package javadoc @@ -59,24 +59,19 @@ This package contains the API documentation for %{name}. %patch0 -p1 %build -export CLASSPATH=$(build-classpath \ - plexus/ \ - maven/ \ - ):target/classes:target/test-classes ant -Dmaven.mode.offline=true package javadoc \ -Dmaven.test.skip=true \ - -lib /usr/share/java + -lib %{_datadir}/java %install # jars -install -Dpm 644 target/%{short_name}-%{version}.jar %{buildroot}%{_javadir}/%{short_name}-%{version}.jar -(cd %{buildroot}%{_javadir} && for jar in *-%{version}*.jar; do ln -sf ${jar} apache-${jar}; done) -(cd %{buildroot}%{_javadir} && for jar in *-%{version}*.jar; do ln -sf ${jar} `echo $jar| sed "s|-%{version}||g"`; done) +install -Dpm 644 target/%{short_name}-%{version}.jar %{buildroot}%{_javadir}/%{short_name}.jar +ln -sf %{short_name}.jar %{buildroot}%{_javadir}/%{name}.jar # pom install -d -m 755 %{buildroot}%{_mavenpomdir} -install -pm 644 pom.xml %{buildroot}%{_mavenpomdir}/%{short_name}-%{version}.pom -%add_maven_depmap %{short_name}-%{version}.pom %{short_name}-%{version}.jar -a "org.apache.commons:%{short_name}" +install -pm 644 pom.xml %{buildroot}%{_mavenpomdir}/%{short_name}.pom +%add_maven_depmap %{short_name}.pom %{short_name}.jar -a "org.apache.commons:%{short_name}" # javadoc install -d -m 0755 %{buildroot}%{_javadocdir}/%{name}-%{version} @@ -84,20 +79,13 @@ cp -pr target/site/api*/* %{buildroot}%{_javadocdir}/%{name}-%{version}/ %fdupes -s %{buildroot}%{_javadocdir}/%{name}-%{version}/ ln -s %{name}-%{version} %{buildroot}%{_javadocdir}/%{name} -%files -%defattr(-,root,root) -%doc LICENSE.txt NOTICE.txt README.md RELEASE-NOTES.txt CONTRIBUTING.md -%{_javadir}/* -%{_mavenpomdir}/* -%if %{defined _maven_repository} -%config(noreplace) %{_mavendepmapfragdir}/%{name} -%else -%{_datadir}/maven-metadata/%{name}.xml -%endif +%files -f .mfiles +%license LICENSE.txt NOTICE.txt +%doc README.md RELEASE-NOTES.txt +%{_javadir}/%{name}.jar %files javadoc -%defattr(-,root,root) -%doc LICENSE.txt +%license LICENSE.txt %{_javadocdir}/* %changelog From 3cce15978f8b6d76319df73b70d82940c20a38d2eb29af0e548449ad2458fe3a Mon Sep 17 00:00:00 2001 From: Fridrich Strba Date: Mon, 28 Jan 2019 07:16:57 +0000 Subject: [PATCH 2/6] OBS-URL: https://build.opensuse.org/package/show/Java:packages/apache-commons-cli?expand=0&rev=22 --- commons-cli-1.4-jdk9.patch | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 commons-cli-1.4-jdk9.patch diff --git a/commons-cli-1.4-jdk9.patch b/commons-cli-1.4-jdk9.patch deleted file mode 100644 index 793a86c..0000000 --- a/commons-cli-1.4-jdk9.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- commons-cli-1.4-src/pom.xml 2017-03-09 13:59:23.000000000 +0100 -+++ commons-cli-1.4-src/pom.xml 2018-10-23 19:42:13.605822641 +0200 -@@ -163,8 +163,8 @@ - - - -- 1.5 -- 1.5 -+ 8 -+ 8 - cli - 1.4 - commons-cli-${commons.release.version} From e49c5531f2ffcb5f63c85ae017eb77153ae250676bba1b045dd91e51632874b5 Mon Sep 17 00:00:00 2001 From: Fridrich Strba Date: Mon, 28 Jan 2019 07:24:57 +0000 Subject: [PATCH 3/6] OBS-URL: https://build.opensuse.org/package/show/Java:packages/apache-commons-cli?expand=0&rev=23 --- apache-commons-cli.spec | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/apache-commons-cli.spec b/apache-commons-cli.spec index 9769703..590375c 100644 --- a/apache-commons-cli.spec +++ b/apache-commons-cli.spec @@ -74,10 +74,9 @@ install -pm 644 pom.xml %{buildroot}%{_mavenpomdir}/%{short_name}.pom %add_maven_depmap %{short_name}.pom %{short_name}.jar -a "org.apache.commons:%{short_name}" # javadoc -install -d -m 0755 %{buildroot}%{_javadocdir}/%{name}-%{version} -cp -pr target/site/api*/* %{buildroot}%{_javadocdir}/%{name}-%{version}/ -%fdupes -s %{buildroot}%{_javadocdir}/%{name}-%{version}/ -ln -s %{name}-%{version} %{buildroot}%{_javadocdir}/%{name} +install -d -m 0755 %{buildroot}%{_javadocdir}/%{name} +cp -pr target/site/api*/* %{buildroot}%{_javadocdir}/%{name} +%fdupes -s %{buildroot}%{_javadocdir}/%{name} %files -f .mfiles %license LICENSE.txt NOTICE.txt @@ -86,6 +85,6 @@ ln -s %{name}-%{version} %{buildroot}%{_javadocdir}/%{name} %files javadoc %license LICENSE.txt -%{_javadocdir}/* +%{_javadocdir}/%{name} %changelog From e1f43791a92cd46cc1544ffcd528099dc8bbdc7edd2d1cb12e349e8c30183f82 Mon Sep 17 00:00:00 2001 From: Fridrich Strba Date: Tue, 5 Feb 2019 12:12:24 +0000 Subject: [PATCH 4/6] OBS-URL: https://build.opensuse.org/package/show/Java:packages/apache-commons-cli?expand=0&rev=24 --- apache-commons-cli.changes | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/apache-commons-cli.changes b/apache-commons-cli.changes index 5118f8c..6e3b5ca 100644 --- a/apache-commons-cli.changes +++ b/apache-commons-cli.changes @@ -1,3 +1,15 @@ +------------------------------------------------------------------- +Tue Feb 5 12:10:09 UTC 2019 - Fridrich Strba + +- Clean-up the spec file +- Removed patch: + * commons-cli-1.4-jdk9.patch + + not needed since we are not building with maven +- Added patch: + * CLI-253-workaround.patch + + [CLI-253] Prevent "Unrecognized option: --null" when handling + long opts in PosixParser + ------------------------------------------------------------------- Tue Oct 23 17:55:39 UTC 2018 - Fridrich Strba From 7017bad02bdeb8009b78c4f7fb9c69753e66086e50b6377434f84954121541e4 Mon Sep 17 00:00:00 2001 From: Fridrich Strba Date: Tue, 5 Feb 2019 15:29:34 +0000 Subject: [PATCH 5/6] Accepting request 671871 from home:jengelh:branches:Java:packages - Trim bias frmo description; update RPM groups. OBS-URL: https://build.opensuse.org/request/show/671871 OBS-URL: https://build.opensuse.org/package/show/Java:packages/apache-commons-cli?expand=0&rev=25 --- apache-commons-cli.changes | 5 +++++ apache-commons-cli.spec | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/apache-commons-cli.changes b/apache-commons-cli.changes index 6e3b5ca..e1fc3cc 100644 --- a/apache-commons-cli.changes +++ b/apache-commons-cli.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue Feb 5 13:30:36 UTC 2019 - Jan Engelhardt + +- Trim bias frmo description; update RPM groups. + ------------------------------------------------------------------- Tue Feb 5 12:10:09 UTC 2019 - Fridrich Strba diff --git a/apache-commons-cli.spec b/apache-commons-cli.spec index 590375c..95135ea 100644 --- a/apache-commons-cli.spec +++ b/apache-commons-cli.spec @@ -42,12 +42,12 @@ Obsoletes: apache-cli < %{version} BuildArch: noarch %description -The CLI library provides a simple and easy to use API for working with the +The CLI library provides an API for working with the command line arguments and options. %package javadoc Summary: Javadoc for %{name} -Group: Development/Libraries/Java +Group: Documentation/HTML Provides: jakarta-%{short_name}-javadoc = %{version} Obsoletes: jakarta-%{short_name}-javadoc < %{version} From a7795341bbb8ab6c96e0488d93fd65e9fc74db2b3707a126910f766334fc69f0 Mon Sep 17 00:00:00 2001 From: Fridrich Strba Date: Tue, 5 Feb 2019 15:30:13 +0000 Subject: [PATCH 6/6] OBS-URL: https://build.opensuse.org/package/show/Java:packages/apache-commons-cli?expand=0&rev=26 --- apache-commons-cli.changes | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apache-commons-cli.changes b/apache-commons-cli.changes index e1fc3cc..df3e18c 100644 --- a/apache-commons-cli.changes +++ b/apache-commons-cli.changes @@ -1,7 +1,7 @@ ------------------------------------------------------------------- Tue Feb 5 13:30:36 UTC 2019 - Jan Engelhardt -- Trim bias frmo description; update RPM groups. +- Trim bias from description; update RPM groups. ------------------------------------------------------------------- Tue Feb 5 12:10:09 UTC 2019 - Fridrich Strba