【问题标题】:Creating junctions in Windows for Hudson build在 Windows 中为 Hudson 构建创建联结
【发布时间】:2010-08-26 19:23:38
【问题描述】:

我在 Hudson 有一份基于 Windows XP 从属设备的工作。我知道符号链接在 Windows XP 中是不可能的(直接),所以我试图使用联结。我写了一个批处理脚本:

@echo off
if "%1" == "" goto ERROR1
if "%2" == "" goto ERROR2
goto create

:create
echo Creating junction for %1 at %2
if exist %2 junction -q -d %2
md %2
junction -q %2 %1
goto :eof

:ERROR1
echo Source directory not specified
goto :eof

:ERROR2
echo Destination directory not specified
goto :eof

在我的工作中,当我调用这个脚本时,它挂在echo Creating junction for %1 at %2 行。这是我的 Hudson“执行 Windows 批处理命令”:

call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x64

copy C:\Data\Scripts\slink.bat .
call slink.bat C:\Data\3rdParty64 3rdParty
call slink.bat %WORKSPACE%\..\..\..\tds.core\label\%label% tds.core

...这是输出:

C:\Data\Hudson\dev\workspace\Common_Windows\label\DFWW9202>call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x64 
Setting environment for using Microsoft Visual Studio 2010 x64 tools. 

1 file(s) copied. 
Creating junction for C:\Data\3rdParty64 at 3rdParty

有什么想法吗? (如果这不是正确的网站,请重定向..对不起,谢谢!)

【问题讨论】:

    标签: command-line windows-xp continuous-integration hudson batch-file


    【解决方案1】:

    解决此问题的最佳方法是:将 /accepteula 命令行参数传递给 junction 命令。

    例如: 结 -q %2 %1 /accepteula

    【讨论】:

    • 为了使其与实际脚本逻辑分开,并将其作为初始化/设置,可以使用junction /accepteula > NUL。这样一来,在 EULA 仍被接受时,输出(使用情况、帮助信息)就会被丢弃。
    【解决方案2】:

    这个过程对我不起作用,但我确实缩小了真正的问题范围。

    一些背景知识:用户第一次在 Windows 计算机上运行“junction.exe”程序时,它会弹出带有同意按钮的最终用户许可协议 (EULA)。一旦该用户单击“同意”按钮,他们就可以正常使用该实用程序。

    junction.exe 为 Hudson 停止,因为该服务以“默认用户”身份运行,而“默认用户”从未单击“同意”按钮。这导致 junction.exe 无形且无限期地停止,等待点击,当然这永远不会到达。

    我们修复它的方法是将系统配置为以众所周知的帐户而不是默认用户的身份运行 Hudson 服务。然后我们以该帐户登录 Windows 机器,运行 junction.exe,单击“同意”按钮,然后注销。

    junction.exe 从那时起就在 Hudson 中运行良好。

    另一种选择是迁移到 Windows Server 2008。有人告诉我,该版本在操作系统本身内置的新“mklink”实用程序中具有连接功能,并且没有 EULA。

    【讨论】:

    • 谢谢!我摆弄了很多,它终于开始工作了......我不确定它是什么,因为从那以后发生了很大的变化,但我很高兴你让它工作了。谢谢你把它放在这里!
    【解决方案3】:

    没关系,如果其他人在看,就找到了 - 我将 slink.bat 的“调用”更改为“start /B”,并添加了完整路径,所以:

    call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x64
    start /B C:\Data\Scripts\slink.bat C:\Data\3rdParty64 3rdParty
    start /B C:\Data\Scripts\slink.bat slink.bat %WORKSPACE%\..\..\..\tds.core\label\%label% tds.core
    

    【讨论】:

      猜你喜欢
      • 2012-01-14
      • 2012-12-14
      • 1970-01-01
      • 2013-11-07
      • 1970-01-01
      • 2013-05-19
      • 2021-09-09
      • 2012-01-20
      • 1970-01-01
      相关资源
      最近更新 更多