Need advice for gnulib dependency

While fixing a broken package (idutils) I discovered that one of the issues was an outdated version of a dependency called gnulib. My question regards the best way to deal with updating gnulib:

Option 1 - Update gnulib from 20200223 to 20210524. The issue here is that other packages depend on gnulib and at least one lbzip2 breaks after this update.

Option 2 - Create a special package ‘gnulib20210524’ and let idutils depend on that. Seems ugly.

Option 3 - Remove idutil’s dependency on gnulib in nix by changing the idutils build to use the ‘git’ (vs --nogit) mode which fetches gnulib from savanah during the idutils build.

Any advice appreciated.

Usually, we update library to the latest version and deal with the broken packages individually if there are not too many.

That could include creating updating idutils to latest version (hopefully, that one will support newer gnulib), or creating a second gnulib package. Preferably, the unqualified attribute should point to the latest version, though.

Having the build fetch stuff will not work in a sandbox.

1 Like

Thanks, I’ll do that (update gnulib). After writing, I saw two other options used by other packages that might be helpful to anyone reading this:

Option 4: Use overrideAttrs to locally update gnulib while leaving the ‘old’ gnulib for everything that might rely on it. This is being used currently by wget2:
(in pkgs/top-level/all-packages.nix):

wget2 = callPackage ../tools/networking/wget2 {
    # update breaks grub2
    gnulib = pkgs.gnulib.overrideAttrs (oldAttrs: rec {
      version = "20210208";
      src = fetchgit {
        url = "https://git.savannah.gnu.org/r/gnulib.git";
        rev = "0b38e1d69f03d3977d7ae7926c1efeb461a8a971";
        sha256 = "06bj9y8wcfh35h653yk8j044k7h5g82d2j3z3ib69rg0gy1xagzp";
      };
    });
  };

And finally option5 is to update gnulib, fix any packages that break and use overrideAttrs with any that can’t be fixed (yet). I might have to use this with grub2 which works with 20200223 but breaks when I update gnulib:
(in pkgs/top-level/all-packages.nix):

grub2 = grub2_full;
 grub2_full = callPackage ../tools/misc/grub/2.0x.nix {                     
    # update breaks grub2
    gnulib = pkgs.gnulib.overrideAttrs (oldAttrs: rec {
      version = "20200223";
      src = fetchgit {
        url = "https://git.savannah.gnu.org/r/gnulib.git";
        rev = "292fd5d6ff5ecce81ec3c648f353732a9ece83c0";  
        sha256 = "0hkg3nql8nsll0vrqk4ifda0v4kpi67xz42r8daqsql6c4rciqnw";
      };
    });
  };