Factor out repeated scriptlets from build-support/release/*.nix.
This commit is contained in:
parent
1eb5450bd4
commit
ce77a5ceec
@ -100,15 +100,10 @@ stdenv.mkDerivation (
|
||||
postHook = ''
|
||||
mkdir -p $out/nix-support
|
||||
echo "$system" > $out/nix-support/system
|
||||
. ${./functions.sh}
|
||||
|
||||
# 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.
|
||||
origSrc=$src
|
||||
if test -d $src/tarballs; then
|
||||
src=$(ls $src/tarballs/*.tar.bz2 $src/tarballs/*.tar.gz | sort | head -1)
|
||||
fi
|
||||
|
||||
src=$(findTarballs $src | head -1)
|
||||
'';
|
||||
}
|
||||
)
|
||||
|
@ -36,13 +36,8 @@ stdenv.mkDerivation (
|
||||
mkdir -p $out/nix-support
|
||||
echo "$system" > $out/nix-support/system
|
||||
|
||||
# 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.
|
||||
origSrc=$src
|
||||
if test -d $src/tarballs; then
|
||||
src=$(ls $src/tarballs/*.tar.bz2 $src/tarballs/*.tar.gz | sort | head -1)
|
||||
fi
|
||||
src=$(findTarballs $src | head -1)
|
||||
|
||||
if test -e $origSrc/nix-support/hydra-release-name; then
|
||||
releaseName=$(cat $origSrc/nix-support/hydra-release-name)
|
||||
|
@ -30,17 +30,10 @@ vmTools.runInLinuxImage (stdenv.mkDerivation (
|
||||
|
||||
# !!! cut&paste from rpm-build.nix
|
||||
postHook = ''
|
||||
mkdir -p $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.
|
||||
echo $src
|
||||
if test -d $src/tarballs; then
|
||||
src=$(ls $src/tarballs/*.tar.bz2 $src/tarballs/*.tar.gz | sort | head -1)
|
||||
fi
|
||||
''; # */
|
||||
. ${./functions.sh}
|
||||
propagateImageName
|
||||
src=$(findTarballs $src | head -1) # Find a tarball.
|
||||
'';
|
||||
|
||||
installExtraDebsPhase = ''
|
||||
for i in $extraDebs; do
|
||||
|
14
pkgs/build-support/release/functions.sh
Normal file
14
pkgs/build-support/release/functions.sh
Normal file
@ -0,0 +1,14 @@
|
||||
findTarballs() {
|
||||
local suffix
|
||||
test -d "$1/tarballs/" && {
|
||||
for suffix in tar.gz tgz tar.bz2 tbz2 tar.xz tar.lzma; do
|
||||
ls $1/tarballs/*.$suffix 2> /dev/null
|
||||
done | sort
|
||||
}
|
||||
echo "$1"
|
||||
}
|
||||
|
||||
propagateImageName() {
|
||||
ensureDir $out/nix-support
|
||||
cat "$diskImage"/nix-support/full-name > $out/nix-support/full-name
|
||||
}
|
@ -58,13 +58,9 @@ stdenv.mkDerivation (
|
||||
name = name + (if src ? version then "-" + src.version else "");
|
||||
|
||||
postHook = ''
|
||||
# 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.
|
||||
. ${./functions.sh}
|
||||
origSrc=$src
|
||||
if test -d $src/tarballs; then
|
||||
src=$(ls $src/tarballs/*.tar.bz2 $src/tarballs/*.tar.gz $src/tarballs/*.tar.xz | sort | head -1)
|
||||
fi
|
||||
src=$(findTarballs $src | head -1)
|
||||
|
||||
# Set GCC flags for coverage analysis, if desired.
|
||||
if test -n "${toString doCoverageAnalysis}"; then
|
||||
|
@ -14,16 +14,10 @@ vmTools.buildRPM (
|
||||
name = name + "-" + diskImage.name + (if src ? version then "-" + src.version else "");
|
||||
|
||||
preBuild = ''
|
||||
mkdir -p $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
|
||||
''; # */
|
||||
. ${./functions.sh}
|
||||
propagateImageName
|
||||
src=$(findTarballs $src | head -1) # Pick the first tarball.
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
declare -a rpms rpmNames
|
||||
|
Loading…
Reference in New Issue
Block a user