From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 80213 invoked by alias); 7 Sep 2016 13:28:40 -0000 Mailing-List: contact cygwin-apps-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cygwin-apps-cvs-owner@sourceware.org Received: (qmail 79503 invoked by uid 9795); 7 Sep 2016 13:28:39 -0000 Date: Wed, 07 Sep 2016 13:28:00 -0000 Message-ID: <20160907132839.79402.qmail@sourceware.org> From: jturney@sourceware.org To: cygwin-apps-cvs@sourceware.org Subject: [calm - Cygwin server-side packaging maintenance script] branch master, updated. 20160705-15-g2e76b35 X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: ed2f5db5b59dd6eef84c98adfbdc0fe27b2d3cb6 X-Git-Newrev: 2e76b3557432f1a3283ec9ad8ac9330be0cf6caf X-SW-Source: 2016-q3/txt/msg00032.txt.bz2 https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=2e76b3557432f1a3283ec9ad8ac9330be0cf6caf commit 2e76b3557432f1a3283ec9ad8ac9330be0cf6caf Author: Jon Turney Date: Wed Sep 7 14:25:06 2016 +0100 Move best_version identifcation after check that there are some versions Selection of the best version should take place after assuring there are some versions, in case there are none. https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=fefa2aa0ef2a223327b75b4aab280a3df7a661d0 commit fefa2aa0ef2a223327b75b4aab280a3df7a661d0 Author: Jon Turney Date: Wed Aug 31 18:19:36 2016 +0100 Fix a bit of logging https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=2674ffdbbf22526b0d846bddd36c0d3a5a527f7f commit 2674ffdbbf22526b0d846bddd36c0d3a5a527f7f Author: Jon Turney Date: Tue Aug 30 12:41:21 2016 +0100 Add module for sending mesages to IRC via irked Diff: --- calm/calm.py | 2 +- calm/irk.py | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ calm/package.py | 14 +++++++------- 3 files changed, 56 insertions(+), 8 deletions(-) diff --git a/calm/calm.py b/calm/calm.py index 7c7ff4d..3f7f374 100755 --- a/calm/calm.py +++ b/calm/calm.py @@ -92,7 +92,7 @@ def process(args): # validate the package set if not package.validate_packages(args, packages[arch]): - logging.error("existing %s package set has errors", arch) + logging.error("existing %s package set has errors" % (arch)) error = True if error: diff --git a/calm/irk.py b/calm/irk.py new file mode 100755 index 0000000..b9f8957 --- /dev/null +++ b/calm/irk.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python3 +# +# Tell irked to send a message to an IRC channel +# +# First argument must be a channel URL. If it does not begin with "irc", +# the base URL for freenode is prepended. +# +# SPDX-License-Identifier: BSD-2-Clause + +import json +import socket +import sys + +DEFAULT_SERVER = ("localhost", 6659) +DEFAULT_TARGET = 'cygwin-bots' + + +def connect(server=DEFAULT_SERVER): + return socket.create_connection(server) + + +def send(s, target, message): + data = {"to": target, "privmsg": message} + # print(json.dumps(data)) + s.sendall(bytes(json.dumps(data), "ascii")) + + +def irk(message, target=DEFAULT_TARGET, server=DEFAULT_SERVER): + s = connect(server) + if "irc:" not in target and "ircs:" not in target: + target = "irc://chat.freenode.net/{0}".format(target) + + send(s, target, message) + + s.close() + + +def main(): + message = " ".join(sys.argv[:]) + + try: + irk(message) + except socket.error as e: + sys.stderr.write("irk: write to server failed: %r\n" % e) + sys.exit(1) + +if __name__ == '__main__': + main() diff --git a/calm/package.py b/calm/package.py index 6dbceb4..e198c9e 100755 --- a/calm/package.py +++ b/calm/package.py @@ -483,13 +483,6 @@ def validate_packages(args, packages): if l in packages[p].override_hints: packages[p].stability[l] = packages[p].override_hints[l] - # identify a 'best' version to take certain information from: this is - # the curr version, if we have one, otherwise, the highest version. - if 'curr' in packages[p].stability: - packages[p].best_version = packages[p].stability['curr'] - else: - packages[p].best_version = sorted(packages[p].vermap.keys(), key=lambda v: SetupVersion(v), reverse=True)[0] - # the package must have some versions if not packages[p].stability: logging.error("package '%s' doesn't have any versions" % (p)) @@ -498,6 +491,13 @@ def validate_packages(args, packages): elif 'curr' not in packages[p].stability and 'curr' not in getattr(args, 'okmissing', []): logging.warning("package '%s' doesn't have a curr version" % (p)) + # identify a 'best' version to take certain information from: this is + # the curr version, if we have one, otherwise, the highest version. + if 'curr' in packages[p].stability: + packages[p].best_version = packages[p].stability['curr'] + else: + packages[p].best_version = sorted(packages[p].vermap.keys(), key=lambda v: SetupVersion(v), reverse=True)[0] + # If, for every stability level, the install tarball is empty and there # is no source tarball, we should probably be marked obsolete if not packages[p].skip: