从源代码在CentOS上创建RPM时与剥离相关的权限错误

时间:2015-05-14 17:49:47

标签: centos rpm stripping

从现有源代码构建RPM时,我收到以下错误:

  

/ usr / bin / strip:无法复制文件   '/home/vagrant/temp/BUILDROOT/python3-3.4.3-1.el6.x86_64/usr/lib/libpython3.4m.a';   原因:许可被拒绝

当我查看此文件的权限时,它没有写入权限。

  

-r-xr-xr-x 1 vagrant vagrant 12823866 5月14日17:33 libpython3.4m.a

我已尝试在%files部分设置权限:

%attr(0644,root,root) /usr/lib/libpython3.4m.a

但这没有效果。

何时进行剥离过程,如何在剥离操作发生之前修复文件以便剥离文件?

1 个答案:

答案 0 :(得分:1)

configure脚本创建一个Makefile。在Makefile中有以下内容:

# Shared libraries must be installed with executable mode on some systems;
# rather than figuring out exactly which, we always give them executable mode.
# Also, making them read-only seems to be a good idea...
INSTALL_SHARED= ${INSTALL} -m 555

我没有自动化专家,所以可能有一些选项来调整它。但是,我在spec文件的%install部分中执行此操作

%install
sed -i 's/INSTALL_SHARED= ${INSTALL} -m 555/INSTALL_SHARED= ${INSTALL} -m 755'/ $RPM_BUILD_DIR/Python-%{version}/Makefile
make install DESTDIR=$RPM_BUILD_ROOT

此外,由于我正在构建python,我还需要关闭post安装的rpm brp-python-bytecompile部分。我在fedora邮件列表上找到了这个,并归功于David Malcom @ RedHat。这是original thread - 你可以将它放在spec文件的顶部:

%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')