Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rpm package primary #40

Merged
merged 5 commits into from
Jul 23, 2019
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions src/it/test14-primaryname/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>de.dentrassi.maven.rpm.test</groupId>
<artifactId>test14-primaryname</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>rpm</packaging>

<name>Test Package #14</name>
<description>
Test primary name
</description>

<url>http://dentrassi.de</url>

<organization>
<name>Jens Reimann</name>
<url>http://dentrassi.de</url>
</organization>

<licenses>
<license>
<name>Eclipse Public License - v 1.0</name>
<distribution>repo</distribution>
<url>https://www.eclipse.org/legal/epl-v10.html</url>
</license>
</licenses>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<skipSigning>true</skipSigning>
<rpm.skipSigning>true</rpm.skipSigning>
</properties>

<build>

<plugins>
<plugin>
<groupId>de.dentrassi.maven</groupId>
<artifactId>rpm</artifactId>
<extensions>true</extensions>
<version>@project.version@</version>
<executions>
<execution>
<configuration>
<group>Application/Misc</group>

<forceRelease>false</forceRelease>
<version>1.0.0</version>

<signature>
<keyId>${keyId}</keyId>
<keyringFile>${user.home}/.gnupg/secring.gpg</keyringFile>
<passphrase>${passphrase}</passphrase>
<hashAlgorithm>SHA1</hashAlgorithm>
<skip>${skipSigning}</skip>
</signature>

</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>sign</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<skipSigning>false</skipSigning>
</properties>
</profile>
</profiles>

</project>
10 changes: 10 additions & 0 deletions src/it/test14-primaryname/verify.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import java.io.File

myfile=null
basedir.eachDirRecurse{dir ->
dir.eachFileMatch(~/.*test14-primaryname-1.0.0-0.\d+.noarch.rpm.*/) { file ->
myfile=file
}
}

myfile != null
16 changes: 13 additions & 3 deletions src/main/java/de/dentrassi/rpm/builder/RpmMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* Oliver Richter - Made packageName & defaultScriptInterpreter configurable
* Lucian Burja - Added setting for creating relocatable RPM packages
* Peter Wilkinson - add skip entry flag
* Daniel Singhal - Added primary artifact support
*******************************************************************************/
package de.dentrassi.rpm.builder;

Expand Down Expand Up @@ -740,7 +741,13 @@ public void execute () throws MojoExecutionException, MojoFailureException

if ( this.attach )
{
this.projectHelper.attachArtifact ( this.project, "rpm", this.classifier, builder.getTargetFile ().toFile () );
this.logger.info ( "attaching %s", this.classifier);
if ( "rpm".equals( project.getPackaging() ) ){
project.getArtifact().setFile( builder.getTargetFile().toFile() );
singhald marked this conversation as resolved.
Show resolved Hide resolved
} else {
this.projectHelper.attachArtifact ( this.project, "rpm", this.classifier, builder.getTargetFile ().toFile () );
}

}
}
catch ( final IOException e )
Expand All @@ -749,8 +756,7 @@ public void execute () throws MojoExecutionException, MojoFailureException
}
}

private Path makeTargetFile ( final Path targetDir )
{
private String makeTargetFilename() {
String outputFileName = this.outputFileName;

if ( outputFileName == null || outputFileName.isEmpty () )
Expand All @@ -766,7 +772,11 @@ private Path makeTargetFile ( final Path targetDir )
}
this.logger.debug ( "Using generated file name - %s", outputFileName, outputFileName );
}
return outputFileName;
}

private Path makeTargetFile ( final Path targetDir ) {
String outputFileName = makeTargetFilename();
final Path targetFile = targetDir.resolve ( outputFileName );;
this.logger.debug ( "Resolved output file name - fileName: %s, fullName: %s", this.outputFileName, targetFile );
return targetFile;
Expand Down
23 changes: 23 additions & 0 deletions src/main/resources/META-INF/plexus/components.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<component-set>
<components>
<component>
<role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
<role-hint>rpm</role-hint>
<implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
<instantiation-strategy>per-lookup</instantiation-strategy>
<configuration>
<phases>
<process-resources>org.apache.maven.plugins:maven-resources-plugin:resources</process-resources>
<compile>org.apache.maven.plugins:maven-compiler-plugin:compile</compile>
<process-test-resources>org.apache.maven.plugins:maven-resources-plugin:testResources</process-test-resources>
<test-compile>org.apache.maven.plugins:maven-compiler-plugin:testCompile</test-compile>
<test>org.apache.maven.plugins:maven-surefire-plugin:test</test>
<package>de.dentrassi.maven:rpm:rpm</package>
<install>org.apache.maven.plugins:maven-install-plugin:install</install>
<deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
</phases>
</configuration>
</component>
</components>
</component-set>