[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Enabling uupdate to simply remove files from upstream source (Was: Minified javascript files)



On Mon, Aug 20, 2012 at 12:32:28AM +0200, Jonas Smedegaard wrote:
> > Well, uscan makes some use of system so this could work - but I hoped
> > for a more Perl-ish solution (similar to the rfc822 reader in
> > python-debian).
> 
> Is this Perl-ish enough for you?:

:-)
 
> #!/usr/bin/perl -w
> use Parse::DebControl;
> use feature "say";
> $okformat = qr'http://www.debian.org/doc/packaging-manuals/copyright-format/1.0';
> $parser = new Parse::DebControl(1);
> $data = $parser->parse_file($ARGV[0], {
>     discardCase=>1,
>     singleBlock=>1,
> });
> die unless ($data->{"format"} =~ m{^$okformat/?$});

# needs checking whether such field exists ...
if ( $data->{"files-excluded"} ) {

> foreach (grep {/\//} split /\s+/, $data->{"files-excluded"}) {
>     say 'dir: '.$_;
> };
> foreach (grep {/^[^\/]+$/} split /\s+/, $data->{"files-excluded"}) {
>     say 'file: '.$_;
> };

}

> Replace "say..." with calls to find ... -delete.

Thanks.  Yes, that's Perl-ish? ;-)

I'm just waiting for Ansgar whether he really wants to have this as
external tool or whether this could be safely included into uscan as a
patch.

Kind regards

     Andreas.


-- 
http://fam-tille.de


Reply to: