[Fedora-packaging] Cannot cd to %{name}-%{version}

zxq9 zxq9 at zxq9.com
Thu Apr 12 15:00:49 UTC 2012


>2012/4/12 Kamal Ahmed <kamal2222ahmed at 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...).


More information about the packaging mailing list