2014-06-29 19:37:35 +04:00
# -*- mode: nix; indent-tabs-mode: nil -*-
2013-07-23 01:37:17 +04:00
{ nixpkgs ? <nixpkgs> , lvm2Src , release ? false ,
rawhide32 ? " " , rawhide64 ? " " ,
2014-06-29 19:37:16 +04:00
fc20_32_updates ? " " , fc20_64_updates ? " " ,
2013-08-27 04:10:58 +04:00
fc19_32_updates ? " " , fc19_64_updates ? " " ,
2013-07-23 01:37:17 +04:00
fc18_32_updates ? " " , fc18_64_updates ? " " ,
2015-01-14 19:28:44 +03:00
T ? " " , ENV ? " " , timeout ? 60 ,
overrides ? { pkgs }: { install_rpms = { } ; distros = { } ; configs = { } ; } } :
2013-05-26 18:26:04 +04:00
let
pkgs = import nixpkgs { } ;
2014-06-27 03:25:18 +04:00
lib = pkgs . lib ;
2015-01-14 19:28:44 +03:00
over = overrides { inherit pkgs ; } ;
2015-02-05 15:30:02 +03:00
install_lcov = ''
rpm - Uv $ { pkgs . fetchurl {
url = " h t t p : / / a r c h i v e s . f e d o r a p r o j e c t . o r g / p u b / a r c h i v e / f e d o r a / l i n u x / u p d a t e s / 1 6 / i 3 8 6 / l c o v - 1 . 9 - 2 . f c 1 6 . n o a r c h . r p m " ;
sha256 = " 0 y c d h 5 m b 7 p 5 l l 7 6 m q k 0 p 6 g p n j s k v x x g h 3 a 3 b f r 1 c r h 9 4 n v p w h p 4 z " ; } }
'' ;
2014-07-29 16:30:22 +04:00
mkTest = args : pkgs . stdenv . mkDerivation rec {
name = " l v m 2 - t e s t - ${ ( args . diskFun { } ) . name } " ;
builder = pkgs . writeScript " l v m 2 - c o l l e c t - r e s u l t s " ''
#!${pkgs.bash}/bin/bash
. $ stdenv/setup
mkdir - p $ out/test-results
for i in $ { lib . concatStringsSep " " buildInputs } ; do
cat $ i/test-results/list > > $ out/test-results/list
2014-09-10 20:18:45 +04:00
cp $ i/test-results ' / ' * . txt $ out/test-results / || true
2014-07-29 16:30:22 +04:00
done
2014-09-14 13:12:12 +04:00
mkdir - p $ out/nix-support
2014-09-30 13:01:48 +04:00
grep ' \ < failed \ > ' $ out/test-results/list && touch $ out/nix-support/failed || true
2014-07-29 16:30:22 +04:00
'' ;
buildInputs = map ( x : runTest ( args // { flavour = x ; } ) )
[ " n d e v - v a n i l l a " " n d e v - l v m e t a d " " n d e v - c l u s t e r " " u d e v - v a n i l l a " " u d e v - l v m e t a d " " u d e v - c l u s t e r " ] ;
} ;
runTest = { build , diskFun , extras ? [ ] , kernel , vmtools , flavour , . . . }: pkgs . stdenv . mkDerivation rec {
2013-05-26 18:26:04 +04:00
diskImage = diskFun { extraPackages = extras ; } ;
2014-07-29 16:30:22 +04:00
name = " l v m 2 - t e s t - ${ diskImage . name } - ${ flavour } " ;
2014-06-27 03:25:18 +04:00
# this is the builder that runs in the guest
origBuilder = pkgs . writeScript " v m - t e s t - g u e s t " ''
#!/bin/bash
export PATH = /usr/bin : /bin : /usr/sbin : /sbin
2014-06-28 13:16:22 +04:00
# we always run in a fresh image, so need to install everything again
2014-10-13 11:18:23 +04:00
ls $ { build } /rpms /* / * . r p m | g r e p - v s y s v i n i t | x a r g s r p m - U v - - o l d p a c k a g e # */
2015-02-05 15:30:02 +03:00
$ { install_lcov }
2014-06-27 03:25:18 +04:00
2014-09-13 19:53:42 +04:00
mkdir - p /xchg/results
2014-09-30 13:02:25 +04:00
touch /xchg/booted
2014-06-27 03:25:18 +04:00
dmsetup targets
2014-07-21 03:54:42 +04:00
export LVM_TEST_BACKING_DEVICE = /dev/sdb
2014-11-19 13:32:23 +03:00
ulimit - c unlimited
2014-06-28 14:51:18 +04:00
2014-07-29 16:30:22 +04:00
watch =
if echo $ { flavour } | grep - q udev ; then
( /usr/lib/systemd/systemd-udevd || /usr/lib/udev/udevd || /sbin/udevd || \
2014-09-13 19:53:42 +04:00
find / - xdev - name \ * udevd ) > > /xchg/udevd.log 2 > & 1 &
watch = " - - w a t c h / x c h g / u d e v d . l o g "
2014-07-29 16:30:22 +04:00
fi
2014-06-28 14:51:18 +04:00
2014-09-30 19:06:19 +04:00
export $ { ENV }
2014-09-13 19:53:42 +04:00
lvm2-testsuite - - batch - - outdir /xchg/results - - continue \
2014-09-30 19:06:19 +04:00
- - timeout $ { toString timeout } - - fatal-timeouts - - heartbeat /xchg/heartbeat \
2014-07-29 16:30:22 +04:00
- - flavours $ { flavour } $ watch - - kmsg $ { if lib . eqStrings T " " then " " else " - - o n l y ${ T } " }
2014-06-27 03:25:18 +04:00
# TODO: coverage reports
# make lcov || true
# cp -R lcov_reports $out/coverage && \
# echo "report coverage $out/coverage" >> $out/nix-support/hydra-build-products || \
# true # not really fatal, although kinda disappointing
2013-05-26 18:26:04 +04:00
'' ;
2014-04-07 22:37:30 +04:00
2014-06-27 03:25:18 +04:00
buildInputs = [ pkgs . coreutils pkgs . bash pkgs . utillinux ] ;
# make a qcow copy of the main image
preVM = ''
diskImage = $ ( pwd ) /disk-image.qcow2
origImage = $ { diskImage }
if test - d " $ o r i g I m a g e " ; then origImage = " $ o r i g I m a g e / d i s k - i m a g e . q c o w 2 " ; fi
$ { vmtools . qemu } /bin/qemu-img create - b " $ o r i g I m a g e " - f qcow2 $ diskImage
'' ;
builder = pkgs . writeScript " v m - t e s t " ''
#!${pkgs.bash}/bin/bash
. $ stdenv/setup
2014-07-21 03:54:42 +04:00
export QEMU_OPTS = " - d r i v e f i l e = / d e v / s h m / t e s t d i s k . i m g , i f = i d e - m 2 5 6 M "
export QEMU_DRIVE_OPTS = " , i f = i d e "
2014-06-28 01:09:30 +04:00
export KERNEL_OPTS = " l o g _ b u f _ l e n = 1 3 1 0 7 2 l o g l e v e l = 1 "
2014-06-27 03:25:18 +04:00
export mountDisk = 1
mkdir - p $ out/test-results $ out/nix-support
touch $ out/nix-support/failed
2014-06-28 01:09:30 +04:00
monitor ( ) {
set + e
counter = 0
2014-06-28 13:16:22 +04:00
rm - f j . current j . last t . current t . last
2014-06-28 01:09:30 +04:00
while true ; do
2014-06-29 19:37:35 +04:00
if ! test - f pid ; then
counter = 0
sleep 60
continue
fi
2014-07-29 16:30:22 +04:00
cat xchg/results/journal > j . current 2 > /dev/null
2014-07-04 20:28:10 +04:00
cat xchg/heartbeat > hb . current 2 > /dev/null
2014-06-29 19:37:35 +04:00
if diff j . current j . last > & /dev/null ; then
2014-06-28 01:09:30 +04:00
counter = $ ( ( $ counter + 1 ) ) ;
else
counter = 0
fi
2015-04-22 10:00:21 +03:00
if test $ counter - eq 10 || test $ ( wc - c < hb . current ) - eq $ ( wc - c < hb . last ) ; then
2014-06-29 19:37:35 +04:00
echo
2015-04-22 10:00:21 +03:00
echo " V M g o t s t u c k ; h e a r t b e a t : $ ( w c - c < h b . c u r r e n t ) $ ( w c - c < h b . l a s t ) , c o u n t e r = $ c o u n t e r . "
2014-06-29 19:37:35 +04:00
echo " l a s t j o u r n a l e n t r y : $ ( t a i l - n 1 j . c u r r e n t ) , p r e v i o u s l y $ ( t a i l - n 1 j . l a s t ) "
kill - - - $ ( cat pid )
2014-06-28 01:09:30 +04:00
fi
sleep 60
2014-06-29 19:37:35 +04:00
mv j . current j . last > & /dev/null
2014-07-04 20:28:10 +04:00
mv hb . current hb . last > & /dev/null
2014-06-28 01:09:30 +04:00
done
}
2014-06-29 19:37:35 +04:00
monitor &
for i in ` seq 1 20 ` ; do # we allow up to 20 VM restarts
2014-09-30 13:02:25 +04:00
rm - f xchg/booted
2014-06-27 03:25:18 +04:00
$ { vmtools . qemu } /bin/qemu-img create - f qcow2 /dev/shm/testdisk.img 4 G
setsid bash - e $ { vmtools . vmRunCommand ( vmtools . qemuCommandLinux kernel ) } &
pid = $ !
2014-06-28 01:09:30 +04:00
2014-09-30 13:02:25 +04:00
# give the VM some time to get up and running
slept = 0
while test $ slept - le 180 && test ! - e xchg/booted ; do
sleep 10
slept = $ ( ( $ slept + 10 ) )
done
2014-06-29 19:37:35 +04:00
echo $ pid > pid # monitor go
2014-06-28 01:09:30 +04:00
wait $ pid || true
2014-06-29 19:37:35 +04:00
rm - f pid # disarm the monitor process
2014-06-28 01:09:30 +04:00
# if we have any new results, stash them
2014-07-29 16:30:22 +04:00
mv xchg/results ' / ' * . txt $ out/test-results / || true
2014-06-28 01:09:30 +04:00
if test - n " $ ( c a t x c h g / i n - v m - e x i t ) " ; then # the VM is done
test 0 - eq " $ ( c a t x c h g / i n - v m - e x i t ) " && rm - f $ out/nix-support/failed
2014-06-27 03:25:18 +04:00
break
fi
2014-06-28 01:09:30 +04:00
2014-06-29 19:37:35 +04:00
sleep 10 # wait for the VM to clean up before starting up a new one
2014-06-27 03:25:18 +04:00
done
2014-07-29 16:30:22 +04:00
cat xchg/results/list > $ out/test-results/list || true
2013-05-26 18:26:04 +04:00
'' ;
2014-06-27 03:25:18 +04:00
} ;
2015-04-07 12:54:25 +03:00
mkTarball = profiling : pkgs . releaseTools . sourceTarball rec {
name = " l v m 2 - t a r b a l l " ;
versionSuffix = if lvm2Src ? revCount
then " . p r e ${ toString lvm2Src . revCount } "
else " " ;
src = lvm2Src ;
autoconfPhase = " : " ;
distPhase = ''
make distclean
version = ` cat VERSION | cut " - d ( " - f1 ` $ { versionSuffix }
version_dm = ` cat VERSION_DM | cut " - d - " - f1 ` $ { versionSuffix }
chmod u + w *
# set up versions
sed - e s , - git , $ { versionSuffix } , - i VERSION VERSION_DM
sed - e " s , \( d e v i c e _ m a p p e r _ v e r s i o n \) [ 0 - 9 . ] * $ , \1 $ v e r s i o n _ d m , " \
- e " s , ^ \( V e r s i o n : [ ^ 0 - 9 % ] * \) [ 0 - 9 . ] * $ , \1 $ v e r s i o n , " \
- e " s , ^ \( R e l e a s e : [ ^ 0 - 9 % ] * \) [ 0 - 9 . ] \+ , \1 0 . H Y D R A , " \
- i spec/source.inc
# tweak RPM configuration
echo " % d e f i n e e n a b l e _ p r o f i l i n g ${ profiling } " > > spec/source.inc
echo " % d e f i n e e n a b l e _ t e s t s u i t e 1 " > > spec/source.inc
sed - e " s : % w i t h c l v m d c o r o s y n c : % w i t h c l v m d c o r o s y n c , s i n g l e n o d e : " - i spec/source.inc
# synthesize a changelog
sed - e ' / ^ % changelog / , $ d' - i spec/lvm2.spec
( echo " % c h a n g e l o g " ;
echo " * ` d a t e + " % a % b % d % Y " ` P e t r R o c k a i < p r o c k a i @ r e d h a t . c o m > - $ v e r s i o n " ;
echo " - A U T O M A T E D B U I L D B Y H y d r a " ) > > spec/lvm2.spec
2015-05-11 18:29:21 +03:00
cp spec /* . # */ # RPM needs the spec file in the source root
2015-04-07 12:54:25 +03:00
# make a tarball
mkdir ../LVM2. $ version
mv * ../LVM2. $ version
ensureDir $ out/tarballs
cd . .
tar cvzf $ out/tarballs/LVM2. $ version . tgz LVM2 . $ version
'' ;
} ;
mkBuild = { src , VM , extras ? [ ] , diskFun , . . . }:
2014-06-27 03:25:18 +04:00
VM rec {
name = " l v m 2 - b u i l d - ${ diskImage . name } " ;
fullName = " l v m 2 - b u i l d - ${ diskImage . name } " ;
2015-04-07 12:54:25 +03:00
inherit src ;
2014-06-27 03:25:18 +04:00
diskImage = diskFun { extraPackages = extras ; } ;
memSize = 512 ;
checkPhase = " : " ;
2014-04-07 22:37:30 +04:00
2015-02-05 15:30:02 +03:00
preConfigure = install_lcov ;
2014-04-07 22:37:30 +04:00
postInstall = ''
2014-06-27 03:25:18 +04:00
mkdir - p $ out/nix-support
for i in $ out/rpms /* / * . r p m ; d o # */
2014-04-07 22:37:30 +04:00
if echo $ i | grep - vq " \. s r c \. r p m $ " ; then
echo " f i l e r p m $ i " > > $ out/nix-support/hydra-build-products
else
echo " f i l e s r p m $ i " > > $ out/nix-support/hydra-build-products
fi
done
'' ;
2013-05-26 18:26:04 +04:00
} ;
2013-08-31 03:00:19 +04:00
rootmods = [ " v i r t i o _ p c i " " v i r t i o _ b l k " " v i r t i o _ b a l l o o n " " e x t 4 " " u n i x "
2014-07-21 05:56:34 +04:00
" c i f s " " v i r t i o _ n e t " " u n i x " " h m a c " " m d 4 " " e c b " " d e s _ g e n e r i c " " s h a 2 5 6 "
" a t a _ p i i x " " s d _ m o d " ] ;
2013-05-26 18:26:04 +04:00
2015-02-16 17:29:29 +03:00
centos_url = ver : arch : if ver == " 6 . 6 " || ver == " 7 "
2014-01-08 19:35:55 +04:00
then " h t t p : / / f t p . f i . m u n i . c z / p u b / l i n u x / c e n t o s / ${ ver } / o s / ${ arch } / "
else " h t t p : / / v a u l t . c e n t o s . o r g / ${ ver } / o s / ${ arch } / " ;
2014-06-27 03:25:18 +04:00
fedora_url = ver : arch : if lib . eqStrings ver " r a w h i d e " || lib . eqStrings ver " 1 9 "
2013-05-26 18:26:04 +04:00
then " f t p : / / f t p . f i . m u n i . c z / p u b / l i n u x / f e d o r a / l i n u x / d e v e l o p m e n t / ${ ver } / ${ arch } / o s / "
else " m i r r o r : / / f e d o r a / l i n u x / r e l e a s e s / ${ ver } / E v e r y t h i n g / ${ arch } / o s / " ;
2013-07-23 01:37:17 +04:00
fedora_update_url = ver : arch : " m i r r o r : / / f e d o r a / l i n u x / u p d a t e s / ${ ver } / ${ arch } " ;
2015-01-14 19:28:44 +03:00
distros = with lib ; let
2013-05-26 18:26:04 +04:00
centos = { version , sha , arch }: {
name = " c e n t o s - ${ version } - ${ arch } " ;
fullName = " C e n t O S ${ version } ( ${ arch } ) " ;
packagesList = pkgs . fetchurl {
url = centos_url version arch + " r e p o d a t a / ${ sha } - p r i m a r y . x m l . g z " ;
sha256 = sha ;
} ;
urlPrefix = centos_url version arch ;
archs = [ " n o a r c h " arch ] ++ ( if eqStrings arch " i 3 8 6 " then [ " i 5 8 6 " " i 6 8 6 " ] else [ ] ) ;
2015-02-11 16:22:05 +03:00
packages = pkgs . vmTools . commonCentOSPackages ;
2013-05-26 18:26:04 +04:00
} ;
fedora = { version , sha , arch }: rec {
name = " f e d o r a - ${ version } - ${ arch } " ;
fullName = " F e d o r a ${ version } ( ${ arch } ) " ;
packagesList = pkgs . fetchurl {
url = fedora_url version arch + " r e p o d a t a / ${ sha } - p r i m a r y . x m l . g z " ;
sha256 = sha ;
} ;
urlPrefix = fedora_url version arch ;
archs = [ " n o a r c h " arch ] ++ ( if eqStrings arch " i 3 8 6 " then [ " i 5 8 6 " " i 6 8 6 " ] else [ ] ) ;
2015-02-11 16:22:05 +03:00
packages = pkgs . vmTools . commonFedoraPackages ;
2013-07-23 02:26:33 +04:00
unifiedSystemDir = true ;
2013-05-26 18:26:04 +04:00
} ;
rawhide = version : arch : repodata : import ( pkgs . runCommand " r a w h i d e - ${ version } - ${ arch } . n i x " { } ''
2014-03-01 02:56:04 +04:00
sha = $ ( grep primary . xml $ { repodata } | sed - re ' s:.* ( [ 0 - 9 a-f ] + ) - primary . * : \ 1 : ' | head - n 1 )
2013-05-26 18:26:04 +04:00
echo ' { fedora }: fedora { version = " ${ version } " ; sha = " ' $ s h a ' " ; arch = " ${ arch } " ; } ' > $ out
'' ) { i n h e r i t f e d o r a ; } ;
2013-07-23 01:37:17 +04:00
update = version : arch : repodata : orig : orig // ( import ( pkgs . runCommand " u p d a t e s - f e d o r a . n i x " { } ''
2014-03-01 02:56:04 +04:00
sha = $ ( grep primary . xml $ { repodata } | sed - re ' s:.* ( [ 0 - 9 a-f ] + ) - primary . * : \ 1 : ' | head - n 1 )
2013-08-27 04:10:58 +04:00
echo fedora $ { version } updates sha : $ sha
2013-07-23 13:02:22 +04:00
( echo ' fetchurl : orig : { packagesLists = [ orig . packagesList ( '
2013-07-23 01:37:17 +04:00
echo " f e t c h u r l { "
echo " u r l = \" ${ fedora_update_url version arch } / r e p o d a t a / $ s h a - p r i m a r y . x m l . g z \" ; "
echo " s h a 2 5 6 = \" $ s h a \" ; "
2013-07-23 13:02:22 +04:00
echo ' } ) ] ; urlPrefixes = [ orig . urlPrefix " ${ fedora_update_url version arch } " ] ; } '
2013-07-23 01:37:17 +04:00
) > $ out
echo built $ out 1 > & 2
2013-07-23 13:02:22 +04:00
'' ) ) p k g s . f e t c h u r l o r i g ;
2013-05-26 18:26:04 +04:00
in {
rawhidex86_64 = rawhide " r a w h i d e " " x 8 6 _ 6 4 " rawhide64 ;
rawhidei386 = rawhide " r a w h i d e " " i 3 8 6 " rawhide32 ;
2014-06-29 19:37:16 +04:00
fedora20ux86_64 = update " 2 0 " " x 8 6 _ 6 4 " fc20_64_updates pkgs . vmTools . rpmDistros . fedora20x86_64 ;
fedora20ui386 = update " 2 0 " " i 3 8 6 " fc20_32_updates pkgs . vmTools . rpmDistros . fedora20i386 ;
2013-08-27 04:10:58 +04:00
fedora19ux86_64 = update " 1 9 " " x 8 6 _ 6 4 " fc19_64_updates pkgs . vmTools . rpmDistros . fedora19x86_64 ;
fedora19ui386 = update " 1 9 " " i 3 8 6 " fc19_32_updates pkgs . vmTools . rpmDistros . fedora19i386 ;
2013-07-23 01:37:17 +04:00
fedora18ux86_64 = update " 1 8 " " x 8 6 _ 6 4 " fc18_64_updates pkgs . vmTools . rpmDistros . fedora18x86_64 ;
fedora18ui386 = update " 1 8 " " i 3 8 6 " fc18_32_updates pkgs . vmTools . rpmDistros . fedora18i386 ;
2013-05-26 18:26:04 +04:00
2014-01-08 19:35:39 +04:00
#centos63x86_64 = centos {
# version="6.3"; arch="x86_64";
# sha="4d3cddf382e81c20b167a8d13c7c92067040a1947dbb3c29cfafa01a74a26a2b";
#};
2013-05-26 18:26:04 +04:00
2014-01-08 19:35:39 +04:00
#centos63i386 = centos {
# version="6.3"; arch="i386";
# sha="5cee0e0c4d7e2dcb997f123ce9107dedbc424d80dd7f2b2471b3b348f3e1754c";
#};
2013-05-26 18:26:04 +04:00
centos64x86_64 = centos {
version = " 6 . 4 " ; arch = " x 8 6 _ 6 4 " ;
sha = " 4 d 4 0 3 0 b 9 2 f 0 1 0 f 4 6 6 e b 4 f 0 0 4 3 1 2 b 9 f 5 3 2 b 9 e 8 5 e 6 0 c 5 e 6 4 2 1 e 8 b 4 2 9 c 1 8 0 a c 1 e f e " ;
} ;
centos64i386 = centos {
version = " 6 . 4 " ; arch = " i 3 8 6 " ;
sha = " 8 7 a a 4 c 4 e 1 9 f 9 a 3 e c 9 3 e 3 d 8 2 0 f 1 e a 6 b 6 e c e 8 8 1 0 c b 4 5 f 1 1 7 a 1 6 3 5 4 4 6 5 e 5 7 a 1 b 5 0 d " ;
} ;
2014-01-08 19:35:55 +04:00
centos65i386 = centos {
version = " 6 . 5 " ; arch = " i 3 8 6 " ;
sha = " a 8 9 f 2 7 c c 7 d 3 c e a 4 3 1 f 3 b d 6 0 5 a 1 e 9 3 0 9 c 3 2 d 5 d 4 0 9 a b c 1 b 5 1 a 7 b 5 c 7 1 c 0 5 f 1 8 a 0 c 2 " ;
} ;
centos65x86_64 = centos {
version = " 6 . 5 " ; arch = " x 8 6 _ 6 4 " ;
sha = " 3 3 5 3 e 3 7 8 f 5 c b 4 b b 6 c 3 b 3 d d 2 c a 2 6 6 c 6 d 6 8 a 1 e 2 9 c 3 6 c f 9 9 f 7 6 a e a 3 d 8 e 1 5 8 6 2 6 0 2 4 " ;
} ;
2014-10-13 11:18:23 +04:00
2015-02-16 17:29:29 +03:00
centos66i386 = centos {
version = " 6 . 6 " ; arch = " i 3 8 6 " ;
sha = " a 8 b 9 3 5 f c a c 1 c 8 5 1 5 c 6 d 8 d a b 3 c 4 3 c 5 3 b 3 e 4 6 1 f 8 9 e b 7 a 9 3 b 1 9 1 4 3 0 3 7 8 4 e 2 8 f c d 1 7 " ;
} ;
centos66x86_64 = centos {
version = " 6 . 6 " ; arch = " x 8 6 _ 6 4 " ;
sha = " 7 6 5 1 b 1 6 a 9 a 2 a 8 a 5 f b d 0 a d 3 f f 8 b b b e 6 f 2 4 0 9 a 6 4 8 5 0 c c f d 8 3 a 6 a 3 f 8 7 4 f 1 3 d 8 6 2 2 f " ;
} ;
2014-10-13 11:18:23 +04:00
centos70x86_64 = centos {
version = " 7 " ; arch = " x 8 6 _ 6 4 " ;
sha = " 1 a 7 d d 0 d 3 1 5 b 3 9 a d 5 0 4 f 5 4 e a 8 8 6 7 6 a b 5 0 2 a 4 8 0 6 4 c b 2 d 8 7 5 a e 3 a e 2 9 4 3 1 e 1 7 5 8 6 1 c " ;
} ;
2015-01-14 19:28:44 +03:00
} // over . distros ;
2013-05-26 18:26:04 +04:00
2014-06-28 13:16:46 +04:00
vm = { pkgs , xmods , dmmods ? false }: with lib ; rec {
2013-05-26 18:26:04 +04:00
tools = import " ${ nixpkgs } / p k g s / b u i l d - s u p p o r t / v m / d e f a u l t . n i x " {
2013-08-31 03:00:19 +04:00
inherit pkgs ; rootModules = rootmods ++ xmods ++
2014-06-28 13:16:46 +04:00
( if dmmods then [ " l o o p " " d m _ m o d " " d m _ s n a p s h o t " " d m _ m i r r o r " " d m _ z e r o " " d m _ r a i d " " d m _ t h i n _ p o o l " ]
else [ ] ) ; } ;
2013-05-26 18:26:04 +04:00
release = import " ${ nixpkgs } / p k g s / b u i l d - s u p p o r t / r e l e a s e / d e f a u l t . n i x " {
pkgs = pkgs // { vmTools = tools ; } ; } ;
2014-04-26 15:45:23 +04:00
imgs = tools . diskImageFuns //
2015-01-14 19:28:44 +03:00
mapAttrs ( n : a : b : pkgs . vmTools . makeImageFromRPMDist ( a // b ) ) distros ;
rpmdistros = tools . rpmDistros // distros ;
2014-04-26 15:45:23 +04:00
rpmbuild = tools . buildRPM ;
2013-05-26 18:26:04 +04:00
} ;
2015-01-14 19:28:44 +03:00
install_rpms = rec {
2013-05-26 18:26:04 +04:00
common = [ " l i b s e l i n u x - d e v e l " " l i b s e p o l - d e v e l " " n c u r s e s - d e v e l " " r e a d l i n e - d e v e l "
2015-05-12 15:33:14 +03:00
" v a l g r i n d " " v a l g r i n d - d e v e l " " g d b " " s t r a c e "
2013-05-26 18:26:04 +04:00
" r e d h a t - r p m - c o n f i g " # needed for rpmbuild of lvm
" w h i c h " " e 2 f s p r o g s " # needed for fsadm
2015-05-14 12:42:33 +03:00
" e 2 f s p r o g s - l i b s " " e 2 f s p r o g s - d e v e l "
2013-05-26 18:26:04 +04:00
" p e r l - G D " # for lcov
2015-04-22 10:00:21 +03:00
" m d a d m " # for tests with lvm2 and mdadm
2015-05-12 15:33:14 +03:00
" d e v i c e - m a p p e r - p e r s i s t e n t - d a t a " # thin and cache
2015-05-14 12:15:20 +03:00
" p k g c o n f i g " # better support for config
2015-02-05 15:30:18 +03:00
" k e r n e l "
2013-05-26 18:26:04 +04:00
] ;
2015-05-14 10:49:54 +03:00
centos63 = [ " c l u s t e r l i b - d e v e l " " o p e n a i s l i b - d e v e l " " c m a n " " l i b u d e v - d e v e l " " p r o c p s " " n c " ] ;
2015-02-16 17:29:29 +03:00
centos64 = centos63 ++ [ " c o r o s y n c l i b - d e v e l " ] ;
2014-01-08 19:35:55 +04:00
centos65 = centos64 ;
2015-02-16 17:29:29 +03:00
centos66 = centos65 ;
2015-02-11 16:22:05 +03:00
centos70 = [ " d l m - d e v e l " " d l m " " c o r o s y n c l i b - d e v e l " " p e r l - D i g e s t - M D 5 " " s y s t e m d - d e v e l "
2015-05-14 10:49:54 +03:00
" s o c a t " # used by test suite lvmpolld
2015-05-12 15:33:14 +03:00
" p r o c p s - n g " ] ;
2015-02-10 19:26:02 +03:00
2015-05-14 16:01:01 +03:00
fedora17_18 = [ " d l m - d e v e l " " c o r o s y n c l i b - d e v e l " " l i b b l k i d " " l i b b l k i d - d e v e l "
" d l m " " s y s t e m d - d e v e l " " p e r l - D i g e s t - M D 5 " " k e r n e l - m o d u l e s - e x t r a " ] ;
fedora17 = fedora17_18 ++ [ " l i b u d e v - d e v e l " " n c " ] ;
2014-06-29 19:37:16 +04:00
2015-05-14 16:01:01 +03:00
fedora18 = fedora17_18 ++ [ " s o c a t " ] ;
2013-07-23 01:37:17 +04:00
fedora18u = fedora18 ;
2014-06-29 19:37:16 +04:00
2015-02-17 16:41:51 +03:00
fedora19 = centos70 ++ [ " k e r n e l - m o d u l e s - e x t r a " ] ;
2013-08-27 04:10:58 +04:00
fedora19u = fedora19 ;
2014-06-29 19:37:16 +04:00
fedora20 = fedora19 ;
fedora20u = fedora20 ;
rawhide = fedora20 ;
2015-01-14 19:28:44 +03:00
} // over . install_rpms ;
2013-05-26 18:26:04 +04:00
2015-04-07 12:54:25 +03:00
wrapper = fun : { arch , image , build ? { } , istest ? false , src ? jobs . tarball }: with lib ;
2014-06-28 13:16:46 +04:00
let use = vm { pkgs = if eqStrings arch " i 3 8 6 " then pkgs . pkgsi686Linux else pkgs ;
xmods = if istest && ( image == " c e n t o s 6 4 " || image == " c e n t o s 6 5 " )
then [ ] else [ " 9 p " " 9 p n e t _ v i r t i o " ] ;
dmmods = istest ; } ;
2014-06-27 03:25:18 +04:00
in fun {
2015-04-07 12:54:25 +03:00
inherit build istest src ;
2013-05-26 18:26:04 +04:00
VM = use . rpmbuild ;
diskFun = builtins . getAttr " ${ image } ${ arch } " use . imgs ;
2015-01-14 19:28:44 +03:00
extras = install_rpms . common ++ builtins . getAttr image install_rpms ;
2014-06-27 03:25:18 +04:00
vmtools = use . tools ;
2013-05-26 18:26:04 +04:00
kernel = use . tools . makeKernelFromRPMDist ( builtins . getAttr " ${ image } ${ arch } " use . rpmdistros ) ;
} ;
2014-06-27 03:25:18 +04:00
configs = {
2015-04-07 12:54:25 +03:00
fc20p_x86_64 = { arch = " x 8 6 _ 6 4 " ; image = " f e d o r a 2 0 " ; src = jobs . tarball_prof ; } ;
fc20p_i386 = { arch = " i 3 8 6 " ; image = " f e d o r a 2 0 " ; src = jobs . tarball_prof ; } ;
2014-06-29 19:37:16 +04:00
fc20_x86_64 = { arch = " x 8 6 _ 6 4 " ; image = " f e d o r a 2 0 " ; } ;
fc20_i386 = { arch = " i 3 8 6 " ; image = " f e d o r a 2 0 " ; } ;
2014-06-27 03:25:18 +04:00
fc19_x86_64 = { arch = " x 8 6 _ 6 4 " ; image = " f e d o r a 1 9 " ; } ;
fc19_i386 = { arch = " i 3 8 6 " ; image = " f e d o r a 1 9 " ; } ;
fc18_x86_64 = { arch = " x 8 6 _ 6 4 " ; image = " f e d o r a 1 8 " ; } ;
fc18_i386 = { arch = " i 3 8 6 " ; image = " f e d o r a 1 8 " ; } ;
fc17_x86_64 = { arch = " x 8 6 _ 6 4 " ; image = " f e d o r a 1 7 " ; } ;
fc17_i386 = { arch = " i 3 8 6 " ; image = " f e d o r a 1 7 " ; } ;
fc18u_x86_64 = { arch = " x 8 6 _ 6 4 " ; image = " f e d o r a 1 8 u " ; } ;
fc18u_i386 = { arch = " i 3 8 6 " ; image = " f e d o r a 1 8 u " ; } ;
fc19u_x86_64 = { arch = " x 8 6 _ 6 4 " ; image = " f e d o r a 1 9 u " ; } ;
fc19u_i386 = { arch = " i 3 8 6 " ; image = " f e d o r a 1 9 u " ; } ;
#centos63_i386 = { arch = "i386" ; image = "centos63"; };
#centos63_x86_64 = { arch = "x86_64" ; image = "centos63"; };
centos64_i386 = { arch = " i 3 8 6 " ; image = " c e n t o s 6 4 " ; } ;
centos64_x86_64 = { arch = " x 8 6 _ 6 4 " ; image = " c e n t o s 6 4 " ; } ;
centos65_i386 = { arch = " i 3 8 6 " ; image = " c e n t o s 6 5 " ; } ;
centos65_x86_64 = { arch = " x 8 6 _ 6 4 " ; image = " c e n t o s 6 5 " ; } ;
2015-02-16 17:29:29 +03:00
centos66_i386 = { arch = " i 3 8 6 " ; image = " c e n t o s 6 6 " ; } ;
centos66_x86_64 = { arch = " x 8 6 _ 6 4 " ; image = " c e n t o s 6 6 " ; } ;
2014-06-27 03:25:18 +04:00
2014-10-13 11:18:23 +04:00
centos70_x86_64 = { arch = " x 8 6 _ 6 4 " ; image = " c e n t o s 7 0 " ; } ;
2014-06-27 03:25:18 +04:00
rawhide_i386 = { arch = " i 3 8 6 " ; image = " r a w h i d e " ; } ;
rawhide_x86_64 = { arch = " x 8 6 _ 6 4 " ; image = " r a w h i d e " ; } ;
2015-01-14 19:28:44 +03:00
} // over . configs ;
2014-06-27 03:25:18 +04:00
rpms = lib . mapAttrs ( n : v : wrapper mkBuild v ) configs ;
2014-06-28 13:16:46 +04:00
tests = let make = n : v : wrapper mkTest ( v // { build = builtins . getAttr n rpms ; istest = true ; } ) ;
in lib . mapAttrs make configs ;
2014-06-27 03:25:18 +04:00
jobs = tests // {
2015-04-07 12:54:25 +03:00
tarball_prof = mkTarball " 1 " ;
tarball = mkTarball " 0 " ;
2013-05-26 18:26:04 +04:00
} ;
in jobs