On 11 May 2001, Fran�ois Pons wrote:
> > Just tried to run gendistrib to build the 8.0 hdlists etc. 8.0 tree is
> > stored on a machine running 7.2. On running gendistrib, I get:
> > Can't load './auto/rpmtools/rpmtools.so' for module
> > rpmtools: librpmio.so.0: cannot open shared object file: No such file or
> > directory at /usr/lib/perl5/5.6.0/i386-linux/DynaLoader.pm line 200.
> > at ./gendistrib line 20
> > According to rpmfind.net, librpmio.so.0 is provided by rpm4, which
> > explains why the 7.2 system (with rpm 3.0.5) doesn't have it. This is a
> > chicken-and-egg situation: I need rpm4 (part of 8.0) to build the 8.0
> > distribution media. Is there any way that librpmio could be provided
> > along with rpmtools in /misc?
> You can use the 8.0 tree of install (DrakX), look at <top_dir>/Mandrake/mdkinst,
> if you have that you can look directly at
> <top_dir>/Mandrake/mdkinst/usr/bin/perl-install/live_install*
> where you will find how to launch a perl script (install2) using the 8.0 binary
> tree. You will have to use PERL5LIB, LD_LIBRARY_PATH and LD_LOADER, since
> gendistrib does not use a lot of things, you can set them as follow, assuming
> $dir point to <top_dir>/Mandrake/mdkinst (in a separate shell environment, new
> xterm for example) :
> export LD_LOADER=$dir/lib/ld-linux.so.2
> export PERL5LIB=`$LD_LOADER $dir/usr/bin/perl -e 'print join ":", @INC'
> export LD_LIBRARY_PATH=$dir/lib:$dir/bin:$dir/usr/bin
> and then you should be available to do
> $LD_LOADER $dir/usr/bin/perl $dir/../../misc/gendistrib <options>
> I do it on the fly, inform me if there are problems, but you should have what is
>necessary.
Thanks. It took a bit more hacking, but I finally got it to work with:
export $distroot=<path to Mandrake>/8.0/i586
cd $distroot/misc
export instroot=$distroot/Mandrake/mdkinst
unset LC_MONETARY LC_CTYPE LC_NUMERIC LC_MESSAGES LC_TIME LC_COLLATE LANGUAGE LANG
RPM_INSTALL_LANG
export LD_LOADER=$instroot/lib/ld-linux.so.2
export
LD_LIBRARY_PATH=$instroot/lib:$instroot/usr/lib:$instroot/bin:$instroot/usr/bin:$instroot/usr/lib/perl5/5.6.0/i386-linux/CORE
export PERL5LIB=`$LD_LOADER $instroot/usr/bin/perl -e 'print "'$distroot'/".join
":'$distroot'/", @INC'`
exec $LD_LOADER $instroot/usr/bin/perl $distroot/misc/gendistrib --distrib $distroot
and a patch to rpmtools.pm. Without the patch, rpmtools.pm kept falling
over with /lib/ld-linux.so.2 problems (rpmtools.pm includes two calls that
involve invoking /bin/sh, which seems to be the problem - AFAICT it's
because the shell ignores LD_LOADER and tries to load programs in the
normal way). Here is the patch:
--- misc/rpmtools.pm.orig Fri May 11 17:59:20 2001
+++ misc/rpmtools.pm Fri May 11 20:10:02 2001
@@ -120,13 +120,19 @@
my ($params, $noclean, $ratio, $dir, $hdlist, @rpms) = @_;
my %names;
+ #- Reset LD_LOADER and LD_LIBRARY_PATH so that external shell calls function
+properly
+ my $ldloader=$ENV{"LD_LOADER"};
+ my $ldlibpath=$ENV{"LD_LIBRARY_PATH"};
+ $ENV{"LD_LOADER"}="";
+ $ENV{"LD_LIBRARY_PATH"}="";
+
#- build a working directory which will hold rpm headers.
$dir ||= '.';
-d $dir or mkdir $dir, 0755 or die "cannot create directory $dir\n";
foreach (@rpms) {
my ($key, $name) = /(([^\/]*)-[^-]*-[^-]*\.[^\/\.]*)\.rpm$/ or next;
- system("rpm2header '$_' > '$dir/$key'") unless -e "$dir/$key";
+ system "./rpm2header '$_' > '$dir/$key'" unless -e "$dir/$key";
$? == 0 or unlink("$dir/$key"), die "bad rpm $_\n";
-s "$dir/$key" or unlink("$dir/$key"), die "bad rpm $_\n";
push @{$names{$name} ||= []}, $key;
@@ -152,6 +158,11 @@
close B or die "packdrake failed\n";
system("rm", "-rf", $dir) unless $dir eq '.' || $noclean;
+
+ #- Restore LD_LOADER and LD_LIBRARY_PATH
+ $ENV{"LD_LIBRARY_PATH"}=$ldlibpath;
+ $ENV{"LD_LOADER"}=$ldloader;
+
}
#- read one or more rpm files.
Thanks again, and I hope that the patch makes sense (I'm not really a Perl
programmer).
Michael