Patchwork package_rpm.bbclass : escape "%" in files and directories name

login
register
mail settings
Submitter Sébastien Mennetrier
Date Oct. 29, 2013, 4:09 p.m.
Message ID <1383062949-12318-1-git-send-email-s.mennetrier@innotis.org>
Download mbox | patch
Permalink /patch/60713/
State New
Headers show

Comments

Sébastien Mennetrier - Oct. 29, 2013, 4:09 p.m.
Fixes [YOCTO #5397]

The rpm process replace all the "%name" in the spec file by the name of
the package. So, if the package is composed of some files or directories
named "%name...", the rpm package process failed.

Replace all "%" present in files or directories names by "[%]"

Signed-off-by: Sébastien Mennetrier <s.mennetrier@innotis.org>
---
 meta/classes/package_rpm.bbclass | 3 +++
 1 file changed, 3 insertions(+)
Paul Eggleton - Oct. 29, 2013, 4:16 p.m.
Hi Sébastien,

On Tuesday 29 October 2013 17:09:09 Sébastien Mennetrier wrote:
> Fixes [YOCTO #5397]
> 
> The rpm process replace all the "%name" in the spec file by the name of
> the package. So, if the package is composed of some files or directories
> named "%name...", the rpm package process failed.
> 
> Replace all "%" present in files or directories names by "[%]"
> 
> Signed-off-by: Sébastien Mennetrier <s.mennetrier@innotis.org>
> ---
>  meta/classes/package_rpm.bbclass | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/meta/classes/package_rpm.bbclass
> b/meta/classes/package_rpm.bbclass index 36bad09..6c73e37 100644
> --- a/meta/classes/package_rpm.bbclass
> +++ b/meta/classes/package_rpm.bbclass
> @@ -662,10 +662,13 @@ python write_specfile () {
>      def walk_files(walkpath, target, conffiles):
>          for rootpath, dirs, files in os.walk(walkpath):
>              path = rootpath.replace(walkpath, "")
> +            path = path.replace("%", "[%]")
>              for dir in dirs:
> +                dir = dir.replace("%", "[%]")
>                  # All packages own the directories their files are in...
>                  target.append('%dir "' + path + '/' + dir + '"')
>              for file in files:
> +                file = file.replace("%", "[%]")
>                  if conffiles.count(path + '/' + file):
>                      target.append('%config "' + path + '/' + file + '"')
>                  else:

Are you sure this is correct? The documentation I have been able to dig up via 
google seems to suggest that %% is the correct way to escape a % sign in a 
spec file.

Cheers,
Paul
Sébastien Mennetrier - Oct. 29, 2013, 4:37 p.m.
I'm not a specialist with rpm but I saw this documentation and I tried with
"%%" and with "\%" and it did not work.

I don't know if it's the best way but it work for me ;)

Regards,
Seb



2013/10/29 Paul Eggleton <paul.eggleton@linux.intel.com>

> Hi Sébastien,
>
> On Tuesday 29 October 2013 17:09:09 Sébastien Mennetrier wrote:
> > Fixes [YOCTO #5397]
> >
> > The rpm process replace all the "%name" in the spec file by the name of
> > the package. So, if the package is composed of some files or directories
> > named "%name...", the rpm package process failed.
> >
> > Replace all "%" present in files or directories names by "[%]"
> >
> > Signed-off-by: Sébastien Mennetrier <s.mennetrier@innotis.org>
> > ---
> >  meta/classes/package_rpm.bbclass | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/meta/classes/package_rpm.bbclass
> > b/meta/classes/package_rpm.bbclass index 36bad09..6c73e37 100644
> > --- a/meta/classes/package_rpm.bbclass
> > +++ b/meta/classes/package_rpm.bbclass
> > @@ -662,10 +662,13 @@ python write_specfile () {
> >      def walk_files(walkpath, target, conffiles):
> >          for rootpath, dirs, files in os.walk(walkpath):
> >              path = rootpath.replace(walkpath, "")
> > +            path = path.replace("%", "[%]")
> >              for dir in dirs:
> > +                dir = dir.replace("%", "[%]")
> >                  # All packages own the directories their files are in...
> >                  target.append('%dir "' + path + '/' + dir + '"')
> >              for file in files:
> > +                file = file.replace("%", "[%]")
> >                  if conffiles.count(path + '/' + file):
> >                      target.append('%config "' + path + '/' + file + '"')
> >                  else:
>
> Are you sure this is correct? The documentation I have been able to dig up
> via
> google seems to suggest that %% is the correct way to escape a % sign in a
> spec file.
>
> Cheers,
> Paul
>
> --
>
> Paul Eggleton
> Intel Open Source Technology Centre
>

Patch

diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
index 36bad09..6c73e37 100644
--- a/meta/classes/package_rpm.bbclass
+++ b/meta/classes/package_rpm.bbclass
@@ -662,10 +662,13 @@  python write_specfile () {
     def walk_files(walkpath, target, conffiles):
         for rootpath, dirs, files in os.walk(walkpath):
             path = rootpath.replace(walkpath, "")
+            path = path.replace("%", "[%]")
             for dir in dirs:
+                dir = dir.replace("%", "[%]")
                 # All packages own the directories their files are in...
                 target.append('%dir "' + path + '/' + dir + '"')
             for file in files:
+                file = file.replace("%", "[%]")
                 if conffiles.count(path + '/' + file):
                     target.append('%config "' + path + '/' + file + '"')
                 else: