Skip to content

pkg_rpm fails trying to create an empty rpm package #711

@nacl

Description

@nacl

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that we are not working on but will review quarterlyrpm

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions