forked from mirrors/nixpkgs
* Automatically build and upload RPMs. Building an RPM is not a pure Nix action, but
we use Nix to do it anyway. svn path=/nixpkgs/trunk/; revision=610
This commit is contained in:
parent
35fa436449
commit
91aafbcae4
|
@ -15,9 +15,9 @@ if ! storeexprs=($(nix-instantiate -vvv do-it.nix)); then exit 1; fi
|
|||
|
||||
srcexpr=${storeexprs[0]}
|
||||
testexpr=${storeexprs[1]}
|
||||
rpmexpr=${storeexprs[2]}
|
||||
|
||||
if ! nix-store -vvvv -r "$srcexpr" > /dev/null; then exit 1; fi
|
||||
|
||||
if ! outpath=$(nix-store -qn "$srcexpr"); then exit 1; fi
|
||||
|
||||
uploader="http://losser.st-lab.cs.uu.nl/~eelco/cgi-bin/upload.pl/"
|
||||
|
@ -26,4 +26,9 @@ curl --silent -T "$outpath/manual.html" "$uploader" || exit 1
|
|||
curl --silent -T "$outpath/style.css" "$uploader" || exit 1
|
||||
curl --silent -T "$outpath"/nix-*.tar.bz2 "$uploader" || exit 1
|
||||
|
||||
if ! nix-store -vvvv -r "$testexpr" > /dev/null; then exit 1; fi
|
||||
#if ! nix-store -vvvv -r "$testexpr" > /dev/null; then exit 1; fi
|
||||
|
||||
if ! nix-store -vvvv -r "$rpmexpr" > /dev/null; then exit 1; fi
|
||||
if ! rpmpath=$(nix-store -qn "$rpmexpr"); then exit 1; fi
|
||||
|
||||
curl --silent -T "$rpmpath"/nix-*.rpm "$uploader" || exit 1
|
||||
|
|
|
@ -22,5 +22,11 @@ let {
|
|||
src = sourcedist;
|
||||
};
|
||||
|
||||
body = [sourcedist testbuild];
|
||||
rpmbuild = (import ./nix-rpm-build.nix) {
|
||||
stdenv = stdenv;
|
||||
getopt = pkgs.getopt;
|
||||
src = sourcedist;
|
||||
};
|
||||
|
||||
body = [sourcedist testbuild rpmbuild];
|
||||
}
|
||||
|
|
16
nix-dist/nix-rpm-build.nix
Normal file
16
nix-dist/nix-rpm-build.nix
Normal file
|
@ -0,0 +1,16 @@
|
|||
{stdenv, getopt, src}:
|
||||
|
||||
derivation {
|
||||
name = "nix-rpm-build";
|
||||
system = stdenv.system;
|
||||
|
||||
builder = ./nix-rpm-build.sh;
|
||||
src = src;
|
||||
|
||||
stdenv = stdenv;
|
||||
getopt = getopt; # required by sdf2table
|
||||
|
||||
# Perhaps it's possible to build RPMs in a pure way? Probably not,
|
||||
# since RPM needs its database to determine dependencies.
|
||||
rpm = "/bin/rpm";
|
||||
}
|
29
nix-dist/nix-rpm-build.sh
Executable file
29
nix-dist/nix-rpm-build.sh
Executable file
|
@ -0,0 +1,29 @@
|
|||
#! /bin/sh
|
||||
|
||||
buildinputs="$getopt"
|
||||
. $stdenv/setup || exit 1
|
||||
|
||||
# Set up a RPM macros file. We have to use ~/.rpmmacros (`--rcfile'
|
||||
# doesn't seem to work properly), so point HOME at the current
|
||||
# directory.
|
||||
export HOME=`pwd`
|
||||
rpmmacros=$HOME/.rpmmacros
|
||||
|
||||
rpmdir=`pwd`/rpm
|
||||
|
||||
# Set up the directory structure expected by RPM.
|
||||
mkdir $rpmdir || exit 1
|
||||
mkdir $rpmdir/BUILD || exit 1
|
||||
mkdir $rpmdir/SOURCE || exit 1
|
||||
mkdir $rpmdir/SPECS || exit 1
|
||||
mkdir $rpmdir/RPMS || exit 1
|
||||
mkdir $rpmdir/SRPMS || exit 1
|
||||
|
||||
echo "%_topdir $rpmdir" > $rpmmacros
|
||||
|
||||
# Do the build.
|
||||
$rpm -ta $src/*.tar.gz || exit 1
|
||||
|
||||
# Copy the resulting RPMs.
|
||||
mkdir $out || exit 1
|
||||
cp -p $rpmdir/RPMS/*/* $out || exit 1
|
Loading…
Reference in a new issue