Bug#850501: rerunning using diffoscope 67-21-gfe7ae15

2017-01-14 Thread Maria Glukhova
Chris,

вс, 15 янв. 2017 г. в 4:57, Chris Lamb :

> As it happens I wrote my own fix before I saw your email
> and I have pushed it — what do you think?
>
>
Making APK metadata appear at fixed place surely looks better. IMO, that
approach follows the original intent of the request much more closely :)
Thank you very much for your work on this!  (And sorry, once again, for not
doing it properly from the start)

Maria
___
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds

Bug#850501: rerunning using diffoscope 67-21-gfe7ae15

2017-01-14 Thread Chris Lamb
Hi Maria,

> Rewrote it so file ordering is not taken into account. Does it work now?

Yes, although this would still mean the output of diffoscope itself
is not determinstic. As it happens I wrote my own fix before I saw your email
and I have pushed it — what do you think?


Regards,

-- 
  ,''`.
 : :'  : Chris Lamb
 `. `'`  la...@debian.org / chris-lamb.co.uk
   `-

___
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds

Bug#850501: rerunning using diffoscope 67-21-gfe7ae15

2017-01-14 Thread Chris Lamb
Maria,

Thank you so much for these :)

> Added some tests for APK comparator, see attached patch.

Unfortunately I'm seeing:

differences = [, , , ]

@skip_unless_tools_exist('apktool', 'zipinfo')
def test_android_manifest(differences):
>   assert differences[1].source1 == 'AndroidManifest.xml'
E   assert 'APK metadata' == 'AndroidManifest.xml'
E - APK metadata
E + AndroidManifest.xml

Any ideas?

> However, please keep in mind apktool takes a lot of time to run even on toy
> examples

Whilst I am not a fan of it slowing down this much, I think I'd
prefer to see some tests in there (that we can speed up later)
rather than none.


Regards,

-- 
  ,''`.
 : :'  : Chris Lamb
 `. `'`  la...@debian.org / chris-lamb.co.uk
   `-

___
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds


Bug#850501: rerunning using diffoscope 67-21-gfe7ae15

2017-01-13 Thread Maria Glukhova
On Mon, 09 Jan 2017 17:11:39 + Chris Lamb  wrote:
> Fixed - so sorry about that! Now I wonder if we should insist on tests
> with patches... ;)

Added some tests for APK comparator, see attached patch.
However, please keep in mind apktool takes a lot of time to run even on toy
examples, so adding these tests would extend the time taken by the whole
testing process significantly (almost doubles it at my system). Which makes
me wonder if that was the reason such tests were not added together with
APK comparator in the first place...


Maria Glukhova
From ba61270f532e29fdaa990190dc7be50ae5c91e44 Mon Sep 17 00:00:00 2001
From: Maria Glukhova 
Date: Fri, 13 Jan 2017 23:22:10 +0200
Subject: [PATCH] Add some tests for APK comarator.

---
 tests/comparators/test_apk.py |  62 ++
 tests/data/apk_manifest_expected_diff |  11 ++
 tests/data/apk_zipinfo_expected_diff  |   6 
 tests/data/test1.apk  | Bin 0 -> 866 bytes
 tests/data/test2.apk  | Bin 0 -> 864 bytes
 5 files changed, 79 insertions(+)
 create mode 100644 tests/comparators/test_apk.py
 create mode 100644 tests/data/apk_manifest_expected_diff
 create mode 100644 tests/data/apk_zipinfo_expected_diff
 create mode 100644 tests/data/test1.apk
 create mode 100644 tests/data/test2.apk

diff --git a/tests/comparators/test_apk.py b/tests/comparators/test_apk.py
new file mode 100644
index 000..6253ace
--- /dev/null
+++ b/tests/comparators/test_apk.py
@@ -0,0 +1,62 @@
+# -*- coding: utf-8 -*-
+#
+# diffoscope: in-depth comparison of files, archives, and directories
+#
+# Copyright © 2017 Maria Glukhova 
+#
+# diffoscope is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# diffoscope is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with diffoscope.  If not, see .
+
+import pytest
+
+from diffoscope.comparators.apk import ApkFile
+
+from utils import skip_unless_tools_exist, data, load_fixture, \
+assert_non_existing
+
+apk1 = load_fixture(data('test1.apk'))
+apk2 = load_fixture(data('test2.apk'))
+
+def test_identification(apk1):
+assert isinstance(apk1, ApkFile)
+
+def test_no_differences(apk1):
+difference = apk1.compare(apk1)
+assert difference is None
+
+@pytest.fixture
+def differences(apk1, apk2):
+return apk1.compare(apk2).details
+
+@skip_unless_tools_exist('apktool', 'zipinfo')
+def test_compare_non_existing(monkeypatch, apk1):
+assert_non_existing(monkeypatch, apk1)
+
+@skip_unless_tools_exist('apktool', 'zipinfo')
+def test_zipinfo(differences):
+assert differences[0].source1 == 'zipinfo {}'
+assert differences[0].source2 == 'zipinfo {}'
+expected_diff = open(data('apk_zipinfo_expected_diff')).read()
+assert differences[0].unified_diff == expected_diff
+
+@skip_unless_tools_exist('apktool', 'zipinfo')
+def test_android_manifest(differences):
+assert differences[1].source1 == 'AndroidManifest.xml'
+assert differences[1].source2 == 'AndroidManifest.xml'
+expected_diff = open(data('apk_manifest_expected_diff')).read()
+assert differences[1].unified_diff == expected_diff
+
+@skip_unless_tools_exist('apktool', 'zipinfo')
+def test_apk_metadata_source(differences):
+assert differences[2].source1 == 'APK metadata'
+assert differences[2].source2 == 'APK metadata'
diff --git a/tests/data/apk_manifest_expected_diff b/tests/data/apk_manifest_expected_diff
new file mode 100644
index 000..9d37a92
--- /dev/null
+++ b/tests/data/apk_manifest_expected_diff
@@ -0,0 +1,11 @@
+@@ -1,9 +1,9 @@
+ 
+-http://schemas.android.com/apk/res/android;>
+ 
+ 
+ 
+ 
+ 
+ 
diff --git a/tests/data/apk_zipinfo_expected_diff b/tests/data/apk_zipinfo_expected_diff
new file mode 100644
index 000..d1810dc
--- /dev/null
+++ b/tests/data/apk_zipinfo_expected_diff
@@ -0,0 +1,6 @@
+@@ -1,3 +1,3 @@
+-Zip file size: 866 bytes, number of entries: 1
++Zip file size: 864 bytes, number of entries: 1
+ -rw 2.0 fat 2096 bl defN 80-Jan-01 02:00 AndroidManifest.xml
+-1 file, 2096 bytes uncompressed, 714 bytes compressed:  65.9%
++1 file, 2096 bytes uncompressed, 712 bytes compressed:  66.0%
diff --git a/tests/data/test1.apk b/tests/data/test1.apk
new file mode 100644
index ..45876d61fab82fc0c492af2cf60e56a3792f820f
GIT binary patch
literal 866
zcmWIWW@Zs#;Nak3U=UDbKnB7X*QGRBMZ(?3%T555LUPW%s+z|hKAxD|o!%laj

Bug#850501: rerunning using diffoscope 67-21-gfe7ae15

2017-01-09 Thread Chris Lamb
Hans-Christoph Steiner wrote:

> Thanks for your work on the APK diffing!  I had to fix a typo to get it
> running that was introduced in diffoscope commit

Fixed - so sorry about that! Now I wonder if we should insist on tests
with patches... ;)

> With that change, diffoscope is now working for me again.  I'm running
> it on the fdroid verification server, you can see the output here:
> 
> https://verification.f-droid.org/

Awesome!


Regards,

-- 
  ,''`.
 : :'  : Chris Lamb
 `. `'`  la...@debian.org / chris-lamb.co.uk
   `-

___
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds


Bug#850501: rerunning using diffoscope 67-21-gfe7ae15

2017-01-09 Thread Hans-Christoph Steiner

Thanks for your work on the APK diffing!  I had to fix a typo to get it
running that was introduced in diffoscope commit
fe7ae15e1c177866acd478af4cc4a51bd5002017 at the bottom of it. It turned
'f_out' into a non-existent 'w'.

With that change, diffoscope is now working for me again.  I'm running
it on the fdroid verification server, you can see the output here:

https://verification.f-droid.org/


Also, about apktool.yml, I don't think we need it at all in diffoscope.
It is not a file from the APK and it is not produced by Android SDK
tools. As far as I know, it is only used by apktool if you want to use
apktool to reconstruct a previously "decoded" APK.

___
Reproducible-builds mailing list
Reproducible-builds@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/reproducible-builds