rpmbuild 创建 tmp 文件并因“权限被拒绝”而失败;当试图删除它们时
背景
我正在尝试构建一个简单的 rpm,它只是将一些 Web 应用程序源文件复制到安装目录。该网络应用程序是用 Java 编写的,由供应商提供(即它不是我编写的)。
由于下述错误,rpm 无法构建。然而,我已经成功地为同一供应商的另一个基于 Java 的 Web 应用程序构建了几乎相同的 rpm。除了安装路径和源文件名等名称之外,规范文件是相同的。
问题
当尝试删除 {BUILDROOT}/web 中的某些文件时,
。rpmbuild -v -bb --clean SPECS/web-app.spec
失败,并出现 权限被拒绝
-app-1.0/tmp
我检查了 rpmbuild
无法删除的文件的权限。下面是一些示例:
-r--r--r--. 1 signer signer 1203 Jan 13 2006 Adler32.class
-r--r--r--. 1 signer signer 19498 Jan 13 2006 Deflate.class
-r--r--r--. 1 signer signer 628 Jan 13 2006 Deflate$Config.class
-r--r--r--. 1 signer signer 8673 Jan 13 2006 InfBlocks.class
他们对我的构建用户(signer
)具有正确的所有权和组,但没有写入权限。
这些文件不是我在 rpm 规范中明确定义的任何进程的一部分。我的规范文件所做的就是运行 %setup
,创建一个目录,并将文件复制到其中。 %setup
期间提取的源 tarball 对其所有文件都具有正确的权限;我可以提取并删除它创建的树。这些文件不是源 tarball 的一部分。我认为tmp
文件与一些Java文件处理有关; rpmbuild
在构建接近尾声时花了很长时间“重新打包”jar 文件。我不确定它的用途是什么,并且我怀疑我正在部署的应用程序是否需要它。
问题
我可以禁用 jar 文件重新打包来解决这个问题吗?还有其他想法吗?
Background
I'm trying to build a simple rpm which just copies some web app source files to an install directory. The web app is written in Java, and is provided by a vendor (i.e it's not written by me).
The rpm fails to build due to the error described below. However, I have successfully built a nearly identical rpm for another Java-based web app from the same vendor. The spec files are the same except for the names of things like the install path and the source file name.
Problem
rpmbuild -v -bb --clean SPECS/web-app.spec
fails with Permission denied
when it tries to remove some files in {BUILDROOT}/web-app-1.0/tmp
.
I checked the permissions on the files that rpmbuild
couldn't remove. Some examples below:
-r--r--r--. 1 signer signer 1203 Jan 13 2006 Adler32.class
-r--r--r--. 1 signer signer 19498 Jan 13 2006 Deflate.class
-r--r--r--. 1 signer signer 628 Jan 13 2006 Deflate$Config.class
-r--r--r--. 1 signer signer 8673 Jan 13 2006 InfBlocks.class
They have the correct ownership and group for my build user (signer
), but no write permission.
These files are not part of any process I explicitly defined in my rpm spec. All my spec file does is run %setup
, make a directory, and copy files into it. The source tarball extracted during %setup
has the correct permissions for all of its files; I can extract and delete the tree it creates. These files are NOT part of the source tarball. I think the tmp
files are related to some Java file processing; rpmbuild
took a long time "repacking" jar files near the end of the build. I'm not sure what purpose that has, and I doubt it's needed for the app I'm deploying.
Questions
Can I disable the jar file repacking to fix this? Any other ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
遗憾的是,看起来
.jar
可能包含没有写入权限的目录,因此在这种情况下......自行提取受影响的jar
的内容,更改权限+w
,然后重新压缩它们...:-/Sadly, looks like the
.jar
probably contains directories with no write permissions, so under the circumstances … extract the contents of the affectedjar
s yourself, change the permissions+w
, and recompress them … :-/最简单的解决方案最终是通过在我的规范文件中添加以下定义来禁用 jar 重新打包:
%define __jar_repack %{nil}
BRPocock 的答案也应该有效。我禁用 jar 重新打包而不是按照 BRPocock 的建议自行重新打包 jar 的原因是,在启用 jar 重新打包的情况下,
rpmbuild
需要花费近 10 分钟的时间来构建,而在禁用它的情况下只需要一分钟。The easiest solution ended up being to disable jar repacking by putting the following define in my spec file:
%define __jar_repack %{nil}
BRPocock's answer should also work. The reason I disabled jar repacking instead of repacking the jars myself as BRPocock suggested is because
rpmbuild
takes almost 10 minutes to build with jar repacking enabled, but only a minute with it disabled.