From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail1.windriver.com (mail1.windriver.com [147.11.146.13]) by mail.openembedded.org (Postfix) with ESMTP id 3153C65C89 for ; Thu, 2 Jul 2015 02:40:03 +0000 (UTC) Received: from ALA-HCA.corp.ad.wrs.com (ala-hca.corp.ad.wrs.com [147.11.189.40]) by mail1.windriver.com (8.15.1/8.15.1) with ESMTPS id t622e461013011 (version=TLSv1 cipher=AES128-SHA bits=128 verify=FAIL) for ; Wed, 1 Jul 2015 19:40:04 -0700 (PDT) Received: from [128.224.162.200] (128.224.162.200) by ALA-HCA.corp.ad.wrs.com (147.11.189.40) with Microsoft SMTP Server id 14.3.224.2; Wed, 1 Jul 2015 19:40:03 -0700 Message-ID: <5594A482.4080104@windriver.com> Date: Thu, 2 Jul 2015 10:40:02 +0800 From: Robert Yang User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: , References: <1435804351-5018-1-git-send-email-rongqing.li@windriver.com> In-Reply-To: <1435804351-5018-1-git-send-email-rongqing.li@windriver.com> Subject: Re: [PATCH] archiver: set permissions for backup files of patch X-BeenThere: openembedded-core@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Patches and discussions about the oe-core layer List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jul 2015 02:40:04 -0000 Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit On 07/02/2015 10:32 AM, rongqing.li@windriver.com wrote: > From: Jian Liu > > 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 > Signed-off-by: Jian Liu > --- > 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 >