Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] distrodata.bbclass: Include PRSPV variable in upstream version checking
@ 2013-07-18 16:08 Emilia Ciobanu
  2013-07-18 19:23 ` Saul Wold
  0 siblings, 1 reply; 3+ messages in thread
From: Emilia Ciobanu @ 2013-07-18 16:08 UTC (permalink / raw)
  To: openembedded-core

The PRSPV variable is used for the packages that have different
representation for a same upstream and local version (e.g 2.0 vs 20).
In this case, the system is using PRSPV instead of PV when comparing
the local and upstream versions.

The packages that are using this modification are the following:
	* zip
	* unzip
	* docbook-sgml-dtd-3.1-native
	* docbook-sgml-dtd-4.1-native

Signed-off-by: Emilia Ciobanu <emilia.maria.silvia.ciobanu@intel.com>
---
 meta/classes/distrodata.bbclass |   39 ++++++++++++++++++++++++++-------------
 1 file changed, 26 insertions(+), 13 deletions(-)

diff --git a/meta/classes/distrodata.bbclass b/meta/classes/distrodata.bbclass
index 204612c..af52dd5 100644
--- a/meta/classes/distrodata.bbclass
+++ b/meta/classes/distrodata.bbclass
@@ -71,7 +71,7 @@ python do_distrodata_np() {
         rstatus = localdata.getVar('RECIPE_COLOR', True)
         if rstatus is not None:
                 rstatus = rstatus.replace(',','')
-                
+
         pupver = localdata.getVar('RECIPE_UPSTREAM_VERSION', True)
         if pcurver == pupver:
                 vermatch="1"
@@ -157,7 +157,7 @@ python do_distrodata() {
         rstatus = localdata.getVar('RECIPE_COLOR', True)
         if rstatus is not None:
                 rstatus = rstatus.replace(',','')
-                
+
         pupver = localdata.getVar('RECIPE_UPSTREAM_VERSION', True)
         if pcurver == pupver:
                 vermatch="1"
@@ -408,7 +408,7 @@ python do_checkpkg() {
                                 s = "%s[^\d\"]*?(\d+[\.\-_])+\d+/?" % m.group()
                         else:
                                 s = "(\d+[\.\-_])+\d+/?"
-                                
+
                         searchstr = "[hH][rR][eE][fF]=\"%s\">" % s
 
                         reg = re.compile(searchstr)
@@ -563,7 +563,10 @@ python do_checkpkg() {
                chk_uri = src_uri
         pdesc = localdata.getVar('DESCRIPTION', True)
         pgrp = localdata.getVar('SECTION', True)
-        pversion = localdata.getVar('PV', True)
+        if localdata.getVar('PRSPV', True):
+                pversion = localdata.getVar('PRSPV', True)
+        else:
+                pversion = localdata.getVar('PV', True)
         plicense = localdata.getVar('LICENSE', True)
         psection = localdata.getVar('SECTION', True)
         phome = localdata.getVar('HOMEPAGE', True)
@@ -590,31 +593,41 @@ python do_checkpkg() {
 
         (type, host, path, user, pswd, parm) = bb.decodeurl(uri)
         if type in ['http', 'https', 'ftp']:
-                pcurver = d.getVar('PV', True)
+                if d.getVar('PRSPV', True):
+                    pcurver = d.getVar('PRSPV', True)
+                else:
+                    pcurver = d.getVar('PV', True)
         else:
-                pcurver = d.getVar("SRCREV", True)
+                if d.getVar('PRSPV', True):
+                    pcurver = d.getVar('PRSPV', True)
+                else:
+                    pcurver = d.getVar("SRCREV", True)
+
 
         if type in ['http', 'https', 'ftp']:
                 newver = pcurver
                 altpath = path
                 dirver = "-"
                 curname = "-"
-        
+
                 """
                 match version number amid the path, such as "5.7" in:
-                        http://download.gnome.org/sources/${PN}/5.7/${PN}-${PV}.tar.gz        
+                        http://download.gnome.org/sources/${PN}/5.7/${PN}-${PV}.tar.gz
                 N.B. how about sth. like "../5.7/5.8/..."? Not find such example so far :-P
                 """
                 m = re.search(r"[^/]*(\d+\.)+\d+([\-_]r\d+)*/", path)
                 if m:
                         altpath = path.split(m.group())[0]
                         dirver = m.group().strip("/")
-        
+
                         """use new path and remove param. for wget only param is md5sum"""
                         alturi = bb.encodeurl([type, host, altpath, user, pswd, {}])
                         my_uri = d.getVar('REGEX_URI', True)
                         if my_uri:
-                            newver = d.getVar('PV', True)
+                            if d.getVar('PRSPV', True):
+                                    newver = d.getVar('PRSPV', True)
+                            else:
+                                    newver = d.getVar('PV', True)
                         else:
                             newver = check_new_dir(alturi, dirver, d)
                         altpath = path
@@ -624,7 +637,7 @@ python do_checkpkg() {
                 """Now try to acquire all remote files in current directory"""
                 if not re.match("Err", newver):
                         curname = altpath.split("/")[-1]
-        
+
                         """get remote name by skipping pacakge name"""
                         m = re.search(r"/.*/", altpath)
                         if not m:
@@ -650,7 +663,7 @@ python do_checkpkg() {
                                 pstatus = "UPDATE"
                         else:
                                 pstatus = "MATCH"
-        
+
                 if re.match("Err", newver):
                         pstatus = newver + ":" + altpath + ":" + dirver + ":" + curname
         elif type == 'git':
@@ -796,7 +809,7 @@ python do_checkpkg() {
                         pmstatus = "MATCH"
                 else:
                         pmstatus = "UPDATE"
-        
+
         psrcuri = psrcuri.split()[0]
         pdepends = "".join(pdepends.split("\t"))
         pdesc = "".join(pdesc.split("\t"))
-- 
1.7.9.5



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] distrodata.bbclass: Include PRSPV variable in upstream version checking
  2013-07-18 16:08 [PATCH] distrodata.bbclass: Include PRSPV variable in upstream version checking Emilia Ciobanu
@ 2013-07-18 19:23 ` Saul Wold
  2013-07-23 15:21   ` Burton, Ross
  0 siblings, 1 reply; 3+ messages in thread
From: Saul Wold @ 2013-07-18 19:23 UTC (permalink / raw)
  To: Emilia Ciobanu; +Cc: openembedded-core

On 07/18/2013 09:08 AM, Emilia Ciobanu wrote:
> The PRSPV variable is used for the packages that have different
> representation for a same upstream and local version (e.g 2.0 vs 20).
> In this case, the system is using PRSPV instead of PV when comparing
> the local and upstream versions.
>
> The packages that are using this modification are the following:
> 	* zip
> 	* unzip
> 	* docbook-sgml-dtd-3.1-native
> 	* docbook-sgml-dtd-4.1-native
>

I thought we were going to look into use regex instead of adding a new 
variable.

This also seems to contain some white space changes, those should be in 
a seperate patch.

Sau!

> Signed-off-by: Emilia Ciobanu <emilia.maria.silvia.ciobanu@intel.com>
> ---
>   meta/classes/distrodata.bbclass |   39 ++++++++++++++++++++++++++-------------
>   1 file changed, 26 insertions(+), 13 deletions(-)
>
> diff --git a/meta/classes/distrodata.bbclass b/meta/classes/distrodata.bbclass
> index 204612c..af52dd5 100644
> --- a/meta/classes/distrodata.bbclass
> +++ b/meta/classes/distrodata.bbclass
> @@ -71,7 +71,7 @@ python do_distrodata_np() {
>           rstatus = localdata.getVar('RECIPE_COLOR', True)
>           if rstatus is not None:
>                   rstatus = rstatus.replace(',','')
> -
> +
>           pupver = localdata.getVar('RECIPE_UPSTREAM_VERSION', True)
>           if pcurver == pupver:
>                   vermatch="1"
> @@ -157,7 +157,7 @@ python do_distrodata() {
>           rstatus = localdata.getVar('RECIPE_COLOR', True)
>           if rstatus is not None:
>                   rstatus = rstatus.replace(',','')
> -
> +
>           pupver = localdata.getVar('RECIPE_UPSTREAM_VERSION', True)
>           if pcurver == pupver:
>                   vermatch="1"
> @@ -408,7 +408,7 @@ python do_checkpkg() {
>                                   s = "%s[^\d\"]*?(\d+[\.\-_])+\d+/?" % m.group()
>                           else:
>                                   s = "(\d+[\.\-_])+\d+/?"
> -
> +
>                           searchstr = "[hH][rR][eE][fF]=\"%s\">" % s
>
>                           reg = re.compile(searchstr)
> @@ -563,7 +563,10 @@ python do_checkpkg() {
>                  chk_uri = src_uri
>           pdesc = localdata.getVar('DESCRIPTION', True)
>           pgrp = localdata.getVar('SECTION', True)
> -        pversion = localdata.getVar('PV', True)
> +        if localdata.getVar('PRSPV', True):
> +                pversion = localdata.getVar('PRSPV', True)
> +        else:
> +                pversion = localdata.getVar('PV', True)
>           plicense = localdata.getVar('LICENSE', True)
>           psection = localdata.getVar('SECTION', True)
>           phome = localdata.getVar('HOMEPAGE', True)
> @@ -590,31 +593,41 @@ python do_checkpkg() {
>
>           (type, host, path, user, pswd, parm) = bb.decodeurl(uri)
>           if type in ['http', 'https', 'ftp']:
> -                pcurver = d.getVar('PV', True)
> +                if d.getVar('PRSPV', True):
> +                    pcurver = d.getVar('PRSPV', True)
> +                else:
> +                    pcurver = d.getVar('PV', True)
>           else:
> -                pcurver = d.getVar("SRCREV", True)
> +                if d.getVar('PRSPV', True):
> +                    pcurver = d.getVar('PRSPV', True)
> +                else:
> +                    pcurver = d.getVar("SRCREV", True)
> +
>
>           if type in ['http', 'https', 'ftp']:
>                   newver = pcurver
>                   altpath = path
>                   dirver = "-"
>                   curname = "-"
> -
> +
>                   """
>                   match version number amid the path, such as "5.7" in:
> -                        http://download.gnome.org/sources/${PN}/5.7/${PN}-${PV}.tar.gz
> +                        http://download.gnome.org/sources/${PN}/5.7/${PN}-${PV}.tar.gz
>                   N.B. how about sth. like "../5.7/5.8/..."? Not find such example so far :-P
>                   """
>                   m = re.search(r"[^/]*(\d+\.)+\d+([\-_]r\d+)*/", path)
>                   if m:
>                           altpath = path.split(m.group())[0]
>                           dirver = m.group().strip("/")
> -
> +
>                           """use new path and remove param. for wget only param is md5sum"""
>                           alturi = bb.encodeurl([type, host, altpath, user, pswd, {}])
>                           my_uri = d.getVar('REGEX_URI', True)
>                           if my_uri:
> -                            newver = d.getVar('PV', True)
> +                            if d.getVar('PRSPV', True):
> +                                    newver = d.getVar('PRSPV', True)
> +                            else:
> +                                    newver = d.getVar('PV', True)
>                           else:
>                               newver = check_new_dir(alturi, dirver, d)
>                           altpath = path
> @@ -624,7 +637,7 @@ python do_checkpkg() {
>                   """Now try to acquire all remote files in current directory"""
>                   if not re.match("Err", newver):
>                           curname = altpath.split("/")[-1]
> -
> +
>                           """get remote name by skipping pacakge name"""
>                           m = re.search(r"/.*/", altpath)
>                           if not m:
> @@ -650,7 +663,7 @@ python do_checkpkg() {
>                                   pstatus = "UPDATE"
>                           else:
>                                   pstatus = "MATCH"
> -
> +
>                   if re.match("Err", newver):
>                           pstatus = newver + ":" + altpath + ":" + dirver + ":" + curname
>           elif type == 'git':
> @@ -796,7 +809,7 @@ python do_checkpkg() {
>                           pmstatus = "MATCH"
>                   else:
>                           pmstatus = "UPDATE"
> -
> +
>           psrcuri = psrcuri.split()[0]
>           pdepends = "".join(pdepends.split("\t"))
>           pdesc = "".join(pdesc.split("\t"))
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] distrodata.bbclass: Include PRSPV variable in upstream version checking
  2013-07-18 19:23 ` Saul Wold
@ 2013-07-23 15:21   ` Burton, Ross
  0 siblings, 0 replies; 3+ messages in thread
From: Burton, Ross @ 2013-07-23 15:21 UTC (permalink / raw)
  To: Saul Wold; +Cc: openembedded-core

On 18 July 2013 20:23, Saul Wold <sgw@linux.intel.com> wrote:
> I thought we were going to look into use regex instead of adding a new
> variable.

Specifically, I was thinking something like this would work:

package_regex.inc has an optional new variable, REGEX_PV_FILTER.  If
set, this will be used with re.sub to filter the PV extracted by
REGEX. Something cloning the syntax of Perl's s/// operator maybe,
using / to split the input RE and the replacement string.

i.e. REGEX_PV_FILTER_pn-docbook = "\./" would replace all dots with
the empty string, thus changing 1.2.3 into 123.

Ross


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-07-23 15:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-18 16:08 [PATCH] distrodata.bbclass: Include PRSPV variable in upstream version checking Emilia Ciobanu
2013-07-18 19:23 ` Saul Wold
2013-07-23 15:21   ` Burton, Ross

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox