• 排错 rpmbuild -ba ***.spec时出现 警告:发现已安装(但未打包的)文件/错误:警告:发现已安装(但未打包的)文件


    排错 rpmbuild -ba ***.spec时出现 警告:发现已安装(但未打包的)文件/错误:警告:发现已安装(但未打包的)文件

    • 问题出现:

    学习Nginx rpm打包时候,他原本的配置是 :

    	# 编译阶段执行的命令
    	%build
    	./configure
    	make
    
    • 1
    • 2
    • 3
    • 4

    那就是默认配置安装,按照他的做可以配置,rpmbuild -ba nginx.spec ,可以生成rpm包。但是作为新时代新青年,这默认安装就能拿下我吗?显然不可能,那好,咱们就要yum/rpm包有编译安装的味道,我想加模块就加模块,我想定义路径,就定义路径。于是新时代新青年版改动就来了,如下:

    	
    	%build
    	./configure --user=nginx --group=nginx --prefix=/opt/nginx --conf-path=/etc/nginx/nginx.conf --sbin-path=/usr/sbin/nginx --error-log-path=/var/log/nginx/nginx_error.log --http-log-path=/var/log/nginx/nginx_access.log --pid-path=/usr/local/nginx/run/nginx.pid
    	make 
    
    • 1
    • 2
    • 3
    • 4

    如此,我就想加什么配置参数都可以,想配置什么模块也行,那么程序能轻易让我得逞吗?显然是不能
    rpmbuild -ba nginx.spec结果如下

    [root@bcchost SPECS]# rpmbuild -ba nginx.spec
    执行(%prep): /bin/sh -e /var/tmp/rpm-tmp.bfNLUG
    + umask 022
    + cd /root/rpmbuild/BUILD
    + cd /root/rpmbuild/BUILD
    + rm -rf nginx-1.22.1
    + /usr/bin/tar -xf -
    + /usr/bin/gzip -dc /root/rpmbuild/SOURCES/nginx-1.22.1.tar.gz
    + STATUS=0
    + '[' 0 -ne 0 ']'
    + cd nginx-1.22.1
    + /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
    + exit 0
    执行(%build): /bin/sh -e /var/tmp/rpm-tmp.pj2whF
    + umask 022
    + cd /root/rpmbuild/BUILD
    + cd nginx-1.22.1
    + ./configure --user=nginx --group=nginx --prefix=/opt/nginx --conf-path=/etc/nginx/nginx.conf --sbin-path=/usr/sbin/nginx --error-log-path=/var/log/nginx/nginx_error.log --http-log-path=/var/log/nginx/nginx_access.log --pid-path=/usr/local/nginx/run/nginx.pid
    checking for OS
     + Linux 3.10.0-1160.76.1.el7.x86_64 x86_64
    checking for C compiler ... found
     + using GNU C compiler
     + gcc version: 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) 
    checking for gcc -pipe switch ... found
    ... ... (中间太多无用信息省略)
    creating objs/Makefile
    
    Configuration summary
      + using system PCRE library
      + OpenSSL library is not used
      + using system zlib library
    
      nginx path prefix: "/opt/nginx"
      nginx binary file: "/usr/sbin/nginx"
      nginx modules path: "/opt/nginx/modules"
      nginx configuration prefix: "/etc/nginx"
      nginx configuration file: "/etc/nginx/nginx.conf"
      nginx pid file: "/usr/local/nginx/run/nginx.pid"
      nginx error log file: "/var/log/nginx/nginx_error.log"
      nginx http access log file: "/var/log/nginx/nginx_access.log"
      nginx http client request body temporary files: "client_body_temp"
      nginx http proxy temporary files: "proxy_temp"
      nginx http fastcgi temporary files: "fastcgi_temp"
      nginx http uwsgi temporary files: "uwsgi_temp"
      nginx http scgi temporary files: "scgi_temp"
    
    + make
    make -f objs/Makefile
    make[1]: Entering directory `/root/rpmbuild/BUILD/nginx-1.22.1'
    
    ... ... (中间太多无用信息省略)
    
    make[1]: Leaving directory `/root/rpmbuild/BUILD/nginx-1.22.1'
    + exit 0
    执行(%install): /bin/sh -e /var/tmp/rpm-tmp.rhFPbw
    + umask 022
    + cd /root/rpmbuild/BUILD
    + '[' /root/rpmbuild/BUILDROOT/nginx-1.22.1-1.el7.centos.x86_64 '!=' / ']'
    + rm -rf /root/rpmbuild/BUILDROOT/nginx-1.22.1-1.el7.centos.x86_64
    ++ dirname /root/rpmbuild/BUILDROOT/nginx-1.22.1-1.el7.centos.x86_64
    + mkdir -p /root/rpmbuild/BUILDROOT
    + mkdir /root/rpmbuild/BUILDROOT/nginx-1.22.1-1.el7.centos.x86_64
    + cd nginx-1.22.1
    + make install DESTDIR=/root/rpmbuild/BUILDROOT/nginx-1.22.1-1.el7.centos.x86_64
    make -f objs/Makefile install
    make[1]: Entering directory `/root/rpmbuild/BUILD/nginx-1.22.1'
    
    ... ... (中间太多无用信息省略)
    
    + '[' '%{buildarch}' = noarch ']'
    + QA_CHECK_RPATHS=1
    + case "${QA_CHECK_RPATHS:-}" in
    + /usr/lib/rpm/check-rpaths
    + /usr/lib/rpm/check-buildroot
    + /usr/lib/rpm/redhat/brp-compress
    + /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
    + /usr/lib/rpm/brp-python-bytecompile /usr/bin/python 1
    + /usr/lib/rpm/redhat/brp-python-hardlink
    + /usr/lib/rpm/redhat/brp-java-repack-jars
    处理文件:nginx-1.22.1-1.el7.centos.x86_64
    Provides: nginx = 1.22.1-1.el7.centos nginx(x86-64) = 1.22.1-1.el7.centos
    Requires(interp): /bin/sh /bin/sh
    Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
    Requires(post): /bin/sh
    Requires(preun): /bin/sh
    处理文件:nginx-debuginfo-1.22.1-1.el7.centos.x86_64
    Provides: nginx-debuginfo = 1.22.1-1.el7.centos nginx-debuginfo(x86-64) = 1.22.1-1.el7.centos
    Requires(rpmlib): rpmlib(FileDigests) <= 4.6.0-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1 rpmlib(CompressedFileNames) <= 3.0.4-1
    检查未打包文件:/usr/lib/rpm/check-files /root/rpmbuild/BUILDROOT/nginx-1.22.1-1.el7.centos.x86_64
    警告:发现已安装(但未打包的)文件:
       /usr/sbin/nginx
       /opt/nginx/html/50x.html
       /opt/nginx/html/index.html
    
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 分析问题

    好的,重点来了,遇到这个问题应该怎么办呢,最开始我是这样解决的
    解决方式一:注释,不检测
    问题解决了吗?解决了,但是没完全解决,出现什么情况,我打包成功了,传入新机器,发现我做出的改变,编译方式出现的文件都没有,而且

    	/usr/sbin/nginx
       /opt/nginx/html/50x.html
       /opt/nginx/html/index.html
    
    • 1
    • 2
    • 3

    在新机器没生成,那么就很难受,我为了什么,为了生成新的包,指定路径上有我的文件啊。
    那么怎么解决呢?

    • 解决

    在打包时候,进行打包不就好了嘛

    	%files
    	%{_prefix}/local/*   #原来的
    
    • 1
    • 2

    改版

    	%files
    	%{_prefix}/local/*
    	/etc/nginx/*
    	%{_prefix}/sbin/nginx
    	/opt/nginx/*  #改版后
    
    • 1
    • 2
    • 3
    • 4
    • 5

    改版后全部源代码

    Name:           nginx   
    Version:        1.22.1
    Release:        1%{?dist}
    Summary:        "nginx"project
    Summary(zh_CN): "nginx"项目
    
    License:        GPLv3+
    URL:            http://nginx.org/download/      
    Source0:        nginx-1.22.1.tar.gz
    
    BuildRequires:  gcc
    Requires:       pcre-devel zlib-devel
    
    %description  -l zh_CN
    这是nginx的项目
    
    
    %prep
    %setup -q
    
    
    %build
    ./configure --user=nginx --group=nginx --prefix=/opt/nginx --conf-path=/etc/nginx/nginx.conf --sbin-path=/usr/sbin/nginx --error-log-path=/var/log/nginx/nginx_error.log --http-log-path=/var/log/nginx/nginx_access.log --pid-path=/usr/local/nginx/run/nginx.pid
    #./configure 
    make 
    
    
    %install
    #%define _unpackaged_files_terminate_build 0
    rm -rf %{buildroot}/*
    make install DESTDIR=%{buildroot}
    
    # 安装后执行的命令
    %post
    useradd nginx -M -s /sbin/nologin
    /usr/sbin/nginx
     
    # 卸载前执行的命令
    %preun
    userdel -r nginx
     
    # 将所需要打包的文件都存放到这边中;-f %{name}.lang 加上后的意思为声明找到的文件
    
    %files
    %{_prefix}/local/*
    /etc/nginx/*
    %{_prefix}/sbin/nginx
    /opt/nginx/*
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48

    特别鸣谢
    老王笔记
    mtOS1573
    提供的学习和解答文章,可以帮忙点点浏览量

  • 相关阅读:
    【ICer的脚本练习】脚本使用的思维培养 —— 用例回归
    kettle应用-数据库表插入/更新
    java毕业设计古典舞在线交流平台(附源码、数据库)
    java虚拟机详解篇六(类的加载机制)
    脑皮质算法(2)一种基于新皮层网格细胞的智能和皮质功能的框架
    算法刷题 week4
    【计组笔记】04_存储系统(一)
    Centos stream9 安装 MySQL8 详细步骤(踩坑笔记)
    Redis分布式锁解锁案例讲解
    NBT:快准全!geNomad——宏病毒组鉴定新工具
  • 原文地址:https://blog.csdn.net/qq_42704442/article/details/128148039