On Wed, 25 Dec 2013 03:13:56 +0100, Csillag Tamas wrote: > > > That's correct. However, I just detected a bug which happens in case > > > there are some files to remove that contain blanks (as it happens in > > > plastimatch where the file > > > doc/Analytic Regularization-2010-06-24.pdf > > > is not deleted.
> However: > > foreach (grep { $_ } split /\s+/, $data->{"files-excluded"}) { > > at > http://anonscm.debian.org/gitweb/?p=collab-maint/devscripts.git;a=blob;f=scripts/uscan.pl;h=433f5e2fd02ee6c910f2b475f27bc182b1fa3850;hb=3025603d7532a5712e7e0278c93fa71dd6d8301f#l1546 > > according to > http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/#files-field > the space should be escapeable. > > Is someone here better with regexes than me? ;-) > We need to replace /\s+/ with one that does not split if the space is escaped > with a backslash. Sounds as if we need something like a "zero-width negative look-behind assertion" (I had to copy this from perlre :)). First try: #v+ #!/usr/bin/perl use strict; use warnings; use 5.010; use Dpkg::Control::Hash; my $data = Dpkg::Control::Hash->new(); $data->load('debian/copyright'); # d/copyright contains: #Files-Excluded: a b # c\ d foreach (grep { $_ } split /(?<!\\)\s+/, $data->{"files-excluded"}) { s?\\??g; # to keep the style of what's in uscan ... say $_; } #v- outputs: a b c d Usual disclaimers apply (no perl expert, no security expert, etc.). Cheers, gregor -- .''`. Homepage: http://info.comodo.priv.at/ - OpenPGP key 0xBB3A68018649AA06 : :' : Debian GNU/Linux user, admin, and developer - http://www.debian.org/ `. `' Member of VIBE!AT & SPI, fellow of the Free Software Foundation Europe `- NP: The Who: I'm A Boy
signature.asc
Description: Digital signature