OpenPKG CVS Repository http://cvs.openpkg.org/ ____________________________________________________________________________
Server: cvs.openpkg.org Name: Michael van Elst Root: /e/openpkg/cvs Email: [EMAIL PROTECTED] Module: openpkg-re Date: 14-Nov-2002 14:19:00 Branch: HEAD Handle: 2002111413190000 Modified files: openpkg-re openpkg-build Log: use openpkg curl if LWP module not found Summary: Revision Changes Path 1.23 +31 -13 openpkg-re/openpkg-build ____________________________________________________________________________ Index: openpkg-re/openpkg-build ============================================================ $ cvs diff -u -r1.22 -r1.23 openpkg-build --- openpkg-re/openpkg-build 14 Nov 2002 11:47:41 -0000 1.22 +++ openpkg-re/openpkg-build 14 Nov 2002 13:19:00 -0000 1.23 @@ -312,32 +312,50 @@ sub get_index ($$$) { my($url,$fn,$with) = @_; my($ua,$req,$res,$rdf); - my($pid); + my($pid,$curl); my(%map); $url = $fn if defined $fn; $url .= '00INDEX.rdf.bz2' if $url =~ /\/$/; if ($url =~ /^\w+:/) { # looks like URL scheme - print "# fetching index $url\n"; eval { require LWP; }; if ($@) { - die "FATAL: LWP is not installed, please fetch index manually\n"; - } + + print "# curling index $url\n"; - $ua = new LWP::UserAgent; - $req = new HTTP::Request GET => $url; - $res = $ua->request($req); - - die "FATAL: cannot read build index\n" unless $res->is_success; - - if ($url =~ /\.bz2$/) { - $pid = spawn($res->content,'bzip2','-dc'); + $curl = $RPM; + $curl =~ s/bin\/rpm$/lib\/openpkg\/curl/ + or die "FATAL: cannot deduce curl path from $RPM\n"; + -f $curl + or die "FATAL: $curl not found\n"; + + if ($url =~ /\.bz2$/) { + open(FH, "$curl -q -s -o - \"$url\" |") + or die "FATAL: cannot curl '$url' ($!)\n"; + $pid = spawn(\*FH,'bzip2','-dc'); + close(FH); + } else { + open(RFH, "$curl -q -s -o - \"$url\" |") + or die "FATAL: cannot curl '$url' ($!)\n"; + } } else { - $pid = cat($res->content,'cat'); + print "# fetching index $url\n"; + + $ua = new LWP::UserAgent; + $req = new HTTP::Request GET => $url; + $res = $ua->request($req); + + die "FATAL: cannot read build index\n" unless $res->is_success; + + if ($url =~ /\.bz2$/) { + $pid = spawn($res->content,'bzip2','-dc'); + } else { + $pid = cat($res->content,'cat'); + } } } else { print "# reading index file $fn\n"; ______________________________________________________________________ The OpenPKG Project www.openpkg.org CVS Repository Commit List [EMAIL PROTECTED]