diff --git a/src/main/java/de/dentrassi/rpm/builder/PackageEntry.java b/src/main/java/de/dentrassi/rpm/builder/PackageEntry.java index ccfeef5..b7b0702 100644 --- a/src/main/java/de/dentrassi/rpm/builder/PackageEntry.java +++ b/src/main/java/de/dentrassi/rpm/builder/PackageEntry.java @@ -169,10 +169,11 @@ public void validate () sources += this.file != null ? 1 : 0; sources += this.collect != null ? 1 : 0; sources += this.linkTo != null ? 1 : 0; + sources += Boolean.TRUE.equals ( this.getGhost () ) ? 1 : 0; if ( sources != 1 ) { - throw new IllegalStateException ( "Exactly one of 'file', 'directory', 'linkTo' or 'collect' must be specified." ); + throw new IllegalStateException ( "Exactly one of 'file', 'directory', 'linkTo', 'collect' or 'ghost' must be specified." ); } super.validate (); diff --git a/src/main/java/de/dentrassi/rpm/builder/RpmMojo.java b/src/main/java/de/dentrassi/rpm/builder/RpmMojo.java index ea0d9e1..b8a6506 100644 --- a/src/main/java/de/dentrassi/rpm/builder/RpmMojo.java +++ b/src/main/java/de/dentrassi/rpm/builder/RpmMojo.java @@ -23,6 +23,7 @@ import java.io.IOException; import java.net.InetAddress; import java.net.UnknownHostException; +import java.nio.ByteBuffer; import java.nio.file.FileAlreadyExistsException; import java.nio.file.Files; import java.nio.file.Path; @@ -1101,6 +1102,10 @@ else if ( entry.getCollect () != null ) { fillFromEntryCollect ( ctx, entry ); } + else if ( Boolean.TRUE.equals ( entry.getGhost () ) ) + { + fillFromEntryGhost ( ctx, entry ); + } } private void fillFromEntryDirectory ( final BuilderContext ctx, final PackageEntry entry ) throws IOException @@ -1118,6 +1123,13 @@ private void fillFromEntryFile ( final BuilderContext ctx, final PackageEntry en ctx.addFile ( entry.getName (), source, makeProvider ( entry, " - " ) ); } + private void fillFromEntryGhost ( final BuilderContext ctx, final PackageEntry entry ) throws IOException + { + this.logger.debug ( " as ghost:" ); + + ctx.addFile ( entry.getName (), ByteBuffer.allocate ( 0 ), makeProvider ( entry, " - " ) ); + } + private void fillFromEntryLinkTo ( final BuilderContext ctx, final PackageEntry entry ) throws IOException { this.logger.debug ( " as symbolic link:" );