diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/README | 1 | ||||
-rwxr-xr-x | tools/git2svn.pl | 129 | ||||
-rw-r--r-- | tools/mini_epn.c | 2 | ||||
-rwxr-xr-x | tools/setup | 1 | ||||
-rwxr-xr-x | tools/tinderbox_build | 2 |
5 files changed, 130 insertions, 5 deletions
diff --git a/tools/README b/tools/README index 21d58461..98c243b0 100644 --- a/tools/README +++ b/tools/README | |||
@@ -1,4 +1,3 @@ | |||
1 | $Id$ | ||
2 | The tools subdirectory contains anciliary files that can be used to configure | 1 | The tools subdirectory contains anciliary files that can be used to configure |
3 | or test the plugins. | 2 | or test the plugins. |
4 | 3 | ||
diff --git a/tools/git2svn.pl b/tools/git2svn.pl new file mode 100755 index 00000000..c90ea96e --- /dev/null +++ b/tools/git2svn.pl | |||
@@ -0,0 +1,129 @@ | |||
1 | #!/usr/bin/perl | ||
2 | # | ||
3 | # This script pulls the current branch, then walks the first parents and | ||
4 | # commit each of them into subversion. | ||
5 | # | ||
6 | # Copyright (C) 2008 Thomas Guyot-Sionnest <dermoth@aei.ca> | ||
7 | # | ||
8 | # The subversion repository must not be taking any external commit or this | ||
9 | # script will erase them. This script cannot run off a bare repository. | ||
10 | # | ||
11 | # *** INITIAL SETUP *** | ||
12 | # | ||
13 | # 1. Run this command line to get the repository up and ready for this script: | ||
14 | # | ||
15 | # $ cd /path/to/repo/; git log -1 --pretty=format:%H >.git/git2svn.last_commit_hash | ||
16 | # | ||
17 | # 2. Configure the lines below... $ENV{'GIT_DIR'} must point to the .git | ||
18 | # directory of the git-svn repo. | ||
19 | # | ||
20 | # *** INITIAL SETUP *** | ||
21 | # | ||
22 | # This program is free software: you can redistribute it and/or modify | ||
23 | # it under the terms of the GNU General Public License as published by | ||
24 | # the Free Software Foundation, either version 3 of the License, or | ||
25 | # (at your option) any later version. | ||
26 | # | ||
27 | # This program is distributed in the hope that it will be useful, | ||
28 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
29 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
30 | # GNU General Public License for more details. | ||
31 | # | ||
32 | # You should have received a copy of the GNU General Public License | ||
33 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
34 | |||
35 | use strict; | ||
36 | use warnings; | ||
37 | |||
38 | # This is the git working tree. Must be tied to a SVN repository | ||
39 | $ENV{'GIT_DIR'} = '/path/to/nagiosplug/.git'; | ||
40 | |||
41 | # For some strange reasons this is needed: | ||
42 | $ENV{'GIT_SVN_ID'} = 'trunk'; | ||
43 | |||
44 | # Path to git binary | ||
45 | my $git = '/usr/bin/git'; | ||
46 | |||
47 | # Force commits from the hash stored in git2svn.last_commit_hash regardless | ||
48 | # of the state of the current repository. Use this if the repository was | ||
49 | # updated manually or if you need to set that hash to a specific value. | ||
50 | # NB: Re-committing old hashes will revert then roll again changes to SVN. | ||
51 | my $FORCE = 0; | ||
52 | |||
53 | # Print debug output. Useful if you want to see what's being committed. | ||
54 | my $DEBUG = 0; | ||
55 | |||
56 | for (@ARGV) { | ||
57 | $FORCE = 1 if (m/force/); | ||
58 | $DEBUG = 1 if (m/debug/); | ||
59 | if (m/help/ || m/--help/ || m/-h/) { | ||
60 | print "Usage: $0 [ debug ] [ force ] [ help ]\n"; | ||
61 | exit 0; | ||
62 | } | ||
63 | } | ||
64 | |||
65 | # 1st get the current commit hash - we'll start committing to SVN from this one | ||
66 | print "Reading saved hash from $ENV{'GIT_DIR'}/git2svn.last_commit_hash\n" if ($DEBUG); | ||
67 | open(SAVHASH, "<$ENV{'GIT_DIR'}/git2svn.last_commit_hash") | ||
68 | or die("Can't open $ENV{'GIT_DIR'}/git2svn.last_commit_hash: $!"); | ||
69 | my $saved_commit_hash = <SAVHASH>; | ||
70 | chomp $saved_commit_hash; | ||
71 | print "Saved commit hash: $saved_commit_hash\n" if ($DEBUG); | ||
72 | close(SAVHASH); | ||
73 | |||
74 | my $last_commit_hash; | ||
75 | if ($FORCE) { | ||
76 | $last_commit_hash = $saved_commit_hash; | ||
77 | print "Forcing last commit hash to $last_commit_hash\n" if ($DEBUG); | ||
78 | } else { | ||
79 | print "Running: $git log -1 --pretty=format:%H\n" if ($DEBUG); | ||
80 | $last_commit_hash = `$git log -1 --pretty=format:%H`; | ||
81 | die("Failed to retrieve last commit hash") if ($?); | ||
82 | chomp $last_commit_hash; | ||
83 | print "Last commit hash: $last_commit_hash\n" if ($DEBUG); | ||
84 | |||
85 | # Sanity check | ||
86 | die("Last commit hash and saved commit hash don't match, aborting") | ||
87 | if ($last_commit_hash ne $saved_commit_hash); | ||
88 | } | ||
89 | |||
90 | # 2nd pull the remote tree | ||
91 | print "Running: $git pull\n" if ($DEBUG); | ||
92 | `$git pull`; | ||
93 | die("Failed to pull") if ($?); | ||
94 | |||
95 | # Then list all first parents since the last one and insert them into an array | ||
96 | my @commits; | ||
97 | print "Running: $git rev-list --first-parent $last_commit_hash..HEAD\n" if ($DEBUG); | ||
98 | open(REVLIST, "$git rev-list --first-parent $last_commit_hash..HEAD|") | ||
99 | or die("Failed to retrieve revision list: $!"); | ||
100 | |||
101 | while (<REVLIST>) { | ||
102 | chomp; | ||
103 | unshift @commits, $_; | ||
104 | print "Prepending the list with $_\n" if ($DEBUG); | ||
105 | } | ||
106 | |||
107 | close(REVLIST); | ||
108 | |||
109 | if (@commits == 0) { | ||
110 | print "Nothing to do.\n"; | ||
111 | exit 0; | ||
112 | } | ||
113 | |||
114 | # Finally, commit every revision found into SVN | ||
115 | foreach my $commit (@commits) { | ||
116 | print "Commiting $commit to Subversion\n"; | ||
117 | print "Running: $git svn set-tree $commit\n" if ($DEBUG); | ||
118 | `$git svn set-tree $commit`; | ||
119 | die("Failed to commit hash $commit") if ($?); | ||
120 | } | ||
121 | |||
122 | # Once done, update the last commit hash | ||
123 | $last_commit_hash = pop @commits; | ||
124 | print "Writing last commit hash to $ENV{'GIT_DIR'}/git2svn.last_commit_hash\n" if ($DEBUG); | ||
125 | open(SAVHASH, ">$ENV{'GIT_DIR'}/git2svn.last_commit_hash") | ||
126 | or die("Can't open $ENV{'GIT_DIR'}/git2svn.last_commit_hash for writing: $!"); | ||
127 | print SAVHASH $last_commit_hash; | ||
128 | close(SAVHASH); | ||
129 | |||
diff --git a/tools/mini_epn.c b/tools/mini_epn.c index cd675389..6f3c5d02 100644 --- a/tools/mini_epn.c +++ b/tools/mini_epn.c | |||
@@ -5,8 +5,6 @@ | |||
5 | * Modified by Douglas Warner | 5 | * Modified by Douglas Warner |
6 | * Last Modified: 05/02/2002 | 6 | * Last Modified: 05/02/2002 |
7 | * | 7 | * |
8 | * $Id$ | ||
9 | * | ||
10 | * This is a sample mini embedded Perl interpreter (hacked out checks.c and | 8 | * This is a sample mini embedded Perl interpreter (hacked out checks.c and |
11 | * perlembed) for use in testing Perl plugins. | 9 | * perlembed) for use in testing Perl plugins. |
12 | * | 10 | * |
diff --git a/tools/setup b/tools/setup index 6db4c6c5..cdaa9c92 100755 --- a/tools/setup +++ b/tools/setup | |||
@@ -1,7 +1,6 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | # | 2 | # |
3 | # autogen.sh glue from CMU Cyrus IMAP | 3 | # autogen.sh glue from CMU Cyrus IMAP |
4 | # $Id$ | ||
5 | # | 4 | # |
6 | # Requires: automake, autoconf, dpkg-dev | 5 | # Requires: automake, autoconf, dpkg-dev |
7 | # set -e | 6 | # set -e |
diff --git a/tools/tinderbox_build b/tools/tinderbox_build index c1d40c69..ab4234aa 100755 --- a/tools/tinderbox_build +++ b/tools/tinderbox_build | |||
@@ -14,7 +14,7 @@ use Sys::Hostname; | |||
14 | use Cwd; | 14 | use Cwd; |
15 | use Time::Local; | 15 | use Time::Local; |
16 | 16 | ||
17 | my $Version = '$Revision$'; | 17 | my $Version = `git describe --abbrev=4 HEAD`; |
18 | 18 | ||
19 | my $myhost = hostname; | 19 | my $myhost = hostname; |
20 | chomp($myhost); | 20 | chomp($myhost); |