Merge branch 'stable-2.9' into stable-2.10

* stable-2.9:
  Inject InitStep members again before calling postRun.
  SSHD: Update to 0.13.0
  Bump SSHD Mina version to 2.0.8
  Bump Bouncycastle version to 1.51
  Update EncryptedContactStore to not use deprecated/removed methods

Change-Id: I4d67f79b9614289f222f9adcc8c513813ab3035c
This commit is contained in:
Shawn Pearce 2014-11-11 10:23:32 -08:00
commit 8071a4f014
7 changed files with 49 additions and 29 deletions

View File

@ -70,6 +70,8 @@ public class BaseInit extends SiteProgram {
protected final PluginsDistribution pluginsDistribution;
private final List<String> pluginsToInstall;
private Injector sysInjector;
protected BaseInit(PluginsDistribution pluginsDistribution,
List<String> pluginsToInstall) {
this.standalone = true;
@ -111,7 +113,7 @@ public class BaseInit extends SiteProgram {
run = createSiteRun(init);
run.upgradeSchema();
init.initializer.postRun();
init.initializer.postRun(createSysInjector(init));
} catch (Exception failure) {
if (init.flags.deleteOnFailure) {
recursiveDelete(getSitePath());
@ -316,15 +318,18 @@ public class BaseInit extends SiteProgram {
}
private Injector createSysInjector(final SiteInit init) {
final List<Module> modules = new ArrayList<>();
modules.add(new AbstractModule() {
@Override
protected void configure() {
bind(ConsoleUI.class).toInstance(init.ui);
bind(InitFlags.class).toInstance(init.flags);
}
});
return createDbInjector(SINGLE_USER).createChildInjector(modules);
if (sysInjector == null) {
final List<Module> modules = new ArrayList<Module>();
modules.add(new AbstractModule() {
@Override
protected void configure() {
bind(ConsoleUI.class).toInstance(init.ui);
bind(InitFlags.class).toInstance(init.flags);
}
});
sysInjector = createDbInjector(SINGLE_USER).createChildInjector(modules);
}
return sysInjector;
}
private static void recursiveDelete(File path) {

View File

@ -20,6 +20,7 @@ import com.google.gerrit.pgm.util.ConsoleUI;
import com.google.gerrit.server.config.SitePaths;
import com.google.gerrit.server.plugins.JarPluginProvider;
import com.google.inject.Inject;
import com.google.inject.Injector;
import com.google.inject.Singleton;
import java.io.File;
@ -69,6 +70,8 @@ public class InitPlugins implements InitStep {
private final InitPluginStepsLoader pluginLoader;
private final PluginsDistribution pluginsDistribution;
private Injector postRunInjector;
@Inject
InitPlugins(final ConsoleUI ui, final SitePaths site,
InitFlags initFlags, InitPluginStepsLoader pluginLoader,
@ -93,6 +96,11 @@ public class InitPlugins implements InitStep {
postInitPlugins();
}
@Inject(optional = true)
void setPostRunInjector(Injector injector) {
postRunInjector = injector;
}
private void installPlugins() throws IOException {
List<PluginData> plugins = listPlugins(site, pluginsDistribution);
for (PluginData plugin : plugins) {
@ -144,6 +152,7 @@ public class InitPlugins implements InitStep {
private void postInitPlugins() throws Exception {
for (InitStep initStep : pluginLoader.getInitSteps()) {
postRunInjector.injectMembers(initStep);
initStep.postRun();
}
}

View File

@ -108,12 +108,13 @@ public class SitePathInitializer {
}
}
public void postRun() throws Exception {
public void postRun(Injector injector) throws Exception {
for (InitStep step : steps) {
if (step instanceof InitPlugins
&& flags.skipPlugins) {
continue;
}
injector.injectMembers(step);
step.postRun();
}
}

View File

@ -15,16 +15,16 @@
# Version should match lib/bouncycastle/BUCK
[library "bouncyCastleProvider"]
name = Bouncy Castle Crypto Provider v149
url = http://www.bouncycastle.org/download/bcprov-jdk15on-149.jar
sha1 = f5155f04330459104b79923274db5060c1057b99
name = Bouncy Castle Crypto Provider v151
url = http://www.bouncycastle.org/download/bcprov-jdk15on-151.jar
sha1 = 9ab8afcc2842d5ef06eb775a0a2b12783b99aa80
remove = bcprov-.*[.]jar
# Version should match lib/bouncycastle/BUCK
[library "bouncyCastleSSL"]
name = Bouncy Castle Crypto SSL v149
url = http://www.bouncycastle.org/download/bcpkix-jdk15on-149.jar
sha1 = 924cc7ad2f589630c97b918f044296ebf1bb6855
name = Bouncy Castle Crypto SSL v151
url = http://www.bouncycastle.org/download/bcpkix-jdk15on-151.jar
sha1 = 6c8c1f61bf27a09f9b1a8abc201523669bba9597
needs = bouncyCastleProvider
remove = bcpkix-.*[.]jar

View File

@ -38,6 +38,8 @@ import org.bouncycastle.openpgp.PGPPublicKey;
import org.bouncycastle.openpgp.PGPPublicKeyRing;
import org.bouncycastle.openpgp.PGPPublicKeyRingCollection;
import org.bouncycastle.openpgp.PGPUtil;
import org.bouncycastle.openpgp.operator.bc.BcPGPDataEncryptorBuilder;
import org.bouncycastle.openpgp.operator.bc.BcPublicKeyKeyEncryptionMethodGenerator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -167,12 +169,16 @@ class EncryptedContactStore implements ContactStore {
}
}
@SuppressWarnings("deprecation")
private final PGPEncryptedDataGenerator cpk()
throws NoSuchProviderException, PGPException {
final BcPGPDataEncryptorBuilder builder =
new BcPGPDataEncryptorBuilder(PGPEncryptedData.CAST5)
.setSecureRandom(prng);
PGPEncryptedDataGenerator cpk =
new PGPEncryptedDataGenerator(PGPEncryptedData.CAST5, true, prng, "BC");
cpk.addMethod(dest);
new PGPEncryptedDataGenerator(builder, true);
final BcPublicKeyKeyEncryptionMethodGenerator methodGenerator =
new BcPublicKeyKeyEncryptionMethodGenerator(dest);
cpk.addMethod(methodGenerator);
return cpk;
}

View File

@ -2,19 +2,19 @@ include_defs('//lib/maven.defs')
# This version must match the version that also appears in
# gerrit-pgm/src/main/resources/com/google/gerrit/pgm/libraries.config
VERSION = '1.49'
VERSION = '1.51'
maven_jar(
name = 'bcprov',
id = 'org.bouncycastle:bcprov-jdk15on:' + VERSION,
sha1 = 'f5155f04330459104b79923274db5060c1057b99',
sha1 = '9ab8afcc2842d5ef06eb775a0a2b12783b99aa80',
license = 'DO_NOT_DISTRIBUTE', #'bouncycastle'
)
maven_jar(
name = 'bcpg',
id = 'org.bouncycastle:bcpg-jdk15on:' + VERSION,
sha1 = '081d84be5b125e1997ab0e2244d1a2276b5de76c',
sha1 = 'b5fa4c280dfbf8bf7c260bc1e78044c7a1de5133',
license = 'DO_NOT_DISTRIBUTE', #'bouncycastle'
deps = [':bcprov'],
)
@ -22,7 +22,7 @@ maven_jar(
maven_jar(
name = 'bcpkix',
id = 'org.bouncycastle:bcpkix-jdk15on:' + VERSION,
sha1 = '924cc7ad2f589630c97b918f044296ebf1bb6855',
sha1 = '6c8c1f61bf27a09f9b1a8abc201523669bba9597',
license = 'DO_NOT_DISTRIBUTE', #'bouncycastle'
deps = [':bcprov'],
)

View File

@ -8,18 +8,17 @@ EXCLUDE = [
maven_jar(
name = 'sshd',
id = 'org.apache.sshd:sshd-core:0.11.1-atlassian-1',
sha1 = '0de20bfa03ddeedc8eb54ab6e85e90e776ea18f8',
id = 'org.apache.sshd:sshd-core:0.13.0',
sha1 = 'c616c5865cc55473c6d63c6fcf46e60d382be172',
license = 'Apache2.0',
deps = [':core'],
exclude = EXCLUDE,
repository = ATLASSIAN,
)
maven_jar(
name = 'core',
id = 'org.apache.mina:mina-core:2.0.7',
sha1 = 'c878e2aa82de748474a624ec3933e4604e446dec',
id = 'org.apache.mina:mina-core:2.0.8',
sha1 = 'd6ff69fa049aeaecdf0c04cafbb1ab53b7487883',
license = 'Apache2.0',
exclude = EXCLUDE,
)