On Sat, Mar 14, 2020 at 03:18:44PM +0100, Klemens Nanni wrote:
> Overall unmaintained but there exists a fork of the currently used repo
> which fixed stuff for Python 3.5.2 on Windows:
> https://github.com/wittrup/jefferson/commit/852aeebbb5a8fb2fd07f365122a4e136a750f4df
>
> This is the only commit besides another minor one on top of upstream and
> it fixes Python 3.x on anything.
>
> I came here because removing Python 2.7 from my system would remove this
> port and eventually binwalk, which I'd like to keep.
>
> For testing, I created a JFFS2 image on Debian with
>
> # apt install mtd-utils
> $ mkdir testdir
> $ touch testdir/{a,b}
> $ /usr/sbin/mkfs.jffs2 -r testdir -o jffs2.img
>
> On OpenBSD, current binwalk and jefferson can extract this:
>
> $ binwalk -e jffs2.img
>
> DECIMAL HEXADECIMAL DESCRIPTION
>
> --------------------------------------------------------------------------------
> 0 0x0 JFFS2 filesystem, little endian
>
> $ cd _jffs2.img.extracted/ ; find .
> .
> ./0.jffs2
> ./jffs2-root
> ./jffs2-root/fs_1
> ./jffs2-root/fs_1/a
> ./jffs2-root/fs_1/b
>
> I then changed upstream and upgraded jefferson, but extraction wouldn't
> work. This was due to the LZMA/Python 2 patch still i place, so I
> removed the patch and dependency, upgraded jefferson again, uninstalled
> py-backport-lzma; this time binwalk was able to extract the image again
> just like before.
>
> Feedback? OK?
Now with the comment removed, too.
Index: Makefile
===================================================================
RCS file: /cvs/ports/sysutils/jefferson/Makefile,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 Makefile
--- Makefile 21 Dec 2019 14:16:53 -0000 1.1.1.1
+++ Makefile 14 Mar 2020 14:19:31 -0000
@@ -3,10 +3,11 @@
COMMENT = JFFS2 filesystem extraction tool
MODPY_EGG_VERSION = 0.2
-GH_COMMIT = 6f9169bad3ceb4e212fae62ad710eeca3350226b
+GH_COMMIT = d1aff710928f05e889b0ae23d97d1b9640eecbd0
GH_PROJECT = jefferson
-GH_ACCOUNT = sviehb
+GH_ACCOUNT = wittrup
DISTNAME = jefferson-${MODPY_EGG_VERSION}
+REVISION = 0
CATEGORIES = sysutils
@@ -16,14 +17,9 @@ MAINTAINER = Jasper Lievisse Adriaanse
PERMIT_PACKAGE = Yes
MODULES = lang/python
-# With python3 extraction fails with:
-# File "/usr/local/lib/python3.7/site-packages/jefferson/rtime.py", line 7,
in decompress
-# value = ord(data_in[pos])
-# TypeError: ord() expected string of length 1, but int found
-#MODPY_VERSION = ${MODPY_DEFAULT_VERSION_3}
+MODPY_VERSION = ${MODPY_DEFAULT_VERSION_3}
-RUN_DEPENDS = archivers/py-backports-lzma \
- devel/py-cstruct${MODPY_FLAVOR}
+RUN_DEPENDS = devel/py-cstruct${MODPY_FLAVOR}
NO_TEST = Yes
Index: distinfo
===================================================================
RCS file: /cvs/ports/sysutils/jefferson/distinfo,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 distinfo
--- distinfo 21 Dec 2019 14:16:53 -0000 1.1.1.1
+++ distinfo 14 Mar 2020 13:34:51 -0000
@@ -1,2 +1,2 @@
-SHA256 (jefferson-0.2-6f9169ba.tar.gz) =
ajxy578hjddkR8C/2F7BcPpAEq+5n37pnr+6dykXzTI=
-SIZE (jefferson-0.2-6f9169ba.tar.gz) = 6258
+SHA256 (jefferson-0.2-d1aff710.tar.gz) =
im3zXhqvZDRWa7WCuP8KXwvdrGdxWw/ees3iqlM2VQ8=
+SIZE (jefferson-0.2-d1aff710.tar.gz) = 6446
Index: patches/patch-src_jefferson_jffs2_lzma_py
===================================================================
RCS file: patches/patch-src_jefferson_jffs2_lzma_py
diff -N patches/patch-src_jefferson_jffs2_lzma_py
--- patches/patch-src_jefferson_jffs2_lzma_py 21 Dec 2019 14:16:53 -0000
1.1.1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,22 +0,0 @@
-$OpenBSD: patch-src_jefferson_jffs2_lzma_py,v 1.1.1.1 2019/12/21 14:16:53
jasper Exp $
-
-Use backports.lzma on python2
-
-Index: src/jefferson/jffs2_lzma.py
---- src/jefferson/jffs2_lzma.py.orig
-+++ src/jefferson/jffs2_lzma.py
-@@ -1,6 +1,6 @@
- import struct
-
--import lzma
-+import backports.lzma
-
- LZMA_BEST_LC = 0
- LZMA_BEST_LP = 0
-@@ -18,4 +18,4 @@ def decompress(data, outlen):
- lzma_header = struct.pack('<BIQ', PROPERTIES, DICT_SIZE, outlen)
- lzma_data = lzma_header + data
- decompressed = lzma.decompress(lzma_data)
-- return decompressed
-\ No newline at end of file
-+ return decompressed