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

Unable to apply patches on ament vendor packages #557

Open
KABILAN235 opened this issue Jan 4, 2025 · 1 comment
Open

Unable to apply patches on ament vendor packages #557

KABILAN235 opened this issue Jan 4, 2025 · 1 comment

Comments

@KABILAN235
Copy link

Problem

Applying patches on ament vendor packages through patchAmentVendorGit seems to be problematic especially in cases where a minor patch required on one of the vendor packages requires a version bump.

Example

I'm using this package from the overlay that uses patchAmentVendorGit under the hood to fetch the source from here

gz-sensors-vendor = lib.patchGzAmentVendorGit rosSuper.gz-sensors-vendor {
    version = "8.2.0";
    hash = "sha256-wEUJoHbvvImuFbaKk84maw5AoKhoEhdU0uOYVBtHhI0=";
  };

Problem arises when we want to include a patch like this this have to be applied. Since patchAmentVendorGit doesn't support patches, the solution here would be to bump up the version from 8.2.0 -> 8.2.1 which isin't ideal

Proposed solution

Would be really cool if we can have a patches as an override attr which allows us to do something like this

gz-sensors-vendor = lib.patchGzAmentVendorGit rosSuper.gz-sensors-vendor {
    version = "8.2.0";
    hash = "sha256-wEUJoHbvvImuFbaKk84maw5AoKhoEhdU0uOYVBtHhI0=";
  }.overrideAttrs ({
    patches ? [], ...
  }: {
    patches = patches ++ [
      (self.fetchpatch {
        url = "https://github.com/gazebosim/gz-sensors/commit/aaef365e6c51dcf98334e9f7a70e5fc4e3281f91.patch";
        hash = "sha256-npFHdb0a3JBA8T6vke54DA08C93aNc/7c6xrfMBo7zI=";
        stripLen = 1;
      })
    ];
  });;
@wentasah
Copy link
Contributor

wentasah commented Jan 4, 2025

I don't understand what is the problem. Could you write which exact errors you encounter?

Isn't it sufficient to put lib.patchGzAmentVendorGit expression in parentheses before overriding it? Like this:

gz-sensors-vendor = (lib.patchGzAmentVendorGit rosSuper.gz-sensors-vendor {
    version = "8.2.0";
    hash = "sha256-wEUJoHbvvImuFbaKk84maw5AoKhoEhdU0uOYVBtHhI0=";
  }).overrideAttrs ({
    patches ? [], ...
  }: {
    patches = patches ++ [
      (self.fetchpatch {
        url = "https://github.com/gazebosim/gz-sensors/commit/aaef365e6c51dcf98334e9f7a70e5fc4e3281f91.patch";
        hash = "sha256-npFHdb0a3JBA8T6vke54DA08C93aNc/7c6xrfMBo7zI=";
        stripLen = 1;
      })
    ];
  });;

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