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

Configuration file flag not added to RPM #445

Open
milgner opened this issue Jul 30, 2024 · 4 comments
Open

Configuration file flag not added to RPM #445

milgner opened this issue Jul 30, 2024 · 4 comments

Comments

@milgner
Copy link

milgner commented Jul 30, 2024

After reading #56 and #118, it seems like the issue was fixed for DEB packages but is still not working for RPMs.

After some experimentation, my Gradle build script now contains:

    from("src/main/resources") {
        fileType = Directive(RPMFILE_CONFIG or RPMFILE_NOREPLACE)
        into("/etc/rebased/conf")
        eachFile {
            configurationFiles.push("/$path")
        }
    }

I have also tried just setting one configurationFile and leaving out the RPMFILE_NOREPLACE flag or the fileType altogether.

But the resulting .rpm file doesn't have any information - about neither the config flag nor the noreplace. The file itself is included as expected, though.

Furthermore, a code search on Github did not turn up any reference to the configurationFiles attribute as part of the rpm packaging plugin.

@milgner milgner changed the title Configuration Files not added to RPM Configuration file flag not added to RPM Jul 31, 2024
@DanielThomas
Copy link
Contributor

configurationFiles was added as Debian specific extension, because has a separate conffiles file and no concept of file directives, but for convenience fileType = CONFIG works.

fileType is all you should need, as covered by https://github.com/nebula-plugins/gradle-ospackage-plugin/wiki/RPM-Plugin#example. The directive is looked up on each copy spec:

Directive fileType = lookup(specToLookAt, 'fileType')

The comment on https://github.com/nebula-plugins/gradle-ospackage-plugin/blob/main/src/main/groovy/com/netflix/gradle/plugins/packaging/CopySpecEnhancement.groovy#L16-L28 seems to indicate that either syntax should work fine.

@milgner
Copy link
Author

milgner commented Aug 5, 2024

That is very strange. I have tried a few more approaches, but the RPM file never lists the file(s) as config files.
My latest approach is

    from("src/main/resources") {
        into("/etc/rebased/conf")
        eachFile {
            fileType = Directive(RPMFILE_CONFIG or RPMFILE_NOREPLACE)
        }
    }

I'm checking with rpm -q --configfiles my.rpm and would expect the file to show up there, too.

@DanielThomas
Copy link
Contributor

At a glance, you'll want to drop the eachFile there, fileType is something we add on the FileCopySpec and it applies to everything in the from.

@milgner
Copy link
Author

milgner commented Aug 6, 2024

That was my very first approach. When that didn't work, I tried all kinds of variations, without success.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants