rpmbuild报错Installed (but unpackaged) file(s) found ?

==============================================================================
The changes which rolled in RPM 4.1 terminate builds when unpackaged binaries  
or documentation are found. Mike Harris gave an extended discussion of  
his thoughts:
==============================================================================
From mharris at redhat.com Tue Feb 25 08:43:39 2003  
Date: Tue, 25 Feb 2003 06:47:11 -0500 (EST)  
From: Mike A. Harris <mharris at redhat.com>  
Reply-To: phoebe-list at redhat.com  
To: phoebe-list at redhat.com  
Subject: phoebe] Re: Strange problem while building RPMs
  
On Mon, 24 Feb 2003, Andreas Thienemann wrote:
  
> I tried building the librpm404 SRPM from Psyche on the current phoebe beta
> as I need the rpm for some software which uses the old API.
>
> rpmbuild --rebuild librpm404-4.0.4-8x.27.src.rpm fails however.
> The complete buildlog is at http://filepile.dicp.de/rpmbuild.log and
> shows that everything runs fine until the end of the %install stage.
>
> The %install stage executes and finished successfully but after checking
> for installed but not packaged files the build stops.
> It seems that the not-packaged files are being recognized as errors and
> not as warnings, something which is not the case with the 8.0
> distribution.
>
> Can someone verify this? Or is it just my setup?
>
> A small Testcase which should compile quickly is one special pident
> package at http://filepile.dicp.de/pidentd-3.0.16-1nousername.src.rpm
>
> Compilation should fail with:
>
> RPM build errors:
> Installed (but unpackaged) file(s) found:
> /usr/sbin/idecrypt
> /usr/sbin/ikeygen
  
First off, let me say that I've read the whole thread before responding,  
so I'll try to avoid repeating what has already been said.  
I will however explain this new feature, what is good about it,  
why it was added to rpm, and how to disable it if you do not want it.
  
There are actually 2 new features here:
  
1) Terminate build if the RPM_BUILD_ROOT contains files that are  
not explicitly listed in a %files section of the spec file
RPM macro: _unpackaged_files_terminate_build
2) Terminate build if there are files that are flagged as documentation  
with %doc in a %files section, but are not present in the RPM_BUILD_ROOT  
during packaging.
RPM macro: _missing_doc_files_terminate_build
What use are these 2 new features? Let me explain...
  
One of the things that can often be a huge pain as a package maintainer,  
is building a package, and not knowing what all files should be included in  
the package. Many packages make it fairly clear, while others do not.  
Still other packages can be extremely huge, and very complex to package  
(XFree86, kernel, glibc, GNOME, KDE, etc.)
  
Both in the initial packaging of a package, as well as when enabling  
a new feature in the software at build time via some ./configure --with-foo      
option, or any number of other reasons, new files can end up getting installed  
into the RPM_BUILD_ROOT during %install without the developer/packager  
even realizing it. Sometimes the files end up getting picked up by a glob,  
but other times the files get lost, and end up unpackaged. For example,  
perhaps some package has 50 applications, and only 10 manpages. Let's  
assume that package is broken up into 4 subpackages, and each package  
contains some commands and some manpages. Since the manpages are  
split across several subpackages, you can't just include them with  
%{_mandir}/man1/* because then all manpages would go into one package.  
So you have to list them  
all individually.
  
If a future release of that software package adds 15 new manpages,  
if the person packaging it into rpm format  
doesn't notice these new manpages, they may get installed into RPM_BUILD_ROOT,  
but actually get innocently left out of the RPM packages. The same can be said  
for icons, png files, jpgs, other applications, info files, README files, and  
all sorts of things.
  
It is kind of a broken idea to expect a developer to manually read every  
tidbit of documentation in every new piece of software in the entire  
distribution, and in RPM packaging in general both inside and outside of the  
distribution, or to expect them to manually search through every single  
directory in RPM_BUILD_ROOT every time they update a software package.  
It is a very long and drawn out tedious process. It can be automated in various  
ways, some which work well with some software, others which work well with  
other software. Some software is tricky though to not miss files when updating  
the packages.
  
The new RPM features described above, are a new feature to eliminate  
this guessing game, and to allow an RPM packager to automatically tell them
if any files are missing from the packaging. It does this by terminating a  
build automatically with the errors you are seeing, if any file is found in the  
RPM_BUILD_ROOT that is not listed to be included in the packaging.
  
There are several possible things that one can do when encountering this RPM  
packaging/debugging aide.
  
1) The proper fix, is to either have the %install section not install files into  
RPM_BUILD_ROOT that you do not want to package up. Alternatively,  
at the end of %install you can delete the files and/or dirs from  
RPM_BUILD_ROOTthat you do not want to package up. You'll likely find  
however that many of these files *should* be packaged up, but the %files  
lists are incomplete so the files were always getting unincluded in your  
packages. The solution is to add the files to the %files lists properly,  
so the files get included in your packaging.
  
  
2) You may like the feature, but for one reason or another do not want to  
use it with a particular rpm package, or perhaps want to slowly fix the package  
to do the right thing, and in the meantime want to disable the feature  
just for this one package. I do this in the XFree86 packaging currently,
as migrating XFree86 to package files cleanly with this feature enabled,  
and have it work on 7 architectures is a huge chore. To disable it in  
one package, add the following to the spec file:
%define _unpackaged_files_terminate_build 0  
%define _missing_doc_files_terminate_build 0
  
3) Some users may not like it. A pity because it is a godsend.  
If someone does not like it at all, they can disable the feature globally  
by putting the following in ~/.rpmmacros:
_unpackaged_files_terminate_build 0  
_missing_doc_files_terminate_build 0
  
In general, developers will really start to appreciate this feature the more  
they use it as it helps to stop you from forgetting to package up important  
or useful files in your RPM packages, or to explicitly remove them if you  
really do not want them.
  
End users rebuilding RPMs may dislike the feature since they aren't necessarily  
developers, and may not want to fiddle around with package lists, and packaging  
trivia. They can simply disable the feature.
  
All in all, this new feature in RPM is a gift from the Gods. Use it. Love it.  
I know I do!
  
Yes, I know it sounds backwards me telling you that this feature rocks  
in one breath, and in another breath telling you that XFree86 packaging  
is not using it. ;o) *YET* ;o)
  
I'm slowly working on it... gimme some time! ;o)
  
I hope this information is helpful to some of you. Feel free to pass it on.
  
Take care,
TTYL
  
--  
Mike A. Harris ftp://people.redhat.com/mharris
OS Systems Engineer - XFree86 maintainer - Red Hat
  
--  
Phoebe-list mailing list
Phoebe-list at redhat.com
https://listman.redhat.com/mailman/listinfo/phoebe-list
  
See also: Omit find_requires during rpmbuild
  
Last updated: Tue, 25 Feb 2003 08:03:41 -0500
  
-- 
  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值