2013-11-21 50 views
0

我有幾個我創建的Puppet模塊,它編譯和安裝x264,這取決於編譯器yasm不尊重依賴性順序?

模塊是這樣的:

class yasm { 
    $install_dir = "/usr/local/yasm" 

    include yasm::download, yasm::compile, yasm::install 
} 

class x264 { 
    require yasm 

    $install_dir = "/usr/local/x264" 

    include x264::download, x264::compile, x264::install 
} 

因此,當我在節點上宣佈一個x264依賴,我希望yasm將被下載,編譯和任何與x264發生之前安裝。

然而,這並不是在所有情況:

[default] Running provisioner: puppet... 
Running Puppet with vagrant-precise64.pp... 
stdin: is not a tty 
warning: Could not retrieve fact fqdn 
warning: Host is missing hostname and/or domain: precise64 
info: Applying configuration version '1385018183' 
notice: /Stage[main]/X264::Download/File[x264-dir]/ensure: created 
notice: /Stage[main]/X264::Download/Exec[x264-clone]/returns: executed successfully 
notice: /Stage[main]/X264::Compile/Exec[x264-compile]/returns: Makefile:3: config.mak: No such file or directory 
notice: /Stage[main]/X264::Compile/Exec[x264-compile]/returns: cat: config.h: No such file or directory 
notice: /Stage[main]/X264::Compile/Exec[x264-compile]/returns: ./configure 
notice: /Stage[main]/X264::Compile/Exec[x264-compile]/returns: Found no assembler 
notice: /Stage[main]/X264::Compile/Exec[x264-compile]/returns: Minimum version is yasm-1.2.0 
notice: /Stage[main]/X264::Compile/Exec[x264-compile]/returns: If you really want to compile without asm, configure with --disable-asm. 
notice: /Stage[main]/X264::Compile/Exec[x264-compile]/returns: make: *** [config.mak] Error 1 
err: /Stage[main]/X264::Compile/Exec[x264-compile]/returns: change from notrun to 0 failed: make returned 2 instead of one of [0] at /tmp/vagrant-puppet/modules-0/x264/manifests/compile.pp:21 
notice: /Stage[main]/X264::Install/Exec[x264-install]: Dependency Exec[x264-compile] has failures: true 
warning: /Stage[main]/X264::Install/Exec[x264-install]: Skipping because of failed dependencies 
notice: /Stage[main]/Yasm::Download/File[yasm-dir]/ensure: created 
notice: /Stage[main]/Yasm::Download/Exec[yasm-download]/returns: executed successfully 
notice: /Stage[main]/Yasm::Download/Exec[yasm-extract]/returns: executed successfully 
notice: /Stage[main]/Yasm::Compile/Exec[yasm-configure]/returns: executed successfully 
notice: /Stage[main]/Yasm::Compile/Exec[yasm-compile]/returns: executed successfully 
notice: /Stage[main]/Yasm::Install/Exec[yasm-install]/returns: executed successfully 
notice: Finished catalog run in 22.66 seconds 
The following SSH command responded with a non-zero exit status. 
Vagrant assumes that this means the command failed! 

puppet apply --verbose --modulepath '/etc/puppet/modules:/tmp/vagrant-puppet/modules-0' --color=false --manifestdir /tmp/vagrant-puppet/manifests --detailed-exitcodes /tmp/vagrant-puppet/manifests/vagrant-precise64.pp || [ $? -eq 2 ] 

不管出於什麼原因,我的木偶之前安裝YASM,這是X264的依賴適用嘗試安裝X264 。我究竟做錯了什麼?我如何表達x264完全取決於yasm?

回答

0

x264直接取決於yasm,但yasm不依賴於任何東西。

include s在yasm只是將其添加到目錄,但不提供任何依賴關係結構。

一種方式做到這一點是:

class yasm { 
    $install_dir = "/usr/local/yasm" 

    require yasm::download, yasm::compile, yasm::install 
} 

class x264 { 
    require yasm 

    $install_dir = "/usr/local/x264" 

    Class['yasm'] -> class{ 'x264::download': } 
    Class['yasm'] -> class{ 'x264::compile': } 
    Class['yasm'] -> class{ 'x264::install': } 
} 
+0

嗯,即使這似乎並沒有爲我工作。我不得不在'x264 :: compile'中需要'yasm'。爲什麼依賴類中的需求不僅意味着模塊頂層的需求? –

+0

哎呀,我以前有缺陷的建議是爲'x264'放置一個依賴項,但不包括它所包含的類,它們本身也沒有依賴關係。 因此,將'require'直接放在需要它的類中(即''x264 :: compile')實際上是可行的。 – xiankai

+0

我改變了我的例子,以包括添加'x264 ::'類的依賴關係。希望這有效! – xiankai