View on GitHub

Bacon @ Red Hat

CLI for ProjectNCL

Alignment Diff

Introduction

During alignment PNC (through Reqour) runs a manipulator on the upstream sources and commits the result on top of the original revision. bacon pnc build get-alignment-diff captures those changes as a diff that applies on top of the original upstream sources, so that the PNC build can be reproduced or reviewed elsewhere.

bacon pnc build get-alignment-diff BRJO2LNIL6QAA

The parts

The diff is split into up to four files, numbered in apply order. Only the files with changes are written.

File Required Content
*-1-build.diff yes The alignment itself: dependency, plugin and property changes, project version rewrites, generated files, anything not recognized
*-2-rerun-state.diff yes for Gradle/sbt GME/SMEG files that apply the alignment at build time (see below)
*-3-reproduce.diff no Removed repositories, to match the PNC build exactly
*-4-noise.diff no PME marker, PME stamp, reports and backups, formatting-only changes: never affects the build

Every part applies on its own on top of the upstream sources; applying all of them, in any order, reproduces the complete alignment. Applying them in numeric order is recommended:

git apply BRJO2LNIL6QAA-alignment-1-build.diff BRJO2LNIL6QAA-alignment-2-rerun-state.diff

Each file starts with comments describing its content, when it can be skipped, the project and its version change. A file grouping several categories has one commented section per category. The comments also list the removed repositories, the added files no rule recognized (kept in the build part) and any warning; git apply and patch ignore them.

The reproduce part only holds the repositories PNC removed from the pom.xml files, so that the build resolves from the PNC repository only. Apply it to reproduce the PNC build exactly; skip it when building outside PNC, where the removed repositories may still be needed to resolve the dependencies.

Options

How the manipulators apply the alignment

The manipulators apply the alignment in two different ways, which is why the rerun-state part mentions GME and SMEG but not PME:

So PME changes never go to the rerun-state part: it is required for Gradle/sbt builds and simply absent for Maven builds. Leave it out only when running GME/SMEG again yourself, as they must start from the upstream state.

Project version

The project version change is reported in the same way whatever the manipulator, on a # Project version: <original> -> <aligned> line at the top of every part, and in the command output. The files holding it are listed in the manifest (--manifest). It is preceded by a # Project: <groupId>:<artifactId> line identifying the project: the root module recorded by the alignment report in the diff (the PME execution root, the GME root project), else the name PNC gave the build (its BREW_BUILD_NAME attribute), else unknown. The project version is read from:

Manipulator Source Part holding the change
PME the version rewritten in the pom.xml files build
GME originalVersion and version in manipulation.json rerun-state
SMEG version := in manipulations.sbt (the original version is not recorded) rerun-state

The project version change is part of the alignment whatever the manipulator, and is never optional: a project often uses its own version elsewhere (e.g. a property referencing its sibling modules), which the manipulator aligns together with the other properties, so the build part does not build without the version rewrite.