Mail Archives: cygwin/2003/03/07/13:28:40
------=_NextPart_000_017D_01C2E4D7.56FB5A50
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Ronald Landheer-Cieslak wrote:
> BTW: is there any way to get the "current" or "latest" snapshot with a
> simple wget? (i.e. is there a
> http://www.cygwin.com/snapshots/latest...?) It would make it easier
> to make a "snapshot" target and get the new-cygwin1.dll from there :)
Not currently. If you are willing to use perl, the attached might serve as a
base.
Curiously, I couldn't find any scripts to do with snapshot page generation
in sources.redhat.com CVS.
Max.
------=_NextPart_000_017D_01C2E4D7.56FB5A50
Content-Type: application/octet-stream;
name="getsnaps.pl"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="getsnaps.pl"
#!/usr/bin/perl=0A=
=0A=
use warnings;=0A=
use strict;=0A=
use Digest::MD5;=0A=
use LWP::Simple;=0A=
=0A=
chdir('snapshots');=0A=
=0A=
my $snaps =3D get("http://cygwin.com/snapshots/");=0A=
unless ($snaps) { die "Unable to get http://cygwin.com/snapshots/\n"; };=0A=
my (@snapurls) =3D $snaps =3D~ m|<a =
href=3D"(http://cygwin.com/snapshots/cygwin-inst-.*?)">|g;=0A=
=0A=
unless (@snapurls)=0A=
{=0A=
warn "No matches in web page! Dumping snaps.html\n";=0A=
open(SNAPS,'>','snaps.html');=0A=
print SNAPS $snaps;=0A=
close(SNAPS);=0A=
die "Dumped snaps.html, Exiting\n";=0A=
};=0A=
=0A=
@snapurls =3D ($snapurls[0]);=0A=
print STDERR join("\n", @snapurls) . "\n\n";=0A=
foreach $_ (@snapurls)=0A=
{=0A=
my ($snapfile) =3D $_ =3D~ m|/([^/]*)$|;=0A=
my ($snappath) =3D $_ =3D~ m|^(.*?)[^/]*$|;=0A=
if (-f $snapfile)=0A=
{=0A=
print STDERR "$snapfile already downloaded!\n";=0A=
}=0A=
else=0A=
{=0A=
print STDERR "Downloading $snappath$snapfile... ";=0A=
system('wget',"$snappath$snapfile");=0A=
print STDERR "Done.\n";=0A=
}=0A=
}=0A=
=0A=
print STDERR "\n";=0A=
=0A=
my @tarballs =3D glob('cygwin-inst-*.tar.bz2');=0A=
die "No snapshots in dir!\n" unless @tarballs;=0A=
while (1 < @tarballs)=0A=
{=0A=
$_ =3D shift @tarballs;=0A=
print STDERR "Removing $_\n";=0A=
unlink $_;=0A=
}=0A=
=0A=
# @tarballs =3D ($tarballs[$#tarballs]);=0A=
=0A=
foreach my $tarball (@tarballs) {=0A=
my ($version) =3D $tarball =3D~ m/^cygwin-inst-([0-9]{8})\.tar\.bz2$/;=0A=
my $size =3D -s $tarball;=0A=
=0A=
open(TARBALL, '<', $tarball);=0A=
my $md5 =3D Digest::MD5->new;=0A=
$md5->addfile(*TARBALL);=0A=
close(TARBALL);=0A=
my $md5sum =3D $md5->hexdigest;=0A=
=0A=
open(SETUPINI, '>', 'setup.ini');=0A=
# my $time =3D time();=0A=
# my $setup_ini =3D <<EOT;=0A=
# setup-timestamp: $time=0A=
# =0A=
# EOT=0A=
# print SETUPINI $setup_ini;=0A=
# print $setup_ini;=0A=
=0A=
my $setup_ini =3D <<EOT;=0A=
setup-timestamp: 1000000000=0A=
=0A=
@ cygwin=0A=
[test]=0A=
version: $version=0A=
install: $tarball $size $md5sum=0A=
=0A=
EOT=0A=
=0A=
print SETUPINI $setup_ini;=0A=
print $setup_ini;=0A=
=0A=
}=0A=
=0A=
close(SETUPINI);=0A=
=0A=
------=_NextPart_000_017D_01C2E4D7.56FB5A50
Content-Type: text/plain; charset=us-ascii
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
------=_NextPart_000_017D_01C2E4D7.56FB5A50--
- Raw text -