Date: Fri, 6 Feb 2004 23:50:19 -0800 (PST) From: "Gerard O'Donnell" <gerard@serizon.com> To: freebsd-ports-bugs@FreeBSD.org Subject: RE: Re: ports/62302: SIZE in distinfos causes failure with FETCH_CMD=wget Message-ID: <200402070750.i177oJpb010480@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR ports/62302; it has been noted by GNATS. From: "Gerard O'Donnell" <gerard@serizon.com> To: <vd@datamax.bg>, <freebsd-gnats-submit@FreeBSD.org> Cc: Subject: RE: Re: ports/62302: SIZE in distinfos causes failure with FETCH_CMD=wget Date: Sat, 7 Feb 2004 17:14:32 +1030 This is a multi-part message in MIME format. ------=_NextPart_000_0000_01C3ED9D.DDFB7B00 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Further to email previously, attached is a perl script if anyone wants to use to traverse the ports tree to strip SIZE information from the distinfo files so that wget works. Usage is stripSIZE.pl <wherever the ports tree is located> e.g: stripSIZE.pl /usr/ports ------=_NextPart_000_0000_01C3ED9D.DDFB7B00 Content-Type: application/octet-stream; name="stripSIZE.pl" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="stripSIZE.pl" #!/usr/bin/perl -w use integer; use strict; use Cwd; use Digest::MD5; # ------------------------------------------------------------------- my($hashRef) =3D {}; my $increment =3D "0000"; my($dirName) =3D join(' ', @ARGV) || die("Usage: $0 <dirName>\n"); $hashRef =3D &process($hashRef, $dirName); print "All done!\n"; # ------------------------------------------------------------------- sub process { my($hashRef, $dirName) =3D @_; $dirName =3D~ tr|\\|/|; my($cwd) =3D cwd(); chdir($dirName) || die("Can't chdir($dirName): $!"); opendir(INX, '.') || die("Can't open($dirName): $!"); my(@fileName) =3D readdir(INX); closedir(INX); my($fileName); =20 =20 for $fileName (@fileName) { #print "Got $fileName.\n"; if ($fileName =3D~ /distinfo/i && $fileName !~ /^distinfo.*bak$/i) { print "Got $dirName/$fileName.\n"; open(INX, $fileName) || croak("Can't open($fileName): $!"); my(@line) =3D <INX>; my $linee; my $hasSize =3D 0; foreach $linee( @line) { if ($linee =3D~ /^SIZE.*=3D.*[0-9]+/) { $hasSize =3D 1; print "HAS SIZE.\n"; } #print "$linee"; } close(INX); =20 if ($hasSize) { my $old =3D $fileName; my $new =3D "$fileName.tmp"; my $bak =3D "$fileName.bak"; open(OLD, "< $old") or die "can't open $old: $!"; open(NEW, "> $new") or die "can't open $new: $!"; # Correct typos, preserving case while (<OLD>) { chomp if /^SIZE.*=3D.*[0-9]+/; s/^SIZE.*=3D.*[0-9]+//g; (print NEW $_) or die "can't write to $new: $!"; } close(OLD) or die "can't close $old: $!"; close(NEW) or die "can't close $new: $!"; rename($old, $bak) or die "can't rename $old to $bak: $!"; rename($new, $old) or die "can't rename $new to $old: $!"; $hasSize =3D 0; } } # Skip ., .. next if ($fileName =3D~ /(^\.\.?)$/i); # Recurse on directories. ($hashRef =3D &process($hashRef, "$dirName/$fileName") ), next if = (-d $fileName); $increment++; if (! defined($$hashRef{$dirName}) ) { $$hashRef{$dirName} =3D {}; $$hashRef{$dirName}{$fileName} =3D {}; } } chdir($cwd) || die("Can't chdir($cwd): $!"); $hashRef; } # End of process. #-------------------------------------------------------------------- # Read a file. Pass in $chomp =3D=3D 0 to stop chomping. sub readFile { my($fileName, $chomp) =3D @_; $chomp =3D 1 if ($#_ =3D=3D 0); open(INX, $fileName) || croak("Can't open($fileName): $!"); my(@line) =3D <INX>; close(INX); chomp(@line) if ($chomp !=3D 0); \@line; } # End of readFile. #-------------------------------------------------------------------- ------=_NextPart_000_0000_01C3ED9D.DDFB7B00--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200402070750.i177oJpb010480>