summary refs log tree commit diff
path: root/pkgs/build-support/release/rpm-build.nix
blob: 3e12eaccba9cb73f5ab2d00ac95e04389a65156c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# This function builds an RPM from a source tarball that contains a
# RPM spec file (i.e., one that can be built using `rpmbuild -ta').

{ name ? "rpm-build"
, diskImage
, src, vmTools
, ... } @ args:

vmTools.buildRPM (

  removeAttrs args ["vmTools"] //

  {
    name = name + "-" + diskImage.name + (if src ? version then "-" + src.version else "");

    preBuild = ''
      ensureDir $out/nix-support
      cat "$diskImage"/nix-support/full-name > $out/nix-support/full-name

      # If `src' is the result of a call to `makeSourceTarball', then it
      # has a subdirectory containing the actual tarball(s).  If there are
      # multiple tarballs, just pick the first one.
      if test -d $src/tarballs; then
          src=$(ls $src/tarballs/*.tar.bz2 $src/tarballs/*.tar.gz | sort | head -1)
      fi
    ''; # */

    postInstall = ''
      for i in $out/rpms/*/*.rpm; do
        echo "file rpm $i" >> $out/nix-support/hydra-build-products
      done
    ''; # */

    meta = (if args ? meta then args.meta else {}) // {
      description = "Build of an RPM package on ${diskImage.fullName} (${diskImage.name})";
    };
  }

)