Bug 87941 - RFE: internalize check_files (was getOutputFrom(): Broken pipe.)
Summary: RFE: internalize check_files (was getOutputFrom(): Broken pipe.)
Keywords:
Status: CLOSED DEFERRED
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: rpm-build
Version: 9
Hardware: i386
OS: Linux
low
low
Target Milestone: ---
Assignee: Jeff Johnson
QA Contact: Mike McLean
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-04-03 21:30 UTC by Michael Schwendt
Modified: 2005-10-31 22:00 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2003-04-29 17:37:02 UTC
Embargoed:


Attachments (Terms of Use)
sample spec file (333 bytes, text/plain)
2003-04-03 21:31 UTC, Michael Schwendt
no flags Details
sample spec file #2 (164 bytes, text/plain)
2003-04-03 21:32 UTC, Michael Schwendt
no flags Details
Spec file (2.30 KB, text/plain)
2003-04-29 18:08 UTC, Valentine Kouznetsov
no flags Details
Output from rpmbuild (20.24 KB, text/plain)
2003-04-29 18:09 UTC, Valentine Kouznetsov
no flags Details
source (113.32 KB, text/plain)
2003-04-29 18:09 UTC, Valentine Kouznetsov
no flags Details
new log (13.12 KB, text/plain)
2003-04-29 18:20 UTC, Valentine Kouznetsov
no flags Details
new spec (2.36 KB, text/plain)
2003-04-29 18:21 UTC, Valentine Kouznetsov
no flags Details

Description Michael Schwendt 2003-04-03 21:30:53 UTC
With older releases, the following used to work fine (even without including a
file in the package).

$ rpmbuild -bb opera-qtdep.spec
Processing files: opera-qtdep-1.0-1
Provides: libqt.so.3
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires: qt
Checking for unpackaged file(s): /usr/lib/rpm/check-files %{buildroot}
getOutputFrom(): Broken pipe


Version-Release number of selected component (if applicable):
4.2-0.69

How reproducible:
Always

Comment 1 Michael Schwendt 2003-04-03 21:31:42 UTC
Created attachment 90883 [details]
sample spec file

Comment 2 Michael Schwendt 2003-04-03 21:32:10 UTC
Created attachment 90884 [details]
sample spec file #2

Comment 3 Andrew McCallum 2003-04-08 21:28:58 UTC
Just encountered this one myself yesterday.  The problem is that you don't have
a buildroot specified and rpmbuild seems to require one now.

If you add:
BuildRoot: /tmp/somepackage
to your spec preamble, everything should work fine.

Comment 4 Michael Schwendt 2003-04-08 22:12:51 UTC
Then it would still be a bug, because it doesn't print a comprehensible error
message or doesn't do a sanity check.

But even if a BuildRoot definition might be required, there is still something
that doesn't work correctly:

Observation #1: In my example spec files, in the %files section, replace the
existing entries with just /bin/sh, and the packages build fine _without_ a
BuildRoot definiton.

Observation #2: 'error: BuildRoot can not be "/": -- means, I could not package
files from my installation.


Comment 5 Michael Schwendt 2003-04-08 22:22:03 UTC
As an addition to observation #1 above, if the %files section is changed to

%files
%defattr(-,root,root)
/etc/services
/bin/sh

it fails again. If the default attributes definition is taken out, it builds
fine again. 

Since this is a non-root build environment, if I enter files from my home
directory, it fails, too. For example, if I use this:

%files
/home/ms/.rpmrc


Comment 6 Valentine Kouznetsov 2003-04-29 15:48:43 UTC
I have similar problems. Below you can find my spec file. Just a few comments:
Adding BuildRoot doesn't not allow package my files, it only allow create
appropriate directory. Observation 2, if I leave in my source only one file
everything works fine (my source file only contains scripts and nothing else). I
think something wrong with string buffer. My spec is very trivial. It's only
copy necessary files and doesn't not build anything. I use RedHat 8.0. Here my
spec file:

#
# cleo - CLEO III software
#
%define version 1.0.0
%define name cleo3-scripts

# Standard CLEO root is /nfs, for time being I'm testing it in
# /mnt/disk1/vk/TEST/
%define cleo_root /mnt/disk1/vk/TEST/topdir
%define cleo_linux %{cleo_root}/linux

#
Summary: CLEO III offline reconstruction software
Vendor: Cornell University
Name: %{name}
Version: %{version}
Release: 1
Copyright: GPL
Group: CLEO/Software
Packager: Valentine Kouznetsov <vk.cornell.edu>
Source: %{name}-%{version}.tar.gz
URL: http://www.lns.cornell.edu/public/CLEO/
#BuildRoot: /tmp/%{name}
Provides: Cleo III offline scripts
Prefix: %{cleo_root}

%changelog
* Wed Apr 16 2003 Valentine Kouznetsov <vk.cornell.edu>
- First attempt to build cleo RPMs

%description
CLEO III Offline reconstruction software is designed to reconstruct
CLEO data. This package contains neccessary scripts to set up CLEO
environment.


%prep
# check & create cleo directory structure
if [ -d $RPM_BUILD_ROOT/%{cleo_linux} ] ; then
  ln -sf $RPM_BUILD_ROOT/%{cleo_linux}/cleo3 $RPM_BUILD_ROOT/%{cleo_root}/cleo3
else
  mkdir -p $RPM_BUILD_ROOT/%{cleo_linux}/cleo3
  ln -sf $RPM_BUILD_ROOT/%{cleo_linux}/cleo3 $RPM_BUILD_ROOT/%{cleo_root}/cleo3
fi

export C3_=$RPM_BUILD_ROOT/%{cleo_root}/cleo3
export C3DIST=$C3_/Offline

if [ ! -d $C3DIST/scripts ] ; then
  mkdir -p $C3DIST/scripts
fi

%setup
echo setup

%build
echo build

%install
# check & create cleo directory structure
if [ ! -d %{cleo_root} ] ; then
  mkdir -p %{cleo_root}
fi

if [ ! -d %{cleo_linux} ] ; then
  mkdir -p %{cleo_linux}
fi

if [ ! -d %{cleo_linux}/cleo3 ] ; then
  mkdir -p %{cleo_linux}/cleo3
fi

if [ ! -h %{cleo_root}/cleo3 ] ; then
  ln -sf %{cleo_linux}/cleo3 %{cleo_root}/cleo3
fi

if [ ! -d %{cleo_root}/cleo3/Offline/scripts ] ; then
  mkdir -p %{cleo_root}/cleo3/Offline/scripts
fi

cp -a * %{cleo_linux}/cleo3/Offline/scripts

%files
%defattr(-,root,root)
%{cleo_root}/cleo3/Offline/scripts/

%clean
rm -rf $RPM_BUILD_ROOT
rm -rf $RPM_BUILD_DIR/%{name}-%{version}


Comment 7 Valentine Kouznetsov 2003-04-29 17:18:30 UTC
I found solution (?) to the problem. To be clear here the way how I make install:

%install
cp * <my_install_dir>

%files
<my_install_dir>

Without BuildRoot this approach doesn' work. And job ended with the following
message:
Checking for unpackaged file(s): /usr/lib/rpm/check-files %{buildroot}


With BuildRoot it works partially, my final RPM contains only this directory
with its contents. But if I'll add
to %install the following:
cp * %{buildroot}/<my_install_dir>
I'll get correctly my RPM with additional warning message, like:

Checking for unpackaged file(s): /usr/lib/rpm/check-files <my_buildroot_dir>
warning: Installed (but unpackaged) file(s) found:
  <my_install_dir>/<my_file>

Hope it helps find problem. If you need my source file as well I can send tar
ball. See my spec file in previous bug message.
Valentine.


Comment 8 Valentine Kouznetsov 2003-04-29 17:27:20 UTC
Just another observation. If you prepend %{buildroot} into file list, like
%files
%{buildroot}/<my_path>/<my_file>

The you'll get immeadiately message
Processing files: <my_package>
error: File not found: <my_buildroot_dir>/<my_buildroot_dir>/<my_path>/<my_file>

It seems to me that there is a bug with buildroot, since by default it
prepending to file list and that cause the problem when you don't use buildroot.


Comment 9 Jeff Johnson 2003-04-29 17:37:02 UTC
Yes, BuildRoot: is needed, or, equivalently, disabling
the checkfiles script by adding
    %define __check_files %{nil}

The check_files helper script is going to be internalized
to rpm eventually, deferred until then.

BTW, BuildRoot: should be used if at all possible.

You should also have ($RPM_BUILD_ROOT and %buildroot are interchangeable
in scriptlets):

    # XXX Change to taste, but following is common
    BuildRoot: %{_tmppath}/%{name}-root

    %install
    # XXX always install into empty BuildRoot:
    rm -rf $RPM_BUILD_ROOT
    ...

    %clean
    # XXX clean up if successful. Dunno if you really want to erase
    # the build directory automagically.
    rm -rf $RPM_BUILD_ROOT

    %files
    # XXX make sure your package can be built as non-root with sane defaults
    %defattr(-,root,root)
    

Comment 10 Jeff Johnson 2003-04-29 17:38:44 UTC
The packager does not need to prepend %{buildroot},
rpm does that automagically, so there is no file
with two %{buildroot} components at the start.

Comment 11 Valentine Kouznetsov 2003-04-29 18:08:52 UTC
Created attachment 91394 [details]
Spec file

Comment 12 Valentine Kouznetsov 2003-04-29 18:09:23 UTC
Created attachment 91395 [details]
Output from rpmbuild

Comment 13 Valentine Kouznetsov 2003-04-29 18:09:44 UTC
Created attachment 91396 [details]
source

Comment 14 Valentine Kouznetsov 2003-04-29 18:10:35 UTC
Ok, fixed. But then I don't understand the warning message, see attachments above.

Comment 15 Valentine Kouznetsov 2003-04-29 18:20:16 UTC
I fix the problem, see new attachment. Just look at rpm.spec and make my spec
similar. Anyway thanks for feedback.


Comment 16 Valentine Kouznetsov 2003-04-29 18:20:49 UTC
Created attachment 91397 [details]
new log

Comment 17 Valentine Kouznetsov 2003-04-29 18:21:14 UTC
Created attachment 91398 [details]
new spec


Note You need to log in before you can comment on or make changes to this bug.