Patchwork [3/4] fetch: If signature check fails, print error

login
register
mail settings
Submitter Morten Svendsen
Date Oct. 5, 2012, 9:51 a.m.
Message ID <26051656224c7db5a1606829f25cc64a3fc34ed6.1349430062.git.morten.thunbergsvendsen@prevas.dk>
Download mbox | patch
Permalink /patch/189451/
State Accepted
Delegated to: Esben Haabendal
Headers show

Comments

Morten Svendsen - Oct. 5, 2012, 9:51 a.m.
---
 lib/oelite/fetch/git.py |    4 ++++
 lib/oelite/fetch/url.py |    5 +++--
 2 files changed, 7 insertions(+), 2 deletions(-)
Esben Haabendal - Oct. 5, 2012, 3:16 p.m.
Morten Thunberg Svendsen <morten.thunbergsvendsen@prevas.dk> writes:

> ---
>  lib/oelite/fetch/git.py |    4 ++++
>  lib/oelite/fetch/url.py |    5 +++--
>  2 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/lib/oelite/fetch/git.py b/lib/oelite/fetch/git.py
> index 27cea01..2fc3ae9 100644
> --- a/lib/oelite/fetch/git.py
> +++ b/lib/oelite/fetch/git.py
> @@ -111,6 +111,10 @@ class GitFetcher():
>                  raise oelite.fetch.FetchError(self.uri, "unknown tag: %s"%(self.tag))
>              if not "_signature" in dir(self):
>                  return (self.signature_name, commit)
> +            if (commit != self._signature):
> +                print "Error signature mismatch "+self.tag
> +                print "  expected: %s"%self._signature
> +                print "  obtained: %s"%commit
>              return commit == self._signature
>          return True
>  
> diff --git a/lib/oelite/fetch/url.py b/lib/oelite/fetch/url.py
> index 2c7900f..0322dcd 100644
> --- a/lib/oelite/fetch/url.py
> +++ b/lib/oelite/fetch/url.py
> @@ -77,8 +77,9 @@ class UrlFetcher():
>          if not "_signature" in dir(self):
>              return (self.localname, signature)
>          if signature != self._signature:
> -            print "Expected signature: %s"%self._signature
> -            print "Obtained signature: %s"%signature
> +            print "Error signature mismatch:"
> +            print "  expected: %s"%self._signature
> +            print "  obtained: %s"%signature
>              return False
>          else:
>              return True

Merged to master, 3.1 and 3.0 branches.

/Esben

Patch

diff --git a/lib/oelite/fetch/git.py b/lib/oelite/fetch/git.py
index 27cea01..2fc3ae9 100644
--- a/lib/oelite/fetch/git.py
+++ b/lib/oelite/fetch/git.py
@@ -111,6 +111,10 @@  class GitFetcher():
                 raise oelite.fetch.FetchError(self.uri, "unknown tag: %s"%(self.tag))
             if not "_signature" in dir(self):
                 return (self.signature_name, commit)
+            if (commit != self._signature):
+                print "Error signature mismatch "+self.tag
+                print "  expected: %s"%self._signature
+                print "  obtained: %s"%commit
             return commit == self._signature
         return True
 
diff --git a/lib/oelite/fetch/url.py b/lib/oelite/fetch/url.py
index 2c7900f..0322dcd 100644
--- a/lib/oelite/fetch/url.py
+++ b/lib/oelite/fetch/url.py
@@ -77,8 +77,9 @@  class UrlFetcher():
         if not "_signature" in dir(self):
             return (self.localname, signature)
         if signature != self._signature:
-            print "Expected signature: %s"%self._signature
-            print "Obtained signature: %s"%signature
+            print "Error signature mismatch:"
+            print "  expected: %s"%self._signature
+            print "  obtained: %s"%signature
             return False
         else:
             return True