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

pkg_rpm fails trying to create an empty rpm package #711

Closed
nacl opened this issue Jun 9, 2023 · 0 comments · Fixed by #859
Closed

pkg_rpm fails trying to create an empty rpm package #711

nacl opened this issue Jun 9, 2023 · 0 comments · Fixed by #859
Labels
P3 An issue that we are not working on but will review quarterly rpm

Comments

@nacl
Copy link
Collaborator

nacl commented Jun 9, 2023

Given the following:

pkg_files(
    name = "empty",
    srcs = [],
)

pkg_rpm(
    name = "empty_rpm",
    srcs = [
        ":empty",
    ],
    architecture = "noarch",
    description = """description""",
    license = "Apache 2.0",
    summary = "summary",
    version = "1.0",
)

empty_rpm will eventually fail to build with:

error: Empty %files file /tmp/tmpa07nyy51/BUILD/empty_rpm.spec.files

Creating an empty package should be possible. For example, one could wish to create a package consisting entirely of metadata that requires other packages. There are two ways users could hit this issue:

  • Users could (inadvertently) create a pkg_files with an empty input and pass it to pkg_rpm. The error presented to the user is related to pkg_rpm internals and is not useful to end-users.
  • Users could deliberately pass in an empty srcs value to pkg_rpm. In this case, we get a failure in the pkg_rpm wrapper macro due to relaxed boolean checks on incoming values (empty lists are "falsey"). Checking specifically for None should be enough. When tested locally, this ends up producing the same error as above.

IMO, making srcs non-mandatory is not a good idea, as requiring its presence (even if it is an empty value) makes the intent clearer.

Other packages (debian packages?) may also have this need as well.

#209 may help to simplify the fix here, but it is not necessary to address this problem.

@nacl nacl added P3 An issue that we are not working on but will review quarterly rpm labels Jun 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 An issue that we are not working on but will review quarterly rpm
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant