From 2a911b5e4094c8a611d4b5e0eceed7e5729a61b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=B6ser=2C=20Daniel?= Date: Wed, 13 Dec 2023 15:29:20 +0100 Subject: [PATCH] Add plugin configuration parameter generateIntermediateDirectories --- .../de/dentrassi/rpm/builder/RpmMojo.java | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/dentrassi/rpm/builder/RpmMojo.java b/src/main/java/de/dentrassi/rpm/builder/RpmMojo.java index 48df840..9e3cc79 100644 --- a/src/main/java/de/dentrassi/rpm/builder/RpmMojo.java +++ b/src/main/java/de/dentrassi/rpm/builder/RpmMojo.java @@ -208,6 +208,28 @@ public void setGenerateDefaultSourcePackage(final boolean generateDefaultSourceP this.generateDefaultSourcePackage = generateDefaultSourcePackage; } + /** + * Whether implicitly created intermediate directories should explicitly + * added to package. + *

+ * If enabled, all from entries implicitly created intermediate directories + * are added as explicit entries to package. Also the rules with file + * information are applied to these directories. + *

+ *

+ * To exclude directories like {@code /usr} from being added, you have + * to add these as prefix property (see {@code prefixes}). Directories + * that match a whole prefix or a sub path of it, are not added. + *

+ */ + @Parameter(property = "rpm.generateIntermediateDirectories", defaultValue = "true") + boolean generateIntermediateDirectories = true; + + public void setGenerateIntermediateDirectories(final boolean generateIntermediateDirectories) { + this.generateIntermediateDirectories = generateIntermediateDirectories; + } + + /** * The prefix of the release if this is a snapshot build, will be suffixed * with the snapshot build id @@ -1096,7 +1118,9 @@ protected void fillPayload(final RpmBuilder builder) throws MojoFailureException } ctx.removeListener(missingDirectoryTracker); - missingDirectoryTracker.addMissingIntermediateDirectoriesToContext(ctx); + if (generateIntermediateDirectories) { + missingDirectoryTracker.addMissingIntermediateDirectoriesToContext(ctx); + } } private void customizeHeader(final RpmBuilder builder) {