Patchwork [2/2] opkg-utils: Allow uppercase lettlers in package names

login
register
mail settings
Submitter Khem Raj
Date May 19, 2011, 9:09 p.m.
Message ID <836208067c345a911ddb3a266ac398b435054798.1305839225.git.raj.khem@gmail.com>
Download mbox | patch
Permalink /patch/4505/
State New, archived
Headers show

Comments

Khem Raj - May 19, 2011, 9:09 p.m.
Some packages have uppercase letters in their names e.g.
efikamx kernel. We allow uppercase character with
uppercase-letters.patch

Import mtime-int.patch from OE commit
c81990aecae3bdf70a7c924699776b248ab7a006

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../opkg-utils/opkg-utils/mtime-int.patch          |   29 +++++++++++++
 .../opkg-utils/opkg-utils/uppercase-letters.patch  |   44 ++++++++++++++++++++
 meta/recipes-devtools/opkg-utils/opkg-utils_svn.bb |    8 +++-
 3 files changed, 79 insertions(+), 2 deletions(-)
 create mode 100644 meta/recipes-devtools/opkg-utils/opkg-utils/mtime-int.patch
 create mode 100644 meta/recipes-devtools/opkg-utils/opkg-utils/uppercase-letters.patch
Frans Meulenbroeks - May 20, 2011, 5:22 a.m.
2011/5/19 Khem Raj <raj.khem@gmail.com>

> Some packages have uppercase letters in their names e.g.
> efikamx kernel. We allow uppercase character with
> uppercase-letters.patch
>
> Import mtime-int.patch from OE commit
> c81990aecae3bdf70a7c924699776b248ab7a006
>
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
>  .../opkg-utils/opkg-utils/mtime-int.patch          |   29 +++++++++++++
>  .../opkg-utils/opkg-utils/uppercase-letters.patch  |   44
> ++++++++++++++++++++
>  meta/recipes-devtools/opkg-utils/opkg-utils_svn.bb |    8 +++-
>  3 files changed, 79 insertions(+), 2 deletions(-)
>  create mode 100644
> meta/recipes-devtools/opkg-utils/opkg-utils/mtime-int.patch
>  create mode 100644
> meta/recipes-devtools/opkg-utils/opkg-utils/uppercase-letters.patch
>
> diff --git a/meta/recipes-devtools/opkg-utils/opkg-utils/mtime-int.patch
> b/meta/recipes-devtools/opkg-utils/opkg-utils/mtime-int.patch
> new file mode 100644
> index 0000000..fdbce21
> --- /dev/null
> +++ b/meta/recipes-devtools/opkg-utils/opkg-utils/mtime-int.patch
> @@ -0,0 +1,29 @@
> +Convert mtime to int before comparing it
> +
> +The st_mtime attribute (which is a float) is compared against a value
> +from the timestamp database, which was stored as an integer there.
> +
> +When working on a filesystem with precise timestamps the comparision
> +will fail nearly everytime hence.
> +
> +Although it might be possible to enhance the database to store the
> +fractional part too, this will complicate things more than we would
> +gain by this change.
>

This part is not covered by the commit message. Was it intended to be in
here.?
Rest of the patch looks fine to me.

Frans

> +
> +Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
> +
> +Upstream-Status: Pending
> +
> +Index: opkg-utils/opkg-make-index
> +===================================================================
> +--- opkg-utils.orig/opkg-make-index
> ++++ opkg-utils/opkg-make-index
> +@@ -100,7 +100,7 @@ for filename in files:
> +      pkg = None
> +      fnameStat = os.stat(filename)
> +      if old_pkg_hash.has_key(basename):
> +-          if pkgsStamps.has_key(basename) and fnameStat.st_mtime ==
> pkgsStamps[basename]:
> ++          if pkgsStamps.has_key(basename) and int(fnameStat.st_mtime) ==
> pkgsStamps[basename]:
> +             if (verbose):
> +                sys.stderr.write("Found %s in Packages\n" % (filename,))
> +             pkg = old_pkg_hash[basename]
> diff --git
> a/meta/recipes-devtools/opkg-utils/opkg-utils/uppercase-letters.patch
> b/meta/recipes-devtools/opkg-utils/opkg-utils/uppercase-letters.patch
> new file mode 100644
> index 0000000..689d780
> --- /dev/null
> +++ b/meta/recipes-devtools/opkg-utils/opkg-utils/uppercase-letters.patch
> @@ -0,0 +1,44 @@
> +when building packages, accept uppercase letters in the package name
> +Fixes issues like
> +
> +
> +| Packaged contents of kernel into
> /home/kraj/work/angstrom/build/tmp-angstrom_2010_x-eglibc/work/efikamx-angstrom-linux-gnueabi/linux-efikamx-2.6.31-r0/deploy-ipks/efikamx/kernel_2.6.31-r0_efikamx.ipk
> +| kernel-2.6.31.12-ER1
> +| *** Error: Package name  contains illegal characters, (other than
> [a-z0-9.+-])
> +|
> +| opkg-build: Please fix the above errors and try again.
> +| ERROR: Function 'opkg-build execution failed' failed
> +
> +Signed-off-by: Khem Raj <raj.khem@gmail.com>
> +
> +Upstream-Status: Pending
> +Index: opkg-utils/opkg-buildpackage
> +===================================================================
> +--- opkg-utils.orig/opkg-buildpackage
> ++++ opkg-utils/opkg-buildpackage
> +@@ -65,8 +65,8 @@ pkg_appears_sane_control() {
> +       required_field Maintainer >/dev/null
> +       required_field Description >/dev/null
> +
> +-      if echo $pkg | grep '[^a-z0-9.+-]'; then
> +-              echo "opkg-build: Error: Package name $name contains
> illegal characters, (other than [a-z0-9.+-])"
> ++      if echo $pkg | grep '[^a-zA-Z0-9.+-]'; then
> ++              echo "opkg-build: Error: Package name $name contains
> illegal characters, (other than [a-zA-Z0-9.+-])"
> +               PKG_ERROR=1;
> +       fi
> +
> +Index: opkg-utils/opkg-build
> +===================================================================
> +--- opkg-utils.orig/opkg-build
> ++++ opkg-utils/opkg-build
> +@@ -118,8 +118,8 @@ You probably want to chown these to a sy
> +       disallowed_filename=`disallowed_field Filename`
> +       [ "$?" -ne 0 ] && PKG_ERROR=1
> +
> +-      if echo $pkg | grep '[^a-z0-9.+-]'; then
> +-              echo "*** Error: Package name $name contains illegal
> characters, (other than [a-z0-9.+-])" >&2
> ++      if echo $pkg | grep '[^a-zA-Z0-9.+-]'; then
> ++              echo "*** Error: Package name $name contains illegal
> characters, (other than [a-zA-Z0-9.+-])" >&2
> +               PKG_ERROR=1;
> +       fi
> +
> diff --git a/meta/recipes-devtools/opkg-utils/opkg-utils_svn.bbb/meta/recipes-devtools/opkg-utils/
> opkg-utils_svn.bb
> index 0db6f80..7e4c6e4 100644
> --- a/meta/recipes-devtools/opkg-utils/opkg-utils_svn.bb
> +++ b/meta/recipes-devtools/opkg-utils/opkg-utils_svn.bb
> @@ -9,10 +9,13 @@ RDEPENDS_${PN} = "python"
>  RDEPENDS_${PN}_virtclass-native = ""
>  SRCREV = "4747"
>  PV = "0.1.8+svnr${SRCPV}"
> -PR = "r2"
> +PR = "r3"
>
>  SRC_URI = "svn://
> svn.openmoko.org/trunk/src/host/;module=opkg-utils;proto=http \
> -           file://index-ignore-filenotfound.patch"
> +           file://index-ignore-filenotfound.patch \
> +           file://mtime-int.patch \
> +           file://uppercase-letters.patch \
> +           "
>
>  S = "${WORKDIR}/opkg-utils"
>
> @@ -24,3 +27,4 @@ do_install() {
>  }
>
>  BBCLASSEXTEND = "native"
> +TARGET_CC_ARCH += "${LDFLAGS}"
> --
> 1.7.4.1
>
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
>
Phil Blundell - May 20, 2011, 6:45 a.m.
On Thu, 2011-05-19 at 14:09 -0700, Khem Raj wrote:
> Some packages have uppercase letters in their names e.g.
> efikamx kernel. We allow uppercase character with
> uppercase-letters.patch

This is not a good idea.  Uppercase characters have never been permitted
in .deb/.ipk. 

Isn't legitimize_package_name() crunching them to lower case for you?
If not then I think it should be made to do that.

p.
Phil Blundell - May 20, 2011, 3:01 p.m.
On Fri, 2011-05-20 at 07:45 +0100, Phil Blundell wrote:
> On Thu, 2011-05-19 at 14:09 -0700, Khem Raj wrote:
> > Some packages have uppercase letters in their names e.g.
> > efikamx kernel. We allow uppercase character with
> > uppercase-letters.patch
> 
> This is not a good idea.  Uppercase characters have never been permitted
> in .deb/.ipk. 
> 
> Isn't legitimize_package_name() crunching them to lower case for you?
> If not then I think it should be made to do that.

I just checked the code and it certainly looks like it should be doing
that:

	# Remaining package name validity fixes
	return s.lower().replace('_', '-').replace('@', '+').replace(',', '+').replace('/', '-')

So if that isn't working for you then I think it needs a bit of
debugging.

p.
Koen Kooi - May 20, 2011, 3:06 p.m.
Op 20 mei 2011, om 17:01 heeft Phil Blundell het volgende geschreven:

> On Fri, 2011-05-20 at 07:45 +0100, Phil Blundell wrote:
>> On Thu, 2011-05-19 at 14:09 -0700, Khem Raj wrote:
>>> Some packages have uppercase letters in their names e.g.
>>> efikamx kernel. We allow uppercase character with
>>> uppercase-letters.patch
>> 
>> This is not a good idea.  Uppercase characters have never been permitted
>> in .deb/.ipk. 
>> 
>> Isn't legitimize_package_name() crunching them to lower case for you?
>> If not then I think it should be made to do that.
> 
> I just checked the code and it certainly looks like it should be doing
> that:
> 
> 	# Remaining package name validity fixes
> 	return s.lower().replace('_', '-').replace('@', '+').replace(',', '+').replace('/', '-')
> 
> So if that isn't working for you then I think it needs a bit of
> debugging.

Does that run on PV or PN? I think Khem has weird things in PV
Andreas Oberritter - May 20, 2011, 4:05 p.m.
On 05/20/2011 05:01 PM, Phil Blundell wrote:
> On Fri, 2011-05-20 at 07:45 +0100, Phil Blundell wrote:
>> On Thu, 2011-05-19 at 14:09 -0700, Khem Raj wrote:
>>> Some packages have uppercase letters in their names e.g.
>>> efikamx kernel. We allow uppercase character with
>>> uppercase-letters.patch
>>
>> This is not a good idea.  Uppercase characters have never been permitted
>> in .deb/.ipk. 
>>
>> Isn't legitimize_package_name() crunching them to lower case for you?
>> If not then I think it should be made to do that.
> 
> I just checked the code and it certainly looks like it should be doing
> that:
> 
> 	# Remaining package name validity fixes
> 	return s.lower().replace('_', '-').replace('@', '+').replace(',', '+').replace('/', '-')
> 
> So if that isn't working for you then I think it needs a bit of
> debugging.

http://patches.openembedded.org/patch/2255/ should solve the problem. I
was waiting for a second ack.

Khem, if this fixes the problem for you, please send an ack or push this
patch.

Regards,
Andreas
Richard Purdie - May 20, 2011, 4:31 p.m.
On Fri, 2011-05-20 at 18:05 +0200, Andreas Oberritter wrote:
> On 05/20/2011 05:01 PM, Phil Blundell wrote:
> > On Fri, 2011-05-20 at 07:45 +0100, Phil Blundell wrote:
> >> On Thu, 2011-05-19 at 14:09 -0700, Khem Raj wrote:
> >>> Some packages have uppercase letters in their names e.g.
> >>> efikamx kernel. We allow uppercase character with
> >>> uppercase-letters.patch
> >>
> >> This is not a good idea.  Uppercase characters have never been permitted
> >> in .deb/.ipk. 
> >>
> >> Isn't legitimize_package_name() crunching them to lower case for you?
> >> If not then I think it should be made to do that.
> > 
> > I just checked the code and it certainly looks like it should be doing
> > that:
> > 
> > 	# Remaining package name validity fixes
> > 	return s.lower().replace('_', '-').replace('@', '+').replace(',', '+').replace('/', '-')
> > 
> > So if that isn't working for you then I think it needs a bit of
> > debugging.
> 
> http://patches.openembedded.org/patch/2255/ should solve the problem. I
> was waiting for a second ack.
> 
> Khem, if this fixes the problem for you, please send an ack or push this
> patch.

I merged this to OE-Core since I happened to look at it :)

Cheers,

Richard
Khem Raj - May 20, 2011, 6:35 p.m.
On Fri, May 20, 2011 at 9:05 AM, Andreas Oberritter
<obi@opendreambox.org> wrote:
> http://patches.openembedded.org/patch/2255/ should solve the problem. I
> was waiting for a second ack.
>
> Khem, if this fixes the problem for you, please send an ack or push this
> patch.
>

yes it does thanks. I meant to look for this before I butchered opkg-utils
but my memory did not serve me well.
Koen Kooi - May 21, 2011, 6:43 a.m.
Op 20 mei 2011, om 20:35 heeft Khem Raj het volgende geschreven:

> On Fri, May 20, 2011 at 9:05 AM, Andreas Oberritter
> <obi@opendreambox.org> wrote:
>> http://patches.openembedded.org/patch/2255/ should solve the problem. I
>> was waiting for a second ack.
>> 
>> Khem, if this fixes the problem for you, please send an ack or push this
>> patch.
>> 
> 
> yes it does thanks. I meant to look for this before I butchered opkg-utils
> but my memory did not serve me well.

With a build from scratch I get:

|  * satisfy_dependencies_for: Cannot satisfy the following dependencies for task-base:
|  *    kernel-2.6.31.12-ER1 *  kernel-2.6.31.12-ER1 *  kernel-2.6.31.12-ER1 *  kernel-2.6.31.12-ER1 *  kernel-2.6.31.12-ER1 *  kernel-2.6.31.12-ER1 *  kernel-2.6.31.12-ER1 *  kernel-2.6.31.12-ER1 *  kernel-2.6.31.12-ER1 *  kernel-2.6.31.12-ER1 *  kernel-2.6.31.12-ER1 *  kernel-2.6.31.12-ER1 *   kernel-2.6.31.12-ER1 *  kernel-2.6.31.12-ER1 *  kernel-2.6.31.12-ER1 *  kernel-2.6.31.12-ER1 *  kernel-2.6.31.12-ER1 *
|  * opkg_install_cmd: Cannot install package task-base.
|  * satisfy_dependencies_for: Cannot satisfy the following dependencies for task-base-extended:
|  *    kernel-2.6.31.12-ER1 *  kernel-2.6.31.12-ER1 *  kernel-2.6.31.12-ER1 *  kernel-2.6.31.12-ER1 *  kernel-2.6.31.12-ER1 *  kernel-2.6.31.12-ER1 *  kernel-2.6.31.12-ER1 *
|  * opkg_install_cmd: Cannot install package task-base-extended.

Patch

diff --git a/meta/recipes-devtools/opkg-utils/opkg-utils/mtime-int.patch b/meta/recipes-devtools/opkg-utils/opkg-utils/mtime-int.patch
new file mode 100644
index 0000000..fdbce21
--- /dev/null
+++ b/meta/recipes-devtools/opkg-utils/opkg-utils/mtime-int.patch
@@ -0,0 +1,29 @@ 
+Convert mtime to int before comparing it
+
+The st_mtime attribute (which is a float) is compared against a value
+from the timestamp database, which was stored as an integer there.
+
+When working on a filesystem with precise timestamps the comparision
+will fail nearly everytime hence.
+
+Although it might be possible to enhance the database to store the
+fractional part too, this will complicate things more than we would
+gain by this change.
+
+Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
+
+Upstream-Status: Pending
+
+Index: opkg-utils/opkg-make-index
+===================================================================
+--- opkg-utils.orig/opkg-make-index
++++ opkg-utils/opkg-make-index
+@@ -100,7 +100,7 @@ for filename in files:
+      pkg = None
+      fnameStat = os.stat(filename)
+      if old_pkg_hash.has_key(basename):
+-          if pkgsStamps.has_key(basename) and fnameStat.st_mtime == pkgsStamps[basename]:
++          if pkgsStamps.has_key(basename) and int(fnameStat.st_mtime) == pkgsStamps[basename]:
+             if (verbose):
+                sys.stderr.write("Found %s in Packages\n" % (filename,))
+             pkg = old_pkg_hash[basename]
diff --git a/meta/recipes-devtools/opkg-utils/opkg-utils/uppercase-letters.patch b/meta/recipes-devtools/opkg-utils/opkg-utils/uppercase-letters.patch
new file mode 100644
index 0000000..689d780
--- /dev/null
+++ b/meta/recipes-devtools/opkg-utils/opkg-utils/uppercase-letters.patch
@@ -0,0 +1,44 @@ 
+when building packages, accept uppercase letters in the package name
+Fixes issues like
+
+
+| Packaged contents of kernel into /home/kraj/work/angstrom/build/tmp-angstrom_2010_x-eglibc/work/efikamx-angstrom-linux-gnueabi/linux-efikamx-2.6.31-r0/deploy-ipks/efikamx/kernel_2.6.31-r0_efikamx.ipk
+| kernel-2.6.31.12-ER1
+| *** Error: Package name  contains illegal characters, (other than [a-z0-9.+-])
+|
+| opkg-build: Please fix the above errors and try again.
+| ERROR: Function 'opkg-build execution failed' failed
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Upstream-Status: Pending
+Index: opkg-utils/opkg-buildpackage
+===================================================================
+--- opkg-utils.orig/opkg-buildpackage
++++ opkg-utils/opkg-buildpackage
+@@ -65,8 +65,8 @@ pkg_appears_sane_control() {
+ 	required_field Maintainer >/dev/null
+ 	required_field Description >/dev/null
+ 
+-	if echo $pkg | grep '[^a-z0-9.+-]'; then
+-		echo "opkg-build: Error: Package name $name contains illegal characters, (other than [a-z0-9.+-])"
++	if echo $pkg | grep '[^a-zA-Z0-9.+-]'; then
++		echo "opkg-build: Error: Package name $name contains illegal characters, (other than [a-zA-Z0-9.+-])"
+ 		PKG_ERROR=1;
+ 	fi
+ 
+Index: opkg-utils/opkg-build
+===================================================================
+--- opkg-utils.orig/opkg-build
++++ opkg-utils/opkg-build
+@@ -118,8 +118,8 @@ You probably want to chown these to a sy
+ 	disallowed_filename=`disallowed_field Filename`
+ 	[ "$?" -ne 0 ] && PKG_ERROR=1
+ 
+-	if echo $pkg | grep '[^a-z0-9.+-]'; then
+-		echo "*** Error: Package name $name contains illegal characters, (other than [a-z0-9.+-])" >&2
++	if echo $pkg | grep '[^a-zA-Z0-9.+-]'; then
++		echo "*** Error: Package name $name contains illegal characters, (other than [a-zA-Z0-9.+-])" >&2
+ 		PKG_ERROR=1;
+ 	fi
+ 
diff --git a/meta/recipes-devtools/opkg-utils/opkg-utils_svn.bb b/meta/recipes-devtools/opkg-utils/opkg-utils_svn.bb
index 0db6f80..7e4c6e4 100644
--- a/meta/recipes-devtools/opkg-utils/opkg-utils_svn.bb
+++ b/meta/recipes-devtools/opkg-utils/opkg-utils_svn.bb
@@ -9,10 +9,13 @@  RDEPENDS_${PN} = "python"
 RDEPENDS_${PN}_virtclass-native = ""
 SRCREV = "4747"
 PV = "0.1.8+svnr${SRCPV}"
-PR = "r2"
+PR = "r3"
 
 SRC_URI = "svn://svn.openmoko.org/trunk/src/host/;module=opkg-utils;proto=http \
-           file://index-ignore-filenotfound.patch"
+           file://index-ignore-filenotfound.patch \
+           file://mtime-int.patch \
+           file://uppercase-letters.patch \
+           "
 
 S = "${WORKDIR}/opkg-utils"
 
@@ -24,3 +27,4 @@  do_install() {
 }
 
 BBCLASSEXTEND = "native"
+TARGET_CC_ARCH += "${LDFLAGS}"