diff options
| author | André Draszik <git@andred.net> | 2020-02-05 16:32:49 +0000 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2020-02-05 08:44:38 -0800 |
| commit | fd2765bb16d6a895d3d6d4886add4b8b6a1baa20 (patch) | |
| tree | c4f6ec2869533998144e216a3989d840a1409504 | |
| parent | 8cda709fb9704660d87b0022430151cf088946b3 (diff) | |
| download | meta-openembedded-fd2765bb16d6a895d3d6d4886add4b8b6a1baa20.tar.gz | |
smem: update to v1.5 (python3 compatibility)
smem generally works using the upstream code, but
the --source argument still throws exceptions - add
a patch to resolve those as well.
There is no release on the downloads URL, but a tag
in mercurial - so this now downloads the snapshot that
tag is pointing to.
Signed-off-by: André Draszik <git@andred.net>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
| -rw-r--r-- | meta-oe/recipes-support/smem/smem/0001-smem-fix-support-for-source-option-python3.patch | 53 | ||||
| -rw-r--r-- | meta-oe/recipes-support/smem/smem_1.5.bb (renamed from meta-oe/recipes-support/smem/smem_1.4.bb) | 20 |
2 files changed, 68 insertions, 5 deletions
diff --git a/meta-oe/recipes-support/smem/smem/0001-smem-fix-support-for-source-option-python3.patch b/meta-oe/recipes-support/smem/smem/0001-smem-fix-support-for-source-option-python3.patch new file mode 100644 index 0000000000..5c1be5a0a2 --- /dev/null +++ b/meta-oe/recipes-support/smem/smem/0001-smem-fix-support-for-source-option-python3.patch | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | From 3ff78f1f00973393d1a7ee4e467a2bacf1c807f3 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: =?UTF-8?q?Andr=C3=A9=20Draszik?= <git@andred.net> | ||
| 3 | Date: Wed, 5 Feb 2020 16:14:21 +0000 | ||
| 4 | Subject: [PATCH] smem: fix support for --source option (python3) | ||
| 5 | MIME-Version: 1.0 | ||
| 6 | Content-Type: text/plain; charset=UTF-8 | ||
| 7 | Content-Transfer-Encoding: 8bit | ||
| 8 | |||
| 9 | Using --source doesn't work without this patch: | ||
| 10 | Traceback (most recent call last): | ||
| 11 | File "./smem", line 727, in <module> | ||
| 12 | showpids() | ||
| 13 | File "./smem", line 299, in showpids | ||
| 14 | showtable(pt.keys(), fields, columns.split(), options.sort or 'pss') | ||
| 15 | File "./smem", line 519, in showtable | ||
| 16 | mt = totalmem() | ||
| 17 | File "./smem", line 118, in totalmem | ||
| 18 | _totalmem = memory()['memtotal'] | ||
| 19 | File "./smem", line 193, in memory | ||
| 20 | m = f.match(l) | ||
| 21 | TypeError: cannot use a string pattern on a bytes-like object | ||
| 22 | |||
| 23 | python3's tarfile returns bytes, whereas all of the rest of | ||
| 24 | the code assumes str. | ||
| 25 | |||
| 26 | Fix the tarfile usage to convert to str before returning the | ||
| 27 | results. | ||
| 28 | |||
| 29 | Signed-off-by: André Draszik <git@andred.net> | ||
| 30 | Upstream-Status: Inappropriate [upstream wants to support python2 & python3] | ||
| 31 | --- | ||
| 32 | smem | 4 ++-- | ||
| 33 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
| 34 | |||
| 35 | diff --git a/smem b/smem | ||
| 36 | index 46a3189..54d40dd 100755 | ||
| 37 | --- a/smem | ||
| 38 | +++ b/smem | ||
| 39 | @@ -90,9 +90,9 @@ class tardata(procdata): | ||
| 40 | d,f = ti.name.split('/') | ||
| 41 | yield d | ||
| 42 | def _read(self, f): | ||
| 43 | - return self.tar.extractfile(f).read() | ||
| 44 | + return self.tar.extractfile(f).read().decode() | ||
| 45 | def _readlines(self, f): | ||
| 46 | - return self.tar.extractfile(f).readlines() | ||
| 47 | + return [l.decode() for l in self.tar.extractfile(f).readlines()] | ||
| 48 | def piduser(self, p): | ||
| 49 | t = self.tar.getmember("%d" % p) | ||
| 50 | if t.uname: | ||
| 51 | -- | ||
| 52 | 2.23.0.rc1 | ||
| 53 | |||
diff --git a/meta-oe/recipes-support/smem/smem_1.4.bb b/meta-oe/recipes-support/smem/smem_1.5.bb index 947c47b0f6..90db9c3f3e 100644 --- a/meta-oe/recipes-support/smem/smem_1.4.bb +++ b/meta-oe/recipes-support/smem/smem_1.5.bb | |||
| @@ -9,9 +9,16 @@ SECTION = "Applications/System" | |||
| 9 | LICENSE = "GPLv2+" | 9 | LICENSE = "GPLv2+" |
| 10 | LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" | 10 | LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263" |
| 11 | 11 | ||
| 12 | SRC_URI = "http://www.selenic.com/${BPN}/download/${BP}.tar.gz" | 12 | HG_CHANGESET = "98273ce331bb" |
| 13 | SRC_URI[md5sum] = "fe79435c3930389bfdb560255c802162" | 13 | SRC_URI = "https://selenic.com/repo/${BPN}/archive/${HG_CHANGESET}.tar.bz2;downloadfilename=${BP}.tar.bz2 \ |
| 14 | SRC_URI[sha256sum] = "2ea9f878f4cf3c276774c3f7e2a41977a1f2d64f98d2dcb6a15f1f3d84df61ec" | 14 | file://0001-smem-fix-support-for-source-option-python3.patch" |
| 15 | SRC_URI[md5sum] = "51c3989779360f42b42ef46b2831be3a" | ||
| 16 | SRC_URI[sha256sum] = "161131c686a6d9962a0e96912526dd46308e022d62e3f8acaed5a56fda8e08ce" | ||
| 17 | |||
| 18 | UPSTREAM_CHECK_URI = "https://selenic.com/repo/smem/tags" | ||
| 19 | UPSTREAM_CHECK_REGEX = "(?P<pver>\d+(\.\d+)+)" | ||
| 20 | |||
| 21 | S = "${WORKDIR}/${BPN}-${HG_CHANGESET}" | ||
| 15 | 22 | ||
| 16 | do_compile() { | 23 | do_compile() { |
| 17 | ${CC} ${CFLAGS} ${LDFLAGS} smemcap.c -o smemcap | 24 | ${CC} ${CFLAGS} ${LDFLAGS} smemcap.c -o smemcap |
| @@ -21,12 +28,15 @@ do_install() { | |||
| 21 | install -d ${D}/${bindir}/ | 28 | install -d ${D}/${bindir}/ |
| 22 | install -d ${D}/${mandir}/man8 | 29 | install -d ${D}/${mandir}/man8 |
| 23 | install -m 0755 ${S}/smem ${D}${bindir}/ | 30 | install -m 0755 ${S}/smem ${D}${bindir}/ |
| 31 | sed -i -e '1s,#!.*python.*,#!${USRBINPATH}/env python3,' ${D}${bindir}/smem | ||
| 24 | install -m 0755 ${S}/smemcap ${D}${bindir}/ | 32 | install -m 0755 ${S}/smemcap ${D}${bindir}/ |
| 25 | install -m 0644 ${S}/smem.8 ${D}/${mandir}/man8/ | 33 | install -m 0644 ${S}/smem.8 ${D}/${mandir}/man8/ |
| 26 | } | 34 | } |
| 27 | RDEPENDS_${PN} += "python-textutils python-compression python-shell python-codecs" | ||
| 28 | 35 | ||
| 29 | PACKAGES =+ "smemcap" | 36 | RDEPENDS_${PN} = "python3-core python3-compression" |
| 37 | RRECOMMENDS_${PN} = "python3-matplotlib python3-numpy" | ||
| 38 | |||
| 39 | PACKAGE_BEFORE_PN = "smemcap" | ||
| 30 | 40 | ||
| 31 | FILES_smemcap = "${bindir}/smemcap" | 41 | FILES_smemcap = "${bindir}/smemcap" |
| 32 | 42 | ||
