mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-15 15:30:39 +00:00
Factor out repeated scriptlets from build-support/release/*.nix.
This commit is contained in:
parent
1eb5450bd4
commit
ce77a5ceec
pkgs/build-support/release
|
@ -100,15 +100,10 @@ stdenv.mkDerivation (
|
||||||
postHook = ''
|
postHook = ''
|
||||||
mkdir -p $out/nix-support
|
mkdir -p $out/nix-support
|
||||||
echo "$system" > $out/nix-support/system
|
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
|
origSrc=$src
|
||||||
if test -d $src/tarballs; then
|
src=$(findTarballs $src | head -1)
|
||||||
src=$(ls $src/tarballs/*.tar.bz2 $src/tarballs/*.tar.gz | sort | head -1)
|
|
||||||
fi
|
|
||||||
|
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -36,13 +36,8 @@ stdenv.mkDerivation (
|
||||||
mkdir -p $out/nix-support
|
mkdir -p $out/nix-support
|
||||||
echo "$system" > $out/nix-support/system
|
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
|
origSrc=$src
|
||||||
if test -d $src/tarballs; then
|
src=$(findTarballs $src | head -1)
|
||||||
src=$(ls $src/tarballs/*.tar.bz2 $src/tarballs/*.tar.gz | sort | head -1)
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test -e $origSrc/nix-support/hydra-release-name; then
|
if test -e $origSrc/nix-support/hydra-release-name; then
|
||||||
releaseName=$(cat $origSrc/nix-support/hydra-release-name)
|
releaseName=$(cat $origSrc/nix-support/hydra-release-name)
|
||||||
|
|
|
@ -30,17 +30,10 @@ vmTools.runInLinuxImage (stdenv.mkDerivation (
|
||||||
|
|
||||||
# !!! cut&paste from rpm-build.nix
|
# !!! cut&paste from rpm-build.nix
|
||||||
postHook = ''
|
postHook = ''
|
||||||
mkdir -p $out/nix-support
|
. ${./functions.sh}
|
||||||
cat "$diskImage"/nix-support/full-name > $out/nix-support/full-name
|
propagateImageName
|
||||||
|
src=$(findTarballs $src | head -1) # Find a tarball.
|
||||||
# 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
|
|
||||||
''; # */
|
|
||||||
|
|
||||||
installExtraDebsPhase = ''
|
installExtraDebsPhase = ''
|
||||||
for i in $extraDebs; do
|
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 "");
|
name = name + (if src ? version then "-" + src.version else "");
|
||||||
|
|
||||||
postHook = ''
|
postHook = ''
|
||||||
# If `src' is the result of a call to `makeSourceTarball', then it
|
. ${./functions.sh}
|
||||||
# has a subdirectory containing the actual tarball(s). If there are
|
|
||||||
# multiple tarballs, just pick the first one.
|
|
||||||
origSrc=$src
|
origSrc=$src
|
||||||
if test -d $src/tarballs; then
|
src=$(findTarballs $src | head -1)
|
||||||
src=$(ls $src/tarballs/*.tar.bz2 $src/tarballs/*.tar.gz $src/tarballs/*.tar.xz | sort | head -1)
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Set GCC flags for coverage analysis, if desired.
|
# Set GCC flags for coverage analysis, if desired.
|
||||||
if test -n "${toString doCoverageAnalysis}"; then
|
if test -n "${toString doCoverageAnalysis}"; then
|
||||||
|
|
|
@ -14,16 +14,10 @@ vmTools.buildRPM (
|
||||||
name = name + "-" + diskImage.name + (if src ? version then "-" + src.version else "");
|
name = name + "-" + diskImage.name + (if src ? version then "-" + src.version else "");
|
||||||
|
|
||||||
preBuild = ''
|
preBuild = ''
|
||||||
mkdir -p $out/nix-support
|
. ${./functions.sh}
|
||||||
cat "$diskImage"/nix-support/full-name > $out/nix-support/full-name
|
propagateImageName
|
||||||
|
src=$(findTarballs $src | head -1) # Pick the first tarball.
|
||||||
# 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 = ''
|
postInstall = ''
|
||||||
declare -a rpms rpmNames
|
declare -a rpms rpmNames
|
||||||
|
|
Loading…
Reference in a new issue