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.

    评论

报告相同问题?

悬赏问题

  • ¥25 关于##爬虫##的问题,如何解决?:
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
  • ¥15 找一位技术过硬的游戏pj程序员
  • ¥15 matlab生成电测深三层曲线模型代码
  • ¥50 随机森林与房贷信用风险模型
  • ¥50 buildozer打包kivy app失败
  • ¥30 在vs2022里运行python代码
  • ¥15 不同尺寸货物如何寻找合适的包装箱型谱
  • ¥15 求解 yolo算法问题
  • ¥15 虚拟机打包apk出现错误