* [PATCH] archiver: set permissions for backup files of patch
@ 2015-07-02 2:32 rongqing.li
2015-07-02 2:40 ` Robert Yang
0 siblings, 1 reply; 3+ messages in thread
From: rongqing.li @ 2015-07-02 2:32 UTC (permalink / raw)
To: openembedded-core
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' %
+ 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
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] archiver: set permissions for backup files of patch
2015-07-02 2:32 [PATCH] archiver: set permissions for backup files of patch rongqing.li
@ 2015-07-02 2:40 ` Robert Yang
2015-07-02 2:43 ` Rongqing Li
0 siblings, 1 reply; 3+ messages in thread
From: Robert Yang @ 2015-07-02 2:40 UTC (permalink / raw)
To: rongqing.li, openembedded-core
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
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] archiver: set permissions for backup files of patch
2015-07-02 2:40 ` Robert Yang
@ 2015-07-02 2:43 ` Rongqing Li
0 siblings, 0 replies; 3+ messages in thread
From: Rongqing Li @ 2015-07-02 2:43 UTC (permalink / raw)
To: Robert Yang, openembedded-core
On 2015年07月02日 10:40, Robert Yang wrote:
>
>
> 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
Thanks, I will fix it
-Roy
>
>> + 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
>>
>
>
--
Best Reagrds,
Roy | RongQing Li
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-07-02 2:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-02 2:32 [PATCH] archiver: set permissions for backup files of patch rongqing.li
2015-07-02 2:40 ` Robert Yang
2015-07-02 2:43 ` Rongqing Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox