Hello community, here is the log from the commit of package apache-commons-cli for openSUSE:Factory checked in at 2019-02-06 14:07:34 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/apache-commons-cli (Old) and /work/SRC/openSUSE:Factory/.apache-commons-cli.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "apache-commons-cli" Wed Feb 6 14:07:34 2019 rev:11 rq:671927 version:1.4 Changes: -------- --- /work/SRC/openSUSE:Factory/apache-commons-cli/apache-commons-cli.changes 2018-10-31 13:22:05.331021089 +0100 +++ /work/SRC/openSUSE:Factory/.apache-commons-cli.new.28833/apache-commons-cli.changes 2019-02-06 14:07:39.202646681 +0100 @@ -1,0 +2,17 @@ +Tue Feb 5 13:30:36 UTC 2019 - Jan Engelhardt <[email protected]> + +- Trim bias from description; update RPM groups. + +------------------------------------------------------------------- +Tue Feb 5 12:10:09 UTC 2019 - Fridrich Strba <[email protected]> + +- 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 + +------------------------------------------------------------------- Old: ---- commons-cli-1.4-jdk9.patch New: ---- CLI-253-workaround.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ apache-commons-cli.spec ++++++ --- /var/tmp/diff_new_pack.JjJkvs/_old 2019-02-06 14:07:40.734646399 +0100 +++ /var/tmp/diff_new_pack.JjJkvs/_new 2019-02-06 14:07:40.742646398 +0100 @@ -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,30 +24,30 @@ 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 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} @@ -59,45 +59,32 @@ %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} -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 +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 +%doc README.md RELEASE-NOTES.txt +%{_javadir}/%{name}.jar %files javadoc -%defattr(-,root,root) -%doc LICENSE.txt -%{_javadocdir}/* +%license LICENSE.txt +%{_javadocdir}/%{name} %changelog ++++++ CLI-253-workaround.patch ++++++ commit 77218790904f40395304669f5d79740f459c0a90 (HEAD -> cli-253, origin/cli-253) Author: Michal Srb <[email protected]> AuthorDate: Mon Jun 22 15:01:30 2015 +0200 Commit: Michal Srb <[email protected]> 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; + } +}
