From patchwork Thu Oct 21 09:10:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Adri=C3=A1n_Moreno?= X-Patchwork-Id: 1544222 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=GlBPDBgr; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.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 4HZhY660ffz9sRR for ; Thu, 21 Oct 2021 20:11:06 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 491CD407EC; Thu, 21 Oct 2021 09:11:04 +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 fbYw0PS62KNm; Thu, 21 Oct 2021 09:11:03 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id 6CDB9407BA; Thu, 21 Oct 2021 09:11:02 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id A28FBC0038; Thu, 21 Oct 2021 09:11:00 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id ED4C6C0036 for ; Thu, 21 Oct 2021 09:10:59 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id B6E77404D2 for ; Thu, 21 Oct 2021 09:10:59 +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 g1VmIOB48ROT for ; Thu, 21 Oct 2021 09:10:59 +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.129.124]) by smtp4.osuosl.org (Postfix) with ESMTPS id F405C40491 for ; Thu, 21 Oct 2021 09:10:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634807457; 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=GlBPDBgrxKowditcqteB8bWxaVg64FEwb9SaNGca44aL/nAYKY0dwrq0kiBLOCpfHs+MrN hVveO7woXC0hHsZowisVv2tJ3MjRCoHpMGzMmiWkG54e/07NaNdVlLbycIRmlqGfbVZgSI Fbn2kHGf7YwqAvNuKVrhA2EHsBFUpPI= 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-17-uW2D9LXsPmuAawOPTGk9qg-1; Thu, 21 Oct 2021 05:10:54 -0400 X-MC-Unique: uW2D9LXsPmuAawOPTGk9qg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CDC3357227; Thu, 21 Oct 2021 09:10:53 +0000 (UTC) Received: from amorenoz.users.ipa.redhat.com (unknown [10.39.194.83]) by smtp.corp.redhat.com (Postfix) with ESMTP id 31F5417A7E; Thu, 21 Oct 2021 09:10:51 +0000 (UTC) From: Adrian Moreno To: dev@openvswitch.org Date: Thu, 21 Oct 2021 11:10:03 +0200 Message-Id: <20211021091007.460641-2-amorenoz@redhat.com> In-Reply-To: <20211021091007.460641-1-amorenoz@redhat.com> References: <20211021091007.460641-1-amorenoz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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: blp@ovn.org, horms@debian.org, dceara@redhat.com Subject: [ovs-dev] [PATCH ovn v1 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 Acked-by: Numan Siddique Acked-by: Dumitru Ceara --- 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: