[Libreoffice-commits] dev-tools.git: ciabot/config-example.cfg ciabot/config.pl.sample ciabot/.gitignore ciabot/INSTALL ciabot/irker-cia-proxy.py ciabot/libreoffice-bugzilla2.py ciabot/libreoffice-ciabot.pl ciabot/projmap.json ciabot/README ciabot/run-libreoffice-ciabot.pl ciabot/setup ciabot/sigui-bugzilla.pl ciabot/start-ciabot.sh ciabot/start-irker.sh
Guilhem Moulin (via logerrit)
logerrit at kemper.freedesktop.org
Wed Jul 8 02:02:17 UTC 2020
ciabot/.gitignore | 1
ciabot/INSTALL | 19 --
ciabot/README | 109 --------------
ciabot/config-example.cfg | 16 --
ciabot/config.pl.sample | 11 -
ciabot/irker-cia-proxy.py | 152 --------------------
ciabot/libreoffice-bugzilla2.py | 231 -------------------------------
ciabot/libreoffice-ciabot.pl | 290 ---------------------------------------
ciabot/projmap.json | 7
ciabot/run-libreoffice-ciabot.pl | 229 ------------------------------
ciabot/setup/install | 34 ----
ciabot/setup/irkerd.conf | 18 --
ciabot/setup/loircbot.conf | 19 --
ciabot/sigui-bugzilla.pl | 129 -----------------
ciabot/start-ciabot.sh | 5
ciabot/start-irker.sh | 7
16 files changed, 1277 deletions(-)
New commits:
commit aed5bd02b50032e9152f2f91c5632f6b44987c35
Author: Guilhem Moulin <guilhem at libreoffice.org>
AuthorDate: Mon Jul 6 00:17:51 2020 +0200
Commit: Guilhem Moulin <guilhem at libreoffice.org>
CommitDate: Mon Jul 6 00:17:51 2020 +0200
ciabot: Move subtree to infra/salt
The repository now lives at https://git.libreoffice.org/infra/salt/+/master/ciabot/ .
This makes it easier for the infra team to deploy changes to production.
Subtree history was preserved during the operation:
https://git.libreoffice.org/infra/salt/history/7162daff402d4ad235ed48e3872bc0b50faa2275
diff --git a/ciabot/.gitignore b/ciabot/.gitignore
deleted file mode 100644
index 3e9cb72..0000000
--- a/ciabot/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/repositories
diff --git a/ciabot/INSTALL b/ciabot/INSTALL
deleted file mode 100644
index 3f36105..0000000
--- a/ciabot/INSTALL
+++ /dev/null
@@ -1,19 +0,0 @@
-The following steps are needed to use this code:
-
-Install some packages:
-- Python
- * git module (Debian: python-git)
- * bugzilla module (Debian: python-bugzilla)
-
-Configure the software:
-- Copy config-example.cfg -> config.cfg and change the defaults
-
-
-- Have this directory as e.g. ~/prod
-
-Clone-out extra repositories
-- git clone https://gitlab.com/esr/irker ~/git/irker
-- git clone https://github.com/vmiklos/irker-cia-proxy ~/git/irker-cia-proxy
-
-Run the install script
-- ~/git/dev-tools/ciabot/setup/install
diff --git a/ciabot/README b/ciabot/README
deleted file mode 100644
index 4ea4e1b..0000000
--- a/ciabot/README
+++ /dev/null
@@ -1,109 +0,0 @@
-How the IRC nofication part works:
-
-1) After a reboot, start-irker.sh and start-ciabot.sh has to be started
-manually. The first starts irkerd, which -- in case of no errors -- has no
-output. The second starts run-libreoffice-ciabot.pl in screen.
-
-2) run-libreoffice-ciabot.pl invokes libreoffice-ciabot.pl for each commit, which
-has an XML output, piped into irker-cia-proxy.py, which sends the info to
-irkerd.
-
-
-TESTING
--------
-
-How to test the IRC notification part:
---------------------------------------
-
-1) Take the IRC bot "offline", by editing ~/bin/irker-cia-proxy/projmap.json,
-e.g. redirect the channel from #libreoffice-dev to some test channel.
-
-2) Run:
-
-cd ~/libreoffice/core
-perl ~/bin/libreoffice-ciabot.pl core f9453275d2710f9d3e9a4cc1285a57db334a5e2e | (cd ~/bin/irker-cia-proxy; python irker-cia-proxy.py -s)
-
-3) Once you're happy with the result, change projmap.json back.
-
-
-How to test the Bugzilla integration:
--------------------------------------
-
-- Follow the instructions in INSTALL to install packages and configure
- the software.
-
- (NOTE: It's possible that for simple testing you won't have to
- install repos besides dev-tools and LibreOffice core. More details
- in the future :-)
-
-- Edit file projmap.json to change the IRC channel
-
-e.g. "to": "ircs://irc.freenode.net/libreoffice-dev" ->
- "to": "ircs://irc.freenode.net/libreoffice-dev-test"
-
-- Edit config.cfg to change the url for the Bugzilla install
-
-e.g. url = bugs.libreoffice.org/xmlrpc.cgi ->
- url = bugzilla-test.documentfoundation.org/xmlrpc.cgi
-
-Don't forget to also update the user/password for connecting.
-
-- If you don't have a LibreOffice core repo handy, clone one out
-
-https://wiki.documentfoundation.org/Development/BuildingOnLinux#Cloning_and_building
-
-- cd to the LibreOffice core repo
-
- cd ~/libreoffice/core
-
-- Run the script:
-
-That should give you text that looks like this (abbreviated for space):
-
- <message>
- <generator>
- <name>CIA Perl client for Git</name>
- <version>1.0</version>
- </generator>
- ...
- </message>
-
-If that doesn't crash, let's go further.
-
-- Make a commit in the core repo (but do NOT push it!).
-
-Reference a test bug so you don't email anyone else. Example:
-
-commit 3da8ea79e9616332fdd13a78409e963a96318428
-Author: Robinson Tryon <qubit at runcibility.com>
-Date: Sun Dec 7 19:49:36 2014 -0500
-
- fdo#76789 - Test Git-Bugzilla integration scripts
-
- Testing the integration scripts in ciabot/ to make sure that they run
- as expected against a new server setup.
-
-If the run is successful, you shouldn't see any output.
-
-- Check the bug report to confirm that the change took place.
-
-Example:
-
- Whiteboard: target:4.4.0
-
- Comment:
-
- Testy Tester 2014-12-08 01:05:09 UTC
-
- Robinson Tryon committed a patch related to this issue.
- It has been pushed to "master":
-
- https://git.libreoffice.org/core/commit/3da8ea79e96163
-
- fdo#76789 - Test Git-Bugzilla integration scripts
-
- The patch should be included in the daily builds available at
- https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
- information about daily builds can be found at:
- https://wiki.documentfoundation.org/Testing_Daily_Builds
- Affected users are encouraged to test the fix and report feedback.
diff --git a/ciabot/config-example.cfg b/ciabot/config-example.cfg
deleted file mode 100644
index 45d95f0..0000000
--- a/ciabot/config-example.cfg
+++ /dev/null
@@ -1,16 +0,0 @@
-[core]
-location = /home/moggi/devel/libo_push/
-
-[help]
-location = /home/ciabot/prod/help/
-
-[online]
-location = /home/ciabot/prod/online/
-
-[contrib/dev-tools]
-location = /home/ciabot/prod/contrib/dev-tools/
-
-[bugzilla]
-url = bugs.libreoffice.org/xmlrpc.cgi
-user = your.user.name at bugs.com
-password = MySecretPassword
diff --git a/ciabot/config.pl.sample b/ciabot/config.pl.sample
deleted file mode 100644
index bd98f39..0000000
--- a/ciabot/config.pl.sample
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/usr/bin/perl -w
-
-use strict;
-
-# The bugzilla has contains the server, username and password for the targeted
-# bugzilla installation. There's NO 'http://' in the server line.
-our $bugzilla = {
- server => 'bugs.libreoffice.org/',
- user => 'libreoffice-commits at lists.freedesktop.org',
- password => 'secret', # CHANGE THIS!
-};
diff --git a/ciabot/irker-cia-proxy.py b/ciabot/irker-cia-proxy.py
deleted file mode 100644
index ed8835f..0000000
--- a/ciabot/irker-cia-proxy.py
+++ /dev/null
@@ -1,152 +0,0 @@
-#!/usr/bin/env python3
-"""
-irker-cia-proxy - proxy CIA requests to an irker relay agent
-
-Copyright (c) 2012 William Pitcock <nenolod at dereferenced.org>
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-This software is provided 'as is' and without any warranty, express or
-implied. In no event shall the authors be liable for any damages arising
-from the use of this software.
-"""
-
-import json, socket, posixpath, re, sys
-from xml.dom import minidom
-from xmlrpc.server import SimpleXMLRPCServer
-from xmlrpc.server import SimpleXMLRPCRequestHandler
-
-bind_ip = ''
-bind_port = 8000
-target_server = "localhost"
-target_port = 6659
-template = "%(bold)s%(project)s:%(bold)s %(green)s%(author)s%(reset)s %(yellow)s%(branch)s%(reset)s * r%(bold)s%(revision)s%(bold)s %(module)s/%(files)s%(bold)s:%(bold)s %(log)s"
-
-projmap = json.load(open("projmap.json"))
-
-class CIAMessage:
- "Abstract class which represents a CIA message."
- def __init__(self, messagexml):
- self._dom = minidom.parseString(messagexml)
- def _render_files(self):
- prefix, endings = self._consolidate_files()
- endstr = ' '.join(endings)
- if len(endstr) > 60:
- endstr = self._summarize_files(endings)
- if prefix.startswith('/'):
- prefix = prefix[1:]
- if endstr:
- return "%s (%s)" % (prefix, endstr)
- return prefix
- def _consolidate_files(self):
- files = []
- filenode = self.dig('message', 'body', 'commit', 'files')
- if filenode is not None:
- for child in filenode.childNodes:
- if child.nodeName == 'file':
- files.append(self._shallowtext(child))
- # Optimization: if we only have one file, don't waste CPU on any of the other
- # stuff we do to pretend to be CIA.
- if len(files) == 1:
- return files[0], []
- prefix = re.sub("[^/]*$", "", posixpath.commonprefix(files))
- endings = []
- for file in files:
- ending = file[len(prefix):].strip()
- if ending == '':
- ending = '.'
- endings.append(ending)
- return prefix, endings
- def _summarize_files(self, files):
- dirs = {}
- for file in files:
- dirs[posixpath.split(file)[0]] = True
- if len(dirs) <= 1:
- return "%d files" % len(files)
- return "%d files in %d dirs" % (len(files), len(dirs))
- def _shallowtext_generator(self, node):
- for child in node.childNodes:
- if child.nodeType == child.TEXT_NODE:
- yield child.data
- def _shallowtext(self, node):
- if node is None:
- return None
- return ''.join(self._shallowtext_generator(node))
- def dig(self, *subElements):
- if not self._dom:
- return None
- node = self._dom
- for name in subElements:
- nextNode = None
- for child in node.childNodes:
- if child.nodeType == child.ELEMENT_NODE and child.nodeName == name:
- nextNode = child
- break
- if nextNode:
- node = nextNode
- else:
- return None
- return node
- def lookup(self, *subElements):
- text = self._shallowtext(self.dig(*subElements))
- if text is not None:
- return text.strip()
- return None
- def data(self):
- paths = {
- 'bold': '\x02',
- 'green': '\x033',
- 'blue': '\x032',
- 'yellow': '\x037',
- 'reset': '\x0F'
- }
- paths['project'] = self.lookup('message', 'source', 'project')
- paths['branch'] = self.lookup('message', 'source', 'branch')
- paths['module'] = self.lookup('message', 'source', 'module')
- paths['revision'] = self.lookup('message', 'body', 'commit', 'revision')
- paths['version'] = self.lookup('message', 'body', 'commit', 'version')
- paths['author'] = self.lookup('message', 'body', 'commit', 'author')
- paths['log'] = self.lookup('message', 'body', 'commit', 'log')
- paths['files'] = self._render_files()
- paths['url'] = self.lookup('message', 'body', 'commit', 'url')
- return paths
- def project(self):
- return self.lookup('message', 'source', 'project')
- def get_template(self):
- # If there is a template for this branch, use it, otherwise fall back to the project or the global one.
- branch_template = "template-%s" % self.data()['branch']
- if branch_template in projmap[self.project()]:
- return projmap[self.project()][branch_template]
- if 'template' in projmap[self.project()]:
- return projmap[self.project()]['template']
- return template
- def get_target(self):
- return projmap[self.project()]['to']
- def message(self):
- return self.get_template() % self.data()
- def relay(self):
- structure = {"to": self.get_target(), "privmsg": self.message()}
- envelope = json.dumps(structure)
- try:
- sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
- sock.sendto(envelope.encode() + b"\n", (target_server, target_port))
- finally:
- sock.close()
-
-if "-s" in sys.argv:
- CIAMessage(sys.stdin.read()).relay()
-else:
- class CIARequestHandler(SimpleXMLRPCRequestHandler):
- "A fake CIA server for receiving messages to translate and proxy."
- rpc_paths = ('/RPC2')
-
- def deliver(message):
- CIAMessage(message).relay()
- return True
-
- server = SimpleXMLRPCServer((bind_ip, bind_port), CIARequestHandler)
- server.register_introspection_functions()
- server.register_function(deliver, 'hub.deliver')
- server.serve_forever()
diff --git a/ciabot/libreoffice-bugzilla2.py b/ciabot/libreoffice-bugzilla2.py
deleted file mode 100644
index 3f61597..0000000
--- a/ciabot/libreoffice-bugzilla2.py
+++ /dev/null
@@ -1,231 +0,0 @@
-# libreoffice git bugzilla integration
-# Copyright (C) 2014 Markus Mohrhard
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <https://www.gnu.org/licenses/>.
-#
-# When a commit referencing a report is merged, this script
-# - adds a comment to the report
-# - updates the whiteboard field with target information
-
-import datetime
-import os
-import re
-import sys, getopt
-import git
-import configparser
-
-import bugzilla
-
-master_target = "7.1.0"
-bug_regex = "\\b(?:bug|fdo|tdf|lo)[#:]?(\\d+)\\b"
-dry_run = False
-
-class FreedesktopBZ:
- bzclass = bugzilla.Bugzilla44
-
- bz = None
-
- def connect(self):
- config = configparser.ConfigParser()
- config.read(os.path.dirname(os.path.abspath(__file__)) + '/config.cfg')
- url = config.get('bugzilla', 'url')
- user = config.get('bugzilla', 'user')
- password = config.get('bugzilla', 'password')
- self.bz = self.bzclass(url=url, cookiefile = "/tmp/cookie", tokenfile = "/tmp/token")
- if not dry_run:
- self.bz.login(user=user, password=password)
-
- def update_whiteboard(self, commit, bugnr, new_version, branch, repo_name):
- print(bugnr)
- if dry_run:
- print(("DRY RUN, we would set the whiteboard to: target:\n%s" % new_version))
- else:
- bug = self.bz.getbug(bugnr)
- print(bug)
- if not bug.product in ("LibreOffice", "LibreOffice Online"):
- print("refusing to update bug with non-LO component")
- return;
- old_whiteboard = bug.whiteboard
-
- m = re.findall(new_version, old_whiteboard)
- if m is None or len(m) == 0:
- if not old_whiteboard == "":
- old_whiteboard = old_whiteboard + " "
- new_whiteboard = old_whiteboard + "target:" + new_version
- update = self.bz.build_update(whiteboard=new_whiteboard)
- self.bz.update_bugs([bugnr], update)
-
- cgiturl = "https://git.libreoffice.org/%s/commit/%s" % (repo_name, commit.hexsha)
- if branch is None:
- branch = "master"
-
- comment_msg = """%s committed a patch related to this issue.
-It has been pushed to "%s":
-
-%s
-
-%s""" %(commit.author, branch, cgiturl, commit.summary)
-
- if (repo_name == "core"):
- comment_msg += """
-
-It will be available in %s.
-
-The patch should be included in the daily builds available at
-https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
-information about daily builds can be found at:
-https://wiki.documentfoundation.org/Testing_Daily_Builds
-
-Affected users are encouraged to test the fix and report feedback.""" %(new_version)
-
- if dry_run:
- print(("DRY RUN, we would add the following comment:\n%s" % comment_msg))
- else:
- bug.addcomment(comment_msg)
-
-
-
-
-def find_target_version(repo, branch):
- if branch is None or branch == "master":
- return master_target
-
- # check if committed to a release branch
- # form libreoffice-x-y-z => will be available in x.y.z
- match = re.search("libreoffice-(\d+)-(\d+)-(\d+)", branch)
- if match is not None:
- return ".".join(match.groups())
-
- # form libreoffice-x-y
- # branch of libreoffice-x-y-z exists => will be available in x.y.z+1
- # else
- # tag libreoffice-x.y.0.z exists => will be available in x.y.0.z+1 (RC)
- # else
- # beta
- match = re.search("libreoffice-(\d+)-(\d+)", branch)
- if match is not None:
- base = ".".join(match.groups())
- branches = repo.remote().refs
- branch_names = [str(branch) for branch in branches]
- print(branch_names)
- search_string = "libreoffice-" + "-".join(match.groups()) + "-(\d+)"
- print(search_string)
- micro_list = [int(m.group(1)) for m in [re.search(search_string, branch) for branch in branch_names] if m is not None]
- if len(micro_list) == 0:
- # first search if we are at an RC already
- search_string = "libreoffice-" + base + ".0." + "(\d+)$"
- tags = repo.tags
- print(tags)
- rc_list = [int(m.group(1)) for m in [re.search(search_string, str(tag)) for tag in tags] if m is not None]
- print(rc_list)
- if len(rc_list) > 0:
- return base + ".0." + str(max(rc_list) + 1)
-
- # we have not yet tagged an RC, check which betas have been tagged
- search_string = "libreoffice-" + base + ".0.0.beta(\d+)"
- beta_list = [int(m.group(1)) for m in [re.search(search_string, str(tag)) for tag in tags] if m is not None]
- print(beta_list)
- if len(beta_list) == 0:
- # no beta yet
- return base + ".0.0.beta0"
- if max(beta_list) >= 2:
- # we only release two betas (except when we release three),
- # therefore now the next will be a RC
- return base + ".0.1"
-
- # normal beta
- return base + ".0.0.beta" + str(max(beta_list) + 1)
- print(micro_list)
- # the next release from libreoffice-x-y is max existing z-branch + 1
- return base + "." + str(max(micro_list) + 1)
-
- return None
-
-def get_commit(repo, commit_id):
- commit = repo.commit(commit_id)
- return commit
-
-def find_bugid(repo, commit_id):
- commit = get_commit(repo, commit_id)
- summary_line = commit.summary
- regex = re.compile(bug_regex)
- m = regex.findall(summary_line)
- if m is None or len(m) == 0:
- print("no bugid found")
- sys.exit()
-
- return [int(i) for i in m]
-
-def read_repo(repo_name):
- config = configparser.ConfigParser()
- config.read(os.path.dirname(os.path.abspath(__file__)) + '/config.cfg')
- path = config.get(repo_name, 'location')
- repo = git.repo.base.Repo(path)
- return repo
-
-def main(argv):
- global dry_run
- print(argv)
- help_text = 'libreoffice-bugzilla2.py -c commitid [-b branchname] [-r repo] [--dry-run]'
- try:
- opts, args = getopt.getopt(argv,"dhc:b:r:",["dry-run","help","commit=","branch=","repo="])
- except getopt.GetoptError:
- print(help_text)
- sys.exit(2)
-
- commit_id = None
- branch = None
- repo_name = None
-
- for opt, arg in opts:
- if opt == '-h':
- print(help_text)
- sys.exit()
- elif opt in ("-d", "--dry-run"):
- dry_run = True
- elif opt in ("-c", "--commit"):
- commit_id = arg
- elif opt in ("-b", "--branch"):
- branch = arg
- elif opt in ("-r", "--repo"):
- repo_name = arg
-
- print(commit_id)
- print(branch)
- print(repo_name)
-
- repo = read_repo(repo_name)
-
- target_version = find_target_version(repo, branch)
-
- bug_ids = find_bugid(repo, commit_id)
-
- commit = get_commit(repo, commit_id)
-
- if target_version is None:
- print("missing target version")
- print(opts)
- sys.exit()
-
- bz = FreedesktopBZ()
- bz.connect()
- print(bug_ids)
- for bug_id in bug_ids:
- print(bug_id)
- bz.update_whiteboard(commit, bug_id, target_version, branch, repo_name)
-
-if __name__ == "__main__":
- main(sys.argv[1:])
-
-# vim:set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/ciabot/libreoffice-ciabot.pl b/ciabot/libreoffice-ciabot.pl
deleted file mode 100755
index d2d0144..0000000
--- a/ciabot/libreoffice-ciabot.pl
+++ /dev/null
@@ -1,290 +0,0 @@
-#!/usr/bin/perl -w
-#
-# ciabot -- Mail a git log message to a given address, for the purposes of CIA
-#
-# Loosely based on cvslog by Russ Allbery <rra at stanford.edu>
-# Copyright 1998 Board of Trustees, Leland Stanford Jr. University
-#
-# Copyright 2001, 2003, 2004, 2005 Petr Baudis <pasky at ucw.cz>
-#
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU General Public License version 2, as published by the
-# Free Software Foundation.
-#
-# The master location of this file is in the Cogito repository
-# (see http://www.kernel.org/git/).
-#
-# This program is designed to run as the .git/hooks/post-commit hook. It takes
-# the commit information, massages it and mails it to the address given below.
-#
-# The calling convention of the post-commit hook is:
-#
-# .git/hooks/post-commit $commit_sha1 $branch_name
-#
-# If it does not work, try to disable $xml_rpc in the configuration section
-# below. Also, remember to make the hook file executable.
-#
-#
-# Note that you can (and it might be actually more desirable) also use this
-# script as the GIT update hook:
-#
-# refname=${1#refs/heads/}
-# [ "$refname" = "master" ] && refname=
-# oldhead=$2
-# newhead=$3
-# for merged in $(git rev-list $newhead ^$oldhead | tac); do
-# /path/to/ciabot.pl $merged $refname
-# done
-#
-# This is useful when you use a remote repository that you only push to. The
-# update hook will be triggered each time you push into that repository, and
-# the pushed commits will be reported through CIA.
-
-use strict;
-use vars qw ($project $from_email $dest_email $noisy $rpc_uri $mail
- $xml_rpc $irker $ignore_regexp $alt_local_message_target);
-
-
-
-
-### Configuration
-
-# Project name (as known to CIA).
-$project = 'LibreOffice';
-
-# The from address in generated mails.
-$from_email = 'kendy at suse.cz';
-
-# Mail all reports to this address.
-#$dest_email = 'cia at cia.navi.cx';
-$dest_email = 'cia at cia.vc';
-
-# If using XML-RPC, connect to this URI.
-$rpc_uri = 'http://cia.vc/RPC2';
-
-# The 'mail' program setup
-$mail = 'mail';
-
-# If set, the script will send CIA the full commit message. If unset, only the
-# first line of the commit message will be sent.
-$noisy = 0;
-
-# This script can communicate with CIA either by mail or by an XML-RPC
-# interface. The XML-RPC interface is faster and more efficient, however you
-# need to have RPC::XML perl module installed, and some large CVS hosting sites
-# (like Savannah or Sourceforge) might not allow outgoing HTTP connections
-# while they allow outgoing mail. Also, this script will hang and eventually
-# not deliver the event at all if CIA server happens to be down, which is
-# unfortunately not an uncommon condition.
-$xml_rpc = 1;
-
-$irker = 1;
-
-# This variable should contain a regexp, against which each file will be
-# checked, and if the regexp is matched, the file is ignored. This can be
-# useful if you do not want auto-updated files, such as e.g. ChangeLog, to
-# appear via CIA.
-#
-# The following example will make the script ignore all changes in two specific
-# files in two different modules, and everything concerning module 'admin':
-#
-# $ignore_regexp = "^(gentoo/Manifest|elinks/src/bfu/inphist.c|admin/)";
-$ignore_regexp = "";
-
-# It can be useful to also grab the generated XML message by some other
-# programs and e.g. autogenerate some content based on it. Here you can specify
-# a file to which it will be appended.
-$alt_local_message_target = "";
-
-
-
-
-### The code itself
-
-use vars qw ($commit $tree @parent $author $committer);
-use vars qw ($user $repo $branch $rev @files $logmsg $message);
-my $line;
-
-
-
-### Input data loading
-
-
-# The commit stuff
-$repo = $ARGV[0];
-$commit = $ARGV[1];
-$branch = $ARGV[2];
-
-open COMMIT, "git cat-file commit $commit|" or die "git cat-file commit $commit: $!";
-my $state = 0;
-$logmsg = '';
-while (defined ($line = <COMMIT>)) {
- if ($state == 1) {
- $logmsg .= $line;
- $noisy or $state++;
- next;
- } elsif ($state > 1) {
- next;
- }
-
- chomp $line;
- unless ($line) {
- $state = 1;
- next;
- }
-
- my ($key, $value) = split(/ /, $line, 2);
- if ($key eq 'tree') {
- $tree = $value;
- } elsif ($key eq 'parent') {
- push(@parent, $value);
- } elsif ($key eq 'author') {
- $author = $value;
- } elsif ($key eq 'committer') {
- $committer = $value;
- }
-}
-close COMMIT;
-
-
-open DIFF, "git diff-tree -r $parent[0] $tree|" or die "git diff-tree $parent[0] $tree: $!";
-while (defined ($line = <DIFF>)) {
- chomp $line;
- my @f;
- (undef, @f) = split(/\t/, $line, 2);
- push (@files, @f);
-}
-close DIFF;
-
-
-# Figure out who is doing the update.
-# XXX: Too trivial this way?
-($user) = $author =~ /<(.*?)@/;
-
-
-$rev = substr($commit, 0, 12);
-
-
-
-
-### Remove to-be-ignored files
-
- at files = grep { $_ !~ m/$ignore_regexp/; } @files
- if ($ignore_regexp);
-exit unless @files;
-
-
-
-### Compose the mail message
-
-
-my ($VERSION) = '1.0';
-#my $ts = time;
-my $ts = time - 7*60*60; # Have to post it in cia.vc's local time ;-)
-
-$message = <<EM
-<message>
- <generator>
- <name>CIA Perl client for Git</name>
- <version>$VERSION</version>
- </generator>
- <source>
- <project>$project</project>
- <module>$repo</module>
-EM
-;
-$message .= " <branch>$branch</branch>" if ($branch);
-$message .= <<EM
- </source>
- <timestamp>
- $ts
- </timestamp>
- <body>
- <commit>
- <author>$user</author>
- <revision>$rev</revision>
- <files>
-EM
-;
-
-foreach (@files) {
- s/&/&/g;
- s/</</g;
- s/>/>/g;
- $message .= " <file>$_</file>\n";
-}
-
-$logmsg =~ s/&/&/g;
-$logmsg =~ s/</</g;
-$logmsg =~ s/>/>/g;
-
-$message .= <<EM
- </files>
- <log>
-$logmsg
- </log>
- </commit>
- </body>
-</message>
-EM
-;
-
-
-
-### Write the message to an alt-target
-
-if ($alt_local_message_target and open (ALT, ">>$alt_local_message_target")) {
- print ALT $message;
- close ALT;
-}
-
-
-### Send out to irker
-
-if ($irker) {
- print $message;
- exit;
-}
-
-
-### Send out the XML-RPC message
-
-
-if ($xml_rpc) {
- # We gotta be careful from now on. We silence all the warnings because
- # RPC::XML code is crappy and works with undefs etc.
- $^W = 0;
- $RPC::XML::ERROR if (0); # silence perl's compile-time warning
-
- require RPC::XML;
- require RPC::XML::Client;
-
- my $rpc_client = new RPC::XML::Client $rpc_uri;
- my $rpc_request = RPC::XML::request->new('hub.deliver', $message);
- my $rpc_response = $rpc_client->send_request($rpc_request);
-
- unless (ref $rpc_response) {
- die "XML-RPC Error: $RPC::XML::ERROR\n";
- }
- exit;
-}
-
-
-
-### Send out the mail
-
-
-# Open our mail program
-
-open (MAIL, "| $mail -r $from_email -s DeliverXML $dest_email") or die "Cannot execute $mail : " . ($?>>8);
-
-
-print MAIL $message;
-
-
-# Close the mail
-
-close MAIL;
-die "$0: mail exit status " . ($? >> 8) . "\n" unless ($? == 0);
-
-# vi: set sw=2:
diff --git a/ciabot/projmap.json b/ciabot/projmap.json
deleted file mode 100644
index d99351f..0000000
--- a/ciabot/projmap.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "LibreOffice": {
- "template": "%(project)s (%(module)s) [%(branch)s] %(author)s * %(files)s: %(log)s",
- "template-None": "%(project)s (%(module)s) %(author)s * %(files)s: %(log)s",
- "to": "ircs://irc.freenode.net/libreoffice-dev"
- }
-}
diff --git a/ciabot/run-libreoffice-ciabot.pl b/ciabot/run-libreoffice-ciabot.pl
deleted file mode 100755
index eb90f0b..0000000
--- a/ciabot/run-libreoffice-ciabot.pl
+++ /dev/null
@@ -1,229 +0,0 @@
-#!/usr/bin/perl -T
-
-use strict;
-use warnings;
-
-$ENV{PATH} = join ':', qw{/usr/bin /bin};
-
-use POSIX;
-use File::Basename;
-
-open STDOUT, '>>', "/var/log/ciabot/ciabot.out";
-open STDERR, '>>', "/var/log/ciabot/ciabot.err";
-my $test = 0;
-
-my $suffix = "";
-my $cwd = dirname($0) =~ /\A([[:alnum:]\/%\.\+\-_]+)\z/ ? $1 : die;
-my $repodir = "$cwd/../repositories";
-
-if ( ! -d "$repodir/core" && ! -d "$repodir/core.git" ) {
- print STDERR "Not a directory with libreoffice repos!\n";
- exit 1;
-}
-if ( -d "$repodir/core.git" ) {
- $suffix=".git"
-}
-sub error($) {
- my ( $message ) = @_;
- 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 |" ) {
- while ( <REFS> ) {
- chomp;
- if ( /^([[:xdigit:]]{40,}) refs\/remotes\/origin\/([[:alnum:]\/%\.\+\-_]+)$/ ) {
- if ( $2 ne 'HEAD' ) {
- $branches{$2} = $1;
- }
- }
- }
- close REFS;
- }
- else {
- error( "Cannot call git show-ref." );
- }
-
- 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 1 if ( $branch eq '' );
- 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};
- my %new = %{$new_ref};
- my $ciabot = "timeout 60 $cwd/libreoffice-ciabot.pl";
- my $ciaproxy = "| ( cd $cwd && python3 irker-cia-proxy.py -s )";
-
- foreach my $key ( keys %new ) {
- my $branch_name = $key;
- $branch_name = '' if ( $branch_name eq 'master' );
- if ($branch_name =~ /aoo\/|distro\/|private\/|feature\//) {
- next;
- }
-
- my $old_head = $old{$key};
- my $new_head = $new{$key};
-
- if ( defined( $old_head ) ) {
- if ( $old_head ne $new_head ) {
- my $ret = system("git rev-parse -q --verify $new_head^2 >/dev/null");
- if ($ret != 0) {
- # not a merge commit, announce every commit
-
- # limit the number of commits we report
- my $limit = 25;
- if ( `git rev-list $new_head ^$old_head | wc -l` > 25 ) {
- # something is wrong - probably a big rebase,
- # or something, report just 1 commit
- $limit = 1;
- }
- if ( open COMMITS, "git rev-list -n $limit $new_head ^$old_head | tac |" ) {
- while ( <COMMITS> ) {
- $_ = /^([[:xdigit:]]{40,})$/ ? $1 : next; # untaint
- print timestamp() . " Sending report about $_ in $key\n";
- if (!$test) {
- if ($repo eq "si-gui")
- {
- qx(perl -I $cwd $cwd/sigui-bugzilla.pl $repo $_ $branch_name);
- } else {
- if ( is_valid_bugzilla_commit( $repo, $branch_name ) ) {
- my $branch = $branch_name;
- $branch = 'master' if ($branch eq '');
- print "reporting to bugzilla: $_ and branch $branch\n";
- qx(python3 $cwd/libreoffice-bugzilla2.py -r $repo -c $_ -b $branch >>/var/log/ciabot/bugzilla.log);
- }
- qx($ciabot $repo $_ $branch_name $ciaproxy);
- }
- } else {
- if ( is_valid_bugzilla_commit( $repo, $branch_name ) ) {
- print "python3 $cwd/libreoffice-bugzilla2.py -r '$repo' -c '$_' -b '$branch_name'\n";
- }
- print "$ciabot '$repo' '$_' '$branch_name' $ciaproxy\n";
- }
- }
- close COMMITS;
- }
- else {
- error( "Cannot call git rev-list." );
- }
- } else {
- # just process the merge commit itself
- print timestamp() . " Sending report about $new_head in $key\n";
- if (!$test) {
- qx($ciabot $repo $new_head $branch_name $ciaproxy);
- # no libreoffice-bugzilla.pl call for the merge commit
- } else {
- print "$ciabot '$repo' '$new_head' '$branch_name' $ciaproxy\n";
- }
- }
- }
- }
- else {
- # Report the newest commit which is not in master
- if ( open COMMITS, "git rev-list -n 1 $new_head ^refs/remotes/origin/master |" ) {
- while ( <COMMITS> ) {
- $_ = /^([[:xdigit:]]{40,})$/ ? $1 : next; # untaint
- print timestamp() . " Sending report about $_ in $key (newly created branch)\n";
- if (!$test) {
- qx($ciabot $repo $_ $branch_name $ciaproxy);
- # no libreoffice-bugzilla.pl call for newly created branch
- } else {
- print "$ciabot '$repo' '$_' '$branch_name' $ciaproxy\n";
- }
- }
- close COMMITS;
- }
- else {
- error( "Cannot call git rev-list." );
- }
- }
- }
-}
-
-print timestamp() . " Checking for changes in the libreoffice repo & sending reports to CIA.vc.\n";
-
-my @all_repos = (
- "core",
- "dictionaries",
- "help",
- "si-gui",
- "online",
- "contrib/dev-tools",
-);
-
-if ($test) {
- @all_repos = ("test");
-}
-
-
-my %old_ref;
-foreach my $repo (@all_repos) {
- chdir "$repodir/$repo$suffix";
- # skip any commits received before we started
- qx(git fetch origin);
- qx(git fetch --tags origin);
- $old_ref{$repo} = get_branches();
-}
-
-while ( 1 ) {
- foreach my $repo (@all_repos) {
- chdir "$repodir/$repo$suffix";
-
- # update
- qx(git fetch origin);
- qx(git fetch --tags origin);
- my $new_ref = get_branches();
-
- # report
- report( $repo, $old_ref{$repo}, $new_ref );
- $old_ref{$repo} = $new_ref;
- }
-
- if (!$test) {
- # check every 5 minutes
- print timestamp() . " Sleeping for 1 minute...\n";
- sleep 1*60;
- } else {
- print "Hit enter to report...\n";
- <STDIN>;
- }
-}
-
-# vim:set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/ciabot/setup/install b/ciabot/setup/install
deleted file mode 100755
index feaaed7..0000000
--- a/ciabot/setup/install
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/bash
-
-# Invoke this script as '/home/$username/git/dev-tools/ciabot/setup/install' or
-# so, and it'll handle the update of the code from git to prod.
-#
-# When cloning new repos, use 'git clone --no-checkout https://git.libreoffice.org/foo'
-#
-# After update, use /sbin/initctl list | grep irkerd (or loircbot), sudo /sbin/start irkerd or sudo /sbin/stop irkerd
-# NOTE: it's enough to start/stop irkerd, it'll automatically start/stop loircbot as well, as they are linked.
-
-if [ "$(whoami)" != "ciabot" ]; then
- echo "forgot 'sudo -u ciabot /bin/bash'?"
- exit 1
-fi
-
-origin=$(dirname $0)
-prefix=/home/ciabot/prod
-
-for i in $origin/../../../irker-cia-proxy/irker-cia-proxy.py \
- $origin/../libreoffice-bugzilla2.py \
- $origin/../libreoffice-ciabot.pl \
- $origin/../projmap.json \
- $origin/../run-libreoffice-ciabot.pl \
- $origin/../sigui-bugzilla.pl
-do
- to=$prefix/$(basename $i)
- if ! diff -q -u $i $to; then
- cat $i > $to
- else
- echo "$to is up to date"
- fi
-done
-
-# vim:set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/ciabot/setup/irkerd.conf b/ciabot/setup/irkerd.conf
deleted file mode 100644
index d55afaa..0000000
--- a/ciabot/setup/irkerd.conf
+++ /dev/null
@@ -1,18 +0,0 @@
-# irkerd - Relay for shipping notification to IRC servers
-#
-
-description "Relay for shipping notification to IRC server"
-
-start on filesystem or runlevel [2345]
-stop on runlevel [!2345]
-
-console log
-setuid ciabot
-setgid ciabot
-
-pre-start script
- test -x /usr/bin/irkerd || { stop; exit 0; }
-end script
-
-exec /usr/bin/irkerd -n loircbot
-
diff --git a/ciabot/setup/loircbot.conf b/ciabot/setup/loircbot.conf
deleted file mode 100644
index 70ef8e7..0000000
--- a/ciabot/setup/loircbot.conf
+++ /dev/null
@@ -1,19 +0,0 @@
-# loircbot - monitor gerrit repos and dispatch notification to irc and bugzilla
-#
-
-description "monitor gerrit's repo and dispatch notification to irc and bugzilla"
-
-start on started irkerd
-stop on stopping irkerd
-
-chdir /home/ciabot/prod
-console log
-setuid ciabot
-setgid ciabot
-
-pre-start script
- test -x /home/ciabot/prod/run-libreoffice-ciabot.pl || { stop; exit 0; }
-end script
-
-exec /home/ciabot/prod/run-libreoffice-ciabot.pl
-
diff --git a/ciabot/sigui-bugzilla.pl b/ciabot/sigui-bugzilla.pl
deleted file mode 100755
index 4958a38..0000000
--- a/ciabot/sigui-bugzilla.pl
+++ /dev/null
@@ -1,129 +0,0 @@
-#!/usr/bin/perl -w
-
-use strict;
-
-# A hook script which integrates with bugzilla. It looks for bug IDs in
-# commit messages and adds the commit message as well as a link to the
-# changeset as a comment on the bug.
-
-# This program is released under the terms of the GNU General Public License
-# version 2. A copy of the license may be obtained by emailing the author,
-# or at https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
-#
-# The absolute lack of warranty and other disclaimers as per the license
-# apply.
-#
-# Copyright 2008, Devendra Gera. All rights reserved.
-#
-# Author : Devendra Gera
-
-### user configurable section
-
-our $bugzilla = {};
-
-do $ENV{'HOME'} . "/bin/config.pl";
-
-# The bug_regex should extract the bug id from the commit message and place
-# it in $1
-my $bug_regex = 'fdo#(\d+)';
-
-##### End user configurable section
-
-use vars qw ($tree @parent $author $committer);
-use vars qw ($user $rev $logmsg);
-
-my $repo = $ARGV[0];
-my $sha = $ARGV[1];
-my $branch = $ARGV[2];
-
-use WWW::Bugzilla;
-my $cgiturl = "https://git.libreoffice.org/$repo/commit/$sha";
-$branch = "master";
-my $line;
-
-open COMMIT, "git cat-file commit $sha|" or die "git cat-file commit $sha: $!";
-my $state = 0;
-$logmsg = '';
-while (defined ($line = <COMMIT>)) {
- if ($state == 1) {
- $logmsg .= $line;
- $state++;
- next;
- } elsif ($state > 1) {
- next;
- }
-
- chomp $line;
- unless ($line) {
- $state = 1;
- next;
- }
-
- my ($key, $value) = split(/ /, $line, 2);
- if ($key eq 'tree') {
- $tree = $value;
- } elsif ($key eq 'parent') {
- push(@parent, $value);
- } elsif ($key eq 'author') {
- $author = $value;
- $author =~ s/ <.*//;
- } elsif ($key eq 'committer') {
- $committer = $value;
- $committer =~ s/ <.*//;
- }
-}
-close COMMIT;
-
-my ($bugNr) = ( $logmsg =~ /$bug_regex/ );
-
-die "no bug number in the commit" unless defined $bugNr;
-
-my $comment = <<END_COMMENT;
-$author committed a patch related to this issue.
-It has been pushed to "$branch":
-
-$cgiturl
-
-$logmsg
-
-The patch should be included in the next version of SI-GUI.
-END_COMMENT
-
-# sanitize the comment - we are not handling utf-8 correctly from some reason
-for ( $comment ) {
- s/á/a/g;
- s/Á/A/g;
- s/é/e/g;
- s/ě/e/g;
- s/É/E/g;
- s/Ě/E/g;
- s/í/i/g;
- s/Í/I/g;
- s/ó/o/g;
- s/Ó/O/g;
- s/ú/u/g;
- s/ů/ů/g;
- s/Ú/U/g;
- s/Ů/U/g;
- s/ý/y/g;
- s/Ý/Y/g;
-}
-
-#commit the comment to bugzilla
-my $bz = WWW::Bugzilla->new(
- server => $bugzilla->{ server },
- email => $bugzilla->{ user },
- password => $bugzilla->{ password },
- bug_number => $bugNr
- );
-
-die "cannot connect to bugzilla" unless defined $bz;
-
-my $product = $bz->product;
-
-die "wrong product" unless $product eq 'LibreOffice';
-
-
-$bz->additional_comments( $comment );
-
-$bz->commit;
diff --git a/ciabot/start-ciabot.sh b/ciabot/start-ciabot.sh
deleted file mode 100755
index 8e364e8..0000000
--- a/ciabot/start-ciabot.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#! /bin/bash
-
-cd ~/bin
-
-test -n "`ps ax | grep run-libreoffice-ciabot.pl | grep -v grep`" || screen -d -m run-libreoffice-ciabot.pl
diff --git a/ciabot/start-irker.sh b/ciabot/start-irker.sh
deleted file mode 100755
index 82facc3..0000000
--- a/ciabot/start-irker.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/bash
-
-cd ~/bin/irker
-export PYTHONPATH=irc-8.3
-if test -z "`ps ax | grep irkerd | grep -v grep`"; then
- ./irkerd -n loirkerbot &>irkerd.log &
-fi
More information about the Libreoffice-commits
mailing list