private void loadPatch(FPID patchId) throws ProvisioningException { final F patchFp = layoutFactory.resolveFeaturePack(patchId.getLocation(), FeaturePackLayout.PATCH, fpFactory); final FeaturePackSpec spec = patchFp.getSpec(); if(!spec.isPatch()) { throw new ProvisioningDescriptionException(patchId + " is not a patch but listed as one"); } allPatches = CollectionUtils.put(allPatches, patchId, patchFp); if(spec.hasFeaturePackDeps()) { for(FeaturePackConfig patchDep : spec.getFeaturePackDeps()) { final FPID patchDepId = patchDep.getLocation().getFPID(); if(allPatches.containsKey(patchDepId)) { continue; } loadPatch(patchDepId); } } final FPID patchFor = spec.getPatchFor(); List<F> patchList = fpPatches.get(patchFor); if(patchList == null) { fpPatches = CollectionUtils.put(fpPatches, patchFor, Collections.singletonList(patchFp)); } else if(patchList.size() == 1) { final List<F> tmp = new ArrayList<>(2); tmp.add(patchList.get(0)); tmp.add(patchFp); fpPatches = CollectionUtils.put(fpPatches, patchFor, tmp); } else { patchList.add(patchFp); } }
F patchTarget = featurePacks.get(fpSpec.getPatchFor().getProducer()); if(patchTarget == null || !patchTarget.getFPID().equals(fpSpec.getPatchFor())) { throw new ProvisioningException(Errors.patchNotApplicable(fpid, fpSpec.getPatchFor())); FeaturePackConfig installedFpConfig = config.getFeaturePackDep(fpSpec.getPatchFor().getProducer()); if(installedFpConfig == null) { installedFpConfig = config.getTransitiveDep(fpSpec.getPatchFor().getProducer());
private ProvisioningConfig.Builder uninstall(FPID fpid, ProvisioningConfig.Builder configBuilder) throws ProvisioningException { if(allPatches.containsKey(fpid)) { final F patchFp = allPatches.get(fpid); final ProducerSpec patchTarget = patchFp.getSpec().getPatchFor().getProducer(); FeaturePackConfig targetConfig = config.getFeaturePackDep(patchTarget); if(targetConfig == null) {
public static String buildPatches(PmCommandInvocation invoc, ProvisioningLayout<FeaturePackLayout> layout) throws ProvisioningException { if (!layout.hasPatches()) { return null; } Table table = new Table(Headers.PATCH, Headers.PATCH_FOR, Headers.UPDATE_CHANNEL); for (FeaturePackLayout fpLayout : layout.getOrderedFeaturePacks()) { List<FeaturePackLayout> patches = layout.getPatches(fpLayout.getFPID()); for (FeaturePackLayout patch : patches) { FeaturePackLocation loc = invoc.getPmSession().getExposedLocation(null, patch.getFPID().getLocation()); FPID patchFor = patch.getSpec().getPatchFor(); table.addLine(patch.getFPID().getBuild(), patchFor.getProducer().getName() + FeaturePackLocation.BUILD_START + patchFor.getBuild(), formatChannel(loc)); } } if (!table.isEmpty()) { table.sort(Table.SortType.ASCENDANT); return table.build(); } return null; }
addAttribute(patchFor, Attribute.FOR, fpSpec.getPatchFor().toString());
final FPID patchFor = product.getSpec().getPatchFor(); if (patchFor != null) { commandInvocation.println("");