From f1b3defc2ea29f4a0ea60e1fc6dbb62f7aebc56e Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Thu, 27 Sep 2012 15:32:22 -0400 Subject: [PATCH] Have irkerhook deduce SVN repo type. Add forge installation instructions. --- Makefile | 3 ++- README | 12 +++++++----- install.txt | 42 ++++++++++++++++++++++++++++++++++++++++++ irkerhook.py | 24 +++++++++++++++--------- 4 files changed, 66 insertions(+), 15 deletions(-) create mode 100644 install.txt diff --git a/Makefile b/Makefile index a4ff6fb..5fcf74c 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,8 @@ pylint: @pylint --output-format=parseable $(PYLINTOPTS) irkerhook.py -SOURCES = README COPYING NEWS BUGS irker irkerhook.py Makefile irker.xml irker-logo.png +SOURCES = README COPYING NEWS BUGS install.txt \ + irker irkerhook.py Makefile irker.xml irker-logo.png version: @echo $(VERS) diff --git a/README b/README index e6b9a06..d76ca38 100644 --- a/README +++ b/README @@ -2,12 +2,14 @@ irker is a specialized IRC client that runs as a daemon, allowing other programs to ship IRC notifications by sending JSON objects to a -listening socket. It is meant to be used by hook scripts in version- -control repositories, allowing them to send commit notifications -to project IRC channels. +listening socket. -A hook script supporting git and Subversion (irkerhook.py) is included. -See its header comment for installation instructions. +It is meant to be used by hook scripts in version- control +repositories, allowing them to send commit notifications to project +IRC channels. A hook script supporting git and Subversion +is included. + +See the install.txt file for installation instructions. Due to the abrupt death of cia.vc in late September 2012 the inmitial release of this software was a bit rushed. See the file diff --git a/install.txt b/install.txt new file mode 100644 index 0000000..116bab6 --- /dev/null +++ b/install.txt @@ -0,0 +1,42 @@ += Forge installation instructions = + +irker and irkerhook.py are intended to be installed on forge sites +such as SourceForge, GitHub, Gitorious, Gna, and Savannah. This +file explains the theory of operation, how to install the code, +and how to test it. + +== Installing irker installation == + +irker needs to run constantly, watching for TCP and UDP traffic on +port 6659. Install it accordingly. + +You should *not* make irker visible from outside the site firewall, as +it can be used to spam IRC channels while masking the source address. + +== Installing irkerhook.py == + +irkerhook.py should be called from the post-commit hook of each +repository. See its header comment for detailed installation +instructions. + +You should set the server and either repository or project variables +from the command line in your post-commit hook. The server variable +should be set to the inside-the-firewall host running your irker +instance. + +A git invocation line should look something like this: + +/usr/local/bin/irkerhook.py project=foobar server=internal.foobar.net + +A Subversion invocation should look something like this: + +REPOSITORY=$1 +REV=$2 +irkerhook.py repository=$REPOSITORY commit=$REV server=internal.foobar.net + +Note that the basename of the repository will be used as the project +name. + +== Testing == + +Go to a project repo and call diff --git a/irkerhook.py b/irkerhook.py index 02ab625..74554b5 100755 --- a/irkerhook.py +++ b/irkerhook.py @@ -13,7 +13,7 @@ # # Currently works for svn and git. For svn you must call it as follows: # -# irkerhook.py type=svn repository=REPO-PATH commit=REVISION channels=CHANNELS server=SERVER +# irkerhook.py repository=REPO-PATH commit=REVISION channels=CHANNELS server=SERVER # # REPO-PATH must be the absolute path of the SVN repository (first # argument of Subversion post-commit). REVISION must be the Subversion numeric @@ -171,10 +171,10 @@ if __name__ == "__main__": print "irkerhook.py: " + str(msg) raise SystemExit, 1 - vcs = "git" notify = True channels = "" commit = "" + repository= "" for (switch, val) in options: if switch == '-n': notify = False @@ -182,18 +182,24 @@ if __name__ == "__main__": print "irkerhook.py: version", version sys.exit(0) - # Force the type if not git, also make globals settable + # Gather info for repo type discrimination, make globals settable for tok in arguments: - if tok.startswith("type="): - vcs = tok[5:] - elif tok.startswith("tinyfier="): + if tok.startswith("tinyfier="): tinyfier = tok[9:] + elif tok.startswith("repository="): + repository = tok[11:] + + # Determine the repository type. Default to git unless user has pointed + # us at a repo with identifiable internals. + vcs = "git" + if os.path.exists(os.path.join(repository, "format")): + vcs = "svn" # Someday we'll have extractors for several version-control systems - if vcs == "git": - extractor = GitExtractor() - else: + if vcs == "svn": extractor = SvnExtractor(arguments) + else: + extractor = GitExtractor() # Changeset URL prefix for your repo: when the commit ID is appended # to this, it should point at a CGI that will display the commit -- 2.26.2