2013-07-23 01:37:17 +04:00
{ nixpkgs ? <nixpkgs> , lvm2Src , release ? false ,
rawhide32 ? " " , rawhide64 ? " " ,
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 ? " " ,
lvm2Nix ? lvm2Src , T ? " " } :
2013-05-26 18:26:04 +04:00
let
pkgs = import nixpkgs { } ;
mkVM = { VM , extras ? [ ] , diskFun , kernel }:
VM rec {
inherit kernel ;
name = " l v m 2 " ;
fullName = " L V M 2 " ;
src = jobs . tarball ;
diskImage = diskFun { extraPackages = extras ; } ;
2014-10-22 11:02:17 +04:00
memSize = 2047 ;
2014-04-07 22:37:30 +04:00
2013-05-26 18:26:04 +04:00
# fc16 lcov is broken and el6 has none... be creative
prepareImagePhase = ''
rpm - Uv $ { pkgs . fetchurl {
2014-02-28 02:43:57 +04:00
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 " ;
2013-05-26 18:26:04 +04:00
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 " ; } }
2013-12-16 00:14:30 +04:00
dmesg - n 1 # avoid spilling dmesg into the main log, we capture it in harness
2013-05-26 18:26:04 +04:00
'' ;
2014-04-07 22:37:30 +04:00
2013-05-26 18:26:04 +04:00
postBuild = ''
2014-04-07 22:37:30 +04:00
mkdir - p $ out/nix-support
2013-12-16 00:14:30 +04:00
cd ` cat /tmp/build-location `
mv test/results/list test/results/list-rpm
2014-04-07 22:37:30 +04:00
ls /tmp/rpmout/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 h # */
2014-01-24 01:12:00 +04:00
( /usr/lib/systemd/systemd-udevd || /usr/lib/udev/udevd || /sbin/udevd || find / - xdev - name \ * udevd ) &
2013-12-16 00:14:30 +04:00
make check_system QUIET = 1 T = $ { T } || touch $ out/nix-support/failed
mv test/results/list test/results/list-system
cat test/results/list- * > test/results/list
cp - R test/results $ out/test-results && \
echo " r e p o r t t e s t s $ o u t / t e s t - r e s u l t s " > > $ out/nix-support/hydra-build-products || \
true
make lcov || true
cp - R lcov_reports $ out/coverage && \
echo " r e p o r t c o v e r a g e $ o u t / c o v e r a g e " > > $ 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
postInstall = ''
for i in $ out/rpms /* / * . r p m ; d o
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 "
2013-08-31 02:35:11 +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 " ] ;
2013-05-26 18:26:04 +04:00
2014-01-08 19:35:55 +04:00
centos_url = ver : arch : if ver == " 6 . 5 "
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 } / " ;
2013-05-26 18:26:04 +04:00
fedora_url = ver : arch : if pkgs . lib . eqStrings ver " r a w h i d e " || pkgs . lib . eqStrings ver " 1 9 "
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 } " ;
2013-05-26 18:26:04 +04:00
extra_distros = with pkgs . lib ; let
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 [ ] ) ;
packages = filter ( n : ! ( eqStrings n " f e d o r a - r e l e a s e " ) ) pkgs . vmTools . commonFedoraPackages ++
[ " c e n t o s - r e l e a s e " ] ;
} ;
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 [ ] ) ;
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 ;
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 " ;
} ;
2013-05-26 18:26:04 +04:00
} ;
2013-08-31 03:00:19 +04:00
vm = pkgs : xmods : with pkgs . 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 ++
2013-05-26 18:26:04 +04:00
[ " 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 " ] ; } ;
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 //
2013-05-26 18:26:04 +04:00
mapAttrs ( n : a : b : pkgs . vmTools . makeImageFromRPMDist ( a // b ) ) extra_distros ;
2014-04-26 15:45:23 +04:00
rpmdistros = tools . rpmDistros // extra_distros ;
rpmbuild = tools . buildRPM ;
2013-05-26 18:26:04 +04:00
} ;
extra_rpms = rec {
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 "
" c o r o s y n c l i b - d e v e l "
" 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
" p e r l - G D " # for lcov
] ;
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 " ] ;
centos64 = centos63 ;
2014-01-08 19:35:55 +04:00
centos65 = centos64 ;
2013-05-26 18:26:04 +04:00
fedora16 = [ " 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 " " s y s t e m d - d e v e l " " l i b u d e v - d e v e l " ] ;
fedora17 = [ " d l m - d e v e l " " c o r o s y n c l i b - d e v e l " " 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 "
" 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 " " l i b u d e v - d e v e l " ] ;
fedora18 = [ " d l m - d e v e l " " c o r o s y n c l i b - d e v e l " " 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 "
" 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 " ] ;
2013-07-23 01:37:17 +04:00
fedora18u = fedora18 ;
2013-05-26 18:26:04 +04:00
fedora19 = [ " 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 " " p r o c p s - n g " ] ;
2013-08-27 04:10:58 +04:00
fedora19u = fedora19 ;
2013-05-26 18:26:04 +04:00
rawhide = fedora19 ;
} ;
mkRPM = { arch , image }: with pkgs . lib ;
2013-08-31 03:00:19 +04:00
let use = vm ( if eqStrings arch " i 3 8 6 " then pkgs . pkgsi686Linux else pkgs )
2014-01-08 19:35:55 +04:00
( if 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 " ] ) ;
2013-05-26 18:26:04 +04:00
in mkVM {
VM = use . rpmbuild ;
diskFun = builtins . getAttr " ${ image } ${ arch } " use . imgs ;
extras = extra_rpms . common ++ builtins . getAttr image extra_rpms ;
kernel = use . tools . makeKernelFromRPMDist ( builtins . getAttr " ${ image } ${ arch } " use . rpmdistros ) ;
} ;
jobs = rec {
tarball = 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 ;
2013-11-15 22:11:15 +04:00
autoconfPhase = " : " ;
2013-05-26 18:26:04 +04:00
distPhase = ''
set - x
make distclean
version = ` cat VERSION | cut " - d ( " - f1 ` $ { versionSuffix }
version_dm = ` cat VERSION_DM | cut " - d - " - f1 ` $ { versionSuffix }
sed - e s , - git , $ { versionSuffix } , - i VERSION VERSION_DM
2013-05-26 20:13:25 +04:00
rm - rf spec ; cp - R $ { lvm2Nix } /spec /* .
2013-05-26 18:26:04 +04:00
chmod u + w *
( echo " % d e f i n e e n a b l e _ p r o f i l i n g 1 " ;
echo " % d e f i n e c h e c k _ c o m m a n d s \\ " ;
echo " m a k e l c o v - r e s e t \\ " ;
echo " d m s e t u p t a r g e t s \\ " ;
2014-04-24 23:03:58 +04:00
echo " m k d i r - p \$ o u t / n i x - s u p p o r t \\ " ;
2013-12-16 00:14:30 +04:00
echo " m a k e c h e c k Q U I E T = 1 T = ${ T } | | t o u c h \$ o u t / n i x - s u p p o r t / f a i l e d \\ "
echo " p w d > / t m p / b u i l d - l o c a t i o n \\ "
echo " t o u c h r p m - n o - c l e a n " ) > > source . inc
2013-05-26 18:26:04 +04:00
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 , " \
- 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 source . inc
sed - e ' / ^ % changelog / , $ d' \
- i lvm2 . spec
echo " % c h a n g e l o g " > > lvm2 . spec ;
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 " > > lvm2 . spec ;
echo " - A U T O M A T E D B U I L D B Y H y d r a " > > lvm2 . spec
mkdir ../LVM2. $ version
mv * ../LVM2. $ version
ensureDir $ out/tarballs
cd . .
tar cvzf $ out/tarballs/LVM2. $ version . tgz LVM2 . $ version
'' ;
} ;
fc19_x86_64 = mkRPM { arch = " x 8 6 _ 6 4 " ; image = " f e d o r a 1 9 " ; } ;
fc19_i386 = mkRPM { arch = " i 3 8 6 " ; image = " f e d o r a 1 9 " ; } ;
fc18_x86_64 = mkRPM { arch = " x 8 6 _ 6 4 " ; image = " f e d o r a 1 8 " ; } ;
fc18_i386 = mkRPM { arch = " i 3 8 6 " ; image = " f e d o r a 1 8 " ; } ;
fc17_x86_64 = mkRPM { arch = " x 8 6 _ 6 4 " ; image = " f e d o r a 1 7 " ; } ;
fc17_i386 = mkRPM { arch = " i 3 8 6 " ; image = " f e d o r a 1 7 " ; } ;
fc16_x86_64 = mkRPM { arch = " x 8 6 _ 6 4 " ; image = " f e d o r a 1 6 " ; } ;
fc16_i386 = mkRPM { arch = " i 3 8 6 " ; image = " f e d o r a 1 6 " ; } ;
2013-07-23 01:37:17 +04:00
fc18u_x86_64 = mkRPM { arch = " x 8 6 _ 6 4 " ; image = " f e d o r a 1 8 u " ; } ;
2013-08-27 04:10:58 +04:00
fc18u_i386 = mkRPM { arch = " i 3 8 6 " ; image = " f e d o r a 1 8 u " ; } ;
fc19u_x86_64 = mkRPM { arch = " x 8 6 _ 6 4 " ; image = " f e d o r a 1 9 u " ; } ;
fc19u_i386 = mkRPM { arch = " i 3 8 6 " ; image = " f e d o r a 1 9 u " ; } ;
2013-07-23 01:37:17 +04:00
2014-01-08 19:35:39 +04:00
#centos63_i386 = mkRPM { arch = "i386" ; image = "centos63"; };
#centos63_x86_64 = mkRPM { arch = "x86_64" ; image = "centos63"; };
2013-05-26 18:26:04 +04:00
centos64_i386 = mkRPM { arch = " i 3 8 6 " ; image = " c e n t o s 6 4 " ; } ;
centos64_x86_64 = mkRPM { arch = " x 8 6 _ 6 4 " ; image = " c e n t o s 6 4 " ; } ;
2014-01-08 19:35:55 +04:00
centos65_i386 = mkRPM { arch = " i 3 8 6 " ; image = " c e n t o s 6 5 " ; } ;
centos65_x86_64 = mkRPM { arch = " x 8 6 _ 6 4 " ; image = " c e n t o s 6 5 " ; } ;
2013-05-26 18:26:04 +04:00
rawhide_i386 = mkRPM { arch = " i 3 8 6 " ; image = " r a w h i d e " ; } ;
rawhide_x86_64 = mkRPM { arch = " x 8 6 _ 6 4 " ; image = " r a w h i d e " ; } ;
} ;
in jobs