From patchwork Tue Jan 16 08:23:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vyacheslav Yurkov X-Patchwork-Id: 37901 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71827C47077 for ; Tue, 16 Jan 2024 08:24:33 +0000 (UTC) Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) by mx.groups.io with SMTP id smtpd.web11.8365.1705393470969641780 for ; Tue, 16 Jan 2024 00:24:31 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=QU0y9/TP; spf=pass (domain: gmail.com, ip: 209.85.221.46, mailfrom: uvv.mail@gmail.com) Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-33770772136so5581110f8f.3 for ; Tue, 16 Jan 2024 00:24:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705393469; x=1705998269; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=UXV3OfWGbYuxMUonLRy130I4B5lOhS5MWWL1Ga39/tk=; b=QU0y9/TPDsXk3kCXU/AoxUq1mVyS/+YuELb13rZ7GIEXTokWvV+EFejcJJmKIcAiSf 56GAhVe2ejCkLjHitOz0yKpkmqXwwf0AIQakrUykeV6+eUgtKOnfXpEThv++vI/XOIJY xOODh9u9ISMU4KbzSnOc6y/9+wSQjAGEpkl499yTpmE7KiwlylobnndwYzUkF/+b/28S 8IgqaznUweK/b+mkOEY6KDjK5qouFqXSYlePLntMbWBotonGBd00fg0tpiYlNW/D1Gup OBvDn09smYF6RHLMElffSHdSvqLJ+p8eH5X+Uk8s2ICFurUftD4sjKXvPnQwzn45N71z Tqmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705393469; x=1705998269; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=UXV3OfWGbYuxMUonLRy130I4B5lOhS5MWWL1Ga39/tk=; b=TMpaQ2wx8v0zKK7dykVj6erX3QNbqml5RwL99tuImTZjSE70HgFaH5BWW1kgoqWWst jo3NsPkiHbNkJwzIPBNZ2WEK0F3FcEHsInZM2sakbeDhRduV/1DnuiWAcGftNiiRwyq5 CBFdNf3y3xdFHAkb9L5rqy3UOa5y44LNomcqWcK6PAFw9Lzm/qR8jEhpPfxM+VLrvGKx +ey65WrShmsV3HnvrYTGJdOo39r0goFjbWJUHk5akU5VHl8Sw24Yreqm4ZIyxSjs6pgs tooivi/kKHpvLESrMhNkZhcbl9DfifOyEjszBHGl1cNsU7BLboXk9IbHJdNiCDM9KE3m L8Rg== X-Gm-Message-State: AOJu0Yxi3Z4MnNSEVaBfuZ/SX4CY+om25vUDPKp8e7zBQ2gAMjucBUAu MjxlUvQxImePbSYsc5X0S+2ltfEVScNTQw== X-Google-Smtp-Source: AGHT+IHSrYhtTp1rdRHeFty7IDtZ2tw8vfIokL1u1PA8m2GiFJpnu+l8D7fCOTBkxjSG/2cyymHUuQ== X-Received: by 2002:a5d:4b05:0:b0:336:6900:96e2 with SMTP id v5-20020a5d4b05000000b00336690096e2mr3192387wrq.72.1705393468867; Tue, 16 Jan 2024 00:24:28 -0800 (PST) Received: from slackware.local ([154.47.27.145]) by smtp.gmail.com with ESMTPSA id dv1-20020a0560000d8100b00337b55ed9afsm1091923wrb.95.2024.01.16.00.24.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 00:24:28 -0800 (PST) From: Vyacheslav Yurkov To: Openembedded-core@lists.openembedded.org Cc: Lukas Funke , Vyacheslav Yurkov Subject: [PATCH v2 1/9] recipetool: Don't fail on local go modules Date: Tue, 16 Jan 2024 09:23:19 +0100 Message-Id: <20240116082327.128990-1-uvv.mail@gmail.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 16 Jan 2024 08:24:33 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/193824 Local modules are usually referenced with a 'replace' directive in go.mod file. If that's the case, remove them from populating SRC_URI. Signed-off-by: Vyacheslav Yurkov --- scripts/lib/recipetool/create_go.py | 36 ++++++++++++++++++----------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/scripts/lib/recipetool/create_go.py b/scripts/lib/recipetool/create_go.py index 21dcb41271..668a24b8dd 100644 --- a/scripts/lib/recipetool/create_go.py +++ b/scripts/lib/recipetool/create_go.py @@ -504,7 +504,7 @@ class GoRecipeHandler(RecipeHandler): return inline_fcn, commit - def __go_handle_dependencies(self, go_mod, localfilesdir, extravalues, d): + def __go_handle_dependencies(self, go_mod, srctree, localfilesdir, extravalues, d): src_uris = [] src_revs = [] @@ -525,6 +525,27 @@ class GoRecipeHandler(RecipeHandler): return src_rev + # we first go over replacement list, because we are essentialy + # interested only in the replaced path + if go_mod['Replace']: + for replacement in go_mod['Replace']: + oldpath = replacement['Old']['Path'] + path = replacement['New']['Path'] + version = '' + if 'Version' in replacement['New']: + version = replacement['New']['Version'] + + if os.path.exists(os.path.join(srctree, path)): + # the module refers to the local path, remove it from requirement list + # because it's a local module + go_mod['Require'][:] = [v for v in go_mod['Require'] if v.get('Path') != oldpath] + else: + # Replace the path and the version, so we don't iterate replacement list anymore + for require in go_mod['Require']: + if require['Path'] == oldpath: + require.update({'Path': path, 'Version': version}) + break + for require in go_mod['Require']: path = require['Path'] version = require['Version'] @@ -534,17 +555,6 @@ class GoRecipeHandler(RecipeHandler): src_uris.append(inline_fcn) src_revs.append(generate_src_rev(path, version, commithash)) - if go_mod['Replace']: - for replacement in go_mod['Replace']: - oldpath = replacement['Old']['Path'] - path = replacement['New']['Path'] - version = replacement['New']['Version'] - - inline_fcn, commithash = self.__generate_srcuri_inline_fcn( - path, version, oldpath) - src_uris.append(inline_fcn) - src_revs.append(generate_src_rev(path, version, commithash)) - pn, _ = determine_from_url(go_mod['Module']['Path']) go_mods_basename = "%s-modules.inc" % pn @@ -693,7 +703,7 @@ class GoRecipeHandler(RecipeHandler): self.__rewrite_src_uri(lines_before, ["file://modules.txt"]) - self.__go_handle_dependencies(go_mod, localfilesdir, extravalues, d) + self.__go_handle_dependencies(go_mod, srctree, localfilesdir, extravalues, d) lines_before.append("require ${BPN}-modules.inc") # Do generic license handling From patchwork Tue Jan 16 08:23:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vyacheslav Yurkov X-Patchwork-Id: 37902 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7266AC47258 for ; Tue, 16 Jan 2024 08:24:33 +0000 (UTC) Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) by mx.groups.io with SMTP id smtpd.web11.8366.1705393471680879699 for ; Tue, 16 Jan 2024 00:24:31 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=RCic81z/; spf=pass (domain: gmail.com, ip: 209.85.221.48, mailfrom: uvv.mail@gmail.com) Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-33694bf8835so7299063f8f.3 for ; Tue, 16 Jan 2024 00:24:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705393470; x=1705998270; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=W8TACjfaP5Orlf3PVEjOTKt/7jhtJJert9otb48ELqY=; b=RCic81z/CZu1bqrUQ7vjV+uUSdaL9B+t/iOJkGzk6D4BOBI3S0eqTLfjh8DJasY95C fy7xWRSEZ7pOgJfSzu32F0la8kRXQaFPHfbTAslOLx9GNGk5aydJH0UkAVGgWLnqD3Ar PcXK7mjlVbsMuOY0cFpWuOWEPFA3EKOo+t/iD+xXfF+wnGBGYFI5Pp9CrbI+Tilrjnn7 kpLbxJSrSOVs5kzhx6oGF7m2KmC1bjC3sg//vJJvuOZZLqwWrDg9QQ3ut32KlNbgKO6R SH3Ia2wIldWzvzcehL/spkfsixYvQMRVV690/nQbB90Tf/Tq24bLr6D+oOfL3qNSJZ50 cuvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705393470; x=1705998270; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=W8TACjfaP5Orlf3PVEjOTKt/7jhtJJert9otb48ELqY=; b=QGbV53EHmQS7Fn8/BaZ5AomszX4UqpXalJoOAYBd+J3YtQiq0ABABCOn0D833YgklL mEyP//rgcfipHMvFEjO3HcbjBgJa5YJk0J7zvqzvk7gYiR6LyqKtLVvEjbpb3ghnfcfE DdlPn1zl5zwbNOaIey8zo16tUCctXtSwdLfjCUDMM72Es8VYv9W6f1ouGq2mdwwKaSWz mbhdLQRcxZZbNKIVEQ/Sf6vvNWdVYay7WN4NpTvBmIvaq3MSxk/y8GkZ6n7yt9D0CK7r dxD7sc67n+3MRpmt90YH+VCGsvaAZWJfmM89wAf6A+0SyVSj613/6M+KsLNXLaIWTlr6 158A== X-Gm-Message-State: AOJu0YzmHlp1dVJyebou0te4PYe2yD/gaqyKCwaLK6JPh4zvI7zy21Iu v3NtzYEn3sOyY20dqXIcUtk0DiISu8LiSQ== X-Google-Smtp-Source: AGHT+IE4fyZMT9zb7oCGbz7JUrCOOjjy7L29MCbNIYCjR+WG9qpPvFPf6NmIsxpKMpgiGcA0z+YpCg== X-Received: by 2002:adf:f049:0:b0:337:bd95:b0f9 with SMTP id t9-20020adff049000000b00337bd95b0f9mr126829wro.35.1705393469633; Tue, 16 Jan 2024 00:24:29 -0800 (PST) Received: from slackware.local ([154.47.27.145]) by smtp.gmail.com with ESMTPSA id dv1-20020a0560000d8100b00337b55ed9afsm1091923wrb.95.2024.01.16.00.24.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 00:24:29 -0800 (PST) From: Vyacheslav Yurkov To: Openembedded-core@lists.openembedded.org Cc: Lukas Funke , Vyacheslav Yurkov Subject: [PATCH v2 2/9] classes: go-vendor: Reference local modules Date: Tue, 16 Jan 2024 09:23:20 +0100 Message-Id: <20240116082327.128990-2-uvv.mail@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20240116082327.128990-1-uvv.mail@gmail.com> References: <20240116082327.128990-1-uvv.mail@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 16 Jan 2024 08:24:33 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/193825 Create symlinks for local modules, which are usually not referenced in the SRC_URI, but still expected to be found in the vendor directory during the build. Signed-off-by: Vyacheslav Yurkov --- meta/classes/go-vendor.bbclass | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/meta/classes/go-vendor.bbclass b/meta/classes/go-vendor.bbclass index 2426bddfba..b965428dd1 100644 --- a/meta/classes/go-vendor.bbclass +++ b/meta/classes/go-vendor.bbclass @@ -169,6 +169,7 @@ python do_go_vendor() { fetched_paths.remove('.') vendored_paths = set() + replaced_paths = dict() with open(modules_txt_src) as f: for line in f: if not line.startswith("#"): @@ -182,6 +183,15 @@ python do_go_vendor() { vendored_paths.add(topdir) topdir = os.path.dirname(topdir) + else: + replaced_module = line.split("=>") + if len(replaced_module) > 1: + # This module has been replaced, use a local path + # we parse the line that has a pattern "# module-name [module-version] => local-path + actual_path = replaced_module[1].strip() + vendored_name = replaced_module[0].split()[1] + bb.debug(1, "added vendored name %s for actual path %s" % (vendored_name, actual_path)) + replaced_paths[vendored_name] = actual_path for path in fetched_paths: if path not in vendored_paths: @@ -189,7 +199,13 @@ python do_go_vendor() { if os.path.exists(realpath): shutil.rmtree(realpath) - # Create a symlink the the actual directory + for vendored_name, replaced_path in replaced_paths.items(): + symlink_target = os.path.join(source_dir, *['src', go_import, replaced_path]) + symlink_name = os.path.join(vendor_dir, vendored_name) + bb.debug(1, "vendored name %s, symlink name %s" % (vendored_name, symlink_name)) + os.symlink(symlink_target, symlink_name) + + # Create a symlink to the actual directory os.symlink(vendor_dir, linkname) } From patchwork Tue Jan 16 08:23:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vyacheslav Yurkov X-Patchwork-Id: 37903 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7DA94C4706C for ; Tue, 16 Jan 2024 08:24:33 +0000 (UTC) Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) by mx.groups.io with SMTP id smtpd.web10.8417.1705393472435345957 for ; Tue, 16 Jan 2024 00:24:32 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ilFkLwwq; spf=pass (domain: gmail.com, ip: 209.85.221.46, mailfrom: uvv.mail@gmail.com) Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-3376555b756so5259079f8f.0 for ; Tue, 16 Jan 2024 00:24:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705393471; x=1705998271; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3itfnlLN5evVjWWwpCRFRFpM5eFRIG6Ijin8ZetZsTQ=; b=ilFkLwwqBArWMuAkSqhmYHSJ9ms33r3VSqKnypaPdVSqJtKYL5dGOapuB3gsSemoAK 0VRkz8F8tYz+AXISB8vO6q658dLAytEP2M61iD7ygo0pVjZ1ROk3L4ukITzTlYJhLGfU E2hXRyUBiSRCiOppX70CKlMgzZvIJr8zNJaVUjJfUSTo2GtjPtsXa9FxQvcz9ZwQibwl aW6b/9kDe1YzScef6ji44PWDpX2GwYX8P/0j3LtNVyE2tMhLufb7jN47HgnLmGsC30HO rIrDI6OvawbUpWOCOLCp+JdL9jSjtU85hpggecKhiqBHg0hUTMAcWnWQjilWKCCOahxy ocWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705393471; x=1705998271; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3itfnlLN5evVjWWwpCRFRFpM5eFRIG6Ijin8ZetZsTQ=; b=g7anTTe+rm30rq3UBR6gDnRxDle7CRhfpV1lHRuKTVD9LFtt64NEyo8Pe8+mNGLXOl iOgJvRZyA01Ozcxw8dg0FdvpLungY5/fSYU3Tg0kayrtLY6mLxh7ZJJs1ehGU9vb4x8S WUvdnq3JdANTUHVgTZR1iwVgGUIUhxcz10aEqI2CJPJWdzzPLcAClimC6fFhbdQh5r79 8NrHFOq9h6FO8hR38ZCrMVgnQvabJf3j+cJAAhv+varVA6ygC85KOmeVIGcu/uxtw8Kj nXm+CyXxuTllWedk1pikqs7DAFQqKLqdUbEazzxbaAQ9e3E4Y7Y7F4jgExzKjr5ig0vf GRxA== X-Gm-Message-State: AOJu0Yzpu2tUdQRPL7XBny9IhMTgX8tgqsQyczjyq4xqRIrcK5yyJwGM lrdOEOjiHVZ8Bm3dss6QvWpSj4RCdkqcbg== X-Google-Smtp-Source: AGHT+IHf/Mcq9fYP8SqhirhcvnVjJ+0l1qF8MYRvO8wYdBuHF988nmV8vt3omHg+ODGt20NHWE07wA== X-Received: by 2002:adf:a2d5:0:b0:336:5b1e:ee66 with SMTP id t21-20020adfa2d5000000b003365b1eee66mr3545832wra.31.1705393470679; Tue, 16 Jan 2024 00:24:30 -0800 (PST) Received: from slackware.local ([154.47.27.145]) by smtp.gmail.com with ESMTPSA id dv1-20020a0560000d8100b00337b55ed9afsm1091923wrb.95.2024.01.16.00.24.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 00:24:30 -0800 (PST) From: Vyacheslav Yurkov To: Openembedded-core@lists.openembedded.org Cc: Lukas Funke , Vyacheslav Yurkov Subject: [PATCH v2 3/9] classes: go-vendor: Handle modules from the same repo Date: Tue, 16 Jan 2024 09:23:21 +0100 Message-Id: <20240116082327.128990-3-uvv.mail@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20240116082327.128990-1-uvv.mail@gmail.com> References: <20240116082327.128990-1-uvv.mail@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 16 Jan 2024 08:24:33 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/193826 Take into account module version when populating vendor directory, because a module with the same URL but with a different version tag could be used as an indirect dependency. Signed-off-by: Vyacheslav Yurkov --- meta/classes/go-vendor.bbclass | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/meta/classes/go-vendor.bbclass b/meta/classes/go-vendor.bbclass index b965428dd1..48f4d1041c 100644 --- a/meta/classes/go-vendor.bbclass +++ b/meta/classes/go-vendor.bbclass @@ -103,18 +103,17 @@ python do_go_vendor() { pathMajor = fetcher.ud[url].parm.get('go_pathmajor') pathMajor = None if not pathMajor else pathMajor.strip('/') - if not repo in modules: - modules[repo] = { "version": version, + if not (repo, version) in modules: + modules[(repo, version)] = { "repo_path": os.path.join(import_dir, p), "module_path": module_path, "subdir": subdir, "pathMajor": pathMajor } - for module_key in sorted(modules): + for module_key, module in modules.items(): # only take the version which is explicitly listed # as a dependency in the go.mod - module = modules[module_key] module_path = module['module_path'] rootdir = module['repo_path'] subdir = module['subdir'] @@ -139,7 +138,7 @@ python do_go_vendor() { dst = os.path.join(vendor_dir, module_path) bb.debug(1, "cp %s --> %s" % (src, dst)) - shutil.copytree(src, dst, symlinks=True, \ + shutil.copytree(src, dst, symlinks=True, dirs_exist_ok=True, \ ignore=shutil.ignore_patterns(".git", \ "vendor", \ "*._test.go")) From patchwork Tue Jan 16 08:23:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vyacheslav Yurkov X-Patchwork-Id: 37905 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D9E2C47077 for ; Tue, 16 Jan 2024 08:24:43 +0000 (UTC) Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) by mx.groups.io with SMTP id smtpd.web10.8418.1705393473303242464 for ; Tue, 16 Jan 2024 00:24:33 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ghtbSfQx; spf=pass (domain: gmail.com, ip: 209.85.221.41, mailfrom: uvv.mail@gmail.com) Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-3376d424a79so7493683f8f.1 for ; Tue, 16 Jan 2024 00:24:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705393471; x=1705998271; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cwrUDtV8/BajkFaRwpvEHVv9phw5OPr7Z/VsfLtdVJc=; b=ghtbSfQxPbk/0dFYN0ukHxwbAiZBhwUc/+JcADOR/wvHmMn2j0TybN+j0EOpEX7UKx JhRLbJaQa1hjaEjZ/CXTJ+Le9RjQz0XoHQA+zx40armodeXEW+Td0XjMZQncUBVncyNX jcQRd3JfztauMZsXep8ZN9qHRON9DM6yX/9TgDN3rz8zZ5jvcT730TzGz3WWwAOHZQ9W UeqRX2mEjwx6fa7e3ht0U8ccjY71noo/nWBd4mxKD36alk7J+AlUlsLvpsWIlU2LpGaR m5ZGMs0HPYkPFWIg/UOAQ3VBUIREvC/Pdnbbt8q1Ssjh+LN/jpBVf17WJ+NGesZHdgy2 jdXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705393471; x=1705998271; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cwrUDtV8/BajkFaRwpvEHVv9phw5OPr7Z/VsfLtdVJc=; b=NRXJHG/mWcxq6m0LQAN1OKf86xtp96kjkb3ea3i2Y9M25O/49l3/1Lrrc3ZjIHjAqE Z2w4PiyoHszQzW6jWHioUHrNpaZaDRBtIfnIwiOEwI2dpaM3DPXOgjFnoVLwqADbsFQK ZbrWTyAJe1gXoZ39+Y6PUeguIIcctxmCQFxC/DelcB9KzAAdxAoid9TwUOgzuWqE8U3g BnOZPDrudRXO+FiC7c818Mleud1sO3AnwkN0ek3Nr6ooU8/fsaeR8ra4Bl7CwUq4fAHr R/xDcCCP/yEplXuK+Z9kityUXX7QlANmHnXrkA4xfEUs5vfrv3RgyHdVU0rTTj5xmWk0 YpSQ== X-Gm-Message-State: AOJu0Yz8ivkTjT3dKkfFQQ+R0f75BDleHAVHz4GbdLSqf7gn+1kUP2i1 WWVycWEFJXLCqP/UGkp+tGO5fdipMRr/Vg== X-Google-Smtp-Source: AGHT+IGD9n2EmyGVnk870B6x7b3Ns7BQd65HX5AzukoA+B6cm31xF3tBJHlMOcxEqjG0hxSwOKCiGg== X-Received: by 2002:a5d:46ca:0:b0:336:a125:5385 with SMTP id g10-20020a5d46ca000000b00336a1255385mr3806760wrs.93.1705393471581; Tue, 16 Jan 2024 00:24:31 -0800 (PST) Received: from slackware.local ([154.47.27.145]) by smtp.gmail.com with ESMTPSA id dv1-20020a0560000d8100b00337b55ed9afsm1091923wrb.95.2024.01.16.00.24.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 00:24:31 -0800 (PST) From: Vyacheslav Yurkov To: Openembedded-core@lists.openembedded.org Cc: Lukas Funke , Vyacheslav Yurkov Subject: [PATCH v2 4/9] classes: go-vendor: Unlink vendor dir later Date: Tue, 16 Jan 2024 09:23:22 +0100 Message-Id: <20240116082327.128990-4-uvv.mail@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20240116082327.128990-1-uvv.mail@gmail.com> References: <20240116082327.128990-1-uvv.mail@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 16 Jan 2024 08:24:43 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/193827 Vendor directory might still be required during install stage, so defer the removal until later stage. Signed-off-by: Vyacheslav Yurkov --- meta/classes/go-vendor.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/classes/go-vendor.bbclass b/meta/classes/go-vendor.bbclass index 48f4d1041c..1bbb99ac79 100644 --- a/meta/classes/go-vendor.bbclass +++ b/meta/classes/go-vendor.bbclass @@ -48,7 +48,7 @@ python do_vendor_unlink() { os.unlink(linkname) } -addtask vendor_unlink before do_install after do_compile +addtask vendor_unlink before do_package after do_install python do_go_vendor() { import shutil From patchwork Tue Jan 16 08:23:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vyacheslav Yurkov X-Patchwork-Id: 37906 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 755D9C47DA6 for ; Tue, 16 Jan 2024 08:24:43 +0000 (UTC) Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) by mx.groups.io with SMTP id smtpd.web10.8419.1705393474524943383 for ; Tue, 16 Jan 2024 00:24:34 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=XNQWQB/I; spf=pass (domain: gmail.com, ip: 209.85.221.46, mailfrom: uvv.mail@gmail.com) Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-3376555b756so5259101f8f.0 for ; Tue, 16 Jan 2024 00:24:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705393472; x=1705998272; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KLxmOWSLj+4LEi9ZlDNGHsMQU71zY56f98sBnO0AlSs=; b=XNQWQB/INKmCJxa+r2A9disH3xN9dADCtFduEseSydle5YYgRprgBhZ2qihUAxSh2K 1JNNe93mU57PxRioj7uU5x+CZaGc8Vtfqy3Xgvz17pEv1+azZ3lZAh8qJts5uJEMDGOv r6TTjZHrG9zCkO4r/wJyLicHTW5oLIbE3Yzf+Rauq/k94JZS6xYuUfKvtB/G7WyMp2Lw lC28BTHldrjSlZW4KPm7UF+BY3ntN1Q+2Rr3G0ZnW1U2kXMHf7zdQ46W5vFy4tH4CURK TbUoTcviqPGi3UvWv810agFop1E3OKfB9hBKxU3QjAEeVaGZCXobY0eyBi5gkZSbRceV mrIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705393472; x=1705998272; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KLxmOWSLj+4LEi9ZlDNGHsMQU71zY56f98sBnO0AlSs=; b=g1Sl2uj7HhQibhy5IVuRQFVvbSD1PpUGNNa+zmD0Jcwt7cFiIfKuTRBQiU3JUVzCpz MgM/OAM9b0KRDA44mYkw7gMM+MPycJ4MWvOVDP+yzKRQaeISoLj2clkV82ozJA7dJuHI Wyr0MLd9ps2/Lu6LWeUZOUYhjNhcc+KkWjO8YHgXi+ukK6NXuC4trlY9FUpOwVuQJZxZ Jv8pGPF2MBYO7PZMQCNgAB+N06a0ie5Y+QOTB4kl30CqJ7QsjSrvHBsDoqO8JH2ykfjP xCHm1vQOKom70MBhG1pqXo4JPqNJEwcbblY1FNMkjnOaMXPlz1SOmC0sKvE7Y4kV50ns Al4g== X-Gm-Message-State: AOJu0YwWY0s5E4aBsk9e6mJwzFkmYFyij2Xou00sNn3Sp5soDW8UqKbm khM5792QNNx/wEnaLtHpN7LbSzHtY7lXjA== X-Google-Smtp-Source: AGHT+IH3Ry94M/JwD9fDzNmvI3yN9EqdAPV9wkDrR/UHnRQsHqAYAH/2pkGgJE1Np4qnCaSYS4gTMw== X-Received: by 2002:a5d:59a6:0:b0:337:aa92:74cb with SMTP id p6-20020a5d59a6000000b00337aa9274cbmr1408368wrr.0.1705393472400; Tue, 16 Jan 2024 00:24:32 -0800 (PST) Received: from slackware.local ([154.47.27.145]) by smtp.gmail.com with ESMTPSA id dv1-20020a0560000d8100b00337b55ed9afsm1091923wrb.95.2024.01.16.00.24.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 00:24:32 -0800 (PST) From: Vyacheslav Yurkov To: Openembedded-core@lists.openembedded.org Cc: Lukas Funke , Vyacheslav Yurkov Subject: [PATCH v2 5/9] recipetool: Proceed even with a missing license file Date: Tue, 16 Jan 2024 09:23:23 +0100 Message-Id: <20240116082327.128990-5-uvv.mail@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20240116082327.128990-1-uvv.mail@gmail.com> References: <20240116082327.128990-1-uvv.mail@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 16 Jan 2024 08:24:43 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/193828 Whenever the recipe uses a CLOSED license, the list is going to be empty. It's a discouraged practice not to have a license, but proceed anyway to finish recipe generation. Signed-off-by: Vyacheslav Yurkov --- scripts/lib/recipetool/create_go.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/lib/recipetool/create_go.py b/scripts/lib/recipetool/create_go.py index 668a24b8dd..035ab9f7c1 100644 --- a/scripts/lib/recipetool/create_go.py +++ b/scripts/lib/recipetool/create_go.py @@ -730,6 +730,12 @@ class GoRecipeHandler(RecipeHandler): new_licenses = [] licenses = origvalue.split('\\') for license in licenses: + if not license: + logger.warning("No license file was detected for the main module!") + # the license list of the main recipe must be empty + # this can happen for example in case of CLOSED license + # Fall through to complete recipe generation + continue license = license.strip() uri, chksum = license.split(';', 1) url = urllib.parse.urlparse(uri) From patchwork Tue Jan 16 08:23:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vyacheslav Yurkov X-Patchwork-Id: 37907 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B770C47DA9 for ; Tue, 16 Jan 2024 08:24:43 +0000 (UTC) Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) by mx.groups.io with SMTP id smtpd.web11.8367.1705393474869622684 for ; Tue, 16 Jan 2024 00:24:35 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=HdfgHCrk; spf=pass (domain: gmail.com, ip: 209.85.221.43, mailfrom: uvv.mail@gmail.com) Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-336897b6bd6so9278000f8f.2 for ; Tue, 16 Jan 2024 00:24:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705393473; x=1705998273; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=by0EPQfdybvs7j/rMb2dZ7JOmqvBZ6Xbud6eQbM7zJY=; b=HdfgHCrkEAxbXxnucm225xdFNJh4q9Ay2BNhaFmM96ePZxqw3DZsot+uL2DK46Zui8 koajIHMilsWt7O/BmcmS6HXvBc+oC+P/66YsShSHfPJhH1xvnMdWf+DX0nOPEureTxmx LPik3eTpL07CTxj9a+NcBebRCF+fSrT4jMUjs5YXPxhGQx0raAfwJo/YIjVFSDw8blHO LPmtWGpJ53DC5q7jX0QyqAy/U+GXfIDImT8PONCvNPpwG5fCISHWf688wCFL936aAau6 zXBAEIrGw2EuSBN8jVo4g6KHz3U8quWOsO4NBcCuQm83d0uhEHzKSWo/fnqy6Sd5a9FF mJIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705393473; x=1705998273; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=by0EPQfdybvs7j/rMb2dZ7JOmqvBZ6Xbud6eQbM7zJY=; b=Vo+DQkDNBBkdyQl/CMKAJZkZRX9sDav3riHBQK8Fp/KwYe9pyaNwxEhO1q4/B+Zy/T +urbPqytG/3LTpuTtsVo6uw4cXvN64TJ3X1X8D6noCDKQLYX6XHBnbjqA5kjL6Lk2cSK LwElxTa2PQ8NDLUngWBkP6BHqiLChh2QVqV14b6xerzm9x6swy6C5SbkYE1OHCDQWhTe 0sui/0gTwWEzCqRQs/6BK9WcCsgnuAwAUUqgSmXluEyvoYBYB6EXcZmH1XfPWcN/+XSP ObRrct6f+NcWOWGyjSm/SvzPMt9BM5oNjCY2RubEa/WFghdDhPOphWfgN+PsUy9M0z64 lLHQ== X-Gm-Message-State: AOJu0YxAPKW4+CEmB866xI75/LIbCaVVDbOBxILF4Ax8mrLgYkM9C4fh YXOU+wZpEXeXnEJ3ZODHqQ5ith5waPVy7A== X-Google-Smtp-Source: AGHT+IFR24adJIt6AJXGifHw/qK9veRXKGm71VgAtTQamdfe8jebwN/hCwfY5Ean1Rvzpd5giuylww== X-Received: by 2002:a5d:51c6:0:b0:337:bc88:9260 with SMTP id n6-20020a5d51c6000000b00337bc889260mr218523wrv.133.1705393473065; Tue, 16 Jan 2024 00:24:33 -0800 (PST) Received: from slackware.local ([154.47.27.145]) by smtp.gmail.com with ESMTPSA id dv1-20020a0560000d8100b00337b55ed9afsm1091923wrb.95.2024.01.16.00.24.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 00:24:32 -0800 (PST) From: Vyacheslav Yurkov To: Openembedded-core@lists.openembedded.org Cc: Lukas Funke , Vyacheslav Yurkov Subject: [PATCH v2 6/9] recipetool: Disregard version in URL for replaced modules Date: Tue, 16 Jan 2024 09:23:24 +0100 Message-Id: <20240116082327.128990-6-uvv.mail@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20240116082327.128990-1-uvv.mail@gmail.com> References: <20240116082327.128990-1-uvv.mail@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 16 Jan 2024 08:24:43 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/193829 Major module version is a part of name, but not necessary part of the actual URL (See https://go.dev/ref/mod#module-path). Nevertheless, name detection function can't handle that suffix, so get rid of it to determine component name. For replaced modules that name might be different that the actual module name defined in go.mod file. Signed-off-by: Vyacheslav Yurkov --- scripts/lib/recipetool/create_go.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/scripts/lib/recipetool/create_go.py b/scripts/lib/recipetool/create_go.py index 035ab9f7c1..c560831442 100644 --- a/scripts/lib/recipetool/create_go.py +++ b/scripts/lib/recipetool/create_go.py @@ -506,6 +506,7 @@ class GoRecipeHandler(RecipeHandler): def __go_handle_dependencies(self, go_mod, srctree, localfilesdir, extravalues, d): + import re src_uris = [] src_revs = [] @@ -555,7 +556,9 @@ class GoRecipeHandler(RecipeHandler): src_uris.append(inline_fcn) src_revs.append(generate_src_rev(path, version, commithash)) - pn, _ = determine_from_url(go_mod['Module']['Path']) + # strip version part from module URL /vXX + baseurl = re.sub(r'/v(\d+)$', '', go_mod['Module']['Path']) + pn, _ = determine_from_url(baseurl) go_mods_basename = "%s-modules.inc" % pn go_mods_filename = os.path.join(localfilesdir, go_mods_basename) @@ -636,7 +639,9 @@ class GoRecipeHandler(RecipeHandler): lic_files_chksum.append( 'file://src/${GO_IMPORT}/vendor/%s;md5=%s' % (licvalue[1], licvalue[2])) - pn, _ = determine_from_url(go_mod['Module']['Path']) + # strip version part from module URL /vXX + baseurl = re.sub(r'/v(\d+)$', '', go_mod['Module']['Path']) + pn, _ = determine_from_url(baseurl) licenses_basename = "%s-licenses.inc" % pn licenses_filename = os.path.join(localfilesdir, licenses_basename) @@ -682,6 +687,13 @@ class GoRecipeHandler(RecipeHandler): localfilesdir = tempfile.mkdtemp(prefix='recipetool-go-') extravalues.setdefault('extrafiles', {}) + + # Use an explicit name determined from the module name because it + # might differ from the actual URL for replaced modules + # strip version part from module URL /vXX + baseurl = re.sub(r'/v(\d+)$', '', go_mod['Module']['Path']) + pn, _ = determine_from_url(baseurl) + # go.mod files with version < 1.17 may not include all indirect # dependencies. Thus, we have to upgrade the go version. if go_version_major == 1 and go_version_minor < 17: @@ -699,18 +711,18 @@ class GoRecipeHandler(RecipeHandler): # Write additional $BPN-modules.inc file self.__go_mod_vendor(go_mod, srctree, localfilesdir, extravalues, d) lines_before.append("LICENSE += \" & ${GO_MOD_LICENSES}\"") - lines_before.append("require ${BPN}-licenses.inc") + lines_before.append("require %s-licenses.inc" % (pn)) self.__rewrite_src_uri(lines_before, ["file://modules.txt"]) self.__go_handle_dependencies(go_mod, srctree, localfilesdir, extravalues, d) - lines_before.append("require ${BPN}-modules.inc") + lines_before.append("require %s-modules.inc" % (pn)) # Do generic license handling handle_license_vars(srctree, lines_before, handled, extravalues, d) self.__rewrite_lic_uri(lines_before) - lines_before.append("GO_IMPORT = \"{}\"".format(go_import)) + lines_before.append("GO_IMPORT = \"{}\"".format(baseurl)) lines_before.append("SRCREV_FORMAT = \"${BPN}\"") def __update_lines_before(self, updated, newlines, lines_before): From patchwork Tue Jan 16 08:23:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vyacheslav Yurkov X-Patchwork-Id: 37908 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 878BDC47DA7 for ; Tue, 16 Jan 2024 08:24:43 +0000 (UTC) Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) by mx.groups.io with SMTP id smtpd.web10.8420.1705393475742225656 for ; Tue, 16 Jan 2024 00:24:36 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=fkQkJrZn; spf=pass (domain: gmail.com, ip: 209.85.221.51, mailfrom: uvv.mail@gmail.com) Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-3368b1e056eso7951347f8f.3 for ; Tue, 16 Jan 2024 00:24:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705393474; x=1705998274; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lx+scOkQ+k12xUnkVDltv9xeNDJdrwBNjeC7XRqoLIo=; b=fkQkJrZnJo5eGvKBvLYNSYigLF7975mCvm6nZi/OLPanGQAGxniw96szHHPXGc24wb 00v9aOyg0pqUmmD9cYEz9WIQcOISsEjPeMSBh3K0XsKskkR4wgjGxbokVYV05HOrHn1g 1niV2Pl+cFv4tk1EOnakuz7Ag8gIoKMSeKqaOo7JMDjLiIXvr5WKuFI9aGUf+77ID7eU euqnHugycg/0tM3ia+Rf2w/LZ23u2qPJcuPpE9wy5EZZAorW67+7+KSTl3VUDj0jfDvm s/gEZnlJm21kSEfWqoPagsy5P7DlU7Q25AT8QEhoc6EMuosQS5QMSS5wug/kFkHbeXGE Tbvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705393474; x=1705998274; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lx+scOkQ+k12xUnkVDltv9xeNDJdrwBNjeC7XRqoLIo=; b=eG3BhUkWGC7JlYTZa4NnXpghAEOAbOBCAiIV8EgusqwGHDiyaizIStBAlh+hpuxCqP Iabvz9RXdKPTSQG3FLryQIUevjnEZOy3e+7AGLOyypKJ4tKrmhJ62maUfZNhC3qgHwD/ MN60wmqRe864ajzOeZYsC/lKTFK00CiYQZ58unehS9dWm3Yvll4P71zx8avWhxBLs+mG HIIekDabO8Hr6LxQJbOMgTc3NhXOLZ88ORZKssOyo+otgAlZX3hygpRB5A38Sd9P/nFW UNFGiFLAg23WjfxsVUWgqLqGanLAdb8k22XrcHzIGE+eh96WxXMr++cLKtQOW7L3Bdr0 +4Ng== X-Gm-Message-State: AOJu0Yx0yGkpQLG5fHwM3YJoRejq/xbBLZ5vUsausZFlEUuX8nLMLmb7 094INESDPrTVSEcYX1052WWMnZbJTSkGpw== X-Google-Smtp-Source: AGHT+IGZdtJUHwElGabHdKXfQKOi+TFdBYjxKtAlir/PHYLtsSyVGWt3VWIQ9BgdI4tjzoySK5AUlw== X-Received: by 2002:a05:6000:92a:b0:337:a5a4:b741 with SMTP id cx10-20020a056000092a00b00337a5a4b741mr1701452wrb.107.1705393473862; Tue, 16 Jan 2024 00:24:33 -0800 (PST) Received: from slackware.local ([154.47.27.145]) by smtp.gmail.com with ESMTPSA id dv1-20020a0560000d8100b00337b55ed9afsm1091923wrb.95.2024.01.16.00.24.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 00:24:33 -0800 (PST) From: Vyacheslav Yurkov To: Openembedded-core@lists.openembedded.org Cc: Lukas Funke , Vyacheslav Yurkov Subject: [PATCH v2 7/9] oeqa/selftest/recipetool: Move create_go test to a proper class Date: Tue, 16 Jan 2024 09:23:25 +0100 Message-Id: <20240116082327.128990-7-uvv.mail@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20240116082327.128990-1-uvv.mail@gmail.com> References: <20240116082327.128990-1-uvv.mail@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 16 Jan 2024 08:24:43 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/193830 Signed-off-by: Vyacheslav Yurkov --- meta/lib/oeqa/selftest/cases/recipetool.py | 24 ++++++++++------------ 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/meta/lib/oeqa/selftest/cases/recipetool.py b/meta/lib/oeqa/selftest/cases/recipetool.py index df15c80069..356bb4a746 100644 --- a/meta/lib/oeqa/selftest/cases/recipetool.py +++ b/meta/lib/oeqa/selftest/cases/recipetool.py @@ -744,19 +744,6 @@ class RecipetoolCreateTests(RecipetoolBase): def test_recipetool_create_git_srcbranch(self): self._test_recipetool_create_git('git://git.yoctoproject.org/matchbox-keyboard;protocol=https', 'matchbox-keyboard-0-1') - -class RecipetoolTests(RecipetoolBase): - - @classmethod - def setUpClass(cls): - import sys - - super(RecipetoolTests, cls).setUpClass() - bb_vars = get_bb_vars(['BBPATH']) - cls.bbpath = bb_vars['BBPATH'] - libpath = os.path.join(get_bb_var('COREBASE'), 'scripts', 'lib', 'recipetool') - sys.path.insert(0, libpath) - def test_recipetool_create_go(self): # Basic test to check go recipe generation def urifiy(url, version, modulepath = None, pathmajor = None, subdir = None): @@ -941,6 +928,17 @@ class RecipetoolTests(RecipetoolBase): self._test_recipe_contents(deps_require_file, checkvars, []) +class RecipetoolTests(RecipetoolBase): + + @classmethod + def setUpClass(cls): + import sys + + super(RecipetoolTests, cls).setUpClass() + bb_vars = get_bb_vars(['BBPATH']) + cls.bbpath = bb_vars['BBPATH'] + libpath = os.path.join(get_bb_var('COREBASE'), 'scripts', 'lib', 'recipetool') + sys.path.insert(0, libpath) def _copy_file_with_cleanup(self, srcfile, basedstdir, *paths): dstdir = basedstdir From patchwork Tue Jan 16 08:23:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vyacheslav Yurkov X-Patchwork-Id: 37904 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 565BDC4706C for ; Tue, 16 Jan 2024 08:24:43 +0000 (UTC) Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) by mx.groups.io with SMTP id smtpd.web11.8368.1705393476766977684 for ; Tue, 16 Jan 2024 00:24:37 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=efQtQSim; spf=pass (domain: gmail.com, ip: 209.85.128.46, mailfrom: uvv.mail@gmail.com) Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-40d6b4e2945so108452105e9.0 for ; Tue, 16 Jan 2024 00:24:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705393475; x=1705998275; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=s9Ri8bKRh0UUnfr+zAPfllkWpqpv4B+od+eg4YK9j8k=; b=efQtQSim9CJpsHmM2qUTTpVgEvgWEWFYET8E8o38nx4/VA4i2C9AxqyJRD5lBOOqaE R85Jn/mUa2AHkXS+F0ixQAn/9JDcEqhCkC9jSf/sL2V9jKJt519Inx5e3PYFyztwas9c jdDEPP+AYIt0kjiHLP4bj/xRZSN5kq/bQMhWHaxFPnudu7EG2e77Szs4qZnBY/tTxicn H3uukEB0NbEd7yX/ASDwILCysx7GQY6KramEU0HK2WpWXlEHQRKsyMYaMWIFSsNiWc3d IkbmzbYsKqG3N2mdb/UvvQEkzsCGb2vbqkT/yeomhLOhnBbt1GlCaUpefcjtZi4hyT6T /ogA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705393475; x=1705998275; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=s9Ri8bKRh0UUnfr+zAPfllkWpqpv4B+od+eg4YK9j8k=; b=C6zwPZgLh+JMQ4T4M+j2xTeHzHPTF8w8xKt/x5X7BMTzcyDRsZmIUXDrk/TwjGXWIF 6IBGKOQBl1yDVk+It3IFKE7y/uktT/gH24oirO3I1xdpP/8Hb9Rm8UN1MbokOsz15Cku 5YssV1m5M1v3Pek/TsZ78viCpkv0wkr23FDvP+Fl2rngmY6p0hOvddc/4eiU4wMjQV7+ tSw9ShvcIxUecOFPtn2E1nmkiSEZKHz+UbXg0PMj8W6UKB6x77H9d/LZwgXyNzeHxftv izpWtAq1ZXTH9P8OlovBI4HzmHjvREhx8Ng/5AwBAJisGPwRHYaGSwQzGmIsotTuVg3i qRYQ== X-Gm-Message-State: AOJu0YzyqP8pRS8pfA80BXQYIqtZsxYtYpRkS6uXHmzCmw+be3zkM8z3 t5XnEonHLDqvbYq7a0fk0XqfFdRDE3qbQw== X-Google-Smtp-Source: AGHT+IGECTXfuuJpkO+RmTk09LK0e9mY6JC9Me839XKUcoMaKbunSMw2F1Ztod/xtB8YZZoUbtCVsg== X-Received: by 2002:a7b:cbd6:0:b0:40d:80b4:16d6 with SMTP id n22-20020a7bcbd6000000b0040d80b416d6mr2339810wmi.188.1705393474769; Tue, 16 Jan 2024 00:24:34 -0800 (PST) Received: from slackware.local ([154.47.27.145]) by smtp.gmail.com with ESMTPSA id dv1-20020a0560000d8100b00337b55ed9afsm1091923wrb.95.2024.01.16.00.24.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 00:24:34 -0800 (PST) From: Vyacheslav Yurkov To: Openembedded-core@lists.openembedded.org Cc: Lukas Funke , Vyacheslav Yurkov Subject: [PATCH v2 8/9] oeqa/selftest/recipetool: Move helper function to the class scope Date: Tue, 16 Jan 2024 09:23:26 +0100 Message-Id: <20240116082327.128990-8-uvv.mail@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20240116082327.128990-1-uvv.mail@gmail.com> References: <20240116082327.128990-1-uvv.mail@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 16 Jan 2024 08:24:43 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/193831 Signed-off-by: Vyacheslav Yurkov --- meta/lib/oeqa/selftest/cases/recipetool.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/meta/lib/oeqa/selftest/cases/recipetool.py b/meta/lib/oeqa/selftest/cases/recipetool.py index 356bb4a746..83848d6170 100644 --- a/meta/lib/oeqa/selftest/cases/recipetool.py +++ b/meta/lib/oeqa/selftest/cases/recipetool.py @@ -744,14 +744,14 @@ class RecipetoolCreateTests(RecipetoolBase): def test_recipetool_create_git_srcbranch(self): self._test_recipetool_create_git('git://git.yoctoproject.org/matchbox-keyboard;protocol=https', 'matchbox-keyboard-0-1') + def _go_urifiy(self, url, version, modulepath = None, pathmajor = None, subdir = None): + modulepath = ",path='%s'" % modulepath if len(modulepath) else '' + pathmajor = ",pathmajor='%s'" % pathmajor if len(pathmajor) else '' + subdir = ",subdir='%s'" % subdir if len(subdir) else '' + return "${@go_src_uri('%s','%s'%s%s%s)}" % (url, version, modulepath, pathmajor, subdir) + def test_recipetool_create_go(self): # Basic test to check go recipe generation - def urifiy(url, version, modulepath = None, pathmajor = None, subdir = None): - modulepath = ",path='%s'" % modulepath if len(modulepath) else '' - pathmajor = ",pathmajor='%s'" % pathmajor if len(pathmajor) else '' - subdir = ",subdir='%s'" % subdir if len(subdir) else '' - return "${@go_src_uri('%s','%s'%s%s%s)}" % (url, version, modulepath, pathmajor, subdir) - temprecipe = os.path.join(self.tempdir, 'recipe') os.makedirs(temprecipe) @@ -919,7 +919,7 @@ class RecipetoolCreateTests(RecipetoolBase): src_uri = set() for d in dependencies: - src_uri.add(urifiy(*d)) + src_uri.add(self._go_urifiy(*d)) checkvars = {} checkvars['GO_DEPENDENCIES_SRC_URI'] = src_uri From patchwork Tue Jan 16 08:23:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vyacheslav Yurkov X-Patchwork-Id: 37909 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C222C47258 for ; Tue, 16 Jan 2024 08:24:43 +0000 (UTC) Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) by mx.groups.io with SMTP id smtpd.web11.8369.1705393477875875024 for ; Tue, 16 Jan 2024 00:24:38 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=GKoeuaoY; spf=pass (domain: gmail.com, ip: 209.85.221.43, mailfrom: uvv.mail@gmail.com) Received: by mail-wr1-f43.google.com with SMTP id ffacd0b85a97d-3366ddd1eddso7811846f8f.0 for ; Tue, 16 Jan 2024 00:24:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705393476; x=1705998276; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NEWwRhHea6E2hSam93xODS1zRKW8OD5WkexpkPcoYGQ=; b=GKoeuaoY7km43haFSlBPstuCC7W6RmFo3HWgFNllA+syrfqa0DFjwfzVLeZm6b3WBE qySUH2lWDvTBdaLXuBbWVo1SVchrNMe1WT1KXJHLYrW49UxqRX/2RgVrU/EWeT8we7xX 1MBDuOQ0BI1hTuN1aK/XCx6Ap6XgrM1btE2EJfEJU4xOwvOA6Mt921pEWeMWpWpq98ur P81OzxOPfpeuMknIIven6yOgBHPpTHI+01DE14v6e1TWGXF1CGBazj0HnCjRY9OVsdkp 3NV1QvKKCvmTvvVU+ANKCXjtWQDoy7JrxXEIonmNRI4X6im3bwG7jjc3r06QGZMkc6Kt W63g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705393476; x=1705998276; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NEWwRhHea6E2hSam93xODS1zRKW8OD5WkexpkPcoYGQ=; b=d1PYbAT8USOUEMHPDR89s0ZFqwLPTYLKv3M3zhhJOEAJCp0216CWo5YqssoGv5+Qhj 9JAi7cFEKF8enSPYeZ1wAtCcU9AIkT4TNcagolePIpXWUI6qQYRZkyPCXRfsuJ/fvXPK zS2q47czZ4Agby3MSy1QlZxapqsg7L43UQHEnyySawAGUAZlyEiyazafE4cPJHF5kT5M 1Vj2JdsVJAOVjKklt9FyUQIFbSCpDh9WZsQELoeWkGmp0IAefiGQqGyHlhgnT6MSP7Xs V2f3vBz8sU88b4VogAC/4azSpgodlZBw+CSOK6+tFKSPYffz7SbphBxDdVpP3uqImUwd 27+g== X-Gm-Message-State: AOJu0YyNPD+kZLShudskce9dqI6AwBVaxGibw5O6dyiiY94RN4lrLX2S xPJNi4g+Ff4xxXiFhyLk9GRA429H67jYeA== X-Google-Smtp-Source: AGHT+IF+SyDF4YQsotJy7Mk07zEa07Rf7jEcunMH1cm0YzKbGOWSFZbqe8ABe/5mb6bd6GVHpOglZw== X-Received: by 2002:a05:6000:12c1:b0:337:43c2:d17b with SMTP id l1-20020a05600012c100b0033743c2d17bmr1540155wrx.77.1705393475704; Tue, 16 Jan 2024 00:24:35 -0800 (PST) Received: from slackware.local ([154.47.27.145]) by smtp.gmail.com with ESMTPSA id dv1-20020a0560000d8100b00337b55ed9afsm1091923wrb.95.2024.01.16.00.24.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 00:24:35 -0800 (PST) From: Vyacheslav Yurkov To: Openembedded-core@lists.openembedded.org Cc: Lukas Funke , Vyacheslav Yurkov Subject: [PATCH v2 9/9] oeqa/selftest/recipetool: Add test coverage for local go modules Date: Tue, 16 Jan 2024 09:23:27 +0100 Message-Id: <20240116082327.128990-9-uvv.mail@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20240116082327.128990-1-uvv.mail@gmail.com> References: <20240116082327.128990-1-uvv.mail@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 16 Jan 2024 08:24:43 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/193832 Signed-off-by: Vyacheslav Yurkov --- meta/lib/oeqa/selftest/cases/recipetool.py | 55 ++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/meta/lib/oeqa/selftest/cases/recipetool.py b/meta/lib/oeqa/selftest/cases/recipetool.py index 83848d6170..0c296875b2 100644 --- a/meta/lib/oeqa/selftest/cases/recipetool.py +++ b/meta/lib/oeqa/selftest/cases/recipetool.py @@ -927,6 +927,61 @@ class RecipetoolCreateTests(RecipetoolBase): self.assertTrue(os.path.isfile(deps_require_file)) self._test_recipe_contents(deps_require_file, checkvars, []) + def test_recipetool_create_go_replace_modules(self): + # Check handling of replaced modules + temprecipe = os.path.join(self.tempdir, 'recipe') + os.makedirs(temprecipe) + + recipefile = os.path.join(temprecipe, 'openapi-generator_git.bb') + deps_require_file = os.path.join(temprecipe, 'openapi-generator', 'go-modules.inc') + lics_require_file = os.path.join(temprecipe, 'openapi-generator', 'go-licenses.inc') + modules_txt_file = os.path.join(temprecipe, 'openapi-generator', 'modules.txt') + + srcuri = 'https://github.com/OpenAPITools/openapi-generator.git' + srcrev = "v7.2.0" + srcbranch = "master" + srcsubdir = "samples/openapi3/client/petstore/go" + + result = runCmd('recipetool create -o %s %s -S %s -B %s --src-subdir %s' % (temprecipe, srcuri, srcrev, srcbranch, srcsubdir)) + + self.maxDiff = None + inherits = ['go-vendor'] + + checkvars = {} + checkvars['GO_IMPORT'] = "github.com/OpenAPITools/openapi-generator/samples/openapi3/client/petstore/go" + checkvars['SRC_URI'] = {'git://${GO_IMPORT};destsuffix=git/src/${GO_IMPORT};nobranch=1;name=${BPN};protocol=https', + 'file://modules.txt'} + + self.assertNotIn('Traceback', result.output) + self.assertIn('No license file was detected for the main module', result.output) + self.assertTrue(os.path.isfile(recipefile)) + self._test_recipe_contents(recipefile, checkvars, inherits) + + # make sure that dependencies don't mention local directory ./go-petstore + dependencies = \ + [ ('github.com/stretchr/testify','v1.8.4', '', '', ''), + ('go.googlesource.com/oauth2','v0.10.0','golang.org/x/oauth2', '', ''), + ('github.com/davecgh/go-spew','v1.1.1', '', '', ''), + ('github.com/golang/protobuf','v1.5.3', '', '', ''), + ('github.com/kr/pretty','v0.3.0', '', '', ''), + ('github.com/pmezard/go-difflib','v1.0.0', '', '', ''), + ('github.com/rogpeppe/go-internal','v1.9.0', '', '', ''), + ('go.googlesource.com/net','v0.12.0','golang.org/x/net', '', ''), + ('github.com/golang/appengine','v1.6.7','google.golang.org/appengine', '', ''), + ('go.googlesource.com/protobuf','v1.31.0','google.golang.org/protobuf', '', ''), + ('gopkg.in/check.v1','v1.0.0-20201130134442-10cb98267c6c', '', '', ''), + ('gopkg.in/yaml.v3','v3.0.1', '', '', ''), + ] + + src_uri = set() + for d in dependencies: + src_uri.add(self._go_urifiy(*d)) + + checkvars = {} + checkvars['GO_DEPENDENCIES_SRC_URI'] = src_uri + + self.assertTrue(os.path.isfile(deps_require_file)) + self._test_recipe_contents(deps_require_file, checkvars, []) class RecipetoolTests(RecipetoolBase):