i found out the directory name "pcore" but outside of  rpm/spec
I wish there was a way inside the rpm , that i could find out the name of the directory that got created as a result of make
in any case.

now i AM able to od a make, but when trying to copy the binaries ( lets say one of the binaries "ggsnc" in /usr/bin) i get error message on permission

ibcm_td.a ./libmt_td.a   -lpthread -lnsl -lrt -o ./hnbgw
make[1]: Leaving directory `/home/kahmed/rpmbuild/BUILD/pcore/obj/hnbgw'
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.32400
+ umask 022
+ cd /home/kahmed/rpmbuild/BUILD
+ cd pcore
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cp obj/ggsnc/ggsnc /usr/bin
cp: cannot create regular file `/usr/bin/ggsnc': Permission denied
error: Bad exit status from /var/tmp/rpm-tmp.32400 (%install)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.32400 (%install)
1. Am i doing the right thing which is to copy the binaries ( since we do NOT have a make install ) to /usr/bin
or this should be done in chroot
2. i am copying binaries in %install section, is this ok ?

%install
cp obj/ggsnc/ggsnc %{_bindir}

Thanks,
-Kamal.


From: zxq9 <zxq9@zxq9.com>
To: packaging@lists.fedoraproject.org
Sent: Thursday, April 12, 2012 11:00 AM
Subject: Re: [Fedora-packaging] Cannot cd to %{name}-%{version}

>2012/4/12 Kamal Ahmed <kamal2222ahmed@yahoo.com>:
>>
>> %prep
>> mkdir %{name}-%{version}
>
>Find out what the directory is really called after extraction, i.e.
>foo-somethingelse and change
>
>> %setup -q
>
>to
>
>%setup -qn foo-somethingelse

Whatever the extraction directory is gets removed prior to the build to keep
the space clean. So what he's saying is that your problem (isolated below)
will stop happening if you name the build one something else.

>> rpmbuild -bb pcore.spec

Everything is fine here...

>> Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.66518
>> + umask 022
>> + cd /home/kahmed/rpmbuild/BUILD
>> + LANG=C
>> + export LANG
>> + unset DISPLAY
>> + mkdir pcore-0.1

And here the working directory is made based on the default extraction
directory (that is, {% name %}-{% version %}).

>> + cd /home/kahmed/rpmbuild/BUILD
>> + rm -rf pcore-0.1

And here it gets removed! So you need to name the one you really want to use
something different, which is what Jon is saying about "setup -qn something-else".

>> + /bin/gzip -dc /home/kahmed/rpmbuild/SOURCES/pcore-0.1.tar.gz
>> + tar -xf -
>> + STATUS=0
>> + '[' 0 -ne 0 ']'
>> + cd pcore-0.1

And of course this step doesn't work because pcore-0.1 has already been
"rm -rf"d

>> /var/tmp/rpm-tmp.66518: line 37: cd: pcore-0.1: No such file or directory

Hope this makes more sense now. Packaging is a little mysterious until you
play with it a bit on your own. And once you do, you'll find that Fedora
has the best all-around guidelines for it, all told. They are strict and a
little difficult to understand "why" at first, but there is a *lot* of
experience expressed in the packaging guidelines, tutorials, rpm itself and
this list (most of the time...).
--
packaging mailing list
packaging@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/packaging