]> git.ipfire.org Git - thirdparty/grsecurity-scrape.git/blob - scrape.pl
Auto commit, 1 new patch{es}.
[thirdparty/grsecurity-scrape.git] / scrape.pl
1 #!/usr/bin/perl
2
3 use warnings;
4 use strict;
5 use XML::Simple;
6 use LWP::Simple 'get', 'getstore';
7 use File::Basename 'dirname', 'basename';
8 use Cwd 'abs_path';
9
10 my $script_dir = abs_path(dirname(__FILE__));
11 chdir($script_dir);
12 my $feed_raw = get("http://grsecurity.net/testing_rss.php");
13
14 my $feed = XMLin($feed_raw, ForceArray => ['item']);
15 my $filename;
16 my $link;
17 my $new_patches;
18
19 for(@{$feed->{channel}->{item}}) {
20 $link = $_->{link};
21 $filename = basename($link);
22 if ( ! -e $script_dir . "/test/". $filename ) {
23 $new_patches++;
24 print("Downloading ", $filename, " ...\n");
25 getstore($link . ".sig", $script_dir . "/test/" . $filename . ".sig");
26 getstore($link, $script_dir . "/test/" . $filename);
27 }
28 }
29 if ($new_patches) {
30 print("Downloading changelog-test.txt ...\n");
31 getstore("https://grsecurity.net/changelog-test.txt", $script_dir . "/test/changelog-test.txt");
32
33 system("git", "add", $script_dir . "/test/" . $filename, $script_dir . "/test/changelog-test.txt", $script_dir . "/test/" . $filename . ".sig");
34 system("git", "commit", "-a", "-m", "Auto commit, " . $new_patches . " new patch{es}.");
35 system("git", "push");
36 }
37