Skip to contentSkip to conversation

checksums.ini - should check only against filename not uri_src

PATCH Martin Jansa 4 participants 6 messages Oct 17, 2008 – Oct 20, 2008

lore
Share & tools
lore
#0 lore raw

Hi,

I think that there is no reason to have 2 files with same name from 2 different mirrors with different checksums. Especially when both will end up in one shared download directory ${DL_DIR}.

Attached is patch adding option to have only filename or pn-filename or pn-pv-filename in checksums.ini for base.bbclass and also shortened checksums.ini (98 were now duplicit after removing their url part.

pn-filename and pn-pv-filename are considered only, because some archives have "bad" names like "1.8.3.tar.bz2" and there could be a conflict with other archive with same filename. In this case I should use checksum name in form pn-filename ie.:
bitbake-1.8.3.tar.bz2 #looks like another type of possible conflict :/ firmware-1.8.3.tar.bz2
to make sure, that only right file from DL_DIR could be used.

What do you think?

Regards

Signature · 3 lines
uin:136542059                jid:[email protected]
Jansa Martin                 sip:[email protected] 
JaMa                         
classes/base.bbclass +14 -2
index 8ff2346..9e5badf 100644
@@ -27,6 +27,9 @@ def base_chk_file(parser, pn, pv, src_uri, localpath, data):
     # we rely on the get method to create errors
     pn_pv_src = "%s-%s-%s" % (pn,pv,src_uri)
     pn_src    = "%s-%s" % (pn,src_uri)
+    fn        = "%s" % (src_uri.rpartition("/")[2])
+    pn_pv_fn  = "%s-%s-%s" % (pn,pv,fn)
+    pn_fn     = "%s-%s" % (pn,fn)
     if parser.has_section(pn_pv_src):
         md5    = parser.get(pn_pv_src, "md5")
         sha256 = parser.get(pn_pv_src, "sha256")
@@ -36,6 +39,15 @@ def base_chk_file(parser, pn, pv, src_uri, localpath, data):
     elif parser.has_section(src_uri):
         md5    = parser.get(src_uri, "md5")
         sha256 = parser.get(src_uri, "sha256")
+    elif parser.has_section(pn_pv_fn):
+        md5    = parser.get(pn_pv_fn, "md5")
+        sha256 = parser.get(pn_pv_fn, "sha256")
+    elif parser.has_section(pn_fn):
+        md5    = parser.get(pn_fn, "md5")
+        sha256 = parser.get(pn_fn, "sha256")
+    elif parser.has_section(fn):
+        md5    = parser.get(fn, "md5")
+        sha256 = parser.get(fn, "sha256")
     else:
         no_checksum = True
 
@@ -741,7 +753,7 @@ def base_get_metadata_svn_revision(d):
 
 def base_get_metadata_git_branch(d):
 	import os
-	branch = os.popen('cd %s; git-branch | grep "^* " | tr -d "* "' % base_get_scmbasepath(d)).read()
+	branch = os.popen('cd %s; git branch | grep "^* " | tr -d "* "' % base_get_scmbasepath(d)).read()
 
 	if len(branch) != 0:
 		return branch
@@ -749,7 +761,7 @@ def base_get_metadata_git_branch(d):
 
 def base_get_metadata_git_revision(d):
 	import os
-	rev = os.popen("cd %s; git-log -n 1 --pretty=oneline --" % base_get_scmbasepath(d)).read().split(" ")[0]
+	rev = os.popen("cd %s; git log -n 1 --pretty=oneline --" % base_get_scmbasepath(d)).read().split(" ")[0]
 	if len(rev) != 0:
 		return rev
 	return "<unknown>"
conf/checksums.ini +4221 -4613

2,960 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.

#1 lore raw

Friday 17 of October 2008 15:17:04 Martin Jansa napisał(a):

Quoted 2 lines

I think that there is no reason to have 2 files with same name from 2 different mirrors with different checksums.

If they have different checksums then they are not same.

Quoted 16 lines

Especially when both will end up in one shared download directory ${DL_DIR}.

Attached is patch adding option to have only filename or pn-filename or pn-pv-filename in checksums.ini for base.bbclass and also shortened checksums.ini (98 were now duplicit after removing their url part.

pn-filename and pn-pv-filename are considered only, because some archives have "bad" names like "1.8.3.tar.bz2" and there could be a conflict with other archive with same filename. In this case I should use checksum name in form pn-filename ie.:
bitbake-1.8.3.tar.bz2 #looks like another type of possible conflict :/ firmware-1.8.3.tar.bz2
to make sure, that only right file from DL_DIR could be used.

Quoted 1 line

What do you think?

Your patch lack part which would write simplified checksums.ini file.

I think that mirrors informations would be still handy as there were ideas to write wget-like tool for fetching sources which would use own database for informations about source locations. We could make use of format like this:

[DirectFB-1.1.0.tar.gz] url0=http://www.directfb.org/download/DirectFB/DirectFB-1.1.0.tar.gz url1=http://www.directfb.org/downloads/Old/DirectFB-1.1.0.tar.gz md5=da30fa2748c7501913c8832a83e654ab sha256=0ee87256a278079955d78e4f235c15a174afbb507b5434f1966cd3e5f5a3f23a

And any change to checksums.ini format would require updating contrib/source-checker/ scripts as they are used to check source mirrors integrity and to sort checksums.ini file.

Regards,

Signature · 3 lines
JID:      [email protected]
Website:  http://blog.haerwu.biz/
LinkedIn: http://www.linkedin.com/in/marcinjuszkiewicz
#2 lore raw
Quoted 1 line · Marcin Juszkiewicz

If they have different checksums then they are not same.

And they shouldn't be fetched to the same DL_DIR in the first place, so checksums.ini can define both with pn-filename, and then bitbake would show an error when the other file would be stored in DL_DIR.

Quoted 13 lines

Your patch lack part which would write simplified checksums.ini file.

I think that mirrors informations would be still handy as there were ideas to write wget-like tool for fetching sources which would use own database for informations about source locations. We could make use of format like this:

[DirectFB-1.1.0.tar.gz] url0=http://www.directfb.org/download/DirectFB/DirectFB-1.1.0.tar.gz url1=http://www.directfb.org/downloads/Old/DirectFB-1.1.0.tar.gz md5=da30fa2748c7501913c8832a83e654ab sha256=0ee87256a278079955d78e4f235c15a174afbb507b5434f1966cd3e5f5a3f23a

Quoted 3 lines

And any change to checksums.ini format would require updating contrib/source-checker/ scripts as they are used to check source mirrors integrity and to sort checksums.ini file.

Thanks for comments.

I would like to improve the patch and add parts for scripts too, if you think it could be used. From discussion on irc it seemed like global checksums.ini is not a good idea at all, at least because of high probability of merge conflicts, and that checksums should be moved to .bb files or defined on per-package files.

Regards,

Signature · 3 lines
uin:136542059                jid:[email protected]
Jansa Martin                 sip:[email protected] 
JaMa                         
#3 lore raw

Hello,

Quoted 6 lines · Martin Jansa

On Fri, Oct 17, 2008 at 08:41:09PM +0200, Marcin Juszkiewicz wrote:
could be used. From discussion on irc it seemed like global checksums.ini is not a good idea at all, at least because of high probability of merge conflicts, and that checksums should be moved to .bb files or defined on per-package files.

Yes, I agree the checksums solution should be redesigned.

Note that I have written a package to help import, learn and automatically google for missing packages, from which some ideas might be ripped.

Source here:

http://www.sidebranch.com/leon/witpa_20080730.tar.bz2

Regards,

Signature · 1 line
Leon
#4 lore raw
Quoted 9 lines · Leon Woestenberg

Hello,

Quoted 6 lines · Martin Jansa

On Fri, Oct 17, 2008 at 08:41:09PM +0200, Marcin Juszkiewicz wrote:
could be used. From discussion on irc it seemed like global checksums.ini is not a good idea at all, at least because of high probability of merge conflicts, and that checksums should be moved to .bb files or defined on per-package files.

Quoted 6 lines

Yes, I agree the checksums solution should be redesigned.

Note that I have written a package to help import, learn and automatically google for missing packages, from which some ideas might be ripped.

Could we use it in OE as do_fetch error handler? If we know the sha256 sum of a package it is safe to pull it from a semi-random place on the net when debian cleans out their archive again.

regards,

Koen

Quoted 6 lines

Source here:

http://www.sidebranch.com/leon/witpa_20080730.tar.bz2

Regards,

#5 lore raw

Hello,

Quoted 11 lines · Koen Kooi
Quoted 5 lines · Leon Woestenberg

On Sat, Oct 18, 2008 at 8:30 PM, Martin Jansa<[email protected]>

Note that I have written a package to help import, learn and automatically google for missing packages, from which some ideas might be ripped.

Could we use it in OE as do_fetch error handler? If we know the sha256 sum of a package it is safe to pull it from a semi-random place on the net when debian cleans out their archive again.

Yes, I should probably make it come up with a random URL on each request.

Regards,

Signature · 1 line
Leon