LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
LinkBack Search this Thread
Old 08-01-2006, 02:39 PM   #1
kenneth.ashin
LQ Newbie
 
Registered: Aug 2006
Posts: 3

Rep: Reputation: 0
rpmbuild: can't make trivial sample work


(There are similar threads but they cover much more
complex cases that the one I'm having trouble with.)

My goal is to use rpmbuild to create a binary rpm package
that will copy files to a fixed location under usr/share
on a client machine.

I can build source and binary packages without errors and
I can run them under rpm without errors, but the source
package seems only to recreate the source file and the spec
file under usr/src/redhat/SOURCES and usr/src/redhat/SPECS.
The binary package doesn't seem to do anything at all.

For testing, I have a file, baz-1.0.tar.gz which has one directory, baz-1.0 which has two files called "one" and "two".
I want to end up with
/usr/share/baz-1.0
/usr/share/baz-1.0/one
/usr/share/baz-1.0/two

Here's my spec file.

************************************************************
Summary: my summary
Name: baz
Version: 1.0
Release: 1
Copyright: my copyright
Group: my group
Source: baz-1.0.tar.gz
URL: ** not allowed to post a usr **
Distribution: my distribution
Vendor: my vendor
Packager: my packager
Buildroot: /usr/src/redhat/myroot

%description
my description

%prep
%setup

%build

%install
mkdir -p $RPM_BUILD_ROOT/usr/share
cp -r $RPM_BUILD_DIR/baz-1.0 $RPM_BUILD_ROOT/usr/share

%clean

%files
/usr/share/baz-1.0/one
/usr/share/baz-1.0/two
************************************************************

rpmbuild -ba $SP/baz-1.0.spec seems to run successfully:

Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.1475
+ umask 022
+ cd /usr/src/redhat/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /usr/src/redhat/BUILD
+ rm -rf baz-1.0
+ /usr/bin/gzip -dc /usr/src/redhat/SOURCES/baz-1.0.tar.gz
+ tar -xvvf -
tar: Read 3072 bytes from -
-rw-rw-rw- kashin/engr 4 2006-07-27 08:30:26 baz-1.0/one
drwxr-xr-x Creating directory: baz-1.0
-rw-rw-rw- kashin/engr 4 2006-07-27 08:30:30 baz-1.0/two
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd baz-1.0
++ /usr/bin/id -u
+ '[' 1092 = 0 ']'
++ /usr/bin/id -u
+ '[' 1092 = 0 ']'
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.1475
+ umask 022
+ cd /usr/src/redhat/BUILD
+ cd baz-1.0
+ LANG=C
+ export LANG
+ unset DISPLAY
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.1475
+ umask 022
+ cd /usr/src/redhat/BUILD
+ cd baz-1.0
+ LANG=C
+ export LANG
+ unset DISPLAY
+ mkdir -p /usr/src/redhat/myroot/usr/share
+ cp -r /usr/src/redhat/BUILD/baz-1.0 /usr/src/redhat/myroot/usr/share
+ /usr/lib/rpm/find-debuginfo.sh /usr/src/redhat/BUILD/baz-1.0
0 blocks
find: /usr/src/redhat/myroot/usr/lib/debug: No such file or directory
+ /usr/lib/rpm/redhat/brp-compress
+ /usr/lib/rpm/redhat/brp-strip /usr/bin/strip
+ /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
Processing files: baz-1.0-1
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Processing files: baz-debuginfo-1.0-1
Checking for unpackaged file(s): /usr/lib/rpm/check-files /usr/src/redhat/myroot
Wrote: /usr/src/redhat/SRPMS/baz-1.0-1.src.rpm
Wrote: /usr/src/redhat/RPMS/i386/baz-1.0-1.i386.rpm
Wrote: /usr/src/redhat/RPMS/i386/baz-debuginfo-1.0-1.i386.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.1475
+ umask 022
+ cd /usr/src/redhat/BUILD
+ cd baz-1.0
+ exit 0

Here's what it creates:

./BUILD/baz-1.0
./BUILD/baz-1.0/two
./BUILD/baz-1.0/debugfiles.list
./BUILD/baz-1.0/one
./BUILD/baz-1.0/debugsources.list

./SRPMS/baz-1.0-1.src.rpm

./myroot/usr
./myroot/usr/src
./myroot/usr/src/debug
./myroot/usr/share
./myroot/usr/share/baz-1.0
./myroot/usr/share/baz-1.0/two
./myroot/usr/share/baz-1.0/one

./RPMS/i386/baz-debuginfo-1.0-1.i386.rpm
./RPMS/i386/baz-1.0-1.i386.rpm

Before I run rpm to install, I clean out some of the
tree so I can see what the install itself does.

So, before I run rpm, here's what the tree looks like:


./BUILD
./SOURCES
./SRPMS
./SRPMS/baz-1.0-1.src.rpm
./rpmtest
./myroot
./RPMS
./RPMS/athlon
./RPMS/i386
./RPMS/i386/baz-debuginfo-1.0-1.i386.rpm
./RPMS/i386/baz-1.0-1.i386.rpm
./RPMS/noarch
./RPMS/i586
./RPMS/i486
./RPMS/i686
./SPECS

Then I run

rpm -Uvv /usr/src/redhat/SRPMS/baz-1.0-1.src.rpm

It seems to run ok:

D: ============== /usr/src/redhat/SRPMS/baz-1.0-1.src.rpm
D: Expected size: 2058 = lead(96)+sigs(180)+pad(4)+data(1778)
D: Actual size: 2058
D: /usr/src/redhat/SRPMS/baz-1.0-1.src.rpm: MD5 digest: OK (42328616d277b77cef83828dfa741f97)
D: added source package [0]
D: found 1 source and 0 binary packages
D: Expected size: 2058 = lead(96)+sigs(180)+pad(4)+data(1778)
D: Actual size: 2058
baz-1.0-1
D: ========== Directories not explicitly included in package:
D: 0 /usr/src/redhat/SOURCES/
D: 1 /usr/src/redhat/SPECS/
D: ==========
D: fini 100777 1 ( 0, 0) 456 /usr/src/redhat/SPECS/baz-1.0.spec;44cf97f8
D: fini 100777 1 ( 0, 0) 176 /usr/src/redhat/SOURCES/baz-1.0.tar.gz;44cf97f8
GZDIO: 1 reads, 1008 total bytes in 0.000057 secs

But all it does is put these files in the redhat tree.

./SOURCES/baz-1.0.tar.gz
./SPECS/baz-1.0.spec


I don't see any evidence that it put the uncompressed sources anywhere at all.
If I run the binary package, I get similar non-results.

Can anyone offer any help?

Thanks,
Ken
 
Old 08-01-2006, 04:32 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 26,519
Blog Entries: 51

Rep: Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598
I've used RPM version 4.2.3 on CentOS-3 and your .spec file creates RPM's OK. Two things. If you don't need to build debuginfo packages (if you don't know you won't need it) add a line "%define debug_package %{nil}" to the top of the .spec file. Next don't focus on .src.rpm's for checking stuff. You only supply .src.rpm's if you need people to recreate packages from scratch on their system.
 
Old 08-01-2006, 05:20 PM   #3
kenneth.ashin
LQ Newbie
 
Registered: Aug 2006
Posts: 3

Original Poster
Rep: Reputation: 0
Thanks for the suggestion. %define debug_package %{nil} cleans up the tree nicely.
Forgetting about the src.rpm, as you suggest - here's an exec of the binary rpm. It does not
lay down the files I want under /usr/share, and I can't actually see that it does anything at
all. I must be missing something.

rpm -Uvv /usr/src/redhat/RPMS/i386/baz-1.0-1.i386.rpm
D: ============== /usr/src/redhat/RPMS/i386/baz-1.0-1.i386.rpm
D: Expected size: 1991 = lead(96)+sigs(180)+pad(4)+data(1711)
D: Actual size: 1991
D: /usr/src/redhat/RPMS/i386/baz-1.0-1.i386.rpm: MD5 digest: OK (27fbe6ef53c9bcaa4cf077501e05cbe3)
D: opening db environment /var/lib/rpm/Packages joinenv
D: opening db index /var/lib/rpm/Packages rdonly mode=0x0
D: locked db index /var/lib/rpm/Packages
D: opening db index /var/lib/rpm/Providename rdonly mode=0x0
D: read h# 1938 Header SHA1 digest: OK (3792490fab916a80f8c1a94de02ff5da908de7e9)
D: added binary package [0]
D: found 0 source and 1 binary packages
D: ========== +++ baz-1.0-1 i386/linux 0x0
D: opening db index /var/lib/rpm/Depends create mode=0x0
D: Requires: rpmlib(CompressedFileNames) <= 3.0.4-1 YES (rpmlib provides)
D: Requires: rpmlib(PayloadFilesHavePrefix) <= 4.0-1 YES (rpmlib provides)
D: opening db index /var/lib/rpm/Conflictname rdonly mode=0x0
D: closed db index /var/lib/rpm/Depends
D: ========== recording tsort relations
D: ========== tsorting packages (order, #predecessors, #succesors, tree, depth)
D: 0 0 0 0 0 +baz-1.0-1
D: installing binary packages
D: closed db index /var/lib/rpm/Conflictname
D: closed db index /var/lib/rpm/Providename
D: closed db index /var/lib/rpm/Packages
D: closed db environment /var/lib/rpm/Packages
D: opening db environment /var/lib/rpm/Packages joinenv
D: opening db index /var/lib/rpm/Packages create mode=0x42
D: mounted filesystems:
D: i dev bsize bavail iavail mount point
D: 0 0xfd00 4096 15869575 13496392 /
D: 1 0x0003 4096 0 -1 /proc
D: 2 0x0000 4096 0 -1 /sys
D: 3 0x0009 4096 0 -1 /dev/pts
D: 4 0x000e 4096 0 -1 /proc/bus/usb
D: 5 0x0801 1024 76942 26054 /boot
D: 6 0x0011 4096 129263 129262 /dev/shm
D: 7 0x0012 4096 0 -1 /proc/sys/fs/binfmt_misc
D: 8 0x0013 4096 0 -1 /var/lib/nfs/rpc_pipefs
D: 9 0x0014 4096 0 -1 /net
D: 10 0x0015 4096 0 -1 /viewstor
D: 11 0x0016 4096 0 -1 /home
D: 12 0x0017 4096 0 -1 /u
D: 13 0x0018 4096 0 -1 /proc/fs/nfsd
D: 14 0x0010 32768 2629879 28855923 /home/qatest
D: sanity checking 1 elements
D: opening db index /var/lib/rpm/Name create mode=0x42
D: read h# 1938 Header SHA1 digest: OK (3792490fab916a80f8c1a94de02ff5da908de7e9)
D: computing 2 file fingerprints
Preparing packages for installation...
D: computing file dispositions
D: opening db index /var/lib/rpm/Basenames create mode=0x42
package baz-1.0-1 is already installed
D: closed db index /var/lib/rpm/Basenames
D: closed db index /var/lib/rpm/Name
D: closed db index /var/lib/rpm/Packages
D: closed db environment /var/lib/rpm/Packages
/usr/src/redhat $ ls /usr/share/baz*
ls /usr/share/baz*
ls: /usr/share/baz*: No such file or directory
 
Old 08-01-2006, 05:43 PM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 26,519
Blog Entries: 51

Rep: Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598
Could you replace (edit post) "rpm -Uvv baz-1.0-1.i386.rpm" with "rpm -qpl baz-1.0-1.i386.rpm"?
 
Old 08-02-2006, 11:06 AM   #5
kenneth.ashin
LQ Newbie
 
Registered: Aug 2006
Posts: 3

Original Poster
Rep: Reputation: 0
rpm -qpl RPMS/i386/baz-1.0-1.i386.rpm
/usr/share/baz-1.0/one
/usr/share/baz-1.0/two
 
Old 08-02-2006, 11:48 AM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 26,519
Blog Entries: 51

Rep: Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598
OK, files seem to be there. I don't see any problems.
Tried removing "rpm -e baz", then installing "rpm -i baz-1.0-1.i386.rpm"?
Tried building something real from .src.rpm (as unprivileged user) and installing the rpm as root afterwards?
 
  


Reply

Tags
rpm


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to make mod_ssl work - virtualhosts make trouble Belize Linux - Software 0 02-26-2005 08:30 PM
How do I make a change to a current kernel? Would 'make oldconfig' work... jtp51 Slackware 11 11-01-2004 11:02 PM
configure, make and make install commands don't work for me Fenster Fedora 8 08-18-2004 10:58 AM
'make' and 'make install' commands dont work on my system? ginda Linux - Newbie 9 04-18-2004 11:17 AM
./configure , make and make install does not work mobassir Linux - Software 7 07-30-2003 09:20 AM


All times are GMT -5. The time now is 05:35 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration