]> git.ipfire.org Git - thirdparty/grsecurity-scrape.git/blame - scrape.pl
Auto commit, 1 new patch{es}.
[thirdparty/grsecurity-scrape.git] / scrape.pl
CommitLineData
6ed33715
PK
1#!/usr/bin/perl
2
3use warnings;
4use strict;
5use XML::Simple;
6use LWP::Simple 'get', 'getstore';
7use File::Basename 'dirname', 'basename';
8use Cwd 'abs_path';
9
10my $script_dir = abs_path(dirname(__FILE__));
e90546db 11chdir($script_dir);
d01a42ac 12my $feed_raw = get("http://grsecurity.net/testing_rss.php");
6ed33715
PK
13
14my $feed = XMLin($feed_raw, ForceArray => ['item']);
15my $filename;
16my $link;
17my $new_patches;
18
19for(@{$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}
29if ($new_patches) {
30 print("Downloading changelog-test.txt ...\n");
ba55a556 31 getstore("http://grsecurity.net/changelog-test.txt", $script_dir . "/test/changelog-test.txt");
6ed33715
PK
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