diff options
-rwxr-xr-x[-rw-r--r--] | local/gentoo_push_notification.py | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | local/post-receive.cfengine-sync | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | local/post-receive.dns-sync | 4 | ||||
-rw-r--r-- | local/post-receive.dns-sync~ | 6 | ||||
-rwxr-xr-x | local/post-receive.gentoo-commits | 66 | ||||
-rwxr-xr-x[-rw-r--r--] | local/post-receive.masterportage-acl-sync | 0 |
6 files changed, 41 insertions, 35 deletions
diff --git a/local/gentoo_push_notification.py b/local/gentoo_push_notification.py index c3a0fac..c3a0fac 100644..100755 --- a/local/gentoo_push_notification.py +++ b/local/gentoo_push_notification.py diff --git a/local/post-receive.cfengine-sync b/local/post-receive.cfengine-sync index 0b6c939..0b6c939 100644..100755 --- a/local/post-receive.cfengine-sync +++ b/local/post-receive.cfengine-sync diff --git a/local/post-receive.dns-sync b/local/post-receive.dns-sync index 0473a5b..e9283be 100644..100755 --- a/local/post-receive.dns-sync +++ b/local/post-receive.dns-sync @@ -1,6 +1,6 @@ #!/bin/sh -# gentoo-infra: infra/githooks.git:local/post-receive.dns-sync +# gentoo-infra: infra/cfengine.git:files/var/lib/gitolite/hooks/post-receive.dns-sync -echo "Pushing commit to ns0.gentoo.org (scrubfowl)" +echo "Pushing commit to ns0.gentoo.org (thrasher)" sudo /usr/local/sbin/sudo-dns-push diff --git a/local/post-receive.dns-sync~ b/local/post-receive.dns-sync~ new file mode 100644 index 0000000..4e87080 --- /dev/null +++ b/local/post-receive.dns-sync~ @@ -0,0 +1,6 @@ +#!/bin/sh +# gentoo-infra: infra/githooks.git:local/post-receive.dns-sync + +echo "Pushing commit to ns0.gentoo.org" + +sudo /usr/local/sbin/sudo-dns-push diff --git a/local/post-receive.gentoo-commits b/local/post-receive.gentoo-commits index 502d0fc..b332fb5 100755 --- a/local/post-receive.gentoo-commits +++ b/local/post-receive.gentoo-commits @@ -1,5 +1,5 @@ #!/usr/bin/perl -w -# gentoo-infra: infra/githooks.git:local/post-receive.gentoo-commits +# gentoo-infra: infra/cfengine.git:files/var/lib/gitolite/hooks/post-receive.gentoo-commits use strict; use POSIX qw( getcwd ); @@ -119,14 +119,14 @@ sub debug { } sub git(@) { - my @args = @_; + my @cmd = @_; my $out; - return if ! @args or $#args == -1; + return if ! @cmd or $#cmd == -1; - my $cmd = "git ".join(" ", @args); + unshift @cmd, 'git'; - open(FH, '-|', $cmd); + open(FH, '-|', @cmd); { local $/ = undef; $out = <FH>; } close(FH); @@ -137,7 +137,7 @@ sub git(@) { sub git_config($) { my $var = shift; - return git("config --get gentoo.".$var); + return git(qw(config --get), $var); } sub git_config_yesno($) { @@ -179,8 +179,8 @@ sub sendmail($) { $mail->{"Debug"} = 0 if ! $mail->{"Debug"}; $mail->{"NoMail"} = 0 if ! $mail->{"NoMail"}; - $mail->{"Debug"} = git_config_yesno("mail.debug") if defined(git_config_yesno("mail.debug")); - $mail->{"NoMail"} = git_config_yesno("mail.nomail") if defined(git_config_yesno("mail.nomail")); + $mail->{"Debug"} = git_config_yesno("gentoo.mail.debug") if defined(git_config_yesno("gentoo.mail.debug")); + $mail->{"NoMail"} = git_config_yesno("gentoo.mail.nomail") if defined(git_config_yesno("gentoo.mail.nomail")); foreach my $to (@{$mail->{"To"}}) { if($mail->{"NoMail"} == 0) { @@ -295,10 +295,10 @@ sub tinyurl($) { return if ! $orig or length($orig) == 0; - my $url = LWP::Simple::get("http://tinyurl.com/api-create.php?url=".$orig) or return $orig; + my $url = LWP::Simple::get("https://tinyurl.com/api-create.php?url=".$orig) or return $orig; # Verify... - return $orig if $url !~ m/^http:\/\/tinyurl\.com\//; + return $orig if $url !~ m/^https?:\/\/tinyurl\.com\//; return $url; } @@ -343,7 +343,7 @@ sub get_data($) { $data{"project"} = "gentoo-user" if $REPO =~ m/^user\//; $data{"project"} = "gentoo" if $REPO !~ m/^user\//; } - $data{"project"} = git_config("project") if ! $PROJECTS{$REPO} and git_config("project"); + $data{"project"} = git_config("gentoo.project") if ! $PROJECTS{$REPO} and git_config("gentoo.project"); if(!$data{"project"}) { $data{"project"} = $REPO; $data{"project"} =~ s/.*\///; @@ -362,7 +362,7 @@ sub get_data($) { #$data{"url"} = tinyurl($data{"url"}); } - my $rawcommit = git("cat-file commit ".$rev); + my $rawcommit = git(qw(cat-file commit), $rev); my $inheader = 1; my $inpgpsig = 0; my $lineno = 0; @@ -455,13 +455,13 @@ sub get_data($) { # $data{"shortlog"} = @{$data{"logmsg"}}[0]; # -M -C - @{$data{"files"}} = split("\n", git("diff-tree --raw --root -r -B --name-only --no-commit-id ".$rev)); + @{$data{"files"}} = split("\n", git(qw(diff-tree --raw --root -r -B --name-only --no-commit-id), $rev)); @{$data{"files_excluded"}} = (); $data{"files_verbose"} = (); my @EXCLUDE; @EXCLUDE = @{$FILE_EXCLUDE{$data{"repo"}}} if $FILE_EXCLUDE{$data{"repo"}}; - @EXCLUDE = (@EXCLUDE, split(/\s+/, git_config("files.exclude"))) if git_config("files.exclude"); + @EXCLUDE = (@EXCLUDE, split(/\s+/, git_config("gentoo.files.exclude"))) if git_config("gentoo.files.exclude"); if(@EXCLUDE) { foreach my $exclude (@EXCLUDE) { @{$data{"files_excluded"}} = (grep(/$exclude/, @{$data{"files"}}), @{$data{"files_excluded"}}); @@ -470,7 +470,7 @@ sub get_data($) { } if($#{$data{"files"}} >= 0) { - foreach my $line (split("\n", git("diff-tree --root -r -C -M -B --name-status --no-commit-id ".$rev." -- ".join(" ", @{$data{"files"}})))) { + foreach my $line (split("\n", git(qw(diff-tree --root -r -C -M -B --name-status --no-commit-id),$rev, '--', @{$data{"files"}}))) { if($line =~ m/^([ACDMRT])(?:[0-9]{3})?\t+([^\t]+)(?:\t+([^\t]+))?/) { my $status = $1; my $old = $2; @@ -617,7 +617,7 @@ sub irc(@) { # <generator> # <name>Gentoo Commits script</name> # <version>0.0.2</version> -# <url>http://gentoo.org</url> +# <url>https://gentoo.org</url> # </generator> # <source> # <project>%(project)</project> @@ -685,22 +685,22 @@ sub commit_mail(@) { my $message; # --ignore-all-space --ignore-space-at-eol - my $gitshow_opts = '--pretty=format: --no-color --root --patch-with-stat --find-copies-harder -C'; + my @gitshow_opts = qw(--pretty=format: --no-color --root --patch-with-stat --find-copies-harder -C); my @to; if(!$ISPRIVATE and (!defined($GENTOO_COMMITS{$REPO}) or $GENTOO_COMMITS{$REPO} == 1) - and (!defined(git_config_yesno("mail.gentoocommits")) or git_config_yesno("mail.gentoocommits") == 1) + and (!defined(git_config_yesno("gentoo.mail.gentoocommits")) or git_config_yesno("gentoo.mail.gentoocommits") == 1) and ($DATA{"project"} eq "gentoo" - or (defined(git_config_yesno("mail.gentoocommits")) and git_config_yesno("mail.gentoocommits") == 1) + or (defined(git_config_yesno("gentoo.mail.gentoocommits")) and git_config_yesno("gentoo.mail.gentoocommits") == 1) or (defined($GENTOO_COMMITS{$REPO}) and $GENTOO_COMMITS{$REPO} == 1)) ) { push(@to, 'gentoo-commits@lists.gentoo.org'); } if($MAILINGLIST{$REPO}) { push(@to, @{$MAILINGLIST{$REPO}}); } - if(git_config("mail.extra")) { - @to = (@to, split(/\s+/, git_config("mail.extra"))); + if(git_config("gentoo.mail.extra")) { + @to = (@to, split(/\s+/, git_config("gentoo.mail.extra"))); } $message .= sprintf("commit: %s\n", $DATA{"rev"}) if $DATA{"rev"}; @@ -746,7 +746,7 @@ sub commit_mail(@) { $subject = sprintf("%s:%s commit in: %s", $REPO, $DATA{"branch"}, $paths ? $paths : "/"); - my @pretty_diff = split("\n", git("show $gitshow_opts $REV -- ".join(" ", @{$DATA{'files'}}))); + my @pretty_diff = split("\n", git('show', @gitshow_opts, $REV, '--', @{$DATA{'files'}})); # Add a empty line between the diff's for better readability my $i = 0; while($i < $#pretty_diff) { @@ -790,8 +790,8 @@ if (DateManipVersion() < 6.0) { } # Don't override DEBUG/DEBUG_SILENT from above -$DEBUG = git_config_yesno("debug") if ($DEBUG != 1 and defined(git_config_yesno("debug"))); -$DEBUG_SILENT = git_config_yesno("debug.silent") if ($DEBUG_SILENT != 1 and defined(git_config_yesno("debug.silent"))); +$DEBUG = git_config_yesno("gentoo.debug") if ($DEBUG != 1 and defined(git_config_yesno("gentoo.debug"))); +$DEBUG_SILENT = git_config_yesno("gentoo.debug.silent") if ($DEBUG_SILENT != 1 and defined(git_config_yesno("gentoo.debug.silent"))); debug("CWD: %s".getcwd()); @@ -827,11 +827,11 @@ while(defined(my $line = <STDIN>)) { $BRANCH =~ s/^refs\/(?:heads|tags|remotes)\///; debug("BRANCH: %s", $BRANCH); - if (git_config("ignorebranch")) { - debug("IGNOREBRANCH: %s", git_config("ignorebranch")); + if (git_config("gentoo.ignorebranch")) { + debug("IGNOREBRANCH: %s", git_config("gentoo.ignorebranch")); } - foreach my $pattern (split(/\s+/, git_config("ignorebranch"))) { + foreach my $pattern (split(/\s+/, git_config("gentoo.ignorebranch"))) { my $ignorebranch_error; eval { @@ -865,19 +865,19 @@ Please contact the repository owner and/or the overlays team if($OLDHEAD ne EMPTY and $NEWHEAD ne EMPTY) { $CHANGE_TYPE = "update"; # Detect merges and always use the merge commits itself and skip all child commits with more than one parent - my @merges = split("\n", git("rev-list --merges ${OLDHEAD}..${NEWHEAD}")); + my @merges = split("\n", git(qw(rev-list --merges), "${OLDHEAD}..${NEWHEAD}")); if($#merges >= 0) { - foreach my $merge (split("\n", git("rev-list --reverse ${OLDHEAD}..${NEWHEAD}"))) { + foreach my $merge (split("\n", git(qw(rev-list --reverse), "${OLDHEAD}..${NEWHEAD}"))) { if(grep(/^\Q${merge}\E$/, @merges)) { push(@REVLIST, $merge); } - elsif(split("\n", git("branch --contains ".$merge)) < 2) { + elsif(split("\n", git(qw(branch --contains), $merge)) < 2) { push(@REVLIST, $merge); } } } else { - @REVLIST = split("\n", git("rev-list --reverse ${OLDHEAD}..${NEWHEAD}")); + @REVLIST = split("\n", git(qw(rev-list --reverse), "${OLDHEAD}..${NEWHEAD}")); } } else { @@ -908,7 +908,7 @@ Please contact the repository owner and/or the overlays team next; } -# if((!defined($CIA_EXCLUDE{$REPO}) or $CIA_EXCLUDE{$REPO} eq 0) and (!defined(git_config_yesno("cia.exclude")) or git_config_yesno("cia.exclude") == 0)) { +# if((!defined($CIA_EXCLUDE{$REPO}) or $CIA_EXCLUDE{$REPO} eq 0) and (!defined(git_config_yesno("gentoo.cia.exclude")) or git_config_yesno("gentoo.cia.exclude") == 0)) { # # No CIA for private/infra repositories # if(!$ISPRIVATE and $CHANGE_TYPE eq "update") { # cia($REV); # FIXME: May we announce new/deleted tags/branches too? @@ -917,7 +917,7 @@ Please contact the repository owner and/or the overlays team commit_mail($REV); - if((!defined($IRC_EXCLUDE{$REPO}) or $IRC_EXCLUDE{$REPO} eq 0) and (!defined(git_config_yesno("irc.exclude")) or git_config_yesno("irc.exclude") == 0)) { + if((!defined($IRC_EXCLUDE{$REPO}) or $IRC_EXCLUDE{$REPO} eq 0) and (!defined(git_config_yesno("gentoo.irc.exclude")) or git_config_yesno("gentoo.irc.exclude") == 0)) { # No IRC for private/infra repositories if(!$ISPRIVATE) { irc($REV); diff --git a/local/post-receive.masterportage-acl-sync b/local/post-receive.masterportage-acl-sync index e517172..e517172 100644..100755 --- a/local/post-receive.masterportage-acl-sync +++ b/local/post-receive.masterportage-acl-sync |