Compare commits

...

No commits in common. "stream-javapackages-tools-202201-rhel-9.4.0" and "c8-stream-3.6" have entirely different histories.

5 changed files with 108 additions and 64 deletions

View File

@ -0,0 +1 @@
c238aeb10a5114b50a6351a8b452a687426ce5b6 SOURCES/commons-cli-1.4-src.tar.gz

6
.gitignore vendored
View File

@ -1,5 +1 @@
/commons-cli-1.2-src.tar.gz
/commons-cli-1.3-src.tar.gz
/commons-cli-1.3.1-src.tar.gz
/commons-cli-1.4-src.tar.gz
/commons-cli-1.5.0-src.tar.gz
SOURCES/commons-cli-1.4-src.tar.gz

View File

@ -0,0 +1,96 @@
commit 77218790904f40395304669f5d79740f459c0a90 (HEAD -> cli-253, origin/cli-253)
Author: Michal Srb <msrb@redhat.com>
AuthorDate: Mon Jun 22 15:01:30 2015 +0200
Commit: Michal Srb <msrb@redhat.com>
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;
+ }
+}

View File

@ -1,28 +1,26 @@
%bcond_with bootstrap
Name: apache-commons-cli
Version: 1.5.0
Release: 5%{?dist}
Version: 1.4
Release: 7%{?dist}
Summary: Command Line Interface Library for Java
License: ASL 2.0
URL: http://commons.apache.org/cli/
BuildArch: noarch
ExclusiveArch: %{java_arches} noarch
Source0: http://www.apache.org/dist/commons/cli/source/commons-cli-%{version}-src.tar.gz
%if %{with bootstrap}
BuildRequires: javapackages-bootstrap
%else
BuildRequires: maven-local
# workaround for https://issues.apache.org/jira/browse/CLI-253
Patch0: CLI-253-workaround.patch
BuildRequires: maven-local-openjdk8
BuildRequires: mvn(junit:junit)
BuildRequires: mvn(org.apache.commons:commons-parent:pom:)
%endif
BuildRequires: mvn(org.apache.maven.plugins:maven-antrun-plugin)
%description
The CLI library provides a simple and easy to use API for working with the
command line arguments and options.
%{?module_package}
%{?javadoc_package}
%prep
@ -33,71 +31,25 @@ command line arguments and options.
%mvn_file : commons-cli %{name}
%build
%mvn_build
%mvn_build -- -Dmaven.compiler.source=1.6 -Dmaven.compiler.target=1.6
%install
%mvn_install
%files -f .mfiles
%files -n %{?module_prefix}%{name} -f .mfiles
%license LICENSE.txt NOTICE.txt
%doc README.md RELEASE-NOTES.txt
%changelog
* Mon Feb 05 2024 Mikolaj Izdebski <mizdebsk@redhat.com> - 1.5.0-5
- Rebuild to regenerate auto-requires
* Wed Jul 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Sat Feb 05 2022 Jiri Vanek <jvanek@redhat.com> - 1.5.0-3
- Rebuilt for java-17-openjdk as system jdk
* Wed Jan 19 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Thu Nov 4 2021 Christian Schuermann <spike@fedoraproject.org> 1.5.0-1
- Update to upstream version 1.5.0
* Wed Jul 21 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.4-14
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Mon May 17 2021 Mikolaj Izdebski <mizdebsk@redhat.com> - 1.4-13
- Bootstrap build
- Non-bootstrap build
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.4-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.4-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Fri Jul 10 2020 Jiri Vanek <jvanek@redhat.com> - 1.4-10
- Rebuilt for JDK-11, see https://fedoraproject.org/wiki/Changes/Java11
* Wed Jun 24 2020 Alexander Kurtakov <akurtako@redhat.com> 1.4-9
- Fix build with Java 11
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.4-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Sat Jan 25 2020 Mikolaj Izdebski <mizdebsk@redhat.com> - 1.4-7
- Build with OpenJDK 8
* Tue Nov 05 2019 Mikolaj Izdebski <mizdebsk@redhat.com> - 1.4-6
- Mass rebuild for javapackages-tools 201902
* Wed Jul 24 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.4-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Fri May 24 2019 Mikolaj Izdebski <mizdebsk@redhat.com> - 1.4-5
- Mass rebuild for javapackages-tools 201901
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.4-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.4-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.4-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

View File

@ -1 +0,0 @@
SHA512 (commons-cli-1.5.0-src.tar.gz) = aa2165695177c3e4561f68585cafb5434758138d8a863f3db1860477f660cf78664d2afb07cc3bc767bc8fa87befc7eaa5bdead423ee8b883c62ff00aec7cdda