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 ; } ;
2013-08-31 12:01:13 +04:00
memSize = 768 ;
2013-05-26 18:26:04 +04:00
# fc16 lcov is broken and el6 has none... be creative
prepareImagePhase = ''
rpm - Uv $ { pkgs . fetchurl {
2013-11-16 01:11:17 +04:00
url = " f t p : / / f t p . i s u . e d u . t w / p u b / L i n u x / 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 " ; } }
'' ;
postBuild = ''
2013-05-27 06:27:26 +04:00
cp - R /tmp/test-results $ out/test-results && \
2013-05-27 07:57:01 +04:00
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 || \
2013-05-27 06:27:26 +04:00
true
2013-05-26 18:26:04 +04:00
cp - R /tmp/lcov $ 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-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
centos_url = ver : arch : " 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 } / " ;
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 " { } ''
sha = $ ( grep primary . xml $ { repodata } | sed - re ' s:.* ( [ 0 - 9 a-f ] + ) - primary . * : \ 1 : ' )
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 " { } ''
sha = $ ( grep primary . xml $ { repodata } | sed - re ' s:.* ( [ 0 - 9 a-f ] + ) - primary . * : \ 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
centos63x86_64 = centos {
version = " 6 . 3 " ; arch = " x 8 6 _ 6 4 " ;
sha = " 4 d 3 c d d f 3 8 2 e 8 1 c 2 0 b 1 6 7 a 8 d 1 3 c 7 c 9 2 0 6 7 0 4 0 a 1 9 4 7 d b b 3 c 2 9 c f a f a 0 1 a 7 4 a 2 6 a 2 b " ;
} ;
centos63i386 = centos {
version = " 6 . 3 " ; arch = " i 3 8 6 " ;
sha = " 5 c e e 0 e 0 c 4 d 7 e 2 d c b 9 9 7 f 1 2 3 c e 9 1 0 7 d e d b c 4 2 4 d 8 0 d d 7 f 2 b 2 4 7 1 b 3 b 3 4 8 f 3 e 1 7 5 4 c " ;
} ;
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 " ;
} ;
} ;
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 ; } ; } ;
imgs = pkgs . vmTools . diskImageFuns //
mapAttrs ( n : a : b : pkgs . vmTools . makeImageFromRPMDist ( a // b ) ) extra_distros ;
rpmdistros = pkgs . vmTools . rpmDistros // extra_distros ;
rpmbuild = release . rpmBuild ;
} ;
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 ;
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 )
( if eqStrings image " c e n t o s 6 4 " 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 \\ " ;
2013-09-03 17:48:34 +04:00
echo " d m e s g - - c o n s o l e - l e v e l d e b u g | | d m e s g 8 | | t r u e \\ " ;
2013-08-21 01:04:37 +04:00
echo " ( / u s r / l i b / s y s t e m d / s y s t e m d - u d e v d | | / u s r / l i b / u d e v / u d e v d | | f i n d / - n a m e \* u d e v d ) & \\ " ;
2013-12-15 20:29:08 +04:00
echo " m a k e c h e c k 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 \\ "
2013-05-27 07:57:01 +04:00
echo " c p - R t e s t / r e s u l t s / t m p / t e s t - r e s u l t s \\ "
2013-05-26 18:26:04 +04:00
echo " m a k e l c o v & & c p - R l c o v _ r e p o r t s / t m p / l c o v " ) > > source . inc
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
2013-05-26 18:26:04 +04:00
centos63_i386 = mkRPM { arch = " i 3 8 6 " ; image = " c e n t o s 6 3 " ; } ;
centos63_x86_64 = mkRPM { arch = " x 8 6 _ 6 4 " ; image = " c e n t o s 6 3 " ; } ;
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 " ; } ;
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