Upgraded: apache-commons-cli from 1.4 to 1.6.0 (#8087)
This commit is contained in:
Родитель
fc9ab5a767
Коммит
f4ae4570ab
|
@ -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,6 +1,5 @@
|
|||
{
|
||||
"Signatures": {
|
||||
"apache-commons-cli-build.xml.tar.bz2": "7d2cd321bc2a81e5bd7668a3bb07b5b3b62cdc513dfac7be8b9b290817d64b25",
|
||||
"commons-cli-1.4-src.tar.gz": "a1def8d94e4fe6be4ffde100a74a647fe3df5ba02f85e3c9191fbb00be880f16"
|
||||
"commons-cli-1.6.0-src.tar.gz": "4e6c853eedac2c965259f3dd820c8d1d4eceeb967b55d7070620f47869b8dc86"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,21 +17,17 @@
|
|||
%global short_name commons-%{base_name}
|
||||
Summary: Command Line Interface Library for Java
|
||||
Name: apache-commons-cli
|
||||
Version: 1.4
|
||||
Release: 5%{?dist}
|
||||
Version: 1.6.0
|
||||
Release: 1%{?dist}
|
||||
License: Apache-2.0
|
||||
Vendor: Microsoft Corporation
|
||||
Distribution: Azure Linux
|
||||
Group: Development/Libraries/Java
|
||||
URL: http://commons.apache.org/%{base_name}/
|
||||
Source0: http://archive.apache.org/dist/commons/%{base_name}/source/commons-cli-%{version}-src.tar.gz
|
||||
Source1: %{name}-build.xml.tar.bz2
|
||||
Patch0: CLI-253-workaround.patch
|
||||
BuildRequires: ant
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: java-devel >= 1.8
|
||||
BuildRequires: javapackages-bootstrap
|
||||
BuildRequires: javapackages-local-bootstrap
|
||||
Requires: java >= 1.8
|
||||
Provides: jakarta-%{short_name} = %{version}-%{release}
|
||||
Obsoletes: jakarta-%{short_name} < %{version}
|
||||
Provides: apache-cli = %{version}
|
||||
|
@ -52,30 +48,17 @@ Obsoletes: jakarta-%{short_name}-javadoc < %{version}
|
|||
This package contains the API documentation for %{name}.
|
||||
|
||||
%prep
|
||||
%setup -q -n %{short_name}-%{version}-src -a1
|
||||
%patch 0 -p1
|
||||
%autosetup -p1 -n commons-cli-%{version}-src
|
||||
|
||||
%pom_remove_parent
|
||||
# Compatibility links
|
||||
%mvn_alias : org.apache.commons:commons-cli
|
||||
%mvn_file : commons-cli %{name}
|
||||
|
||||
%build
|
||||
ant -Dmaven.mode.offline=true package javadoc \
|
||||
-Dmaven.test.skip=true \
|
||||
-lib %{_datadir}/java
|
||||
%mvn_build
|
||||
|
||||
%install
|
||||
# jars
|
||||
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}.pom
|
||||
%add_maven_depmap %{short_name}.pom %{short_name}.jar -a "org.apache.commons:%{short_name}"
|
||||
|
||||
# javadoc
|
||||
install -d -m 0755 %{buildroot}%{_javadocdir}/%{name}
|
||||
cp -pr target/site/api*/* %{buildroot}%{_javadocdir}/%{name}
|
||||
%fdupes -s %{buildroot}%{_javadocdir}/%{name}
|
||||
%mvn_install
|
||||
|
||||
%files -f .mfiles
|
||||
%license LICENSE.txt NOTICE.txt
|
||||
|
@ -87,6 +70,10 @@ cp -pr target/site/api*/* %{buildroot}%{_javadocdir}/%{name}
|
|||
%{_javadocdir}/%{name}
|
||||
|
||||
%changelog
|
||||
* Mon Feb 26 2024 George Mileka <gmileka@microsoft.com> - 1.6.0-1
|
||||
- Updated to 1.6.0-1.
|
||||
- Removed patch CLI-253-workaround.patch.
|
||||
|
||||
* Fri Mar 17 2023 Mykhailo Bykhovtsev <mbykhovtsev@microsoft.com> - 1.4-5
|
||||
- Moved from extended to core
|
||||
- License verified
|
||||
|
|
|
@ -285,8 +285,8 @@
|
|||
"type": "other",
|
||||
"other": {
|
||||
"name": "apache-commons-cli",
|
||||
"version": "1.4",
|
||||
"downloadUrl": "http://archive.apache.org/dist/commons/cli/source/commons-cli-1.4-src.tar.gz"
|
||||
"version": "1.6.0",
|
||||
"downloadUrl": "http://archive.apache.org/dist/commons/cli/source/commons-cli-1.6.0-src.tar.gz"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
Загрузка…
Ссылка в новой задаче