From patchwork Tue Sep 4 08:30:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Bader X-Patchwork-Id: 965830 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 424KmK6WfMz9s7T; Tue, 4 Sep 2018 18:30:57 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1fx6jZ-00009b-3p; Tue, 04 Sep 2018 08:30:49 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1fx6jX-00008x-BB for kernel-team@lists.ubuntu.com; Tue, 04 Sep 2018 08:30:47 +0000 Received: from 1.general.smb.uk.vpn ([10.172.193.28] helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1fx6jX-0000aS-2C for kernel-team@lists.ubuntu.com; Tue, 04 Sep 2018 08:30:47 +0000 From: Stefan Bader To: kernel-team@lists.ubuntu.com Subject: [kteam-tools] NEW: stable/update-kuc-sru-dates Date: Tue, 4 Sep 2018 10:30:46 +0200 Message-Id: <1536049846-16802-1-git-send-email-stefan.bader@canonical.com> X-Mailer: git-send-email 2.7.4 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" Adds a new shell script which updates the entry web page kernel.ubuntu.com/index.html with a new set of dates and commits the result (if differing to before). Signed-off-by: Stefan Bader Acked-by: Kamal Mostafa --- If anybody has a better name, I do not insist on the current one. The script itself takes the SRU cycle date and passes it into gen-sru-announce --html. Then takes that output and inserts it between the repective markers in the kernel.ubuntu.com/index.html file. The path is found relative to the script path. To make this work either the stable directory has to be in the PATH environment or a softlink pointing to it must be present in some path, or the script is called with a full path. -Stefan stable/update-kuc-sru-dates | 74 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100755 stable/update-kuc-sru-dates diff --git a/stable/update-kuc-sru-dates b/stable/update-kuc-sru-dates new file mode 100755 index 0000000..3d8cec5 --- /dev/null +++ b/stable/update-kuc-sru-dates @@ -0,0 +1,74 @@ +#!/bin/bash +#------------------------------------------------------------------------------ +# Update the main web page (index.html) SRU dates section with the output from +# gen-sru-announce --html and commit the changes if successful. +# +# Arguments: +# : This is the YYYY.MM.DD date of the Monday which starts the +# new cycle. +#------------------------------------------------------------------------------ +set -e +if [ -L "$0" ]; then + BINDIR=$(dirname $(readlink $0)) +else + BINDIR=$(dirname "$0") +fi +if [ "$BINDIR" = "." ]; then + BINDIR=$(pwd) +fi + +SRC="$BINDIR/../kernel.ubuntu.com/index.html" +if [ ! -r $SRC ]; then + echo "EE: $SRC cannot be read!" >&2 + exit 1 +fi + +if [ "$1" = "" ]; then + echo "Usage: $(basename $0) " >&2 + exit 1 +fi + +TMP=$(mktemp '/tmp/update-sru-XXXXX') +trap 'test -f "$TMP" && rm "$TMP"' ERR + +gen-sru-announce --html "$1" >>$TMP || ( + echo "EE: Error calling gen-sru-announce:" >&2 + cat $TMP >&2 + exit 1 +) + +awk -v DATA=$TMP ' + match($0, //){ + skip=1 + indent=RSTART-1 + print $0 + while (getline < DATA) { + printf("%*s%s\n", indent, " ", $0) + } + next + } + //{ + skip=0 + } + skip == 0{ + print $0 + } +' $SRC >$SRC.new && mv $SRC.new $SRC + +MSG=$(cat </dev/null)" != "" ]; then + git add $SRC && git commit -s -m"$MSG" +fi + +test -f "$TMP" && rm "$TMP" + +exit 0 +