Skip to contentSkip to conversation

OEDEM 2009 summary: Death to checksums.ini?

DISCUSSION Phil Blundell 10 participants 27 messages Nov 10, 2009 – Nov 14, 2009

lore
Share & tools
lore
#0 lore raw

The current checksums.ini arrangement has a number of issues:

- single monolithic file is a rich source of merge conflicts
- concrete URIs require many duplicate entries for different mirrors
- can be annoying for folks using overlays and/or collections
- storing the checksum separately from the rest of the .bb file makes
cherry-picking harder than it needs to be
- large amount of churn in checksums.ini can make it hard to spot cases
where checksums were changed rather than just added.

It was proposed that, rather than storing checksums centrally in checksums.ini, they should be placed in the individual .bb file to which the checksum relates. Bitbake already has a certain level of support for reading checksums from SRC_URI and it would seem natural to try to make use of that.

There was some discussion around alternative proposals of storing the checksums in separate files within the recipes/ directory. These proposals didn't seem to offer any real advantage over storing the checksums within the .bb file (and, importantly, didn't really solve the issues around recipe copying/merging) so they were not pursued further.

Some concerns were raised around .inc files and other places where multiple recipes shared a single definition of SRC_URI, but it seems like these can all be addressed with strategic use of variable substitutions.

Also, some concerns were raised over the disk space impact of the lengthened SRC_URIs. However, the net increase in disk space usage seems like it will be marginal at worst: many packages will actually wind up using less space with the new arrangement.

There was a side discussion around providing a separate mechanism for a site-local cache of checksums, to be used solely for verifying that a particular source archive has not changed from one build to the next. This cache would not be checked in anywhere or distributed. RP noted that this was the original intent of checksums.ini. Agreed to park this for now since it is independent of (though somewhat related to) the topic of shared checksums.

Conclusions:

- checksums are clearly part of the metadata, it seems like they naturally belong in the .bb file.

- there was general acceptance that the checksums belong in SRC_URI.

Next steps:

- figure out a way to implement sha256sum checking, either by extending the code in bitbake's fetcher or by providing equivalent functionality in base.bbclass

- work out a migration strategy: is it feasible to splice the existing checksums into the SRC_URIs programmatically? RP thinks yes. PB suggests leaving the existing checksums.ini as read-only and switching to checksums incrementally for new packages. RP: can make a git hook to allow deletion from checksums.ini but no other changes.

#1 lore raw
Quoted 10 lines · On Tuesday 10 November 2009 17:55:40 Phil Blundell wrote:

The current checksums.ini arrangement has a number of issues:

- single monolithic file is a rich source of merge conflicts
- concrete URIs require many duplicate entries for different mirrors
- can be annoying for folks using overlays and/or collections
- storing the checksum separately from the rest of the .bb file makes
cherry-picking harder than it needs to be
- large amount of churn in checksums.ini can make it hard to spot cases
where checksums were changed rather than just added.

Quoted 5 lines

It was proposed that, rather than storing checksums centrally in checksums.ini, they should be placed in the individual .bb file to which the checksum relates. Bitbake already has a certain level of support for reading checksums from SRC_URI and it would seem natural to try to make use of that.

*sigh*

SRC_URI = "http://example.org/${PN}-${PV}.tar,bz2"

how do you want to handle these? What happens if you place a checksum in the inc file? Do you want to propose removing SRC_URI from .ini files and put them back to the .bb files?

z.

#2 lore raw

2009/11/11 Holger Hans Peter Freyther <[email protected]>:

Quoted 17 lines · On Tuesday 10 November 2009 17:55:40 Phil Blundell wrote:
Quoted 10 lines

The current checksums.ini arrangement has a number of issues:

 - single monolithic file is a rich source of merge conflicts
 - concrete URIs require many duplicate entries for different mirrors
 - can be annoying for folks using overlays and/or collections
 - storing the checksum separately from the rest of the .bb file makes cherry-picking harder than it needs to be
 - large amount of churn in checksums.ini can make it hard to spot cases where checksums were changed rather than just added.

Quoted 5 lines

It was proposed that, rather than storing checksums centrally in checksums.ini, they should be placed in the individual .bb file to which the checksum relates.  Bitbake already has a certain level of support for reading checksums from SRC_URI and it would seem natural to try to make use of that.

Quoted 7 lines

*sigh*

SRC_URI = "http://example.org/${PN}-${PV}.tar,bz2"

how do you want to handle these? What happens if you place a checksum in the inc file? Do you want to propose removing SRC_URI from .ini files and put them back to the .bb files?

While I think the monolithic checksums.ini file has its problems (I've cursed more than once that someone changed the fiel just wwhen I had changed it), I think Holger has a point with ${PN}-{$PV} One now needs to explicitly add the checksum to the recipe.

Would it be better to have a separate checksums.ini file in the directory with the packages (and I know that for some dirs like perl this still can become substantial)..
With some machinery we could even generate the checksum automatically if a new package or version is added (NOT if the checksum is alreayd there and is changed).

How about that?

Frans.

#4 lore raw
Quoted 10 lines · On Wednesday 11 November 2009 09:24:09 Phil Blundell wrote:
Quoted 5 lines · Holger Hans Peter Freyther

SRC_URI = "http://example.org/${PN}-${PV}.tar,bz2"

how do you want to handle these? What happens if you place a checksum in the inc file? Do you want to propose removing SRC_URI from .ini files and put them back to the .bb files?

SRC_URI = "http://example.org/${PN}-${PV}.tar,bz2;md5sum=${MD5SUM}"

You can define ${MD5SUM} whereever you like.

This will create an even bigger mess. Sometimes you need to download two things, this means you will end up with A_MD5SUM, B_MD5SUM, A_SHASUM, B_SHASUM. The main problem with the above is that in contrast to a well defined checksums.ini file we will end up with n-variants of the above trick.

I agree that conceptually the checksum belongs to the URI, but putting it into the URI is just creating a horrible mess. It has issues with .inc files, adding a shasum will make the URI not fit in any terminal...

The best alternatives so far where:
- Place the checksums into the dir of the recipe
- Use a MD5SUM_${URL} = "", SHA256SUM_${URL} = "" syntax

z.

#5 lore raw
Quoted 4 lines · Holger Hans Peter Freyther

This will create an even bigger mess. Sometimes you need to download two things, this means you will end up with A_MD5SUM, B_MD5SUM, A_SHASUM, B_SHASUM. The main problem with the above is that in contrast to a well defined checksums.ini file we will end up with n-variants of the above trick.

The number of recipes where multiple items need to be downloaded and checksummed is small: this is a tiny minority of the total. So, although I agree that this case will become more ugly, I don't think this is going to be a common enough problem that it will represent a very big deal.

Quoted 7 lines

I agree that conceptually the checksum belongs to the URI, but putting it into the URI is just creating a horrible mess. It has issues with .inc files, adding a shasum will make the URI not fit in any terminal...

The best alternatives so far where:
- Place the checksums into the dir of the recipe
- Use a MD5SUM_${URL} = "", SHA256SUM_${URL} = "" syntax

I would be happy with the latter of those suggestions. I don't think the former really addresses the problems with the current checksums.ini.

p.

#6 lore raw

2009/11/11 Phil Blundell <[email protected]>:

Quoted 16 lines · Holger Hans Peter Freyther
Quoted 4 lines

This will create an even bigger mess. Sometimes you need to download two things, this means you will end up with A_MD5SUM, B_MD5SUM, A_SHASUM, B_SHASUM. The main problem with the above is that in contrast to a well defined checksums.ini file we will end up with n-variants of the above trick.

The number of recipes where multiple items need to be downloaded and checksummed is small: this is a tiny minority of the total.  So, although I agree that this case will become more ugly, I don't think this is going to be a common enough problem that it will represent a very big deal.

Quoted 4 lines

I agree that conceptually the checksum belongs to the URI, but putting it into the URI is just creating a horrible mess. It has issues with .inc files, adding a shasum will make the URI not fit in any terminal...

Quoted 6 lines
Quoted 3 lines

The best alternatives so far where:
      - Place the checksums into the dir of the recipe
      - Use a MD5SUM_${URL} = "", SHA256SUM_${URL} = "" syntax

I would be happy with the latter of those suggestions.  I don't think the former really addresses the problems with the current checksums.ini.

I'd like things to work with minimal effort, so I would encourage a solution where, if you create a new recipe, the resulting checksums are automatically added (automating the dumb and error prone cut & paste process).
In that view having the checksums in a separate file would help (although it will require adding a file to the commit which can be forgotten).

Frans.

#7 lore raw
In reply to Phil Blundell
Quoted 7 lines · On Wednesday 11 November 2009 10:17:42 Phil Blundell wrote:
Quoted 5 lines · Holger Hans Peter Freyther

This will create an even bigger mess. Sometimes you need to download two things, this means you will end up with A_MD5SUM, B_MD5SUM, A_SHASUM, B_SHASUM. The main problem with the above is that in contrast to a well defined checksums.ini file we will end up with n-variants of the above trick.

Quoted 5 lines

The number of recipes where multiple items need to be downloaded and checksummed is small: this is a tiny minority of the total. So, although I agree that this case will become more ugly, I don't think this is going to be a common enough problem that it will represent a very big deal.

It depends. Currently the instructions to update the checksums.ini are straight forward and branch free, with the above it is impossible to write a branch free documentation that everyone can follow. :)

PS: Let me come up with a patch introducing the new variables..

#11 lore raw
In reply to Phil Blundell
Quoted 9 lines
Quoted 6 lines

There was some discussion around alternative proposals of storing the checksums in separate files within the recipes/ directory.

The best alternatives so far where:
      - Place the checksums into the dir of the recipe
      - Use a MD5SUM_${URL} = "", SHA256SUM_${URL} = "" syntax

I would be happy with the latter of those suggestions.  I don't think the former really addresses the problems with the current checksums.ini.

Yes, I sponsor the idea of a single Manifest in each dir.

Let apart filetype specifier, example here:
http://www.gentoo.org/proj/en/glep/glep-0044-extras/manifest2-example.txt

Having a Manifest listing the filename, the size and some checksums on a single line seems to me very easy to parse for an automated script wich could refresh/generate the whole file.

Finally, a question: why do we have full URL in the checksum-file? I can't see the real advantages in case of checksum mismatch...

My (euro)2 cents

Andrea

#13 lore raw
In reply to Phil Blundell

Am Mittwoch, den 11.11.2009, 09:17 +0000 schrieb Phil Blundell:

Quoted 16 lines · Holger Hans Peter Freyther
Quoted 4 lines

This will create an even bigger mess. Sometimes you need to download two things, this means you will end up with A_MD5SUM, B_MD5SUM, A_SHASUM, B_SHASUM. The main problem with the above is that in contrast to a well defined checksums.ini file we will end up with n-variants of the above trick.

The number of recipes where multiple items need to be downloaded and checksummed is small: this is a tiny minority of the total. So, although I agree that this case will become more ugly, I don't think this is going to be a common enough problem that it will represent a very big deal.

Quoted 4 lines

I agree that conceptually the checksum belongs to the URI, but putting it into the URI is just creating a horrible mess. It has issues with .inc files, adding a shasum will make the URI not fit in any terminal...

Quoted 6 lines
Quoted 3 lines

The best alternatives so far where:
- Place the checksums into the dir of the recipe
- Use a MD5SUM_${URL} = "", SHA256SUM_${URL} = "" syntax

I would be happy with the latter of those suggestions. I don't think the former really addresses the problems with the current checksums.ini.

I agree here, the latter syntax seems well.

:M:

#8 lore raw
In reply to Holger Hans Peter Freyther
Quoted 14 lines · Holger Hans Peter Freyther
Quoted 7 lines · On Wednesday 11 November 2009 10:17:42 Phil Blundell wrote:
Quoted 5 lines · Holger Hans Peter Freyther

This will create an even bigger mess. Sometimes you need to download two things, this means you will end up with A_MD5SUM, B_MD5SUM, A_SHASUM, B_SHASUM. The main problem with the above is that in contrast to a well defined checksums.ini file we will end up with n-variants of the above trick.

Quoted 5 lines

The number of recipes where multiple items need to be downloaded and checksummed is small: this is a tiny minority of the total. So, although I agree that this case will become more ugly, I don't think this is going to be a common enough problem that it will represent a very big deal.

Quoted 3 lines

It depends. Currently the instructions to update the checksums.ini are straight forward and branch free, with the above it is impossible to write a branch free documentation that everyone can follow. :)

True. On the other hand, if you are making a recipe with multiple downloaded tarballs then you are already some way outside what can be achieved using a straightforward "painting by numbers" approach. I'm not sure that the checksums make a material difference to that.

Quoted 1 line

PS: Let me come up with a patch introducing the new variables..

That'd be great.

p.

#9 lore raw
Quoted 7 lines · On Wednesday 11 November 2009 14:31:21 Phil Blundell wrote:
Quoted 6 lines · Holger Hans Peter Freyther
Quoted 1 line · On Wednesday 11 November 2009 10:17:42 Phil Blundell wrote:

On Wed, 2009-11-11 at 09:44 +0100, Holger Hans Peter Freyther wrote:

It depends. Currently the instructions to update the checksums.ini are straight forward and branch free, with the above it is impossible to write a branch free documentation that everyone can follow. :)

True

#10 lore raw
Quoted 10 lines · On Wednesday 11 November 2009 14:37:46 Holger Hans Peter Freyther wrote:
Quoted 7 lines · On Wednesday 11 November 2009 14:31:21 Phil Blundell wrote:
Quoted 6 lines · Holger Hans Peter Freyther
Quoted 1 line · On Wednesday 11 November 2009 10:17:42 Phil Blundell wrote:

On Wed, 2009-11-11 at 09:44 +0100, Holger Hans Peter Freyther wrote:

It depends. Currently the instructions to update the checksums.ini are straight forward and branch free, with the above it is impossible to write a branch free documentation that everyone can follow. :)

True

ouch, it is a good sign to go to bed... I have quoted myself now..

z.

#15 lore raw
In reply to Holger Hans Peter Freyther
Quoted 18 lines · Holger Hans Peter Freyther
Quoted 10 lines · On Wednesday 11 November 2009 09:24:09 Phil Blundell wrote:
Quoted 5 lines · Holger Hans Peter Freyther

SRC_URI = "http://example.org/${PN}-${PV}.tar,bz2"

how do you want to handle these? What happens if you place a checksum in the inc file? Do you want to propose removing SRC_URI from .ini files and put them back to the .bb files?

SRC_URI = "http://example.org/${PN}-${PV}.tar,bz2;md5sum=${MD5SUM}"

You can define ${MD5SUM} whereever you like.

This will create an even bigger mess. Sometimes you need to download two things, this means you will end up with A_MD5SUM, B_MD5SUM, A_SHASUM, B_SHASUM. The main problem with the above is that in contrast to a well defined checksums.ini file we will end up with n-variants of the above trick.

Quoted 7 lines

I agree that conceptually the checksum belongs to the URI, but putting it into the URI is just creating a horrible mess. It has issues with .inc files, adding a shasum will make the URI not fit in any terminal...

The best alternatives so far where:
- Place the checksums into the dir of the recipe
- Use a MD5SUM_${URL} = "", SHA256SUM_${URL} = "" syntax

Might I also propose:

SCR_URI = "xyz://abc.com/efg.tgz;name=bar"

MD5SUM_bar = ""

or maybe :

MD5SUM[bar] = ""

Cheers,

Richard

#16 lore raw
Quoted 7 lines · Richard Purdie

SCR_URI = "xyz://abc.com/efg.tgz;name=bar"

MD5SUM_bar = ""

or maybe :

MD5SUM[bar] = ""

The labelling is a good idea, although I am not especially keen on either of those notations. How about:

SRC_URI = "xyz://abc.com/efg.tgz;name=bar"
SRC_URI[md5sum:bar] = "..."
SRC_URI[sha256sum:bar] = "..."

p.

#17 lore raw

2009/11/11 Phil Blundell <[email protected]>:

Quoted 7 lines · Richard Purdie
Quoted 6 lines

SCR_URI = "xyz://abc.com/efg.tgz;name=bar"

MD5SUM_bar = ""

or maybe :

Quoted 9 lines
Quoted 1 line

MD5SUM[bar] = ""

The labelling is a good idea, although I am not especially keen on either of those notations.  How about:

SRC_URI = "xyz://abc.com/efg.tgz;name=bar"
SRC_URI[md5sum:bar] = "..."
SRC_URI[sha256sum:bar] = "..."

Would we still be able to use PN and PV in the md5sum:bar etc?

#18 lore raw
Quoted 10 lines · Frans Meulenbroeks

2009/11/11 Phil Blundell <[email protected]>:

Quoted 9 lines · Richard Purdie
Quoted 7 lines

SCR_URI = "xyz://abc.com/efg.tgz;name=bar"

MD5SUM_bar = ""

or maybe :

MD5SUM[bar] = ""

Quoted 8 lines
Quoted 7 lines

The labelling is a good idea, although I am not especially keen on either of those notations. How about:

SRC_URI = "xyz://abc.com/efg.tgz;name=bar"
SRC_URI[md5sum:bar] = "..."
SRC_URI[sha256sum:bar] = "..."

Would we still be able to use PN and PV in the md5sum:bar etc?

Not directly, though it isn't entirely obvious to me why this would be a useful thing to do. Did you have a situation in mind where this would be desirable?

p.

#19 lore raw

2009/11/11 Phil Blundell <[email protected]>:

Quoted 18 lines · Frans Meulenbroeks
Quoted 17 lines

2009/11/11 Phil Blundell <[email protected]>:

Quoted 16 lines · Richard Purdie
Quoted 7 lines

SCR_URI = "xyz://abc.com/efg.tgz;name=bar"

MD5SUM_bar = ""

or maybe :

MD5SUM[bar] = ""

The labelling is a good idea, although I am not especially keen on either of those notations.  How about:

SRC_URI = "xyz://abc.com/efg.tgz;name=bar"
SRC_URI[md5sum:bar] = "..."
SRC_URI[sha256sum:bar] = "..."

Quoted 6 lines
Quoted 1 line

Would we still be able to use PN and PV in the md5sum:bar etc?

Not directly, though it isn't entirely obvious to me why this would be a useful thing to do.  Did you have a situation in mind where this would be desirable?

I am somewhat lazy so if a new version of a recipe has to be made I'd like to touch as little as possible.
(the less I have to do the less chance of an error occurring) So preferably I would use PV an PN in the url and not copy it from somewhere (as that is more error prone too.

(btw I can also envision a new bitbake task which will rewrite the checksums).

Frans

#14 lore raw
In reply to Phil Blundell
Quoted 11 lines · Phil Blundell
Quoted 4 lines · Holger Hans Peter Freyther

This will create an even bigger mess. Sometimes you need to download two things, this means you will end up with A_MD5SUM, B_MD5SUM, A_SHASUM, B_SHASUM. The main problem with the above is that in contrast to a well defined checksums.ini file we will end up with n-variants of the above trick.

The number of recipes where multiple items need to be downloaded and checksummed is small: this is a tiny minority of the total.  So, although I agree that this case will become more ugly, I don't think this is going to be a common enough problem that it will represent a very big deal.

That seems to depend on how must weigth you put on clean vs. "messy" solutions.

Quoted 10 lines
Quoted 7 lines

I agree that conceptually the checksum belongs to the URI, but putting it into the URI is just creating a horrible mess. It has issues with .inc files, adding a shasum will make the URI not fit in any terminal...

The best alternatives so far where:
      - Place the checksums into the dir of the recipe
      - Use a MD5SUM_${URL} = "", SHA256SUM_${URL} = "" syntax

I would be happy with the latter of those suggestions.  I don't think the former really addresses the problems with the current checksums.ini.

Which part of the current checksums.ini problems does the former not resolve?

Isn't the main issue with checksums.ini is the merge nightmare it poses? I don't see how this will be a big problem with per recipe checksums files.

A per recipe checksums file is also the one solution I have seen that would reduce manual work needed for OE developers to actually maintain checksums. And face it, we are for the most part lazy :-D

As I also made clear on OEDEM, I think it is important to make things simpler and easier to work with. Not cause more mess and come up with additional hurdless for OE developers.

/Esben

#20 lore raw
In reply to Frans Meulenbroeks
Quoted 25 lines · Frans Meulenbroeks

2009/11/11 Phil Blundell <[email protected]>:

Quoted 18 lines · Frans Meulenbroeks
Quoted 17 lines

2009/11/11 Phil Blundell <[email protected]>:

Quoted 16 lines · Richard Purdie
Quoted 7 lines

SCR_URI = "xyz://abc.com/efg.tgz;name=bar"

MD5SUM_bar = ""

or maybe :

MD5SUM[bar] = ""

The labelling is a good idea, although I am not especially keen on either of those notations. How about:

SRC_URI = "xyz://abc.com/efg.tgz;name=bar"
SRC_URI[md5sum:bar] = "..."
SRC_URI[sha256sum:bar] = "..."

Quoted 6 lines
Quoted 1 line

Would we still be able to use PN and PV in the md5sum:bar etc?

Not directly, though it isn't entirely obvious to me why this would be a useful thing to do. Did you have a situation in mind where this would be desirable?

Quoted 5 lines

I am somewhat lazy so if a new version of a recipe has to be made I'd like to touch as little as possible.
(the less I have to do the less chance of an error occurring) So preferably I would use PV an PN in the url and not copy it from somewhere (as that is more error prone too.

That should still work fine. The purpose of the "name=bar" thing is to decouple the checksum from the exact URI in use. So, you can write:

SRC_URI = "${MIRROR}/somedir/${PN}-${PV}.tar.gz;name=mytarball \
           ${OTHERMIRROR}/${PN}-${PV}-extra-files.tar.gz;name=extrafiles"

and then, in another file if you prefer, add:

SRC_URI[md5sum:mytarball] = "d3b07384d113edec49eaa6238ad5ff00" SRC_URI[md5sum:extrafiles] = "c157a79031e1c40f85931829bc5fc552"

p.

#21 lore raw

2009/11/11 Phil Blundell <[email protected]>:

Quoted 35 lines · Frans Meulenbroeks
Quoted 25 lines

2009/11/11 Phil Blundell <[email protected]>:

Quoted 18 lines · Frans Meulenbroeks
Quoted 17 lines

2009/11/11 Phil Blundell <[email protected]>:

Quoted 16 lines · Richard Purdie
Quoted 7 lines

SCR_URI = "xyz://abc.com/efg.tgz;name=bar"

MD5SUM_bar = ""

or maybe :

MD5SUM[bar] = ""

The labelling is a good idea, although I am not especially keen on either of those notations.  How about:

SRC_URI = "xyz://abc.com/efg.tgz;name=bar"
SRC_URI[md5sum:bar] = "..."
SRC_URI[sha256sum:bar] = "..."

Quoted 6 lines
Quoted 1 line

Would we still be able to use PN and PV in the md5sum:bar etc?

Not directly, though it isn't entirely obvious to me why this would be a useful thing to do.  Did you have a situation in mind where this would be desirable?

Quoted 5 lines

I am somewhat lazy so if a new version of a recipe has to be made I'd like to touch as little as possible.
(the less I have to do the less chance of an error occurring) So preferably I would use PV an PN in the url and not copy it from somewhere (as that is more error prone too.

That should still work fine.  The purpose of the "name=bar" thing is to decouple the checksum from the exact URI in use.  So, you can write:

Quoted 8 lines

SRC_URI = "${MIRROR}/somedir/${PN}-${PV}.tar.gz;name=mytarball \
          ${OTHERMIRROR}/${PN}-${PV}-extra-files.tar.gz;name=extrafiles"

and then, in another file if you prefer, add:

SRC_URI[md5sum:mytarball] = "d3b07384d113edec49eaa6238ad5ff00" SRC_URI[md5sum:extrafiles] = "c157a79031e1c40f85931829bc5fc552"

Ah ok, now I understand. I thought at the place of bar I would get the url, not a name tag associated to the url.

Thanks for clarifying , Frans

#12 lore raw
In reply to Andrea Adami
Quoted 10 lines · Andrea Adami
Quoted 9 lines
Quoted 6 lines

There was some discussion around alternative proposals of storing the checksums in separate files within the recipes/ directory.

The best alternatives so far where:
      - Place the checksums into the dir of the recipe
      - Use a MD5SUM_${URL} = "", SHA256SUM_${URL} = "" syntax

I would be happy with the latter of those suggestions.  I don't think the former really addresses the problems with the current checksums.ini.

Quoted 8 lines

Yes, I sponsor the idea of a single Manifest in each dir.

Let apart filetype specifier, example here:
http://www.gentoo.org/proj/en/glep/glep-0044-extras/manifest2-example.txt

Having a Manifest listing the filename, the size and some checksums on a single line seems to me very easy to parse for an automated script wich could refresh/generate the whole file.

I also like the way Gentoo handle with this problem, but I guess that if we go that way we'd still have trouble regarding merging and conflicts, like we current have with checksums.

Adding the checksum metadata in the recipe itself makes easier the life of a lot of people, we just need to identify the easier and prettier way of doing that.

Cheers,

Signature · 1 line
Ricardo Salveti de Araujo
#22 lore raw
In reply to Phil Blundell
Quoted 10 lines · Phil Blundell

That should still work fine. The purpose of the "name=bar" thing is to decouple the checksum from the exact URI in use. So, you can write:

SRC_URI = "${MIRROR}/somedir/${PN}-${PV}.tar.gz;name=mytarball \
           ${OTHERMIRROR}/${PN}-${PV}-extra-files.tar.gz;name=extrafiles"

and then, in another file if you prefer, add:

SRC_URI[md5sum:mytarball] = "d3b07384d113edec49eaa6238ad5ff00" SRC_URI[md5sum:extrafiles] = "c157a79031e1c40f85931829bc5fc552"

It turns out that colons in flag names aren't actually accepted by the parser, but something similar with dots is OK. So, here's a patch to make it work. The modified notation is actually:

SRC_URI[mytarball.md5sum] = "d3b07384d113edec49eaa6238ad5ff00"

and likewise for sha256sum.

p.

classes/base.bbclass +46 -2
index 9d063f2..9508754 100644
@@ -56,6 +56,50 @@ def base_chk_load_parser(config_paths):
 
     return parser
 
+def base_chk_file_vars(parser, localpath, params, data):
+    try:
+        name = params["name"]
+    except KeyError:
+        return False
+    flagName = "%s.md5sum" % name
+    want_md5sum = bb.data.getVarFlag("SRC_URI", flagName, data)
+    flagName = "%s.sha256sum" % name
+    want_sha256sum = bb.data.getVarFlag("SRC_URI", flagName, data)
+
+    if (want_sha256sum == None and want_md5sum == None):
+        # no checksums to check, nothing to do
+        return False
+
+    if not os.path.exists(localpath):
+        localpath = base_path_out(localpath, data)
+        bb.note("The localpath does not exist '%s'" % localpath)
+        raise Exception("The path does not exist '%s'" % localpath)
+
+    if want_md5sum:
+        try:
+	    md5pipe = os.popen('PATH=%s md5sum %s' % (bb.data.getVar('PATH', data, True), localpath))
+            md5data = (md5pipe.readline().split() or [ "" ])[0]
+            md5pipe.close()
+        except OSError, e:
+            raise Exception("Executing md5sum failed")
+        if want_md5sum != md5data:
+            bb.note("The MD5Sums did not match. Wanted: '%s' and Got: '%s'" % (want_md5sum, md5data))
+            raise Exception("MD5 Sums do not match. Wanted: '%s' Got: '%s'" % (want_md5sum, md5data))
+
+    if want_sha256sum:
+        try:
+            shapipe = os.popen('PATH=%s oe_sha256sum %s' % (bb.data.getVar('PATH', data, True), localpath))
+            shadata = (shapipe.readline().split() or [ "" ])[0]
+            shapipe.close()
+        except OSError, e:
+            raise Exception("Executing shasum failed")
+        if want_sha256sum != sha256data:
+            bb.note("The SHA256Sums did not match. Wanted: '%s' and Got: '%s'" % (want_sha256sum, sha256data))
+            raise Exception("SHA256 Sums do not match. Wanted: '%s' Got: '%s'" % (want_sha256sum, sha256data))
+
+    return True
+
+
 def base_chk_file(parser, pn, pv, src_uri, localpath, data):
     no_checksum = False
     # Try PN-PV-SRC_URI first and then try PN-SRC_URI
@@ -639,11 +683,11 @@ python base_do_fetch() {
 	# Check each URI
 	for url in src_uri.split():
 		localpath = bb.data.expand(bb.fetch.localpath(url, localdata), localdata)
-		(type,host,path,_,_,_) = bb.decodeurl(url)
+		(type,host,path,_,_,params) = bb.decodeurl(url)
 		uri = "%s://%s%s" % (type,host,path)
 		try:
 			if type == "http" or type == "https" or type == "ftp" or type == "ftps":
-				if not base_chk_file(parser, pn, pv,uri, localpath, d):
+				if not (base_chk_file_vars(parser, localpath, params, d) or base_chk_file(parser, pn, pv,uri, localpath, d)):
 					if not bb.data.getVar("OE_ALLOW_INSECURE_DOWNLOADS",d, True):
 						bb.fatal("%s-%s: %s has no entry in conf/checksums.ini, not checking URI" % (pn,pv,uri))
 					else:
#23 lore raw
Quoted 28 lines · Phil Blundell

On Wed, 2009-11-11 at 20:34 +0000, Phil Blundell wrote:

classes/base.bbclass +18 -0
index 9d063f2..9508754 100644
@@ -56,6 +56,50 @@ def base_chk_load_parser(config_paths):
 
    return parser
 
+def base_chk_file_vars(parser, localpath, params, data):
+    try:
+        name = params["name"]
+    except KeyError:
+        return False
+    flagName = "%s.md5sum" % name
+    want_md5sum = bb.data.getVarFlag("SRC_URI", flagName, data)
+    flagName = "%s.sha256sum" % name
+    want_sha256sum = bb.data.getVarFlag("SRC_URI", flagName, data)
+
+    if (want_sha256sum == None and want_md5sum == None):
+        # no checksums to check, nothing to do
+        return False
+
+    if not os.path.exists(localpath):
+        localpath = base_path_out(localpath, data)
+        bb.note("The localpath does not exist '%s'" % localpath)
+        raise Exception("The path does not exist '%s'" % localpath)

classes/base.bbclass def base_chk_load_parser(config_paths): · line 86

Quoted 10 lines
classes/base.bbclass +10 -0
+
+    if want_md5sum:
+        try:
+	    md5pipe = os.popen('PATH=%s md5sum %s' % (bb.data.getVar('PATH', data, True), localpath))
+            md5data = (md5pipe.readline().split() or [ "" ])[0]
+            md5pipe.close()
+        except OSError, e:
+            raise Exception("Executing md5sum failed")
+        if want_md5sum != md5data:
+            bb.note("The MD5Sums did not match. Wanted: '%s' and Got: '%s'" % (want_md5sum, md5data))

please s/and Got/and got/g

classes/base.bbclass def base_chk_load_parser(config_paths): · line 87

Quoted 1 line
classes/base.bbclass +1 -0
+            raise Exception("MD5 Sums do not match. Wanted: '%s' Got: '%s'" % (want_md5sum, md5data))

Why are you providing the same information as a note and in the exception text?

classes/base.bbclass def base_chk_load_parser(config_paths): · line 95

Quoted 8 lines
classes/base.bbclass +8 -0
+
+    if want_sha256sum:
+        try:
+            shapipe = os.popen('PATH=%s oe_sha256sum %s' % (bb.data.getVar('PATH', data, True), localpath))
+            shadata = (shapipe.readline().split() or [ "" ])[0]
+            shapipe.close()
+        except OSError, e:
+            raise Exception("Executing shasum failed")

sha256sum
[]

classes/base.bbclass python base_do_fetch() { · line 689

Quoted 9 lines
classes/base.bbclass +1 -1
@@ -639,11 +683,11 @@ python base_do_fetch() {
 	# Check each URI
 	for url in src_uri.split():
 		localpath = bb.data.expand(bb.fetch.localpath(url, localdata), localdata)
-		(type,host,path,_,_,_) = bb.decodeurl(url)
+		(type,host,path,_,_,params) = bb.decodeurl(url)
 		uri = "%s://%s%s" % (type,host,path)
 		try:
 			if type == "http" or type == "https" or type == "ftp" or type == "ftps":

if type in ["http", "https", "ftp", "ftps"]:
(while you're at it :)

cheers,
Bernhard

#24 lore raw
Quoted 4 lines · Bernhard Reutner-Fischer
Quoted 1 line

+ raise Exception("MD5 Sums do not match. Wanted: '%s' Got: '%s'" % (want_md5sum, md5data))

Why are you providing the same information as a note and in the exception text?

This is the way those diagnostics have always been done (see the existing code in base.bbclass). In practice I don't think the exception text is used for anything but it seems fairly harmless to go on providing it. If we're going to change that then it should presumably be done for both forms of the checksum code, not just for this one.

p.

#25 lore raw
In reply to Phil Blundell
Quoted 5 lines · Phil Blundell

It turns out that colons in flag names aren't actually accepted by the parser, but something similar with dots is OK. So, here's a patch to make it work. The modified notation is actually:

SRC_URI[mytarball.md5sum] = "d3b07384d113edec49eaa6238ad5ff00"

I've committed this patch now. Also, by way of example, I've converted busybox 1.14.3 to use the new notation.

Share and enjoy.

p.

#26 lore raw
Quoted 9 lines · On Friday 13 November 2009 18:47:04 Phil Blundell wrote:
Quoted 5 lines · Phil Blundell

It turns out that colons in flag names aren't actually accepted by the parser, but something similar with dots is OK. So, here's a patch to make it work. The modified notation is actually:

SRC_URI[mytarball.md5sum] = "d3b07384d113edec49eaa6238ad5ff00"

I've committed this patch now. Also, by way of example, I've converted busybox 1.14.3 to use the new notation.

thanks