commit b1172b0a405fb415123d9206fe8b8b1a1b459f9b8e5c740600ef9a192095336a Author: Fridrich Strba Date: Wed Oct 24 06:52:50 2018 +0000 OBS-URL: https://build.opensuse.org/package/show/Java:packages/beust-jcommander?expand=0&rev=1 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -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 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/0001-ParseValues-NullPointerException-patch.patch b/0001-ParseValues-NullPointerException-patch.patch new file mode 100644 index 0000000..312ff62 --- /dev/null +++ b/0001-ParseValues-NullPointerException-patch.patch @@ -0,0 +1,61 @@ +From 2b813829d02b89206493520eb86075a43b145db9 Mon Sep 17 00:00:00 2001 +From: Roman Vais +Date: Tue, 13 Jun 2017 13:24:24 +0200 +Subject: [PATCH] ParseValues-NullPointerException-patch + +--- + .../java/com/beust/jcommander/Parameterized.java | 27 ++++++++++++++++++++-- + 1 file changed, 25 insertions(+), 2 deletions(-) + +diff --git a/src/main/java/com/beust/jcommander/Parameterized.java b/src/main/java/com/beust/jcommander/Parameterized.java +index 3264008..e937a66 100644 +--- a/src/main/java/com/beust/jcommander/Parameterized.java ++++ b/src/main/java/com/beust/jcommander/Parameterized.java +@@ -13,6 +13,8 @@ import java.lang.reflect.Type; + import java.util.Collections; + import java.util.List; + import java.util.Set; ++import java.util.logging.Level; ++import java.util.logging.Logger; + + /** + * Encapsulate a field or a method annotated with @Parameter or @DynamicParameter +@@ -180,12 +182,33 @@ public class Parameterized { + String fieldName = Character.toLowerCase(name.charAt(3)) + name.substring(4); + Object result = null; + try { +- Field field = method.getDeclaringClass().getDeclaredField(fieldName); ++ Field field = object.getClass().getDeclaredField(fieldName); + if (field != null) { + setFieldAccessible(field); + result = field.get(object); + } +- } catch(NoSuchFieldException | IllegalAccessException ex) { ++ } catch(NoSuchFieldException ex) { ++ Class clazz = object.getClass(); ++ Field found = null; ++ while (clazz != null && method.getDeclaringClass().isAssignableFrom(clazz)) { ++ try { ++ found = clazz.getDeclaredField(fieldName); ++ } catch (NoSuchFieldException nfex) { ++ // ignore ++ } ++ if (found != null) break; ++ clazz = clazz.getSuperclass(); ++ } ++ if (found != null) { ++ setFieldAccessible(found); ++ try { ++ result = found.get(object); ++ } catch (IllegalAccessException iex) { ++ // ignore ++ } ++ } ++ ++ } catch(IllegalAccessException ex) { + // ignore + } + return result; +-- +2.7.4 + diff --git a/beust-jcommander-1.71.tar.gz b/beust-jcommander-1.71.tar.gz new file mode 100644 index 0000000..729092c --- /dev/null +++ b/beust-jcommander-1.71.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9d084ad6b8087f2a215ee53a611a25e2d25903f400f36b92099be59cece7c481 +size 122566 diff --git a/beust-jcommander.changes b/beust-jcommander.changes new file mode 100644 index 0000000..6118968 --- /dev/null +++ b/beust-jcommander.changes @@ -0,0 +1,4 @@ +------------------------------------------------------------------- +Wed Oct 24 06:47:17 UTC 2018 - Fridrich Strba + +- Initial packaging built without maven, adapted from Fedora rpm diff --git a/beust-jcommander.pom b/beust-jcommander.pom new file mode 100644 index 0000000..70f5b62 --- /dev/null +++ b/beust-jcommander.pom @@ -0,0 +1,277 @@ + + + + 4.0.0 + com.beust + jcommander + jar + JCommander + @VERSION@ + A Java framework to parse command line options with annotations. + http://beust.com/jcommander + + + The Apache Software License, Version 2.0 + http://www.apache.org/licenses/LICENSE-2.0.txt + repo + + + + scm:git:git@github.com:cbeust/jcommander.git + scm:git:git@github.com:cbeust/jcommander.git + git@github.com:cbeust/jcommander.git + + + + + jcenter + bintray + http://jcenter.bintray.com + + + + + + + sonatype-nexus-staging + Nexus Staging Repository + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + + + + + Cedric Beust + + + + + org.sonatype.oss + oss-parent + 3 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.1 + + 1.8 + 1.8 + UTF-8 + + + + + + org.apache.maven.plugins + maven-resources-plugin + 2.4.1 + + UTF-8 + + + + + + org.apache.felix + maven-bundle-plugin + 2.1.0 + + + bundle-manifest + process-classes + + manifest + + + + <_versionpolicy>$(@) + + + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 2.3.1 + + + ${project.build.outputDirectory}/META-INF/MANIFEST.MF + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.10 + + false + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.7 + + *.internal + + + + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + org.apache.felix + + maven-bundle-plugin + + + [2.1.0,) + + + manifest + + + + + + + + + + + + + + + + + org.testng + testng + 6.8.21 + jar + test + + + jcommander + com.beust + + + + + + + + + + license + + + + com.mycila.maven-license-plugin + maven-license-plugin + 1.7.0 + + false +
src/main/license/license-header.txt
+ + src/** + pom.xml + + + **/.git/** + + **/target/** + + false +
+ + + + check + + + +
+
+
+
+ + + + sign + + + + maven-gpg-plugin + 1.4 + + + sign-artifacts + verify + + sign + + + + + + + +
+ +
diff --git a/beust-jcommander.spec b/beust-jcommander.spec new file mode 100644 index 0000000..20a8d73 --- /dev/null +++ b/beust-jcommander.spec @@ -0,0 +1,104 @@ +# +# spec file for package beust-jcommander +# +# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# +# 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 short_name jcommander +Name: beust-%{short_name} +Version: 1.71 +Release: 0 +Summary: Java framework for parsing command line parameters +License: Apache-2.0 +Group: Development/Libraries/Java +URL: http://jcommander.org/ +# ./generate-tarball.sh +Source0: %{name}-%{version}.tar.gz +# Adapted from earlier version that still shipped poms. It uses kobalt for building now +Source1: %{name}.pom +# Cleaned up bundled jars hose licensing cannot be easily verified +Source2: generate-tarball.sh +Patch0: 0001-ParseValues-NullPointerException-patch.patch +BuildRequires: fdupes +BuildRequires: java-devel >= 1.7 +BuildRequires: javapackages-local +BuildRequires: javapackages-tools +Requires: java >= 1.7 +Obsoletes: %{short_name} < %{version}-%{release} +Provides: %{short_name} = %{version}-%{release} +BuildArch: noarch + +%description +JCommander is a very small Java framework that makes it trivial to +parse command line parameters (with annotations). + +%package javadoc +Summary: API documentation for %{name} +Group: Development/Libraries/Java + +%description javadoc +This package contains the %{summary}. + +%prep +%setup -q -n %{short_name}-%{version} +%patch0 -p1 + +chmod -x license.txt +cp -p %{SOURCE1} pom.xml +sed -i 's/@VERSION@/%{version}/g' pom.xml + +%build +mkdir -p build/classes +mkdir -p build/doc +javac -d build/classes -source 7 -target 7 `find src/main/java -name *.java | xargs` +javadoc -d build/javadoc -source 7 --source-path src/main/java/ `find src/main/java -name *.java | xargs` +(cd build/classes && jar cf ../%{name}-%{version}.jar `find . -name *.class | xargs`) + +%install +# jars +install -d -m 0755 %{buildroot}%{_javadir} +install -m 644 build/%{name}-%{version}.jar \ + %{buildroot}%{_javadir}/%{name}-%{version}.jar +(cd %{buildroot}%{_javadir} && ln -s %{name}-%{version}.jar %{name}.jar) +(cd %{buildroot}%{_javadir} && ln -s %{name}-%{version}.jar %{short_name}-%{version}.jar) +(cd %{buildroot}%{_javadir} && ln -s %{short_name}-%{version}.jar %{short_name}.jar) + +# pom +install -d -m 755 %{buildroot}%{_mavenpomdir} +install -pm 644 pom.xml %{buildroot}%{_mavenpomdir}/%{name}-%{version}.pom +%add_maven_depmap %{name}-%{version}.pom %{name}-%{version}.jar + +# javadoc +install -dm 755 %{buildroot}%{_javadocdir}/%{name} +cp -pr build/javadoc/* %{buildroot}%{_javadocdir}/%{name}/ +%fdupes -s %{buildroot}%{_javadocdir}/%{name}/ + +%files +%license license.txt +%doc notice.md README.markdown +%{_javadir}/* +%{_mavenpomdir}/* +%if %{defined _maven_repository} +%{_mavendepmapfragdir}/%{name} +%else +%{_datadir}/maven-metadata/%{name}.xml* +%endif + +%files javadoc +%license license.txt +%doc notice.md +%{_javadocdir}/%{name} + +%changelog diff --git a/generate-tarball.sh b/generate-tarball.sh new file mode 100644 index 0000000..ec52ecd --- /dev/null +++ b/generate-tarball.sh @@ -0,0 +1,20 @@ +#!/bin/bash +set -e + +name=beust-jcommander +version="$(sed -n 's/Version:\s*//p' *.spec)" + +# RETRIEVE +wget "https://github.com/cbeust/jcommander/archive/${version}.tar.gz" -O "${name}-${version}.orig.tar.gz" + +rm -rf tarball-tmp +mkdir tarball-tmp +cd tarball-tmp +tar zxf "../${name}-${version}.orig.tar.gz" + +# CLEAN TARBALL +rm -r */gradle* */kobalt* */lib + +tar zcf "../${name}-${version}.tar.gz" * +cd .. +rm -r tarball-tmp "${name}-${version}.orig.tar.gz"