[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] openwrt: more readline fun

Holger Levsen gitlab at salsa.debian.org
Fri Oct 11 15:08:36 BST 2019



Holger Levsen pushed to branch master at Debian QA / jenkins.debian.net


Commits:
03bfcb70 by Paul Spooren at 2019-10-11T14:08:27Z
openwrt: more readline fun

The problem is that the current package parser excepts an array where
every line ends with a "\n" to it can be combined via `+=` in the
linebuffer. However the `urlopen().readlines()` returns an undecoded
byte array with `\n`, whereas
`urlopen().read().decode("utf-8").splitlines()` returns an decoded array
without the leading `\n`.

This approach now uses `map` to convert the bytes to strings and
preserve the newline. Instead of this spagetti code I'd like to rewrite
the parser function itself, however this would break current
compatibility.

In future I may migrate the parser function to `rblib/`.

Signed-off-by: Holger Levsen <holger at layer-acht.org>

- - - - -


1 changed file:

- bin/reproducible_openwrt_rebuild.py


Changes:

=====================================
bin/reproducible_openwrt_rebuild.py
=====================================
@@ -452,7 +452,16 @@ def diffoscope_multithread():
 def store_results():
     with open(target_dir + "/packages/Packages.manifest") as rebuild_manifest:
         result = show_list_difference(
-            urlopen(download_url + "/packages/Packages.manifest").readlines(),
+            [
+                list(
+                    map(
+                        lambda x: x.decode("utf-8"),
+                        urlopen(
+                            download_url + "/packages/Packages.manifest"
+                        ).readlines(),
+                    )
+                )
+            ],
             rebuild_manifest.readlines(),
         )
         insert_into_db(result, "{}-rebuild".format(version))



View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/commit/03bfcb70300e7b6bf9bbd4e87dea4914d44c3ec2

-- 
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/commit/03bfcb70300e7b6bf9bbd4e87dea4914d44c3ec2
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/qa-jenkins-scm/attachments/20191011/e0a66693/attachment.html>


More information about the Qa-jenkins-scm mailing list