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

login
register
mail settings
Submitter Jacob Kroon
Date April 6, 2014, 10:39 a.m.
Message ID <CAPbeDCnEFRneQq7=uXtaW0EYGU8bUtG15Cmtico1fHYsQLeVWQ@mail.gmail.com>
Download mbox | patch
Permalink /patch/70299/
State New
Headers show

Comments

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


or am I missing something here ?

/Jacob

Patch

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