#8 Can't obtain RPM directory structure

closed-accepted
nobody
None
5
2004-02-25
2004-01-06
Ivan Pechorin
No

When I try to build RPM for perl modules, if there is neither libwww-perl nor HTTP::Lite available and cpan2rpm tries to use "links", I get error. Here is full output:

-------------------------- BEGIN ----------------------------
$ cpan2rpm CGI::Upload

-- cpan2rpm - Ver: 2.022 --
Signatures not set up
Upgrade check

WARNING: libwww-perl module not found. To install, one of the following options may help:

1) Try http://www.rpmfind.net/linux/rpm2html/search.php?query=perl-libwww-perl
2) Specify the full URL of the tarball manually.
cpan2rpm -i http://www.cpan.org/modules/by-module/LWP/libwww-perl-5.68.tar.gz
3) Download tarball and specify file on commandline.
4) Configure CPAN: perl -MCPAN -eshell
5) cpan2rpm -i libwww-perl

Trying HTTP::Lite...

WARNING: this alternative module could not be found either! Please install the libwww-perl package as indicated above.

Trying external programs...
RPM user environment - Your account does not have
permissions to the requisite RPM directory structure.
Try 'cpan2rpm --mk-rpm-dirs=~/rpm' to setup your
environment for non-root package building.
Failing dirs: /usr/src/redhat/SRPMS /usr/src/redhat/BUILD /usr/src/redhat/SOURCES /usr/src/redhat/SPECS /usr/src/redhat/RPMS
-- Done --
----------------------------- END -----------------------------

I found that in line 321 of cpan2rpm each value of %RPMDIR is being tested as "-d && -w". These values a being obtained by sub getrpm_macdef(), which returns extra space in the end of each value (directory name). I think that this extra space makes test in line 321 to fail.

The following patch, which removes extra space, worked for me:

*** cpan2rpm 2003-12-23 09:12:58.000000000 +0300
--- /usr/bin/cpan2rpm 2004-01-06 19:49:55.000000000 +0300
***************
*** 311,316 ****
--- 311,317 ----
for my $k (keys %RPMDIR) {
next if $k eq "ARCH";
local $_ = $RPMDIR{$k};
+ s/\s+$//;

# e.g. %_specdir = "%{name}-%{version}"
s/%{?name?}/$info{name}/i if $info{name};

Discussion

  • Ivan Pechorin
    Ivan Pechorin
    2004-01-06

    Logged In: YES
    user_id=691492

    This is perl, v5.8.2 built for i386-linux-thread-multi

     
  • Ivan Pechorin
    Ivan Pechorin
    2004-01-06

    • summary: cpan2rpm fails to obtain RPM directories --> fails to obtain RPM directory structure from RPM environment
     
  • Ivan Pechorin
    Ivan Pechorin
    2004-01-06

    • summary: fails to obtain RPM directory structure from RPM environment --> Can't obtain RPM directory structure
     
  • Ivan Pechorin
    Ivan Pechorin
    2004-01-06

    Patch which fixes the problem.

     
    Attachments
  • Erick Calder
    Erick Calder
    2004-02-25

    • status: open --> closed-accepted
     
  • Erick Calder
    Erick Calder
    2004-02-25

    Logged In: YES
    user_id=575496

    it's weird that the call to RPM should return whitespace but I'll
    take your word for it. I've patched getrpm_macdef() with
    your line. thanks for reporting it!

     
  • Ivan Pechorin
    Ivan Pechorin
    2004-02-25

    Logged In: YES
    user_id=691492

    I tried this only on RedHat 9, don't know whether it's true
    for other distributions and/or versions of RPM.

    vond@localhost vond$ cat /etc/redhat-release
    Red Hat Linux release 9 (Shrike)
    vond@localhost vond$ rpm -q rpm
    rpm-4.2-0.69
    vond@localhost vond$ rpm -q rpm-build
    rpm-build-4.2-0.69