private int getIndexForDepToInstall(ProvisioningConfig.Builder configBuilder, ProducerSpec producer) throws ProvisioningException { int index = Integer.MAX_VALUE; final Set<ProducerSpec> visitedFps = new HashSet<>(featurePacks.size()); visitedFps.add(producer); for(F f : featurePacks.values()) { if(!f.isTransitiveDep() && dependsOn(f, producer, visitedFps)) { index = Math.min(index, configBuilder.getFeaturePackDepIndex(f.getFPID().getLocation())); } } return index; }
/** * Query for available version update and patches for the specific producer. * * @param producer the producer to check the updates for * @return available updates for the producer * @throws ProvisioningException in case of a failure */ public FeaturePackUpdatePlan getFeaturePackUpdate(ProducerSpec producer) throws ProvisioningException { final F f = featurePacks.get(producer); if(f == null) { throw new ProvisioningException(Errors.unknownFeaturePack(producer.getLocation().getFPID())); } final FeaturePackLocation fpl = f.getFPID().getLocation(); final Universe<?> universe = layoutFactory.getUniverseResolver().getUniverse(fpl.getUniverse()); final Channel channel = universe.getProducer(fpl.getProducerName()).getChannel(fpl.getChannelName()); final List<F> patches = fpPatches.get(fpl.getFPID()); final Set<FPID> patchIds; if (patches == null || patches.isEmpty()) { patchIds = Collections.emptySet(); } else if (patches.size() == 1) { patchIds = Collections.singleton(patches.get(0).getFPID()); } else { final Set<FPID> tmp = new HashSet<>(patches.size()); for (F p : patches) { tmp.add(p.getFPID()); } patchIds = CollectionUtils.unmodifiable(tmp); } return channel.getUpdatePlan(FeaturePackUpdatePlan.request(fpl, patchIds, f.isTransitiveDep())); }
public static List<FeaturePackLocation> getInstallationLocations(Path installation, PmSession session, boolean transitive, boolean patches) { List<FeaturePackLocation> items = new ArrayList<>(); try { PathsUtils.assertInstallationDir(installation); ProvisioningManager mgr = session. newProvisioningManager(installation, false); try (ProvisioningLayout<FeaturePackLayout> layout = mgr.getLayoutFactory().newConfigLayout(mgr.getProvisioningConfig())) { for (FeaturePackLayout fp : layout.getOrderedFeaturePacks()) { if (fp.isDirectDep() || (fp.isTransitiveDep() && transitive)) { items.add(fp.getFPID().getLocation()); } if (patches) { List<FeaturePackLayout> appliedPatches = layout.getPatches(fp.getFPID()); for (FeaturePackLayout patch : appliedPatches) { items.add(patch.getFPID().getLocation()); } } } } } catch (Exception ex) { CliLogging.completionException(ex); } return items; }
private static void addCustomUpdates(ProvisioningPlan plan, List<FeaturePackLocation> custom, ProvisioningManager mgr) throws ProvisioningException { try (ProvisioningLayout<?> layout = mgr.getLayoutFactory().newConfigLayout(mgr.getProvisioningConfig())) { for (FeaturePackLocation loc : custom) { FeaturePackLayout fpl = layout.getFeaturePack(loc.getProducer()); FeaturePackLocation current = fpl.getFPID().getLocation(); FeaturePackUpdatePlan fpPlan = FeaturePackUpdatePlan.request(current, fpl.isTransitiveDep()).setNewLocation(loc).buildPlan(); if (fpPlan.hasNewLocation()) { plan.update(fpPlan); } } } }
if(installedFp.isTransitiveDep() == fpConfig.isTransitive()) { return configBuilder.updateFeaturePackDep(fpConfig); if(installedFp.isTransitiveDep()) {