rpmbuild php软件包无法创建目录权限,然后拒绝%install

时间:2019-02-08 02:58:23

标签: php linux rpmbuild

我想自定义构建一个php rpm软件包,但是在== None时遇到了一些问题,错误显示如下:

%install

我的php Spec文件在这里:

Build complete.
Don't forget to run 'make test'.

+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.JrATF9
+ umask 022
+ cd /home/work/rpmbuild/BUILD
+ '[' /home/work/rpmbuild/BUILDROOT/php-7.3.2-1.el7.x86_64 '!=' / ']'
+ rm -rf /home/work/rpmbuild/BUILDROOT/php-7.3.2-1.el7.x86_64
++ dirname /home/work/rpmbuild/BUILDROOT/php-7.3.2-1.el7.x86_64
+ mkdir -p /home/work/rpmbuild/BUILDROOT
+ mkdir /home/work/rpmbuild/BUILDROOT/php-7.3.2-1.el7.x86_64
+ cd php-7.3.2
+ rm -rf /home/work/rpmbuild/BUILDROOT/php-7.3.2-1.el7.x86_64
+ /usr/bin/mkdir -p /home/work/rpmbuild/BUILDROOT/php-7.3.2-1.el7.x86_64/usr/local/lib/php/extensions/no-debug-non-zts-20180731
+ /usr/bin/make install DESTDIR=/home/work/rpmbuild/BUILDROOT/php-7.3.2-1.el7.x86_64
mkdir: cannot create directory '/usr/local/lib/php': Permission denied
mkdir: cannot create directory '/usr/local/lib/php/extensions': No such file or directory
mkdir: cannot create directory '/usr/local/lib/php/extensions/no-debug-non-zts-20180731': No such file or directory
make: *** [install-modules] Error 1
error: Bad exit status from /var/tmp/rpm-tmp.JrATF9 (%install)

RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.JrATF9 (%install)

如何创建Name: php Version: 7.3.2 Release: 1%{?dist} Source0: %{name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root %prep %setup -q %build ./configure --enable-fpm --enable-mbstring --with-pdo-mysql --without-sqlite3 --without-pdo-sqlite --with-openssl --with-zlib --with-curl --with-libdir=lib64 make %{?_smp_mflags} %install rm -rf $RPM_BUILD_ROOT %{__mkdir} -p $RPM_BUILD_ROOT/usr/local/lib/php/extensions/no-debug-non-zts-20180731 %make_install %files %defattr(-,root,root) %attr(0755,root,root) %dir /usr/local/lib/php %attr(0755,root,root) %dir /usr/local/lib/php/extensions %attr(0755,root,root) %dir /usr/local/lib/php/extensions/no-debug-non-zts-20180731 权限或拥有正确的权限?

有什么帮助吗?

1 个答案:

答案 0 :(得分:0)

您正处在正确的轨道上,而不是像root那样建造!尝试将./configure调用替换为%{configure},这是一个宏,它将放入他们想要的所有Red Hat标志(例如检查堆栈溢出等)以及DESTDIR标志和一切都需要它“正常工作”。您已经(正确地)使用了%{make_install}宏,因此可以正常使用。

我会打出mkdir的电话,因为“ make install”应该可以解决这个问题。