All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alexander Kanavin" <alex.kanavin@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: Alexander Kanavin <alex.kanavin@gmail.com>
Subject: [PATCH 01/21] devtool: correctly handle non-standard source tree locations in upgrades
Date: Wed, 14 Jul 2021 14:25:46 +0200	[thread overview]
Message-ID: <20210714122606.605142-1-alex.kanavin@gmail.com> (raw)

When S is set to a sub-directory of upstream source, the license
checks and the bbappend writing (specifically, setting EXTERNALSRC)
need to operate on that sub-directory.

'devtool modify' already has similar logic, and it was copied from there
and adjusted.

Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
 scripts/lib/devtool/upgrade.py | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/scripts/lib/devtool/upgrade.py b/scripts/lib/devtool/upgrade.py
index c6d98299da..da1456a01a 100644
--- a/scripts/lib/devtool/upgrade.py
+++ b/scripts/lib/devtool/upgrade.py
@@ -521,6 +521,15 @@ def upgrade(args, config, basepath, workspace):
         else:
             srctree = standard.get_default_srctree(config, pn)
 
+        # Check that recipe isn't using a shared workdir
+        s = os.path.abspath(rd.getVar('S'))
+        workdir = os.path.abspath(rd.getVar('WORKDIR'))
+        srctree_s = srctree
+        if s.startswith(workdir) and s != workdir and os.path.dirname(s) != workdir:
+            # Handle if S is set to a subdirectory of the source
+            srcsubdir = os.path.relpath(s, workdir).split(os.sep, 1)[1]
+            srctree_s = os.path.join(srctree, srcsubdir)
+
         # try to automatically discover latest version and revision if not provided on command line
         if not args.version and not args.srcrev:
             version_info = oe.recipeutils.get_recipe_upstream_version(rd)
@@ -550,12 +559,12 @@ def upgrade(args, config, basepath, workspace):
         try:
             logger.info('Extracting current version source...')
             rev1, srcsubdir1 = standard._extract_source(srctree, False, 'devtool-orig', False, config, basepath, workspace, args.fixed_setup, rd, tinfoil, no_overrides=args.no_overrides)
-            old_licenses = _extract_licenses(srctree, (rd.getVar('LIC_FILES_CHKSUM') or ""))
+            old_licenses = _extract_licenses(srctree_s, (rd.getVar('LIC_FILES_CHKSUM') or ""))
             logger.info('Extracting upgraded version source...')
             rev2, md5, sha256, srcbranch, srcsubdir2 = _extract_new_source(args.version, srctree, args.no_patch,
                                                     args.srcrev, args.srcbranch, args.branch, args.keep_temp,
                                                     tinfoil, rd)
-            new_licenses = _extract_licenses(srctree, (rd.getVar('LIC_FILES_CHKSUM') or ""))
+            new_licenses = _extract_licenses(srctree_s, (rd.getVar('LIC_FILES_CHKSUM') or ""))
             license_diff = _generate_license_diff(old_licenses, new_licenses)
             rf, copied = _create_new_recipe(args.version, md5, sha256, args.srcrev, srcbranch, srcsubdir1, srcsubdir2, config.workspace_path, tinfoil, rd, license_diff, new_licenses, srctree, args.keep_failure)
         except bb.process.CmdError as e:
@@ -564,7 +573,7 @@ def upgrade(args, config, basepath, workspace):
             _upgrade_error(e, rf, srctree, args.keep_failure)
         standard._add_md5(config, pn, os.path.dirname(rf))
 
-        af = _write_append(rf, srctree, args.same_dir, args.no_same_dir, rev2,
+        af = _write_append(rf, srctree_s, args.same_dir, args.no_same_dir, rev2,
                         copied, config.workspace_path, rd)
         standard._add_md5(config, pn, af)
 
-- 
2.31.1


             reply	other threads:[~2021-07-14 12:26 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-14 12:25 Alexander Kanavin [this message]
2021-07-14 12:25 ` [PATCH 02/21] tcmode-default.inc: do not set PREFERRED_VERSION for toolchain items Alexander Kanavin
2021-07-14 12:55   ` [OE-core] " Richard Purdie
2021-07-14 13:40     ` Alexander Kanavin
2021-07-20 17:11       ` Denys Dmytriyenko
2021-07-14 14:01   ` Bruce Ashfield
2021-07-14 14:04     ` Alexander Kanavin
2021-07-14 17:07       ` Khem Raj
2021-07-14 12:25 ` [PATCH 03/21] llvm: make upgradable via devtool Alexander Kanavin
2021-07-14 17:18   ` [OE-core] " Khem Raj
2021-07-14 12:25 ` [PATCH 04/21] llvm: update 12.0.0 -> 12.0.1 Alexander Kanavin
2021-07-14 12:25 ` [PATCH 05/21] systemd: update 248.3 -> 249 Alexander Kanavin
2021-07-17 22:58   ` [OE-core] " Alexandre Belloni
2021-07-18  0:44     ` Khem Raj
2021-07-22 19:32       ` Alexander Kanavin
2021-07-14 12:25 ` [PATCH 06/21] xserver-xorg: update 1.20.11 -> 1.20.12 Alexander Kanavin
2021-07-14 12:25 ` [PATCH 07/21] libmodulemd: update 2.12.1 -> 2.13.0 Alexander Kanavin
2021-07-14 12:25 ` [PATCH 08/21] bluez5: upgrade 5.59 -> 5.60 Alexander Kanavin
2021-07-14 12:25 ` [PATCH 09/21] createrepo-c: upgrade 0.17.3 -> 0.17.4 Alexander Kanavin
2021-07-14 12:25 ` [PATCH 10/21] ethtool: upgrade 5.12 -> 5.13 Alexander Kanavin
2021-07-14 12:25 ` [PATCH 11/21] gtk+3: upgrade 3.24.29 -> 3.24.30 Alexander Kanavin
2021-07-14 12:25 ` [PATCH 12/21] harfbuzz: upgrade 2.8.1 -> 2.8.2 Alexander Kanavin
2021-07-14 12:25 ` [PATCH 13/21] iproute2: upgrade 5.12.0 -> 5.13.0 Alexander Kanavin
2021-07-14 12:25 ` [PATCH 14/21] libgit2: upgrade 1.1.0 -> 1.1.1 Alexander Kanavin
2021-07-14 12:26 ` [PATCH 15/21] mpg123: upgrade 1.28.0 -> 1.28.2 Alexander Kanavin
2021-07-14 12:26 ` [PATCH 16/21] mtools: upgrade 4.0.31 -> 4.0.32 Alexander Kanavin
2021-07-14 12:26 ` [PATCH 17/21] ruby: upgrade 3.0.1 -> 3.0.2 Alexander Kanavin
2021-07-14 12:26 ` [PATCH 18/21] stress-ng: upgrade 0.12.11 -> 0.12.12 Alexander Kanavin
2021-07-14 12:26 ` [PATCH 19/21] webkitgtk: upgrade 2.32.1 -> 2.32.2 Alexander Kanavin
2021-07-14 12:26 ` [PATCH 20/21] xwayland: upgrade 21.1.1 -> 21.1.2 Alexander Kanavin
2021-07-14 12:26 ` [PATCH 21/21] tcl: fix upstream version check Alexander Kanavin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210714122606.605142-1-alex.kanavin@gmail.com \
    --to=alex.kanavin@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.