dongpao1926 2019-02-08 02:58
浏览 504

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

I want to custom build a php rpm package, but I have some problem in the %install time, errors show as follows:

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)

My php Spec file is here:

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

How can I create the /usr/local/lib/php permission or own the right permission ?

Any help you ?

  • 写回答

1条回答 默认 最新

  • doujiu8145 2019-02-09 13:38
    关注

    You're on the right track by not building as root! Try replacing the ./configure call with %{configure} which is a macro that will put in all the Red Hat flags they want (like checking for stack overflows, etc) as well as the DESTDIR flags and whatnot you need for it all to "just work." You're already (properly) using the %{make_install} macro so you're fine there.

    I would take out the mkdir call because the "make install" should cover that.

    评论

报告相同问题?

悬赏问题

  • ¥30 matlab解优化问题代码
  • ¥15 写论文,需要数据支撑
  • ¥15 identifier of an instance of 类 was altered from xx to xx错误
  • ¥100 反编译微信小游戏求指导
  • ¥15 docker模式webrtc-streamer 无法播放公网rtsp
  • ¥15 学不会递归,理解不了汉诺塔参数变化
  • ¥15 基于图神经网络的COVID-19药物筛选研究
  • ¥30 软件自定义无线电该怎样使用
  • ¥15 R语言mediation包做中介分析,直接效应和间接效应都很小,为什么?
  • ¥15 Jenkins+k8s部署slave节点offline