Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Robert Yang <liezhi.yang@windriver.com>
To: <rongqing.li@windriver.com>, <openembedded-core@lists.openembedded.org>
Subject: Re: [PATCH] archiver: set permissions for backup files of patch
Date: Thu, 2 Jul 2015 10:40:02 +0800	[thread overview]
Message-ID: <5594A482.4080104@windriver.com> (raw)
In-Reply-To: <1435804351-5018-1-git-send-email-rongqing.li@windriver.com>



On 07/02/2015 10:32 AM, rongqing.li@windriver.com wrote:
> From: Jian Liu <jian.liu@windriver.com>
>
> For the program patch with version before 2.6, backup files
> for nonexisting files are created with mode 0. During making
> tarball for these files, this will cause permission error.
>
> Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
> Signed-off-by: Jian Liu <jian.liu@windriver.com>
> ---
>   meta/classes/archiver.bbclass | 18 ++++++++++++++++--
>   1 file changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/meta/classes/archiver.bbclass b/meta/classes/archiver.bbclass
> index 7b5274d..f5cdb77 100644
> --- a/meta/classes/archiver.bbclass
> +++ b/meta/classes/archiver.bbclass
> @@ -224,7 +224,7 @@ def create_tarball(d, srcdir, suffix, ar_outdir, pf=None):
>       """
>       create the tarball from srcdir
>       """
> -    import tarfile
> +    import tarfile, subprocess, errno
>
>       bb.utils.mkdirhier(ar_outdir)
>       if pf:
> @@ -239,7 +239,21 @@ def create_tarball(d, srcdir, suffix, ar_outdir, pf=None):
>       os.chdir(dirname)
>       bb.note('Creating %s' % tarname)
>       tar = tarfile.open(tarname, 'w:gz')
> -    tar.add(basename)
> +    # For patch before 2.6 backup files for
> +    # nonexisting files are created with mode 0.
> +    # Change the permission of backup files.
> +    # In future, this can be deleted if patch-2.6 and above
> +    # is used widely.
> +    try:
> +        tar.add(basename)
> +    except IOError as exc:
> +        if exc.errno == errno.EACCES:
> +            # Make sure the probable back up patches have read permission
> +            subprocess.call('chmod a+r -R %s/.pc* >/dev/null 2>&1 | true' %

The '|' should be '||' ?

// Robert

> +                            basename, shell=True)
> +            tar.add(basename)
> +        else:
> +            raise IOError("I/O error({0}): {1}".format(exc.errno, exc.strerror))
>       tar.close()
>
>   # creating .diff.gz between source.orig and source
>


  reply	other threads:[~2015-07-02  2:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-02  2:32 [PATCH] archiver: set permissions for backup files of patch rongqing.li
2015-07-02  2:40 ` Robert Yang [this message]
2015-07-02  2:43   ` Rongqing Li

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=5594A482.4080104@windriver.com \
    --to=liezhi.yang@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=rongqing.li@windriver.com \
    /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