slickfive
slickfive

Reputation: 45

RPM spec %files

I'm trying to create a simple RPM and experiencing the dreaded 'unpackaged file' issue. The RPM contains a single tar file with a number of pre-compiled binary files (for the time being). The installation needs to install these onto the host system.

My spec file: Summary Case

Name LL

Packager: Me

Source: one.tar.gz

license: AllRightsReserved

BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

%description
Initial RPM test

%prep
%setup -n one

%build

%install
rm -rf -v $RPM_BUILD_ROOT
mkdir -p -v $RPM_BUILD_ROOT/opt/rpm_test
cp -R * -v $RPM_BUILD_ROOT/opt/rpm_test

%clean 
rm -rf %{buildroot}
rm -rf $RPM_BUILD_ROOT
rm -rf $RPM_BUILD_DIR
rm -rf %{_tmppath/%{name}
rm -rf %{_topdir}/BUILD%{name}

%post
echo "$RPM_BUILD_ROOT Adding file"

%postun

%files
#%defattr(-,root,root,-)
%dir /opt/rpm_test/one
/opt/rpm_test/one/file1.txt
/opt/rpm_test/one/file2.txt
/opt/rpm_test/one/file3.txt
%dir

The output:

[rajp@007 SPECS]$ rpmbuild -bb case1.spec 
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.f2j8Hn
+ umask 022
+ cd /home/rajp/rpmbuild1/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /home/rajp/rpmbuild1/BUILD
+ rm -rf one
+ /usr/bin/gzip -dc /home/rajp/rpmbuild1/SOURCES/one.tar.gz
+ /bin/tar -xvvf -
drwxrwxr-x rajp/rajp         0 2016-03-23 10:00 one/
-rw-rw-r-- rajp/rajp         6 2016-03-23 10:00 one/file3.txt
-rw-rw-r-- rajp/rajp         6 2016-03-23 10:00 one/file1.txt
-rw-rw-r-- rajp/rajp         6 2016-03-23 10:00 one/file2.txt
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd one
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.PSIwwg
+ umask 022
+ cd /home/rajp/rpmbuild1/BUILD
+ cd one
+ LANG=C
+ export LANG
+ unset DISPLAY
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.TEN8l9
+ umask 022
+ cd /home/rajp/rpmbuild1/BUILD
+ '[' /home/rajp/rpmbuild1/BUILDROOT/LL-2.6-1.x86_64 '!=' / ']'
+ rm -rf /home/rajp/rpmbuild1/BUILDROOT/LL-2.6-1.x86_64
++ dirname /home/rajp/rpmbuild1/BUILDROOT/LL-2.6-1.x86_64
+ mkdir -p /home/rajp/rpmbuild1/BUILDROOT
+ mkdir /home/rajp/rpmbuild1/BUILDROOT/LL-2.6-1.x86_64
+ cd one
+ LANG=C
+ export LANG
+ unset DISPLAY
+ rm -rf -v /home/rajp/rpmbuild1/BUILDROOT/LL-2.6-1.x86_64
removed directory: `/home/rajp/rpmbuild1/BUILDROOT/LL-2.6-1.x86_64'
+ mkdir -p -v /home/rajp/rpmbuild1/BUILDROOT/LL-2.6-1.x86_64/opt/rpm_test
mkdir: created directory `/home/rajp/rpmbuild1/BUILDROOT/LL-2.6-1.x86_64'
mkdir: created directory `/home/rajp/rpmbuild1/BUILDROOT/LL-2.6-1.x86_64/opt'
mkdir: created directory `/home/rajp/rpmbuild1/BUILDROOT/LL-2.6-1.x86_64/opt/rpm_test'
+ cp -R file1.txt file2.txt file3.txt -v /home/rajp/rpmbuild1/BUILDROOT/LL-2.6-1.x86_64/opt/rpm_test
`file1.txt' -> `/home/rajp/rpmbuild1/BUILDROOT/LL-2.6-1.x86_64/opt/rpm_test/file1.txt'
`file2.txt' -> `/home/rajp/rpmbuild1/BUILDROOT/LL-2.6-1.x86_64/opt/rpm_test/file2.txt'
`file3.txt' -> `/home/rajp/rpmbuild1/BUILDROOT/LL-2.6-1.x86_64/opt/rpm_test/file3.txt'
+ /usr/lib/rpm/find-debuginfo.sh --strict-build-id /home/rajp/rpmbuild1/BUILD/one
+ /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/redhat/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump
+ /usr/lib/rpm/brp-python-bytecompile
+ /usr/lib/rpm/redhat/brp-python-hardlink
+ /usr/lib/rpm/redhat/brp-java-repack-jars
Processing files: LL-debuginfo-2.6-1.x86_64
Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/rajp/rpmbuild1/BUILDROOT/LL-2.6-1.x86_64
error: Installed (but unpackaged) file(s) found:
   /opt/rpm_test/file1.txt
   /opt/rpm_test/file2.txt
   /opt/rpm_test/file3.txt


RPM build errors:
    Installed (but unpackaged) file(s) found:
   /opt/rpm_test/file1.txt
   /opt/rpm_test/file2.txt
   /opt/rpm_test/file3.txt
[rajp@007 SPECS]$ 

Unfortunately Google's not helping :(

Thanks in advance

Upvotes: 0

Views: 1455

Answers (3)

slickfive
slickfive

Reputation: 45

RESOLVED! I moved the %files section just under the %description section! Hope this helps someone..

Upvotes: 1

Aaron D. Marasco
Aaron D. Marasco

Reputation: 6748

Take out the empty %postun? I think that's the problem.

Upvotes: 0

Thomas Dickey
Thomas Dickey

Reputation: 54505

Your spec-file uses /opt/rpm_test/one, while the problematic files are in /opt/rpm_test/.

Expected:

/opt/rpm_test/one/file1.txt

Actual

/opt/rpm_test/file1.txt

Upvotes: 0

Related Questions