summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2014-03-03 14:20:28 +0000
committerJan-Marek Glogowski <glogow@fbihome.de>2014-03-04 15:38:58 +0000
commitea5d93ba9a99f50c4771844ca3e58c3ce372c4d2 (patch)
tree84e29d52c17138c083fd5ea42918db8cb35eab4f
parent530dd9b821c61381946cf6236afe93c75f83b124 (diff)
Filter branches for automatic bugzilla reports.private/jmux/filter-bugzilla-branches
Introduces a much stricter branch filter for the 'core' repository. Now it just reports changes for libreoffice-[^/]* and master.
-rwxr-xr-xciabot/run-libreoffice-ciabot.pl33
1 files changed, 33 insertions, 0 deletions
diff --git a/ciabot/run-libreoffice-ciabot.pl b/ciabot/run-libreoffice-ciabot.pl
index 689cb36..4cb1bdb 100755
--- a/ciabot/run-libreoffice-ciabot.pl
+++ b/ciabot/run-libreoffice-ciabot.pl
@@ -24,6 +24,13 @@ sub error($) {
print STDERR "$message\n";
}
+#
+# Get a list of filtered branch HEADs
+#
+# Gets all branches, except HEAD.
+#
+# @returns \%{ branch name => git branch head hashval }
+#
sub get_branches() {
my %branches;
if ( open REFS, "git show-ref |" ) {
@@ -44,10 +51,34 @@ sub get_branches() {
return \%branches;
}
+#
+# Should we generate Bugzilla comments?
+#
+# Report all commits for all repositories except 'core'. For 'core'
+# just report libreoffice-* and master branches to Bugzilla.
+#
+# @returns true, if this commit should be reported to Bugzilla.
+#
+sub is_valid_bugzilla_commit($$) {
+ my ( $repo, $branch ) = @_;
+ return 1 if ( $repo ne 'core' );
+ return ( $branch =~ /^(libreoffice-[^\/]*|master)$/ );
+}
+
sub timestamp() {
return strftime("[%Y-%m-%d %H:%M:%S]", localtime);
}
+#
+# Report all branch changes to IRC and bugzilla.
+#
+# We just report changes filtered by is_valid_bugzilla_report to Bugzilla
+# but inform IRC off all changes.
+#
+# $1 = repository name
+# $2 = hashref of old branch heads (@see get_branches).
+# $3 = hashref of new branch heads (@see get_branches).
+#
sub report($$$) {
my ( $repo, $old_ref, $new_ref ) = @_;
my %old = %{$old_ref};
@@ -88,10 +119,12 @@ sub report($$$) {
qx(perl -I $cwd $cwd/sigui-bugzilla.pl $repo $_ $branch_name);
} else {
qx($ciabot $repo $_ $branch_name $ciaproxy);
+ next if ( ! is_valid_bugzilla_commit( $repo, $branch_name ) );
qx(perl -I $cwd $cwd/libreoffice-bugzilla.pl $repo $_ $branch_name);
}
} else {
print "$ciabot '$repo' '$_' '$branch_name' $ciaproxy\n";
+ next if ( ! is_valid_bugzilla_commit( $repo, $branch_name ) );
print "perl -I $cwd $cwd/libreoffice-bugzilla.pl '$repo' '$_' '$branch_name'\n";
}
}