bazelbuild / rules_pkg

Bazel rules for creating packages of many types (zip, tar, deb, rpm, ...)
Apache License 2.0
212 stars 166 forks source link

Enable pkg_rpm and pkg_subrpm to create empty RPMs #859

Closed kellyma2 closed 2 months ago

kellyma2 commented 2 months ago

At present we fail in two ways if we try to create empty RPMs:

This change tweaks the former condition so that srcs has to be non-None or we have to have a specfile, but will allow us to have an empty ([]) value for srcs. Additionally, it injects %defattr(-,root,root) as a reasonable default for the %files blocks so as to allow rpmbuild to be happy with what we're providing.

Fixes #711

kellyma2 commented 2 months ago

I still wonder why anyone would want an empty RPM, but I'll go with the flow on that.

The examples I've encountered thusfar involve having an empty / stub top level RPM with non-empty sub RPMs, although I figured it's harmless to also enable sub RPMs to do this too.