rpm-maven-plugin icon indicating copy to clipboard operation
rpm-maven-plugin copied to clipboard

SpecWriter.writeMove cannot handle toplevel dotfiles

Open ncubede opened this issue 5 years ago • 1 comments

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 avatar May 16 '19 06:05 ncubede

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" );
}

ncubede avatar May 16 '19 06:05 ncubede