From patchwork Sun Jan 27 16:25:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddhesh Poyarekar X-Patchwork-Id: 1031598 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-99566-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sourceware.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="usDanOgH"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43ndRc5mByz9s7h for ; Mon, 28 Jan 2019 03:26:03 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; q=dns; s=default; b=R1X E8kQd4iffS3TZwYWSoLR+mwBeXi1sNZhD4axhCC+kvTZ21jN0Dgp0Gnci4lgSE97 HbmkApC7WOMrD6q6ueQlA17wGzi+Ff+CGflxIAN0AY70X0uugBjoLT/5fL45ktlm mdtTGV9FhJxBjE2PItEnCYivQZDARbphHzescHqI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; s=default; bh=SN7O2Ca26 Fe05A9xBOXyl6lOPL0=; b=usDanOgHuPsfMvz7gtAjewvIOcFqqfS8Gvaj1Chvg PZCXPmx09KIfrCjMjxJoPtPdjRh4W4H4qjGJgC6wK/ki9PZqQKC0e4m/jTYEaUld yE34X0IfdKfUWAcj2bUKPqCVWx//WkMxdM8ucZtLmZ/kCWnRX1opyGWBOSjWzqYX rY= Received: (qmail 24081 invoked by alias); 27 Jan 2019 16:25:57 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 24067 invoked by uid 89); 27 Jan 2019 16:25:57 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_NEUTRAL autolearn=ham version=3.3.2 spammy=identify, weak, quality, Hx-spam-relays-external:ESMTPA X-HELO: palegreen.birch.relay.mailchannels.net X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Whimsical-Duck: 4e3541c67c1687c5_1548606352743_3008960202 X-MC-Loop-Signature: 1548606352743:2513030497 X-MC-Ingress-Time: 1548606352743 X-DH-BACKEND: pdx1-sub0-mail-a21 From: Siddhesh Poyarekar To: libc-alpha@sourceware.org Cc: carlos@redhat.com, joseph@codesourcery.com, Siddhesh Poyarekar Subject: [2.30][RFC] vcs-to-changelog quirks file for glibc Date: Sun, 27 Jan 2019 21:55:22 +0530 Message-Id: <20190127162522.5671-1-siddhesh@sourceware.org> MIME-Version: 1.0 X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: 0 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedtledrieekgdekkecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucggtfgfnhhsuhgsshgtrhhisggvpdfftffgtefojffquffvnecuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffoggfgsedtkeertdertddtnecuhfhrohhmpefuihguughhvghshhcurfhohigrrhgvkhgrrhcuoehsihguughhvghshhesshhouhhrtggvfigrrhgvrdhorhhgqeenucffohhmrghinhepghhnuhdrohhrghenucfkphepuddvfedrvdehvddrvddtvddrudejvdenucfrrghrrghmpehmohguvgepshhmthhppdhhvghloheplhhinhgrrhhoqdhlrghpthhophdrihhnthhrrgdrrhgvshgvrhhvvgguqdgsihhtrdgtohhmpdhinhgvthepuddvfedrvdehvddrvddtvddrudejvddprhgvthhurhhnqdhprghthhepufhiugguhhgvshhhucfrohihrghrvghkrghruceoshhiugguhhgvshhhsehsohhurhgtvgifrghrvgdrohhrgheqpdhmrghilhhfrhhomhepshhiugguhhgvshhhsehsohhurhgtvgifrghrvgdrohhrghdpnhhrtghpthhtohepshhiugguhhgvshhhsehsohhurhgtvgifrghrvgdrohhrghenucevlhhushhtvghrufhiiigvpedt A vcs-to-changelog script set has been posted on the gnulib mailing list (archive not updated yet) and this script uses a quirks file in the project for a number of things including determining the target VCS and macro substitutions that are needed to allow the frontend parser in the script to work correctly. This is the glibc quirks file that makes a number of substitutions including all the libc-symbol hack macros. --- If all goes well, I intend to add this quirks file immediately upon opening 2.30 development on master so that we don't have to put in ChangeLog entries from 2.30 onwards. Does that sound acceptable? This is of course assuming that the script is at least accepted in principle in gnulib, i.e. the approach is considered acceptable and we only need to iterate on making sure that code quality standards are met. Siddhesh vcstocl_quirks.py | 64 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 vcstocl_quirks.py diff --git a/vcstocl_quirks.py b/vcstocl_quirks.py new file mode 100644 index 0000000000..b29ea56031 --- /dev/null +++ b/vcstocl_quirks.py @@ -0,0 +1,64 @@ +#!/usr/bin/python3 +# VCSToChangeLog Quirks for the GNU C Library. + +# Copyright (C) 2019 Free Software Foundation, Inc. +# +# The GNU C Library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# The GNU C Library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with the GNU C Library; if not, see +# . + +from frontend_c import Frontend +from vcs_to_changelog import ProjectQuirks +import re + +class GlibcProjectQuirks(ProjectQuirks): + repo = 'git' + + IGNORE_LIST = [ + 'ChangeLog', + 'sysdeps/x86_64/dl-trampoline.h' + ] + + MACRO_QUIRKS = \ + [{'orig': r'ElfW\((\w+)\)', 'sub': r'\1__ELF_NATIVE_CLASS_t'}, + {'orig': r'(libc_freeres_fn)\s*\((\w+)\)', 'sub': r'static void \1__\2 (void)'}, + {'orig': r'(IMPL)\s*\((\w+), .*\)$', 'sub': r'static void \1__\2 (void) {}'}, + {'orig': r'__(BEGIN|END)_DECLS', 'sub': r''}, + {'orig': 'weak_function', 'sub': '__attribute__ ((weak))'}, + {'orig': r'ATTRIBUTE_(CONST|MALLOC|PURE|FORMAT)', + 'sub': r'__attribute__ ((\1))'}, + {'orig': r'__THROW', 'sub': r'__attribute__ ((__nothrow__ __LEAF))'}, + {'orig': r'__THROWNL', 'sub': r'__attribute__ ((__nothrow__))'}, + {'orig': r'([^_])attribute_(\w+)', 'sub': r'\1__attribute__ ((\2))'}, + {'orig': r'^attribute_(\w+)', 'sub': r'__attribute__ ((\1))'}] + + def __init__(self, debug): + self.debug = debug + ''' Build a list of macro calls used for symbol versioning and attributes. + + glibc uses a set of macro calls that do not end with a semi-colon and hence + breaks our parser. Identify those calls from include/libc-symbols.h and + filter them out. + ''' + with open('include/libc-symbols.h') as macrofile: + op = macrofile.readlines() + op = Frontend.remove_comments(self, op) + self.C_MACROS = [re.sub(r'.*define (\w+).*', r'\1', x[:-1]) for x in op \ + if 'define ' in x] + + super().__init__() + +def get_project_quirks(debug): + ''' Accessor function. + ''' + return GlibcProjectQuirks(debug)