From patchwork Thu Oct 14 16:41:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Moreno X-Patchwork-Id: 1541022 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=fNu7ybBu; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HVZtj1sNlz9sNH for ; Fri, 15 Oct 2021 03:42:04 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id BD899405AC; Thu, 14 Oct 2021 16:42:02 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id odwt-LN7poU2; Thu, 14 Oct 2021 16:42:01 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id D9E2140262; Thu, 14 Oct 2021 16:42:00 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id B9354C0011; Thu, 14 Oct 2021 16:42:00 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 4DA64C000D for ; Thu, 14 Oct 2021 16:41:59 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 3C6EB6069B for ; Thu, 14 Oct 2021 16:41:59 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp3.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4doE0mj6XIiz for ; Thu, 14 Oct 2021 16:41:58 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp3.osuosl.org (Postfix) with ESMTPS id 69636605FE for ; Thu, 14 Oct 2021 16:41:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634229717; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zgrpFMFgfpcgKi/GaE/SYY1hjS2iaOBEnImQa7WRj1Y=; b=fNu7ybBuJVK7l1ixcH0lZ5XdM0DuPG55rNHusdV/vcGxn28SdXwgj/TASQMZNSZv3OTLSg WJ+tweFPsiWhzod07978RxgdEKOgJuVzihnMmSJYcLbpqhc3XgiUCMvlSRo1+H5oF/AmFr BIOxgvbqW4KN92DztfzOQRNxw3TFZS8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-300-vF0d-0ekOPGvRfBq5a2qTA-1; Thu, 14 Oct 2021 12:41:54 -0400 X-MC-Unique: vF0d-0ekOPGvRfBq5a2qTA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5EA751966322 for ; Thu, 14 Oct 2021 16:41:53 +0000 (UTC) Received: from amorenoz.users.ipa.redhat.com (unknown [10.39.193.133]) by smtp.corp.redhat.com (Postfix) with ESMTP id 23D3A2C175; Thu, 14 Oct 2021 16:41:51 +0000 (UTC) From: Adrian Moreno To: dev@openvswitch.org Date: Thu, 14 Oct 2021 18:41:26 +0200 Message-Id: <20211014164130.606220-2-amorenoz@redhat.com> In-Reply-To: <20211014164130.606220-1-amorenoz@redhat.com> References: <20211014164130.606220-1-amorenoz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=amorenoz@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: dceara@redhat.com Subject: [ovs-dev] [RFC ovn 1/5] manpages.mk: fix dependencies path X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Currently, if "make" is run after the project is built, the root manpage (ovn-detrace.1) is rebuilt unnecessarily. The reason is that its dependencies are wrong: files such as lib/common.man or lib/ovs.tmac do not exist in the project's root path so "make" will constantly rebuild the manpage target. Instead, those dependencies live in $ovs_src. Modify sodepends.py to generate a makefile that contains the variable names that point the right paths. Signed-off-by: Adrian Moreno --- Makefile.am | 2 +- build-aux/sodepends.py | 45 ++++++++++++++++++++++++++++++++++++++---- manpages.mk | 12 +++++------ 3 files changed, 48 insertions(+), 11 deletions(-) diff --git a/Makefile.am b/Makefile.am index 0169c96ef..3b0df8393 100644 --- a/Makefile.am +++ b/Makefile.am @@ -425,7 +425,7 @@ CLEANFILES += flake8-check include $(srcdir)/manpages.mk $(srcdir)/manpages.mk: $(MAN_ROOTS) build-aux/sodepends.py $(OVS_SRCDIR)/python/build/soutil.py - @PYTHONPATH=$(OVS_SRCDIR)/python$(psep)$$PYTHONPATH$(psep)$(srcdir)/python $(PYTHON3) $(srcdir)/build-aux/sodepends.py -I. -I$(srcdir) -I$(OVS_MANDIR) $(MAN_ROOTS) >$(@F).tmp + @PYTHONPATH=$(OVS_SRCDIR)/python$(psep)$$PYTHONPATH$(psep)$(srcdir)/python $(PYTHON3) $(srcdir)/build-aux/sodepends.py -I. -Isrcdir,$(srcdir) -IOVS_MANDIR,$(OVS_MANDIR) $(MAN_ROOTS) >$(@F).tmp @if cmp -s $(@F).tmp $@; then \ touch $@; \ rm -f $(@F).tmp; \ diff --git a/build-aux/sodepends.py b/build-aux/sodepends.py index 45812bcbd..343fda1af 100755 --- a/build-aux/sodepends.py +++ b/build-aux/sodepends.py @@ -16,9 +16,44 @@ from build import soutil import sys +import getopt +import os -def sodepends(include_dirs, filenames, dst): +def parse_include_dirs(): + include_dirs = [] + options, args = getopt.gnu_getopt(sys.argv[1:], 'I:', ['include=']) + for key, value in options: + if key in ['-I', '--include']: + include_dirs.append(value.split(',')) + else: + assert False + + include_dirs.append(['.']) + return include_dirs, args + + +def find_include_file(include_info, name): + for info in include_info: + if len(info) == 2: + dir = info[1] + var = "$(%s)/" % info[0] + else: + dir = info[0] + var = "" + + file = "%s/%s" % (dir, name) + try: + os.stat(file) + return var + name + except OSError: + pass + sys.stderr.write("%s not found in: %s\n" % + (name, ' '.join(str(include_info)))) + return None + + +def sodepends(include_info, filenames, dst): ok = True print("# Generated automatically -- do not modify! " "-*- buffer-read-only: t -*-") @@ -28,6 +63,7 @@ def sodepends(include_dirs, filenames, dst): continue # Open file. + include_dirs = [info[0] for info in include_info] fn = soutil.find_file(include_dirs, toplevel) if not fn: ok = False @@ -47,8 +83,9 @@ def sodepends(include_dirs, filenames, dst): name = soutil.extract_include_directive(line) if name: - if soutil.find_file(include_dirs, name): - dependencies.append(name) + include_file = find_include_file(include_info, name) + if include_file: + dependencies.append(include_file) else: ok = False @@ -62,6 +99,6 @@ def sodepends(include_dirs, filenames, dst): if __name__ == '__main__': - include_dirs, args = soutil.parse_include_dirs() + include_dirs, args = parse_include_dirs() error = not sodepends(include_dirs, args, sys.stdout) sys.exit(1 if error else 0) diff --git a/manpages.mk b/manpages.mk index 9f7a0ced3..9e3e75fe2 100644 --- a/manpages.mk +++ b/manpages.mk @@ -2,10 +2,10 @@ utilities/ovn-detrace.1: \ utilities/ovn-detrace.1.in \ - lib/common-syn.man \ - lib/common.man \ - lib/ovs.tmac + $(OVS_MANDIR)/lib/common-syn.man \ + $(OVS_MANDIR)/lib/common.man \ + $(OVS_MANDIR)/lib/ovs.tmac utilities/ovn-detrace.1.in: -lib/common-syn.man: -lib/common.man: -lib/ovs.tmac: +$(OVS_MANDIR)/lib/common-syn.man: +$(OVS_MANDIR)/lib/common.man: +$(OVS_MANDIR)/lib/ovs.tmac: