base: decode SRC_URI before adding implicit fetch dependencies
PATCH 1/2 base: decode SRC_URI before adding implicit fetch dependencies
To avoid false positives such as a SRC_URI for http://foo.xz/foo.zip gaining a dependnecy on xz-native decode the URI so that precise tests can be done.
--- meta/classes/base.bbclass | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-)
meta/classes/base.bbclass +12 -13
@@ -527,38 +527,37 @@ python () { bb.note("INCLUDING " + pn + " as buildable despite INCOMPATIBLE_LICENSE because it has been whitelisted for HOSTTOOLS") srcuri = d.getVar('SRC_URI', True) + (scheme, _ , path) = bb.fetch.decodeurl(srcuri)[:3] # Svn packages should DEPEND on subversion-native - if "svn://" in srcuri: + if scheme == "svn": d.appendVarFlag('do_fetch', 'depends', ' subversion-native:do_populate_sysroot') # Git packages should DEPEND on git-native - if "git://" in srcuri: + elif scheme == "git": d.appendVarFlag('do_fetch', 'depends', ' git-native:do_populate_sysroot') # Mercurial packages should DEPEND on mercurial-native - elif "hg://" in srcuri: + elif scheme == "hg": d.appendVarFlag('do_fetch', 'depends', ' mercurial-native:do_populate_sysroot') # OSC packages should DEPEND on osc-native - elif "osc://" in srcuri: + elif scheme == "osc" d.appendVarFlag('do_fetch', 'depends', ' osc-native:do_populate_sysroot') - # *.lz4 should depends on lz4-native for unpacking - # Not endswith because of "*.patch.lz4;patch=1". Need bb.fetch.decodeurl in future - if '.lz4' in srcuri: + # *.lz4 should DEPEND on lz4-native for unpacking + if path.endswith('.lz4'): d.appendVarFlag('do_unpack', 'depends', ' lz4-native:do_populate_sysroot') - # *.xz should depends on xz-native for unpacking - # Not endswith because of "*.patch.xz;patch=1". Need bb.fetch.decodeurl in future - if '.xz' in srcuri: + # *.xz should DEPEND on xz-native for unpacking + elif path.endswith('.xz'): d.appendVarFlag('do_unpack', 'depends', ' xz-native:do_populate_sysroot') - # unzip-native should already be staged before unpacking ZIP recipes - if ".zip" in srcuri: + # .zip should DEPEND on unzip-native for unpacking + elif path.endswith('.zip'): d.appendVarFlag('do_unpack', 'depends', ' unzip-native:do_populate_sysroot') # file is needed by rpm2cpio.sh - if ".src.rpm" in srcuri: + elif path.endswith('.src.rpm'): d.appendVarFlag('do_unpack', 'depends', ' file-native:do_populate_sysroot') set_packagetriplet(d)
Signature · 1 line
2.4.9 (Apple Git-60)
PATCH 2/2 base: add automatic dependency on lzip-native for .lz SRC_URI
Now that the SRC_URI is parsed this can be done without false-positives.
--- meta/classes/base.bbclass | 4 ++++ 1 file changed, 4 insertions(+)
meta/classes/base.bbclass +4 -0
@@ -548,6 +548,10 @@ python () { if path.endswith('.lz4'): d.appendVarFlag('do_unpack', 'depends', ' lz4-native:do_populate_sysroot') + # *.lz should DEPEND on lzip-native for unpacking + elif path.endswith('.lz'): + d.appendVarFlag('do_unpack', 'depends', ' lzip-native:do_populate_sysroot') + # *.xz should DEPEND on xz-native for unpacking elif path.endswith('.xz'): d.appendVarFlag('do_unpack', 'depends', ' xz-native:do_populate_sysroot')
Signature · 1 line
2.4.9 (Apple Git-60)
These don't actually work, v2 incoming.
Ross
Quoted 79 lines · Ross Burton
To avoid false positives such as a
SRC_URIfor http://foo.xz/foo.zip
gaining a
dependnecy on xz-native decode the URI so that precise tests can be done.Signed-off-by Ross Burton <[email protected]>--- meta/classes/base.bbclass | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-)meta/classes/base.bbclass +5
-6@@ -527,38 +527,37 @@ python () { bb.note("INCLUDING " + pn + " as buildable despite INCOMPATIBLE_LICENSE because it has been whitelisted for HOSTTOOLS") srcuri = d.getVar('SRC_URI', True) + (scheme, _ , path) = bb.fetch.decodeurl(srcuri)[:3] # Svn packages should DEPEND on subversion-native - if "svn://" in srcuri: + if scheme == "svn": d.appendVarFlag('do_fetch', 'depends', ' subversion-native:do_populate_sysroot') # Git packages should DEPEND on git-native - if "git://" in srcuri: + elif scheme == "git": d.appendVarFlag('do_fetch', 'depends', ' git-native:do_populate_sysroot') # Mercurial packages should DEPEND on mercurial-native - elif "hg://" in srcuri: + elif scheme == "hg": d.appendVarFlag('do_fetch', 'depends', ' mercurial-native:do_populate_sysroot') # OSC packages should DEPEND on osc-native - elif "osc://" in srcuri: + elif scheme == "osc" d.appendVarFlag('do_fetch', 'depends', ' osc-native:do_populate_sysroot') - # *.lz4 should depends on lz4-native for unpacking - # Not endswith because of "*.patch.lz4;patch=1". Needbb.fetch.decodeurl in future
meta/classes/base.bbclass +2
-1- if '.lz4' in srcuri: + # *.lz4 should DEPEND on lz4-native for unpacking + if path.endswith('.lz4'): d.appendVarFlag('do_unpack', 'depends', 'lz4-native:do_populate_sysroot')
meta/classes/base.bbclass +0
-2- # *.xz should depends on xz-native for unpacking - # Not endswith because of "*.patch.xz;patch=1". Needbb.fetch.decodeurl in future
meta/classes/base.bbclass +2
-1- if '.xz' in srcuri: + # *.xz should DEPEND on xz-native for unpacking + elif path.endswith('.xz'): d.appendVarFlag('do_unpack', 'depends', 'xz-native:do_populate_sysroot')
meta/classes/base.bbclass +2
-2- # unzip-native should already be staged before unpacking ZIP recipes - if ".zip" in srcuri: + # .zip should DEPEND on unzip-native for unpacking + elif path.endswith('.zip'): d.appendVarFlag('do_unpack', 'depends', 'unzip-native:do_populate_sysroot')
# file is needed by rpm2cpio.shmeta/classes/base.bbclass +1
-1- if ".src.rpm" in srcuri: + elif path.endswith('.src.rpm'): d.appendVarFlag('do_unpack', 'depends', 'file-native:do_populate_sysroot')
set_packagetriplet(d)
--
2.4.9 (Apple Git-60)