query
On this page

rpmClosureGenerator

pkgs.vmTools.rpmClosureGenerator

Docs pulled from | This Revision | 10 minutes ago


Generate a Nix expression containing fetchurl calls for the closure of a set of top-level RPM packages from the `primary.xml.gz' file of a Fedora or openSUSE distribution.


Noogle detected

Implementation

The following is the current implementation of this function.

rpmClosureGenerator =
    {
      name,
      packagesLists,
      urlPrefixes,
      packages,
      archs ? [ ],
    }:
    assert (builtins.length packagesLists) == (builtins.length urlPrefixes);
    runCommand "${name}.nix"
      {
        nativeBuildInputs = [
          buildPackages.perl
          buildPackages.perlPackages.XMLSimple
        ];
        inherit archs;
      }
      ''
        ${lib.concatImapStrings (i: pl: ''
          gunzip < ${pl} > ./packages_${toString i}.xml
        '') packagesLists}
        perl -w ${rpm/rpm-closure.pl} \
          ${
            lib.concatImapStrings (i: pl: "./packages_${toString i}.xml ${pl.snd} ") (
              lib.zipLists packagesLists urlPrefixes
            )
          } \
          ${toString packages} > $out
      '';