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

version_file's content not getting appended to the deb package's name #845

Open
taytayallday opened this issue Mar 31, 2024 · 2 comments
Open
Labels
p4 An idea that we are not considering working on at this time. wontfix

Comments

@taytayallday
Copy link

The version_file attribute of pkg_deb is not working correctly. The name of the debian package that bazel generates should be in the form of name_version_arch.deb which is true when you have a pkg_deb with "version". But for some reason, you end up with name__arch.deb when you have the "version_file" attribute. The .changes file does contain the version in the text file, but the name does not end up with it

On a bazel build with pkg_deb that has version:

builder@container:~/mybazel/bazel-bin$ ls
mydeb.deb  mydeb_1.1.1_amd64.changes  mydeb_1.1.1_amd64.deb  mytar.manifest  mytar.tar.gz  src

On a bazel build with pkg_deb that has version_file:

builder@container:~/mybazel/bazel-bin$ ls
mydeb.deb             mydeb__amd64.changes  mydeb__amd64.deb      mytar.manifest        mytar.tar.gz
builder@container:~/mybazel/bazel-bin$ cat mydeb__amd64.changes 
Format: 1.8
Date: Thu Jan  1 00:00:00 1970
Source: mydeb
Binary: mydeb
Architecture: amd64
Version: 1.1.1
@taytayallday
Copy link
Author

In [rules_pkg/pkg/private/deb/deb.bzl], we have

def _pkg_deb_impl(ctx):
    """The implementation for the pkg_deb rule."""

    package_file_name = ctx.attr.package_file_name
    if not package_file_name:
        package_file_name = "%s_%s_%s.deb" % (
            ctx.attr.package,
            ctx.attr.version,
            ctx.attr.architecture,
        )

    outputs, output_file, output_name = setup_output_files(
        ctx,
        package_file_name = package_file_name,
    )

but in the case where we use version_file, version is empty.

@aiuto aiuto added the wontfix label Apr 1, 2024
@aiuto
Copy link
Collaborator

aiuto commented Apr 1, 2024

This not possible given the relative ordering of analysis and execution in Bazel.
The file name is defined at analysis time, which must complete before we execute the actions required by the rule.
Reading the content of the version file happens in that execution phase.

It would be possible to detect that the user specified the version file and neither the file name or the version, os that the file name would be mydeb_XXXX_x86.deb. Or maybe it could fail hard.

@aiuto aiuto added the p4 An idea that we are not considering working on at this time. label Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p4 An idea that we are not considering working on at this time. wontfix
Projects
None yet
Development

No branches or pull requests

2 participants