Update to upstream version 1.5.0
This commit is contained in:
parent
85e874346e
commit
8ef3c461de
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,3 +2,4 @@
|
||||
/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
|
||||
|
@ -1,96 +0,0 @@
|
||||
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;
|
||||
+ }
|
||||
+}
|
@ -1,8 +1,8 @@
|
||||
%bcond_with bootstrap
|
||||
|
||||
Name: apache-commons-cli
|
||||
Version: 1.4
|
||||
Release: 14%{?dist}
|
||||
Version: 1.5.0
|
||||
Release: 1%{?dist}
|
||||
Summary: Command Line Interface Library for Java
|
||||
License: ASL 2.0
|
||||
URL: http://commons.apache.org/cli/
|
||||
@ -10,16 +10,12 @@ BuildArch: noarch
|
||||
|
||||
Source0: http://www.apache.org/dist/commons/cli/source/commons-cli-%{version}-src.tar.gz
|
||||
|
||||
# workaround for https://issues.apache.org/jira/browse/CLI-253
|
||||
Patch0: CLI-253-workaround.patch
|
||||
|
||||
BuildRequires: maven-local-openjdk8
|
||||
BuildRequires: maven-local
|
||||
%if %{with bootstrap}
|
||||
BuildRequires: javapackages-bootstrap
|
||||
%else
|
||||
BuildRequires: mvn(junit:junit)
|
||||
BuildRequires: mvn(org.apache.commons:commons-parent:pom:)
|
||||
BuildRequires: mvn(org.apache.maven.plugins:maven-antrun-plugin)
|
||||
%endif
|
||||
|
||||
%description
|
||||
@ -36,7 +32,7 @@ command line arguments and options.
|
||||
%mvn_file : commons-cli %{name}
|
||||
|
||||
%build
|
||||
%mvn_build -- -Dmaven.compiler.source=1.6 -Dmaven.compiler.target=1.6
|
||||
%mvn_build
|
||||
|
||||
%install
|
||||
%mvn_install
|
||||
@ -46,6 +42,9 @@ command line arguments and options.
|
||||
%doc README.md RELEASE-NOTES.txt
|
||||
|
||||
%changelog
|
||||
* 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
|
||||
|
||||
|
2
sources
2
sources
@ -1 +1 @@
|
||||
SHA512 (commons-cli-1.4-src.tar.gz) = a5db856f6154e4340aab1865e3b34c752c0dceb8063faa64740ed470d8e6b3e7782242ae51d6bb57a535a6d6dad2943cc3130d7202223b8f89b8cbecdc3d9d4f
|
||||
SHA512 (commons-cli-1.5.0-src.tar.gz) = aa2165695177c3e4561f68585cafb5434758138d8a863f3db1860477f660cf78664d2afb07cc3bc767bc8fa87befc7eaa5bdead423ee8b883c62ff00aec7cdda
|
||||
|
Loading…
Reference in New Issue
Block a user