This commit is contained in:
parent
382b0250bd
commit
214d86cc86
87
0001-Do-not-use-commons-cli-deprecated-classes.patch
Normal file
87
0001-Do-not-use-commons-cli-deprecated-classes.patch
Normal file
@ -0,0 +1,87 @@
|
||||
From 03df6f6688419f2d85116647c78e36b203c9a16a Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Fridrich=20=C5=A0trba?= <fridrich.strba@bluewin.ch>
|
||||
Date: Thu, 19 May 2022 09:30:24 +0200
|
||||
Subject: [PATCH 1/2] Do not use commons-cli deprecated classes
|
||||
|
||||
---
|
||||
.../plexus/tools/cli/AbstractCli.java | 32 +++++++++----------
|
||||
1 file changed, 15 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/src/main/java/org/codehaus/plexus/tools/cli/AbstractCli.java b/src/main/java/org/codehaus/plexus/tools/cli/AbstractCli.java
|
||||
index aac570d..de8f675 100644
|
||||
--- a/src/main/java/org/codehaus/plexus/tools/cli/AbstractCli.java
|
||||
+++ b/src/main/java/org/codehaus/plexus/tools/cli/AbstractCli.java
|
||||
@@ -18,9 +18,9 @@ package org.codehaus.plexus.tools.cli;
|
||||
|
||||
import org.apache.commons.cli.CommandLine;
|
||||
import org.apache.commons.cli.CommandLineParser;
|
||||
-import org.apache.commons.cli.GnuParser;
|
||||
+import org.apache.commons.cli.DefaultParser;
|
||||
import org.apache.commons.cli.HelpFormatter;
|
||||
-import org.apache.commons.cli.OptionBuilder;
|
||||
+import org.apache.commons.cli.Option;
|
||||
import org.apache.commons.cli.Options;
|
||||
import org.apache.commons.cli.ParseException;
|
||||
import org.codehaus.plexus.ContainerConfiguration;
|
||||
@@ -47,17 +47,17 @@ public abstract class AbstractCli
|
||||
// These are standard options that we would want to use for all our projects.
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
- public static final char QUIET = 'q';
|
||||
+ public static final String QUIET = "q";
|
||||
|
||||
- public static final char DEBUG = 'X';
|
||||
+ public static final String DEBUG = "X";
|
||||
|
||||
- public static final char ERRORS = 'e';
|
||||
+ public static final String ERRORS = "e";
|
||||
|
||||
- public static final char HELP = 'h';
|
||||
+ public static final String HELP = "h";
|
||||
|
||||
- public static final char VERSION = 'v';
|
||||
+ public static final String VERSION = "v";
|
||||
|
||||
- public static final char SET_SYSTEM_PROPERTY = 'D';
|
||||
+ public static final String SET_SYSTEM_PROPERTY = "D";
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Abstract methods
|
||||
@@ -344,19 +344,17 @@ public abstract class AbstractCli
|
||||
options = new Options();
|
||||
|
||||
options.addOption(
|
||||
- OptionBuilder.withLongOpt( "define" ).hasArg().withDescription( "Define a system property" ).create(
|
||||
- SET_SYSTEM_PROPERTY ) );
|
||||
+ Option.builder( SET_SYSTEM_PROPERTY ).longOpt( "define" ).hasArg().desc( "Define a system property" ).build() );
|
||||
options.addOption(
|
||||
- OptionBuilder.withLongOpt( "help" ).withDescription( "Display help information" ).create( HELP ) );
|
||||
+ Option.builder( HELP ).longOpt( "help" ).desc( "Display help information" ).build() );
|
||||
options.addOption(
|
||||
- OptionBuilder.withLongOpt( "version" ).withDescription( "Display version information" ).create( VERSION ) );
|
||||
+ Option.builder( VERSION ).longOpt( "version" ).desc( "Display version information" ).build() );
|
||||
options.addOption(
|
||||
- OptionBuilder.withLongOpt( "quiet" ).withDescription( "Quiet output - only show errors" ).create( QUIET ) );
|
||||
+ Option.builder( QUIET ).longOpt( "quiet" ).desc( "Quiet output - only show errors" ).build() );
|
||||
options.addOption(
|
||||
- OptionBuilder.withLongOpt( "debug" ).withDescription( "Produce execution debug output" ).create( DEBUG ) );
|
||||
+ Option.builder( DEBUG ).longOpt( "debug" ).desc( "Produce execution debug output" ).build() );
|
||||
options.addOption(
|
||||
- OptionBuilder.withLongOpt( "errors" ).withDescription( "Produce execution error messages" ).create(
|
||||
- ERRORS ) );
|
||||
+ Option.builder( ERRORS ).longOpt( "errors" ).desc( "Produce execution error messages" ).build() );
|
||||
|
||||
return buildCliOptions( options );
|
||||
}
|
||||
@@ -367,7 +365,7 @@ public abstract class AbstractCli
|
||||
// We need to eat any quotes surrounding arguments...
|
||||
String[] cleanArgs = cleanArgs( args );
|
||||
|
||||
- CommandLineParser parser = new GnuParser();
|
||||
+ CommandLineParser parser = new DefaultParser();
|
||||
|
||||
return parser.parse( buildDefaultCliOptions(), cleanArgs );
|
||||
}
|
||||
--
|
||||
2.36.1
|
||||
|
25
0002-No-unchecked-operations.patch
Normal file
25
0002-No-unchecked-operations.patch
Normal file
@ -0,0 +1,25 @@
|
||||
From f1ab5142f755d9f8c2209a98e9a546e8a6965429 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Fridrich=20=C5=A0trba?= <fridrich.strba@bluewin.ch>
|
||||
Date: Thu, 19 May 2022 09:30:58 +0200
|
||||
Subject: [PATCH 2/2] No unchecked operations
|
||||
|
||||
---
|
||||
.../java/org/codehaus/plexus/tools/cli/AbstractCli.java | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/main/java/org/codehaus/plexus/tools/cli/AbstractCli.java b/src/main/java/org/codehaus/plexus/tools/cli/AbstractCli.java
|
||||
index de8f675..2f2e5a4 100644
|
||||
--- a/src/main/java/org/codehaus/plexus/tools/cli/AbstractCli.java
|
||||
+++ b/src/main/java/org/codehaus/plexus/tools/cli/AbstractCli.java
|
||||
@@ -372,7 +372,7 @@ public abstract class AbstractCli
|
||||
|
||||
private static String[] cleanArgs( String[] args )
|
||||
{
|
||||
- List cleaned = new ArrayList();
|
||||
+ List<String> cleaned = new ArrayList<String>();
|
||||
|
||||
StringBuffer currentArg = null;
|
||||
|
||||
--
|
||||
2.36.1
|
||||
|
@ -1,3 +1,15 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu May 19 07:38:31 UTC 2022 - Fridrich Strba <fstrba@suse.com>
|
||||
|
||||
- Added patches:
|
||||
* 0001-Do-not-use-commons-cli-deprecated-classes.patch
|
||||
+ the GnuParser and OptionBuilder classes are deprecated
|
||||
in commons-cli since version 1.3
|
||||
+ port to the recommended DefaultParser and Option.builder(...)
|
||||
* 0002-No-unchecked-operations.patch
|
||||
+ replace raw java.util.List with typed java.util.List<E>
|
||||
interface
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sun Mar 20 17:53:17 UTC 2022 - Fridrich Strba <fstrba@suse.com>
|
||||
|
||||
|
@ -27,6 +27,8 @@ URL: https://github.com/codehaus-plexus/plexus-cli
|
||||
Source0: %{name}-%{version}.tar.xz
|
||||
Source1: LICENSE-2.0.txt
|
||||
Source100: %{name}-build.xml
|
||||
Patch0: 0001-Do-not-use-commons-cli-deprecated-classes.patch
|
||||
Patch1: 0002-No-unchecked-operations.patch
|
||||
BuildRequires: ant
|
||||
BuildRequires: apache-commons-cli
|
||||
BuildRequires: fdupes
|
||||
@ -60,6 +62,8 @@ Javadoc for %{name}.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
cp -p %{SOURCE1} .
|
||||
cp -p %{SOURCE100} build.xml
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user