]> git.ipfire.org Git - thirdparty/grsecurity-scrape.git/commitdiff
perl script to get latest grsec version from rss.
authorPiotr Karbowski <piotr.karbowski@gmail.com>
Thu, 19 Sep 2013 18:37:32 +0000 (20:37 +0200)
committerPiotr Karbowski <piotr.karbowski@gmail.com>
Thu, 19 Sep 2013 18:37:32 +0000 (20:37 +0200)
scrape.pl [new file with mode: 0644]

diff --git a/scrape.pl b/scrape.pl
new file mode 100644 (file)
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");
+}
+