From: Piotr Karbowski Date: Thu, 19 Sep 2013 18:37:32 +0000 (+0200) Subject: perl script to get latest grsec version from rss. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6ed33715e8f0f8e01d997144ad545bbbbf1afca1;p=thirdparty%2Fgrsecurity-scrape.git perl script to get latest grsec version from rss. --- diff --git a/scrape.pl b/scrape.pl new file mode 100644 index 0000000..78a2a1a --- /dev/null +++ b/scrape.pl @@ -0,0 +1,38 @@ +#!/usr/bin/perl + +use warnings; +use strict; +use XML::Simple; +use LWP::Simple 'get', 'getstore'; +use File::Basename 'dirname', 'basename'; +use Cwd 'abs_path'; + +my $script_dir = abs_path(dirname(__FILE__)); + +print("Getting rss feed ...\n"); +my $feed_raw = get("https://grsecurity.net/testing_rss.php"); + +my $feed = XMLin($feed_raw, ForceArray => ['item']); +my $filename; +my $link; +my $new_patches; + +for(@{$feed->{channel}->{item}}) { + $link = $_->{link}; + $filename = basename($link); + if ( ! -e $script_dir . "/test/". $filename ) { + $new_patches++; + print("Downloading ", $filename, " ...\n"); + getstore($link . ".sig", $script_dir . "/test/" . $filename . ".sig"); + getstore($link, $script_dir . "/test/" . $filename); + } +} +if ($new_patches) { + print("Downloading changelog-test.txt ...\n"); + getstore("https://grsecurity.net/changelog-test.txt", $script_dir . "/test/changelog-test.txt"); + + system("git", "add", $script_dir . "/test/" . $filename, $script_dir . "/test/changelog-test.txt", $script_dir . "/test/" . $filename . ".sig"); + system("git", "commit", "-a", "-m", "Auto commit, " . $new_patches . " new patch{es}."); + system("git", "push"); +} +