为什么我可以手动构建 Python MSI 安装程序,但我的 Bamboo 远程代理服务却无法?

发布于 2024-11-03 15:57:22 字数 2059 浏览 5 评论 0原文

背景

我的 Bamboo 服务器在 Linux 上运行。我使用 Bamboo 为 Python 应用程序构建可执行安装程序和源代码发行版。

我无法从 Linux 为我的 Python 包构建 MSI 安装程序,因此我在另一台计算机上的 Windows 7 64 位上将 Bamboo Remote Agent 作为服务运行。该远程代理配置为提供构建 Windows 二进制文件的功能,因此 Bamboo 运行 MSI 和EXE 建立在它的基础上。

.zip 源代码 dist 和 .exe 安装程序已成功构建。但是,我的构建脚本在尝试构建 .msi 安装程序时失败。

构建脚本

构建脚本是一个非常简单的批处理文件:

python setup.py bdist --formats=zip
IF %ERRORLEVEL% NEQ 0 EXIT /B 1

python setup.py bdist_wininst
IF %ERRORLEVEL% NEQ 0 EXIT /B 1

echo ***Building msi installer***
echo.
python setup.py bdist_msi
IF %ERRORLEVEL% NEQ 0 EXIT /B 1

错误

以下是我的构建日志的一部分(用于上下文):

28-Apr-2011 13:26:46    ***Building msi installer***
...
28-Apr-2011 13:26:46    creating build\bdist.win32\msi\Lib\site-packages
28-Apr-2011 13:26:46    creating build\bdist.win32\msi\Lib\site-packages\my_pkg
...

28-Apr-2011 13:26:46    running install_egg_info
28-Apr-2011 13:26:46    Writing build\bdist.win32\msi\Lib\site-packages\my_pkg-0.4.0b23-py2.7.egg-info

我从 Python 得到以下异常回溯:

Traceback (most recent call last):
File "setup.py", line 38, in <module>
  'my_pkg': ['default_config.cfg']},
File "c:\python27\lib\distutils\core.py", line 152, in setup
  dist.run_commands()
File "c:\python27\lib\distutils\dist.py", line 953, in run_commands
  self.run_command(cmd)
File "c:\python27\lib\distutils\dist.py", line 972, in run_command
  cmd_obj.run()
File "c:\python27\lib\distutils\command\bdist_msi.py", line 243, in run
  sversion, author)
File "c:\python27\lib\msilib\__init__.py", line 139, in init_database
 db = OpenDatabase(name, MSIDBOPEN_CREATE)
_msi.MSIError: unknown error 65f

0x65f 转换为 1631,如果我的 Google Fu 很强,可能“错误 1631:Windows Installer 服务无法启动”

进一步测试

如果我转到执行构建的计算机上的 Bamboo 代理的构建目录,并从 Windows 资源管理器手动运行构建脚本批处理文件,则 .msi 构建会成功。

请注意,我在之前的版本中使用了相同的 SVN 存储库修订版,但我不得不移动我的开发系统,并且可能无意中更改了 Windows 中的某些配置(或者可能是 Windows 更新)打破了它)。

Background

My Bamboo server is running on Linux. I use Bamboo to build executable installers and source distributions for a Python app.

I can't build MSI installers for my Python package from Linux, so I am running a Bamboo Remote Agent as a service on Windows 7 64-bit on another machine. This remote agent is configured to provide the capability of building Windows binaries, so Bamboo runs the MSI & EXE builds on it.

The .zip source dist and .exe installer are built successfully. However, my build script fails when it tries to build the .msi installer.

Build script

The build script is a very simple batch file:

python setup.py bdist --formats=zip
IF %ERRORLEVEL% NEQ 0 EXIT /B 1

python setup.py bdist_wininst
IF %ERRORLEVEL% NEQ 0 EXIT /B 1

echo ***Building msi installer***
echo.
python setup.py bdist_msi
IF %ERRORLEVEL% NEQ 0 EXIT /B 1

Error

Below is part of my build log (for context):

28-Apr-2011 13:26:46    ***Building msi installer***
...
28-Apr-2011 13:26:46    creating build\bdist.win32\msi\Lib\site-packages
28-Apr-2011 13:26:46    creating build\bdist.win32\msi\Lib\site-packages\my_pkg
...

28-Apr-2011 13:26:46    running install_egg_info
28-Apr-2011 13:26:46    Writing build\bdist.win32\msi\Lib\site-packages\my_pkg-0.4.0b23-py2.7.egg-info

I get the following exception traceback from Python:

Traceback (most recent call last):
File "setup.py", line 38, in <module>
  'my_pkg': ['default_config.cfg']},
File "c:\python27\lib\distutils\core.py", line 152, in setup
  dist.run_commands()
File "c:\python27\lib\distutils\dist.py", line 953, in run_commands
  self.run_command(cmd)
File "c:\python27\lib\distutils\dist.py", line 972, in run_command
  cmd_obj.run()
File "c:\python27\lib\distutils\command\bdist_msi.py", line 243, in run
  sversion, author)
File "c:\python27\lib\msilib\__init__.py", line 139, in init_database
 db = OpenDatabase(name, MSIDBOPEN_CREATE)
_msi.MSIError: unknown error 65f

0x65f translates to 1631, which - if my Google Fu is strong - might be "Error 1631: The Windows Installer service failed to start".

Further Testing

If I go to the Bamboo agent's build directory on the machine performing the build, and manually run the build script batchfile from Windows Explorer, the .msi build is successful.

Note that I had this all working in a previous build with the same SVN repo revision, but I have had to move my development systems since and may have inadvertently changed some configuration in Windows (or perhaps a Windows update broke it).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夜唯美灬不弃 2024-11-10 15:57:22

如果 Bamboo 代理是 Windows 服务,您可能需要以提升的权限运行它。关于服务帐户如何访问 MSI 服务有一些奇怪的规则。 (我从未缩小所需的确切权限范围。)

If the Bamboo agent is a Windows service, you might need to run it with elevated privileges. There are weird rules about how service accounts can access the MSI service. (I never narrowed down the exact permissions that are required.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文