Compare commits
2 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cb76400ca3 | ||
|
|
7db3387801 |
6 changed files with 359 additions and 3 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
/client-2.2.0.zip
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
2017-04-30: Retired orphaned package, because it was orphaned for
|
||||
more than six weeks.
|
||||
|
||||
13
slf4j-backward-compatible-fix.patch
Normal file
13
slf4j-backward-compatible-fix.patch
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
diff --git zanata-client-commands/src/main/java/org/zanata/client/commands/push/PushCommand.java zanata-client-commands/src/main/java/org/zanata/client/commands/push/PushCommand.java
|
||||
index a625bc1..46e0ab1 100644
|
||||
--- zanata-client-commands/src/main/java/org/zanata/client/commands/push/PushCommand.java
|
||||
+++ zanata-client-commands/src/main/java/org/zanata/client/commands/push/PushCommand.java
|
||||
@@ -646,7 +646,7 @@ public class PushCommand extends PushPullCommand<PushOptions>
|
||||
}
|
||||
else
|
||||
{
|
||||
- log.info("pushing target doc [name={} size={} client-locale={}] to server [locale={}] (skipped due to dry run)", srcDoc.getName(), targetDoc.getTextFlowTargets().size(), locale.getLocalLocale(), locale.getLocale());
|
||||
+ log.info("pushing target doc [name={} size={} client-locale={}] to server [locale={}] (skipped due to dry run)", new Object[] {srcDoc.getName(), targetDoc.getTextFlowTargets().size(), locale.getLocalLocale(), locale.getLocale()});
|
||||
}
|
||||
}
|
||||
|
||||
151
sni-for-client-2.2.0.patch
Normal file
151
sni-for-client-2.2.0.patch
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
diff --git zanata-rest-client/pom.xml zanata-rest-client/pom.xml
|
||||
index 3fb3b24..d1467df 100644
|
||||
--- zanata-rest-client/pom.xml
|
||||
+++ zanata-rest-client/pom.xml
|
||||
@@ -24,6 +24,10 @@
|
||||
<groupId>org.zanata</groupId>
|
||||
<artifactId>zanata-common-api</artifactId>
|
||||
</dependency>
|
||||
+ <dependency>
|
||||
+ <groupId>commons-beanutils</groupId>
|
||||
+ <artifactId>commons-beanutils</artifactId>
|
||||
+ </dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
diff --git zanata-rest-client/src/main/java/org/zanata/rest/client/ZanataProxyFactory.java zanata-rest-client/src/main/java/org/zanata/rest/client/ZanataProxyFactory.java
|
||||
index 9133412..44c1dae 100644
|
||||
--- zanata-rest-client/src/main/java/org/zanata/rest/client/ZanataProxyFactory.java
|
||||
+++ zanata-rest-client/src/main/java/org/zanata/rest/client/ZanataProxyFactory.java
|
||||
@@ -1,14 +1,28 @@
|
||||
package org.zanata.rest.client;
|
||||
|
||||
+import java.io.IOException;
|
||||
+import java.net.InetSocketAddress;
|
||||
import java.net.MalformedURLException;
|
||||
+import java.net.Socket;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
-
|
||||
+import java.net.UnknownHostException;
|
||||
+import java.security.SecureRandom;
|
||||
+
|
||||
+import org.apache.commons.beanutils.PropertyUtils;
|
||||
+import org.apache.http.client.HttpClient;
|
||||
+import org.apache.http.conn.ClientConnectionManager;
|
||||
+import org.apache.http.conn.ConnectTimeoutException;
|
||||
+import org.apache.http.conn.scheme.Scheme;
|
||||
+import org.apache.http.conn.ssl.SSLSocketFactory;
|
||||
+import org.apache.http.impl.client.DefaultHttpClient;
|
||||
+import org.apache.http.params.HttpParams;
|
||||
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
|
||||
import org.jboss.resteasy.client.ClientExecutor;
|
||||
import org.jboss.resteasy.client.ClientRequestFactory;
|
||||
import org.jboss.resteasy.client.ClientResponse;
|
||||
+import org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor;
|
||||
import org.jboss.resteasy.plugins.providers.RegisterBuiltin;
|
||||
import org.jboss.resteasy.spi.ResteasyProviderFactory;
|
||||
import org.slf4j.Logger;
|
||||
@@ -19,6 +33,9 @@ import org.zanata.rest.service.AsynchronousProcessResource;
|
||||
import org.zanata.rest.service.CopyTransResource;
|
||||
import org.zanata.rest.service.StatisticsResource;
|
||||
|
||||
+import javax.net.ssl.SSLContext;
|
||||
+import javax.net.ssl.SSLSocket;
|
||||
+import javax.net.ssl.TrustManager;
|
||||
import javax.ws.rs.core.Response;
|
||||
|
||||
public class ZanataProxyFactory implements ITranslationResourcesFactory
|
||||
@@ -45,7 +62,7 @@ public class ZanataProxyFactory implements ITranslationResourcesFactory
|
||||
{
|
||||
this(base, username, apiKey, null, clientApiVersion, false);
|
||||
}
|
||||
-
|
||||
+
|
||||
public ZanataProxyFactory(URI base, String username, String apiKey, VersionInfo clientApiVersion, boolean logHttp)
|
||||
{
|
||||
this(base, username, apiKey, null, clientApiVersion, logHttp);
|
||||
@@ -54,10 +71,10 @@ public class ZanataProxyFactory implements ITranslationResourcesFactory
|
||||
public ZanataProxyFactory(URI base, String username, String apiKey, ClientExecutor executor, VersionInfo clientApiVersion,
|
||||
boolean logHttp)
|
||||
{
|
||||
- crf = new ClientRequestFactory(executor, null, fixBase(base));
|
||||
+ crf = new ClientRequestFactory(createClientExecutor(), null, fixBase(base));
|
||||
registerPrefixInterceptor(new TraceDebugInterceptor(logHttp));
|
||||
registerPrefixInterceptor(new ApiKeyHeaderDecorator(username, apiKey, clientApiVersion.getVersionNo()));
|
||||
-
|
||||
+
|
||||
clientVersion = clientApiVersion.getVersionNo();
|
||||
String clientTimestamp = clientApiVersion.getBuildTimeStamp();
|
||||
IVersionResource iversion = createIVersionResource();
|
||||
@@ -86,6 +103,50 @@ public class ZanataProxyFactory implements ITranslationResourcesFactory
|
||||
}
|
||||
}
|
||||
|
||||
+ private static ClientExecutor createClientExecutor() {
|
||||
+ try {
|
||||
+ final SSLContext sslContext = SSLContext.getInstance("TLS");
|
||||
+
|
||||
+ sslContext.init(null, null, new SecureRandom());
|
||||
+
|
||||
+ // NB: This factory is a workaround to enable SNI with
|
||||
+ // httpcomponents-client 4.2; not needed for 4.3
|
||||
+ SSLSocketFactory factory = new SSLSocketFactory(sslContext) {
|
||||
+ @Override
|
||||
+ public Socket connectSocket(Socket socket,
|
||||
+ InetSocketAddress remoteAddress,
|
||||
+ InetSocketAddress localAddress,
|
||||
+ HttpParams params)
|
||||
+ throws IOException, UnknownHostException,
|
||||
+ ConnectTimeoutException {
|
||||
+ if (socket instanceof SSLSocket) {
|
||||
+ try {
|
||||
+ PropertyUtils.setProperty(socket, "host",
|
||||
+ remoteAddress.getHostName());
|
||||
+ }
|
||||
+ catch (Exception ex) {
|
||||
+ log.warn(
|
||||
+ "Unable to enable SNI; you may have trouble connecting to some secure hosts. Please ensure that you are running Java 1.7 or later.");
|
||||
+ }
|
||||
+ }
|
||||
+ return super.connectSocket(socket, remoteAddress,
|
||||
+ localAddress, params);
|
||||
+ }
|
||||
+ };
|
||||
+
|
||||
+ HttpClient client = new DefaultHttpClient();
|
||||
+
|
||||
+ ClientConnectionManager manager = client.getConnectionManager();
|
||||
+ manager.getSchemeRegistry().register(
|
||||
+ new Scheme("https", 443, factory));
|
||||
+ return new ApacheHttpClient4Executor(client);
|
||||
+
|
||||
+ } catch (Exception e) {
|
||||
+ log.warn("error creating SSL client", e);
|
||||
+ }
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
public <T> T createProxy(Class<T> clazz, URI baseUri)
|
||||
{
|
||||
log.debug("{} proxy uri: {}", clazz.getSimpleName(), baseUri);
|
||||
@@ -244,7 +305,8 @@ public class ZanataProxyFactory implements ITranslationResourcesFactory
|
||||
|
||||
public ISourceDocResource getSourceDocResource(String projectSlug, String versionSlug)
|
||||
{
|
||||
- return createProxy(ISourceDocResource.class, getResourceURI(projectSlug, versionSlug));
|
||||
+ return createProxy(ISourceDocResource.class, getResourceURI(projectSlug,
|
||||
+ versionSlug));
|
||||
}
|
||||
|
||||
public IFileResource getFileResource()
|
||||
@@ -317,7 +379,7 @@ public class ZanataProxyFactory implements ITranslationResourcesFactory
|
||||
{
|
||||
crf.getPrefixInterceptors().registerInterceptor(interceptor);
|
||||
}
|
||||
-
|
||||
+
|
||||
protected IVersionResource createIVersionResource()
|
||||
{
|
||||
URL url;
|
||||
1
sources
Normal file
1
sources
Normal file
|
|
@ -0,0 +1 @@
|
|||
a63d56d4a11fa48f7fbda5f0efbe0cf9 client-2.2.0.zip
|
||||
193
zanata-client.spec
Normal file
193
zanata-client.spec
Normal file
|
|
@ -0,0 +1,193 @@
|
|||
%global shortname client
|
||||
|
||||
%global submodule_rest zanata-rest-%{shortname}
|
||||
%global submodule_commands zanata-%{shortname}-commands
|
||||
%global submodule_cli zanata-cli
|
||||
|
||||
Name: zanata-%{shortname}
|
||||
Version: 2.2.0
|
||||
Release: 4%{?dist}
|
||||
Summary: Zanata client module
|
||||
|
||||
Group: Development/Tools
|
||||
License: LGPLv2+
|
||||
URL: https://github.com/zanata/%{name}
|
||||
Source0: https://github.com/zanata/%{name}/archive/%{shortname}-%{version}.zip
|
||||
Patch0: sni-for-client-2.2.0.patch
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
BuildRequires: maven-local
|
||||
|
||||
BuildRequires: maven-dependency-plugin
|
||||
BuildRequires: maven-enforcer-plugin
|
||||
BuildRequires: maven-surefire-plugin
|
||||
BuildRequires: maven-surefire-provider-testng
|
||||
BuildRequires: maven-surefire-provider-junit4
|
||||
|
||||
# dependencies in zanata-rest-client
|
||||
BuildRequires: zanata-parent
|
||||
BuildRequires: zanata-api
|
||||
BuildRequires: junit
|
||||
BuildRequires: resteasy
|
||||
|
||||
# dependencies in zanata-common-commands
|
||||
BuildRequires: zanata-common
|
||||
BuildRequires: mockito
|
||||
BuildRequires: apache-commons-configuration
|
||||
BuildRequires: log4j
|
||||
BuildRequires: args4j
|
||||
BuildRequires: openprops
|
||||
BuildRequires: apache-commons-collections
|
||||
BuildRequires: guava
|
||||
BuildRequires: hamcrest
|
||||
BuildRequires: apache-commons-lang
|
||||
BuildRequires: apache-commons-codec
|
||||
BuildRequires: apache-commons-io
|
||||
BuildRequires: opencsv
|
||||
BuildRequires: ant
|
||||
|
||||
# dependencies in zanata-cli
|
||||
BuildRequires: exec-maven-plugin
|
||||
|
||||
Requires: jpackage-utils
|
||||
Requires: java
|
||||
|
||||
Requires: slf4j
|
||||
Requires: zanata-api
|
||||
Requires: resteasy
|
||||
Requires: zanata-common
|
||||
Requires: apache-commons-configuration
|
||||
Requires: log4j
|
||||
Requires: args4j
|
||||
Requires: openprops
|
||||
Requires: apache-commons-collections
|
||||
Requires: guava
|
||||
Requires: apache-commons-lang
|
||||
Requires: apache-commons-codec
|
||||
Requires: apache-commons-io
|
||||
Requires: opencsv
|
||||
Requires: ant
|
||||
|
||||
|
||||
%description
|
||||
Zanata client modules.
|
||||
Holds most of Zanata's client code, including Zanata CLI.
|
||||
It also contains REST stub for interacting with a Zanata server.
|
||||
|
||||
%package javadoc
|
||||
Summary: Javadocs for %{name}
|
||||
Group: Documentation
|
||||
Requires: jpackage-utils
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description javadoc
|
||||
This package contains the API documentation for %{shortname}.
|
||||
This includes submodules:
|
||||
%{submodule_rest}, %{submodule_commands} and %{submodule_cli}.
|
||||
|
||||
%prep
|
||||
%setup -q -n %{name}-%{shortname}-%{version}
|
||||
%pom_disable_module zanata-maven-plugin
|
||||
%pom_remove_plugin :appassembler-maven-plugin %{submodule_cli}
|
||||
%pom_remove_plugin :maven-assembly-plugin %{submodule_cli}
|
||||
|
||||
%patch0
|
||||
|
||||
%build
|
||||
# -Dmaven.local.debug=true
|
||||
# we delete all test class under f19 because of hamcrest compatibility issue
|
||||
find . -type f -name "*Test.java" | xargs rm
|
||||
%mvn_build -- -Dmdep.analyze.skip=true -DskipTests
|
||||
|
||||
# local offline maven can not resolve each module,
|
||||
# we have to disable our own module and generate classpath one by one
|
||||
cd %{submodule_rest}
|
||||
mvn-rpmbuild dependency:build-classpath -DincludeScope=compile -Dmdep.outputFile=target/%{submodule_rest}-classpath.txt
|
||||
|
||||
cd ..
|
||||
%pom_remove_dep org.zanata:%{submodule_rest} %{submodule_commands}
|
||||
cd %{submodule_commands}
|
||||
mvn-rpmbuild dependency:build-classpath -DincludeScope=compile -Dmdep.outputFile=target/%{submodule_commands}-classpath.txt
|
||||
|
||||
cd ..
|
||||
%pom_remove_dep org.zanata:%{submodule_commands} %{submodule_cli}
|
||||
cd %{submodule_cli}
|
||||
mvn-rpmbuild dependency:build-classpath -DincludeScope=compile -Dmdep.outputFile=target/%{submodule_cli}-classpath.txt
|
||||
|
||||
|
||||
%install
|
||||
%mvn_install
|
||||
|
||||
rest_cp=$(cat %{submodule_rest}/target/%{submodule_rest}-classpath.txt)
|
||||
commands_cp=$(cat %{submodule_commands}/target/%{submodule_commands}-classpath.txt)
|
||||
cli_cp=$(cat %{submodule_cli}/target/%{submodule_cli}-classpath.txt)
|
||||
|
||||
%global CLASSPATH $rest_cp:$commands_cp:$cli_cp
|
||||
|
||||
mkdir -p %{buildroot}%{_bindir}
|
||||
|
||||
install -d -m 755 %{buildroot}%{_bindir}
|
||||
# create wrapper script
|
||||
# adapted from jpackage_script().
|
||||
# We build CLASSPATH at build time and the script won't be able to access it at runtime
|
||||
############# copied from jpackage_script() ###########################
|
||||
cat > %{buildroot}%{_bindir}/zanata-cli << ZANATA_CLI
|
||||
#!/bin/sh
|
||||
#
|
||||
# %{name} script
|
||||
# JPackage Project <http://www.jpackage.org/>
|
||||
|
||||
# Source functions library
|
||||
. %{_javadir}-utils/java-functions
|
||||
|
||||
# Source system prefs
|
||||
if [ -f %{_sysconfdir}/java/%{name}.conf ] ; then
|
||||
. %{_sysconfdir}/java/%{name}.conf
|
||||
fi
|
||||
|
||||
# Source user prefs
|
||||
if [ -f \$HOME/.%{name}rc ] ; then
|
||||
. \$HOME/.%{name}rc
|
||||
fi
|
||||
|
||||
# Configuration
|
||||
MAIN_CLASS=org.zanata.client.ZanataClient
|
||||
BASE_JARS="%{name}/%{submodule_rest} %{name}/%{submodule_commands} %{name}/%{submodule_cli} slf4j/log4j12 opencsv"
|
||||
CLASSPATH=%{CLASSPATH}
|
||||
|
||||
# Set parameters
|
||||
set_jvm
|
||||
# we have built CLASSPATH above
|
||||
set_classpath \$BASE_JARS
|
||||
|
||||
# Let's start
|
||||
run "\$@"
|
||||
ZANATA_CLI
|
||||
|
||||
chmod 755 %{buildroot}%{_bindir}/zanata-cli
|
||||
#################################################################
|
||||
|
||||
|
||||
%files -f .mfiles
|
||||
%dir %{_javadir}/%{name}
|
||||
%attr(0755,root,root) %{_bindir}/zanata-cli
|
||||
%doc README.txt
|
||||
|
||||
%files javadoc -f .mfiles-javadoc
|
||||
|
||||
%changelog
|
||||
* Tue Jul 22 2014 Patrick Huang <pahuang@redhat.com> 2.2.0-4
|
||||
- Patch to fix SNI problem
|
||||
|
||||
* Fri Nov 01 2013 Ding-Yi Chen <dchen@redhat.com> 2.2.0-3
|
||||
- Fixes Bug 1025112 - zanata-cli: Incorrect BASE_JARS
|
||||
|
||||
* Thu May 16 2013 Patrick Huang <pahuang@redhat.com> 2.2.0-2
|
||||
- Change license to LGPLv2+
|
||||
|
||||
* Fri Mar 1 2013 Patrick Huang <pahuang@redhat.com> 2.2.0-1
|
||||
- Upstream version update
|
||||
|
||||
* Mon Feb 11 2013 Patrick Huang <pahuang@redhat.com> 2.0.1-1
|
||||
- Initial RPM package
|
||||
Reference in a new issue