public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Fwd: GSOC PROJECT ON DEVELOPMENT OF GCC WEBSITE
       [not found] <CAKHuNOqezouCPbeiv4YnLAFZqZRcWJpAROTdCoihMr7NX51bSg@mail.gmail.com>
@ 2012-03-25  6:30 ` Anil Mavila
  0 siblings, 0 replies; only message in thread
From: Anil Mavila @ 2012-03-25  6:30 UTC (permalink / raw)
  To: gcc

[-- Attachment #1: Type: text/plain, Size: 858 bytes --]

Hi GCC WORLD,

My name is Anil and i am doing B.TECH in IT from BITS  and i am
interested in doing project  web development for GCC .
I will be doing the following works:-

->Move extra pages corresponding to technical news items into a
directory of their own. Add an index for these.
For these a particular directory(say tech)will be created and the task
will be completed and index will also be kept.

->to improve the navigation,every page will added with buttons to
navigate . And the buttons will be provided for
the index also.

->system to automatically checks the mirrors list.
to perform this i already downloaded the  script by dj@redhat.com and
trying to improve it.I am sending the copy of script as attachment.

This is my first time in GSOC, so assist me masters.

Waiting for your valuable suggestion.
With regards Anil

[-- Attachment #2: SCRIPT.TXT --]
[-- Type: text/plain, Size: 3805 bytes --]

SCRIPT BY dj@redhat.com
This assumes there's a file "mirror.ts" at the top of each mirror's
directory tree.  I run my copy of this nightly.  The output are the
files getting.inc and getting.dat.

#!/usr/bin/perl
# -*- perl -*-

$| = 1;

chdir "/home/web/djgpp" || die;

$found = 0;
$notfound = 0;

use GDBM_File;
tie %GC, 'GDBM_File', "/tmp/djgpp-mirror-cache", &GDBM_WRCREAT, 0640;

if ( -f "mirrors.txt") {
   open(S, "mirrors.txt");
   while (<S>) {
       ($url, $junk, $name) = m@((ftp|http|rsync)://\S+)\s+(.*\S)\s*@;
       next unless $url =~ /(ftp|http|rsync):/;
       $url .= "/" unless $url =~ m@/$@;
       push(@urls, $url);
       push(@names, $name);
   }
   close(S);
} else {
   print "No file mirrors.txt?\n";
}

$now = time();
$cutoff = $now - 3 * 24 * 60 * 60;

for ($i=0; $i<=$#urls; $i++) {
   $name = $names[$i];
   $url = $urls[$i];

   $last_try = $when = $ts = 0;
   if ($GC{$url}) {
       ($last_try, $when, $ts, $type) = split(' ', $GC{$url});
   }
   if ($when < $now - 24*60*60) {
       $type = "";
       ($newts,$type) = split(' ', &urlget("${url}mirror.ts"));
       $newts += 0;
       if ($newts > 0) {
           $when = $now;
           $ts = $newts;
       }
   }
   $GC{$url} = "$now $when $ts $type";

   if ($last_try - $when > 3*24*60*60) {
       printf("DEAD %s  %s\n", &age($when), $url);
       $notfound ++;
       $inc .= "<!-- dead: $url -->\n";
   } elsif ($ts < $cutoff) {
       printf("BAD  %s  %s\n", &age($ts), $url);
       $notfound ++;
       $inc .= "<!-- failed: $url -->\n";
   } else {
       printf("OK   %s  %s  $type\n", &age($ts), $url);
       if ($type eq "full") {
           $typestring = " (Full)";
           $datstring = "full";
       } elsif ($type eq "current") {
           $typestring = " (Current)";
           $datstring = "current";
       } else {
           $typestring = "";
           $datstring = "current";
       }
       $inc .= sprintf "<tr><td><a href=\"%s\">%s</a></td><td>%s$typestring</td></tr>\n", $url, $url, $name;
       $dat .= "$url\t$datstring\t$name\n";
       $found ++;
   }
}

sub age {
   my ($ts) = @_;
   my ($hours, $days, $rv);
   return "never" if $ts == 0;
   $hours = $now - $ts;
   $hours = int ($hours / 3600 + 0.5);
   $days = int($hours / 24);
   $hours -= $days * 24;
   if ($days > 0) {
       $rv = "$days+$hours";
   } else {
       $rv = $hours;
   }
   return sprintf("%5s", $rv);
}

print "$found ok, $notfound bad.\n";
if ($found > 3 && $found > 0.4 * ($found+$notfound)) {
   print "Results saved\n";
   open(INC, ">getting.inc");
   print INC $inc;
   close(INC);
   open(INC, ">getting.dat");
   print INC $dat;
   close(INC);
} else {
   print "Not doing the Update.\n";
}

untie %GC;

#-----------------------------------------------------------------------------

sub urlget {
   my ($url,$cache) = @_;
   my $rv = '';

   if ($url =~ m@rsync://([^/]+)/(.*)@) {
       ($host, $path) = ($1, $2);
       unlink "/tmp/cm.rs.tmp.$$";
       system "rsync ${host}::$path /tmp/cm.rs.tmp.$$ > /dev/null 2>&1";
       open (CM, "/tmp/cm.rs.tmp.$$");
       $rv = join('', <CM>);
       close (CM);
       unlink "/tmp/cm.rs.tmp.$$";
       return $rv;
   }

   if ( -f $cache && -M $cache < 0.1) {
       open(S, $cache);
       $rv = join('', <S>);
       close(S);
       return $rv;
   }

   if (1) {
       open(WGET, "wget --passive-ftp -U djgpp-verifier -q -O - $url |");
       while (<WGET>) {
           $rv .= $_;
       }
       close(WGET);
       $rv =~ s/[\r\n]+$//;
   } else {
       $rv = '';
   }

   if ($cache && $rv) {
       open(S, "> $cache");
       print S $rv;
       close(S);
   }
   return $rv;
}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-03-25  6:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CAKHuNOqezouCPbeiv4YnLAFZqZRcWJpAROTdCoihMr7NX51bSg@mail.gmail.com>
2012-03-25  6:30 ` Fwd: GSOC PROJECT ON DEVELOPMENT OF GCC WEBSITE Anil Mavila

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).