[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgresql-general
Subject:    [HACKERS] trivial script for getting pgsql-committers patches
From:       Alvaro Herrera <alvherre () commandprompt ! com>
Date:       2006-07-31 22:15:17
Message-ID: 20060731221517.GB23655 () alvh ! no-ip ! org
[Download RAW message or body]

> I attach it in case someone finds it useful.  If you have any ideas for
> improvements, they're welcome.  (Code improvements are even more welcome
> of course).

Too quick to hit send, sorry.

Yeah, the name of the script sucks.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.


#!/usr/bin/perl -w

$pid = fork;
if ($pid == -1)
{
	print "woops ... $!";
	exit;
}
elsif ($pid != 0)
{
	exit;
}

use LWP::UserAgent;
$suffix = "";
$temp = `mktemp /tmp/patch.XXXXXX`;
chomp $temp;
open SAL, ">", $temp or die "$temp: $!";

$agent = LWP::UserAgent->new(keep_alive => 3);

while (<>)
{
	if (!defined $subject && /^Subject: \[COMMITTERS\] pgsql: (.*)/)
	{
		$subject = $1;
	} 
	elsif (m/^Modified/)
	{
		$suffix = "&f=H";
	}
	elsif (m/^Added/)
	{
		$suffix = "";
	}
	elsif (m,\((http://[^)]*)\)$,)
	{
		my $url = $1.$suffix;
		$res = $agent->get($url);
		print SAL $res->content;
	}
}

close SAL;
$subject =~ s/[ _'\/]/_/g;
rename $temp, sprintf ("/tmp/patch.%s.html", $subject);


---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic