[bitbake-devel] fetch2: Fix bug in file checksum generation

Submitted by Jacob Kroon on April 6, 2014, 10:39 a.m.

Details

Message ID CAPbeDCnEFRneQq7=uXtaW0EYGU8bUtG15Cmtico1fHYsQLeVWQ@mail.gmail.com
State New
Headers show

Commit Message

Jacob Kroon April 6, 2014, 10:39 a.m.
Hi Richard,


or am I missing something here ?

/Jacob

Patch hide | download patch | download mbox

diff --git a/bitbake/lib/bb/fetch2/__init__.py
b/bitbake/lib/bb/fetch2/__init__.py

> index 4335e7a..8e5342f 100644
> --- a/bitbake/lib/bb/fetch2/__init__.py
> +++ b/bitbake/lib/bb/fetch2/__init__.py
> @@ -969,6 +969,7 @@ def get_file_checksums(filelist, pn):
>                  checksum = checksum_file(f)
>                  if checksum:
>                      checksums.append((f, checksum))
> +            continue
>          elif os.path.isdir(pth):
>              # Handle directories
>              for root, dirs, files in os.walk(pth):
> @@ -977,6 +978,7 @@ def get_file_checksums(filelist, pn):
>                      checksum = checksum_file(fullpth)
>                      if checksum:
>                          checksums.append((fullpth, checksum))
> +            continue
>          else:
>              checksum = checksum_file(pth)
>

Perhaps it would be cleaner to do

diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py
index 4335e7a..03ab234 100644
--- a/lib/bb/fetch2/__init__.py
+++ b/lib/bb/fetch2/__init__.py
@@ -979,9 +979,8 @@  def get_file_checksums(filelist, pn):
                         checksums.append((fullpth, checksum))
         else:
             checksum = checksum_file(pth)
-
-        if checksum:
-            checksums.append((pth, checksum))
+            if checksum:
+                checksums.append((pth, checksum))

     checksums.sort(key=operator.itemgetter(1))
     return checksums