Sync from SUSE:ALP:Source:Standard:1.0 apache-commons-cli revision 8774cd4e186456e713c33a60f97b20f1

This commit is contained in:
Adrian Schröter 2024-02-19 15:35:09 +01:00
commit 3071231fdb
7 changed files with 509 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

95
CLI-253-workaround.patch Normal file
View File

@ -0,0 +1,95 @@
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
Index: commons-cli-1.5.0-src/src/main/java/org/apache/commons/cli/Options.java
===================================================================
--- commons-cli-1.5.0-src.orig/src/main/java/org/apache/commons/cli/Options.java
+++ commons-cli-1.5.0-src/src/main/java/org/apache/commons/cli/Options.java
@@ -186,6 +186,20 @@ public class Options implements Serializ
return this;
}
+ /*
+ * 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);
+ }
+
/**
* Gets the options with a long name starting with the name specified.
*
Index: commons-cli-1.5.0-src/src/main/java/org/apache/commons/cli/PosixParser.java
===================================================================
--- commons-cli-1.5.0-src.orig/src/main/java/org/apache/commons/cli/PosixParser.java
+++ commons-cli-1.5.0-src/src/main/java/org/apache/commons/cli/PosixParser.java
@@ -145,7 +145,7 @@ public class PosixParser extends Parser
} else if (matchingOpts.size() > 1) {
throw new AmbiguousOptionException(opt, matchingOpts);
} else {
- currentOption = options.getOption(matchingOpts.get(0));
+ currentOption = options.getLongOption(matchingOpts.get(0));
tokens.add("--" + currentOption.getLongOpt());
if (pos != -1) {
Index: commons-cli-1.5.0-src/src/test/java/org/apache/commons/cli/bug/BugCLI253Test.java
===================================================================
--- /dev/null
+++ commons-cli-1.5.0-src/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

@ -0,0 +1,128 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="commons-cli" default="package" basedir=".">
<!-- ====================================================================== -->
<!-- Build environment properties -->
<!-- ====================================================================== -->
<property name="build.finalName" value="commons-cli-1.5.0"/>
<property name="build.dir" value="target"/>
<property name="build.outputDir" value="${build.dir}/classes"/>
<property name="build.srcDir" value="src/main/java"/>
<property name="build.resourceDir" value="."/>
<property name="build.testOutputDir" value="${build.dir}/test-classes"/>
<property name="build.testDir" value="src/test/java"/>
<property name="build.testResourceDir" value="src/test/resources"/>
<property name="test.reports" value="${build.dir}/test-reports"/>
<property name="reporting.outputDirectory" value="${build.dir}/site"/>
<!-- ====================================================================== -->
<!-- Defining classpaths -->
<!-- ====================================================================== -->
<path id="build.classpath"/>
<!-- ====================================================================== -->
<!-- Cleaning up target -->
<!-- ====================================================================== -->
<target name="clean" description="Clean the output directory">
<delete dir="${build.dir}"/>
</target>
<!-- ====================================================================== -->
<!-- Compilation target -->
<!-- ====================================================================== -->
<target name="compile" description="Compile the code">
<mkdir dir="${build.outputDir}"/>
<javac destdir="${build.outputDir}"
encoding="iso-8859-1"
nowarn="false"
debug="true"
optimize="false"
deprecation="true"
target="8"
verbose="false"
fork="false"
source="8">
<src>
<pathelement location="${build.srcDir}"/>
</src>
<classpath refid="build.classpath"/>
</javac>
<mkdir dir="${build.outputDir}/META-INF"/>
<copy todir="${build.outputDir}/META-INF">
<fileset dir="${build.resourceDir}">
<include name="NOTICE.txt"/>
<include name="LICENSE.txt"/>
</fileset>
</copy>
</target>
<!-- ====================================================================== -->
<!-- Javadoc target -->
<!-- ====================================================================== -->
<target name="javadoc" description="Generates the Javadoc of the application">
<javadoc sourcepath="${build.srcDir}"
packagenames="*"
destdir="${reporting.outputDirectory}/apidocs"
access="protected"
old="false"
verbose="false"
encoding="iso-8859-1"
version="true"
use="true"
author="true"
splitindex="false"
nodeprecated="false"
nodeprecatedlist="false"
notree="false"
noindex="false"
nohelp="false"
nonavbar="false"
serialwarn="false"
charset="ISO-8859-1"
source="8"
linksource="true"
breakiterator="false">
<link href="http://java.sun.com/javase/7/docs/api/"/>
</javadoc>
</target>
<!-- ====================================================================== -->
<!-- Package target -->
<!-- ====================================================================== -->
<target name="package" depends="compile" description="Package the application">
<jar jarfile="${build.dir}/${build.finalName}.jar"
compress="true"
index="false"
basedir="${build.outputDir}"
excludes="**/package.html">
<manifest>
<attribute name="Bundle-Description" value="Apache Commons CLI provides a simple API for presenting, processing and validating a command line interface."/>
<attribute name="Bundle-DocURL" value="http://commons.apache.org/proper/commons-cli/"/>
<attribute name="Bundle-License" value="https://www.apache.org/licenses/LICENSE-2.0.txt"/>
<attribute name="Bundle-ManifestVersion" value="2"/>
<attribute name="Bundle-Name" value="Apache Commons CLI"/>
<attribute name="Bundle-SymbolicName" value="org.apache.commons.cli"/>
<attribute name="Bundle-Vendor" value="The Apache Software Foundation"/>
<attribute name="Bundle-Version" value="1.5.0"/>
<attribute name="Export-Package" value="org.apache.commons.cli;version=&quot;1.5.0&quot;"/>
<attribute name="Implementation-Title" value="Apache Commons CLI"/>
<attribute name="Implementation-Vendor-Id" value="org.apache"/>
<attribute name="Implementation-Vendor" value="The Apache Software Foundation"/>
<attribute name="Implementation-Version" value="1.5.0"/>
<attribute name="Include-Resource" value="META-INF/NOTICE.txt=NOTICE.txt,META-INF/LICENSE.txt=LICENSE.txt"/>
<attribute name="Require-Capability" value="osgi.ee;filter:=&quot;(&amp;(osgi.ee=JavaSE)(version=1.7))&quot;"/>
<attribute name="Specification-Title" value="Apache Commons CLI"/>
<attribute name="Specification-Vendor" value="The Apache Software Foundation"/>
<attribute name="Specification-Version" value="1.5.0"/>
</manifest>
</jar>
</target>
</project>

View File

@ -0,0 +1 @@
addFilter("apache-commons-cli-javadoc.noarch: W: package-with-huge-docs")

171
apache-commons-cli.changes Normal file
View File

@ -0,0 +1,171 @@
-------------------------------------------------------------------
Thu Sep 21 05:39:25 UTC 2023 - Fridrich Strba <fstrba@suse.com>
- Build with java source/target levels 8
-------------------------------------------------------------------
Thu Dec 16 16:26:28 UTC 2021 - David Anes <david.anes@suse.com>
- Rebased patch CLI-253-workaround.patch to new version.
- Updated build XML file to new version.
- Harmonized the use of X.Y.X strings everywhere.
- Updated new source locations from Apache.
- Added 'apache-commons-cli-rpmlintrc' to silence 'package-with-huge-docs' warning (Javadoc generates many files...)
- Update to 1.5:
* New features:
- (CLI-217) Accommodate toggling partial matching in DefaultParser. Thanks to Rubin Simons.
- (CLI-274) Option parser type EXISTING_FILE_VALUE not check file existing Thanks to Béla Schaum.
- (CLI-271) CommandLine.getXXX and CommandLine.hasXXX should accept an Option as a parameter Thanks to Christoph Läubrich.
- (CLI-276) Adjust access-modifier of checkRequiredOptions() to protected. Thanks to Jason Dillon.
- (CLI-282) TypeHandler should throw ParseException for an unsupported class. Thanks to Alex Nordlund.
- Added setter for Builder.option #33. Thanks to Waldemar Sojka, Gary Gregory.
- Add Option unit tests #76. Thanks to Waldemar Sojka, Gary Gregory.
* Fixed bugs:
- Fix NPE in DefaultParser.isLongOption(String). Thanks to Gary Gregory.
- (CLI-279) @param or @return lines should end with a period in CommandLine.java Thanks to Krishna Mohan Rao Kandunoori.
- Replace deprecated FindBugs with SpotBugs. Thanks to Gary Gregory.
- Replace CLIRR with JApiCmp. Thanks to Gary Gregory.
- Option Javadocs grammar nits #55. Thanks to Elliotte Rusty Harold.
- Minor Improvements #57, #61. Thanks to Arturo Bernal, Gary Gregory.
- (CLI-254) Input "test" gets parsed as test, quotes die #58. Thanks to stoty.
- (CLI-287) Allow whitespace-only header and footer #26. Thanks to MrQubo, Gary Gregory.
* Updates:
- (CLI-294) Update Java from version 5 to 7.
- Docs: Replace OptionBuilder in usage page #30. Thanks to Mincong Huang.
- Remove deprecated sudo setting. #36. Thanks to dengliming.
- Bump junit:junit from 4.12 to 4.13.2, #53, #60. Thanks to Gary Gregory, Dependabot.
- Bump commons-parent from 48 to 52. Thanks to Dependabot.
- Bump maven-pmd-plugin from 3.12.0 to 3.15.0, #44, #54, #67. Thanks to Dependabot.
- Bump actions/checkout from v2.3.1 to v2.3.5 #46, #72. Thanks to Dependabot.
- Bump actions/setup-java from v1.4.2 to v2 #50. Thanks to Dependabot, Gary Gregory.
- Bump maven-antrun-plugin from 1.7 to 3.0.0 #43. Thanks to Dependabot.
- Bump maven-checkstyle-plugin from 2.15 to 3.1.2 #41. Thanks to Gary Gregory.
- Bump checkstyle to 9.0.1 #68. Thanks to Gary Gregory.
- Bump actions/cache from 2 to 2.1.6 #64, #65. Thanks to Dependabot.
- Bump commons.animal-sniffer.version 1.19 -> 1.20. Thanks to Gary Gregory.
- Bump maven-bundle-plugin 5.1.1 -> 5.1.2. Thanks to Gary Gregory.
- Bump biz.aQute.bndlib.version 5.1.2 -> 6.0.0. Thanks to Gary Gregory.
- Bump spotbugs from 4.4.1 to 4.4.2 #70. Thanks to Dependabot.
- Bump spotbugs-maven-plugin from 4.4.1 to 4.4.2.2 #71. Thanks to Dependabot.-
-------------------------------------------------------------------
Fri Feb 12 12:54:07 UTC 2021 - Fridrich Strba <fstrba@suse.com>
- Add OSGi manifest to the build files.
- Set java source/target levels to 6
-------------------------------------------------------------------
Mon Mar 25 17:19:16 UTC 2019 - Fridrich Strba <fstrba@suse.com>
- Remove pom parent, since we don't use it when not building with
maven
-------------------------------------------------------------------
Tue Feb 5 13:30:36 UTC 2019 - Jan Engelhardt <jengelh@inai.de>
- Trim bias from description; update RPM groups.
-------------------------------------------------------------------
Tue Feb 5 12:10:09 UTC 2019 - Fridrich Strba <fstrba@suse.com>
- 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 <fstrba@suse.com>
- Upgrade to version 1.4
- Modify the build.xml.tar.bz2 to build with source/target 8 and
adapt for the commons-cli-1.4
- Modified patch:
* commons-cli-1.2-jdk9.patch -> commons-cli-1.4-jdk9.patch
+ Rediff the remaining hunk to the changed context of pom.xml
-------------------------------------------------------------------
Tue May 15 06:21:41 UTC 2018 - fstrba@suse.com
- Modified patch:
* commons-cli-1.2-jdk9.patch
+ Build with source and target 8 to prepare for a possible
removal of 1.6 compatibility
- Run fdupes on the documentation
-------------------------------------------------------------------
Fri Sep 29 06:41:14 UTC 2017 - fstrba@suse.com
- Don't condition the maven defines on release version, but on
_maven_repository being defined
-------------------------------------------------------------------
Thu Sep 14 09:33:27 UTC 2017 - fstrba@suse.com
- Added patch:
* commons-cli-1.2-jdk9.patch
- Specify java source and target level 1.6 in order to allow
building with jdk9
-------------------------------------------------------------------
Fri May 19 08:41:33 UTC 2017 - tchvatal@suse.com
- Fix build with new javapackages-tools
-------------------------------------------------------------------
Wed Mar 18 09:37:41 UTC 2015 - tchvatal@suse.com
- Fix build with new javapackages-tools
-------------------------------------------------------------------
Thu Dec 4 18:55:52 UTC 2014 - p.drouand@gmail.com
- Remove java-devel dependency; not needed anymore
-------------------------------------------------------------------
Fri Jun 27 11:14:46 UTC 2014 - tchvatal@suse.com
- Fix the pom providing on 13.2
-------------------------------------------------------------------
Sat Mar 8 18:22:40 UTC 2014 - badshah400@gmail.com
- For openSUSE >= 13.1 remove all references to maven scripts as
these do not work; fixes building for openSUSE >= 13.1
- Lots of specfile formatting cleanups
- Move old %changelog section entries to .changes with proper
formatting
- Add copyright info to spec file.
-------------------------------------------------------------------
Mon Dec 12 23:47:58 UTC 2011 - dmacvicar@suse.de
- rename apache-cli to apache-commons-cli
- add java() provides
-------------------------------------------------------------------
Tue Jul 19 10:07:32 UTC 2011 - dmacvicar@suse.de
- converted to build with ant:ant
- removed reference to non existing target/osgi/MANIFEST
in maven-build.xml
-------------------------------------------------------------------
Tue Nov 09 00:00:00 UTC 2010 - chris.spike@arcor.de
- Removed maven* BRs in favour of apache-commons-parent
- Added deprecated groupId to depmap for compatibility reasons
-------------------------------------------------------------------
Mon Oct 18 00:00:00 UTC 2010 - chris.spike@arcor.de
- Removed Epoch
-------------------------------------------------------------------
Sun Oct 03 00:00:00 UTC 2010 - chris.spike@arcor.de
- Rename and rebase from jakarta-commons-cli

88
apache-commons-cli.spec Normal file
View File

@ -0,0 +1,88 @@
#
# spec file for package apache-commons-cli
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%global base_name cli
%global short_name commons-%{base_name}
Name: apache-commons-cli
Version: 1.5.0
Release: 0
Summary: Command Line Interface Library for Java
License: Apache-2.0
Group: Development/Libraries/Java
URL: https://commons.apache.org/%{base_name}/
Source0: https://dlcdn.apache.org/commons/%{base_name}/source/%{short_name}-%{version}-src.tar.gz
Source1: %{name}-build.xml
Source2: apache-commons-cli-rpmlintrc
Patch0: CLI-253-workaround.patch
BuildRequires: ant
BuildRequires: fdupes
BuildRequires: javapackages-local
Provides: jakarta-%{short_name} = %{version}-%{release}
Obsoletes: jakarta-%{short_name} < %{version}-%{release}
Provides: apache-cli = %{version}-%{release}
Obsoletes: apache-cli < %{version}-%{release}
BuildArch: noarch
%description
The CLI library provides an API for working with the
command line arguments and options.
%package javadoc
Summary: Javadoc for %{name}
Group: Documentation/HTML
Provides: jakarta-%{short_name}-javadoc = %{version}-%{release}
Obsoletes: jakarta-%{short_name}-javadoc < %{version}-%{release}
%description javadoc
This package contains the API documentation for %{name}.
%prep
%setup -q -n %{short_name}-%{version}-src
cp %{SOURCE1} build.xml
%patch0 -p1
%pom_remove_parent
%build
%ant package javadoc
%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}
%files -f .mfiles
%license LICENSE.txt NOTICE.txt
%doc README.md RELEASE-NOTES.txt
%{_javadir}/%{name}.jar
%files javadoc
%license LICENSE.txt
%{_javadocdir}/%{name}
%changelog

BIN
commons-cli-1.5.0-src.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.