On Monday 14 September 2009 00:00:48 Andres Mejia wrote: > Package: sbuild > Version: 0.59.1~rc1 > Severity: wishlist > Tags: patch > > Please allow sbuild to build from remote source files as well as files on > the local system. > > Here are patches that I've implemented for the current git version. It adds > three new utility subroutines and uses them to download files from the web. > Basically, on top of supporting passing in local dsc files and > [PACKAGE_VERSION] to get sources via apt, you can now supply a url of a > dsc file on the web, and sbuild will use these source files to build the > corresponding packages just like it does now. > > I had to change how dsc_files() was parsing dsc files because of some > problem I was experiencing with dcmd. The new way of parsing the dsc file > is better I think. This takes out a dependency from devscripts I think, > but will need a dependency on libwww-perl. > > -- System Information: > Debian Release: squeeze/sid > APT prefers unstable > APT policy: (500, 'unstable'), (1, 'experimental') > Architecture: i386 (i686) > > Kernel: Linux 2.6.30-1-686 (SMP w/2 CPU cores) > Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) > Shell: /bin/sh linked to /bin/dash > > Versions of packages sbuild depends on: > ii adduser 3.110 add and remove users and > groups ii libsbuild-perl 0.59.1~rc1 Tool for building > Debian binary pa ii perl 5.10.0-25 Larry Wall's > Practical Extraction ii perl-modules 5.10.0-25 Core > Perl modules > > Versions of packages sbuild recommends: > ii debootstrap 1.0.15 Bootstrap a basic Debian > system ii fakeroot 1.13 Gives a fake root > environment > > Versions of packages sbuild suggests: > ii deborphan 1.7.28 program that can find unused > packa ii wget 1.11.4-4 retrieves files from > the web > > -- no debconf information >
I think using LWP::UserAgent should be optional to avoid a dependency on libwww- perl, so here's a third patch that will allow sbuild to work with or without LWP::UserAgent. Supplying a remote .dsc file will still need LWP::UserAgent however. -- Regards, Andres
From 77dfe6ec5971bd371c3d1c56efd6ba162092600c Mon Sep 17 00:00:00 2001 From: Andres Mejia <[email protected]> Date: Mon, 14 Sep 2009 13:36:00 -0400 Subject: [PATCH 3/3] Make support for downloading remote source files with LWP::UserAgent optional. --- lib/Sbuild/Utility.pm | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-) diff --git a/lib/Sbuild/Utility.pm b/lib/Sbuild/Utility.pm index 2ae95a7..a1ce61a 100644 --- a/lib/Sbuild/Utility.pm +++ b/lib/Sbuild/Utility.pm @@ -40,7 +40,7 @@ use warnings; use Sbuild::Conf; use Sbuild::Chroot; use File::Temp qw(tempfile); -use LWP::UserAgent; # Needed to grab content from the WWW. +use Module::Load::Conditional qw(can_load); # Used to check for LWP::UserAgent use Time::HiRes qw ( time ); # Needed for high resolution timers sub get_dist ($); @@ -142,6 +142,11 @@ sub check_url { # If $url is a readable plain file on the local system, just return true. return 1 if (-f $url && -r $url); + # Load LWP::UserAgent if possible, else return 0. + if (! can_load( modules => { 'LWP::UserAgent' => undef, } )) { + return 0; + } + # Setup the user agent. my $ua = LWP::UserAgent->new; @@ -172,6 +177,11 @@ sub download { # $url. return $url if (-f $url && -r $url); + # Load LWP::UserAgent if possible, else return 0. + if (! can_load( modules => { 'LWP::UserAgent' => undef, } )) { + return 0; + } + # Filehandle we'll be writing to. my $fh; -- 1.6.3.3

