mojohaus / rpm-maven-plugin

http://www.mojohaus.org/rpm-maven-plugin/
Other
56 stars 48 forks source link

SpecWriter.writeMove cannot handle toplevel dotfiles #112

Open ncubede opened 5 years ago

ncubede commented 5 years ago

The generated move section in the spec file moves TMP_BUILD_ROOT/*, where it should move all files. If e.g. a .bashrc is packaged in a prefix, then it fails to build, as .bashrc is not moved, but is mentioned in the spec file.

That would be much less of an issue, if the move section could be overridden in configuration, but it can't be. A possible script that would work (assuming TMP_BUILD_ROOT is set instead of hardcoding it into the script in writeMove) is:

mkdir -p "$RPM_BUILD_ROOT" find "$TMP_BUILD_ROOT" -depth 1 | while read top do mv "$TMP_BUILD_ROOT/$top" "$RPM_BUILD_ROOT/" done

I would stay away from moving / and /.??, which then may or may not exist.

ncubede commented 5 years ago
private void writeMove()
{
    final String tmpBuildRoot = FileHelper.toUnixPath( mojo.getBuildroot() );
    spec.println();
spec.println( "%install" );
    spec.println();
    spec.print( "TMP_BUILD_ROOT=\"");
    spec.print( tmpBuildRoot );
    spec.println( "\"" );
spec.println( "mkdir -p \"$RPM_BUILD_ROOT\"" );
    spec.println( "find \"$TMP_BUILD_ROOT\" -depth 1 | while read top ; do mv \"$top\" \"$RPM_BUILD_ROOT/\"; done" );
}