From: Paul Eggleton <paul.eggleton@linux.intel.com>
To: Sai Hari Chandana Kalluri <chandana.kalluri@xilinx.com>
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [PATCH v2 1/3] devtool modify: Update devtool modify to copy source from work-shared if its already downloaded.
Date: Tue, 05 Mar 2019 12:46:07 +1300 [thread overview]
Message-ID: <1904655.CDzVhXoS6Q@localhost.localdomain> (raw)
In-Reply-To: <1548445982-25182-2-git-send-email-chandana.kalluri@xilinx.com>
Thanks for looking into this problem - this is a tricky one. My apologies for the delay in reviewing. Comments below.
On Saturday, 26 January 2019 8:53:00 AM NZDT Sai Hari Chandana Kalluri wrote:
> --- a/scripts/lib/devtool/standard.py
> +++ b/scripts/lib/devtool/standard.py
> @@ -717,6 +717,72 @@ def _check_preserve(config, recipename):
> tf.write(line)
> os.rename(newfile, origfile)
>
> +# Function links a file from src location to dest location
> +def copy_file(c,dest):
> + import errno
> + destdir = os.path.dirname(dest)
> + if os.path.islink(c):
> + linkto = os.readlink(c)
> + if os.path.lexists(dest):
> + if not os.path.islink(dest):
> + raise OSError(errno.EEXIST, "Link %s already exists as a file" % dest, dest)
> + if os.readlink(dest) == linkto:
> + return dest
> + raise OSError(errno.EEXIST, "Link %s already exists to a different location? (%s vs %s)" % (dest, os.readlink(dest), linkto), dest)
> + os.symlink(linkto, dest)
> + else:
> + try:
> + os.link(c, dest)
> + except OSError as err:
> + if err.errno == errno.EXDEV:
> + bb.utils.copyfile(c, dest)
> + else:
> + raise
> +
> +# Function creates folders in a given target location
> +def copy_dirs(root,dirs,target):
> + for d in dirs:
> + destdir = os.path.join(target,d)
> + if os.path.islink(os.path.join(root,d)):
> + linkto = os.readlink(os.path.join(root,d))
> + os.symlink(linkto,destdir)
> + else:
> + bb.utils.mkdirhier(target+d)
> +
> +# Function to link src dir to dest dir
> +def copy_src_to_ws(srcdir,srctree):
> + target = srctree
> + if os.path.exists(target):
> + raise DevtoolError('source already in your workspace')
> +
> + bb.utils.mkdirhier(target)
> + for root,dirs,files in os.walk(srcdir):
> + #convert abspath to relpath for root
> + destdir = root.replace(srcdir,"")
> + target = srctree+destdir+"/"
> + copy_dirs(root,dirs,target)
> + for f in files:
> + copy_file(os.path.join(root,f),os.path.join(target,f))
We already have a function to do this - oe.path.copyhardlinktree(). I appreciate that does not symlink if it can't hard link as you're doing here, but given the side-effects if the kernel source goes away I think we'd prefer "hard link or copy" rather than "hard link or symlink".
> @@ -852,10 +990,12 @@ def modify(args, config, basepath, workspace):
> f.write('\ndo_patch() {\n'
> ' :\n'
> '}\n')
> - f.write('\ndo_configure_append() {\n'
> - ' cp ${B}/.config ${S}/.config.baseline\n'
> - ' ln -sfT ${B}/.config ${S}/.config.new\n'
> - '}\n')
> +
> + if rd.getVarFlag('do_menuconfig','task'):
> + f.write('\ndo_configure_append() {\n'
> + ' cp ${B}/.config ${S}/.config.baseline\n'
> + ' ln -sfT ${B}/.config ${S}/.config.new\n'
> + '}\n')
> if initial_rev:
> f.write('\n# initial_rev: %s\n' % initial_rev)
> for commit in commits:
This change does not appear to be directly related to the rest of the commit, can it be split out and properly described?
Thanks,
Paul
--
Paul Eggleton
Intel Open Source Technology Centre
next prev parent reply other threads:[~2019-03-04 23:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-25 19:52 [PATCH v2 0/3] Devtool: provide easy means of reconfiguring Sai Hari Chandana Kalluri
2019-01-25 19:53 ` [PATCH v2 1/3] devtool modify: Update devtool modify to copy source from work-shared if its already downloaded Sai Hari Chandana Kalluri
2019-03-04 23:46 ` Paul Eggleton [this message]
2019-01-25 19:53 ` [PATCH v2 2/3] devtool modify: Create a copy of kernel source within work-shared if not present Sai Hari Chandana Kalluri
2019-01-25 19:53 ` [PATCH v2 3/3] devtool: provide support for devtool menuconfig command Sai Hari Chandana Kalluri
2019-02-07 17:07 ` Chandana Kalluri
2019-03-04 23:46 ` Paul Eggleton
2019-03-11 21:19 ` Chandana Kalluri
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=1904655.CDzVhXoS6Q@localhost.localdomain \
--to=paul.eggleton@linux.intel.com \
--cc=chandana.kalluri@xilinx.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox