Hello community, here is the log from the commit of package zramcfg for openSUSE:Factory checked in at 2020-05-29 21:22:50 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/zramcfg (Old) and /work/SRC/openSUSE:Factory/.zramcfg.new.3606 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "zramcfg" Fri May 29 21:22:50 2020 rev:2 rq:809774 version:0.2 Changes: -------- --- /work/SRC/openSUSE:Factory/zramcfg/zramcfg.changes 2016-08-03 11:42:42.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.zramcfg.new.3606/zramcfg.changes 2020-05-29 21:36:51.998558709 +0200 @@ -1,0 +2,7 @@ +Fri May 22 17:07:09 UTC 2020 - Libor Pechacek <lpecha...@suse.com> + +- Fix build +- Python3 compatibility + * Add patch v0.2-Port-to-Python3.patch + +------------------------------------------------------------------- New: ---- v0.2-Port-to-Python3.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ zramcfg.spec ++++++ --- /var/tmp/diff_new_pack.LajTOa/_old 2020-05-29 21:36:52.514560245 +0200 +++ /var/tmp/diff_new_pack.LajTOa/_new 2020-05-29 21:36:52.518560257 +0200 @@ -1,7 +1,7 @@ # # spec file for package zramcfg # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,21 +12,22 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # - +%define skip_python2 1 %define version_unconverted 0.2 Name: zramcfg Version: 0.2 Release: 0 Summary: ZRAM configuration -License: GPL-2.0+ +License: GPL-2.0-or-later Group: System/Kernel -Url: https://github.com/hreinecke/zramcfg +URL: https://github.com/hreinecke/zramcfg Source: %{name}-%{version}.tar.xz -BuildRequires: python +Patch0: v0.2-Port-to-Python3.patch +BuildRequires: python3 BuildRequires: systemd-rpm-macros BuildArch: noarch @@ -37,11 +38,13 @@ %prep %setup +%patch0 -p1 %build +%python_build %install -python setup.py install --prefix=%{_prefix} --root=%{buildroot} +%python_install chmod a+x "%{buildroot}/%{python_sitelib}/%{name}.py" mkdir -p "%{buildroot}/%{_sbindir}" ln -sf ../..%{python_sitelib}/%{name}.py "%{buildroot}/%{_sbindir}/%{name}" ++++++ v0.2-Port-to-Python3.patch ++++++ >From 33e0c7856b9a184858b7d41e20db1f17e74950de Mon Sep 17 00:00:00 2001 From: Libor Pechacek <lpecha...@gmx.com> Date: Fri, 22 May 2020 19:14:44 +0200 Subject: [PATCH] Port to Python3 Signed-off-by: Libor Pechacek <lpecha...@suse.com> --- zramcfg.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/zramcfg.py b/zramcfg.py index 4d64face2d2d..b499df4123ad 100644 --- a/zramcfg.py +++ b/zramcfg.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 # # zramcfg # Copyright (c) 2016 Julius & Hannes Reinecke @@ -12,13 +12,13 @@ import glob import os import subprocess import argparse -import ConfigParser +import configparser class zramcfg: cfgnames = ['max_comp_streams' , 'comp_algorithm', 'disksize', 'mem_limit' ] def __init__(self, name): - self.config = ConfigParser.SafeConfigParser() + self.config = configparser.ConfigParser() self.cfgfile = name def is_active(self, dev): @@ -32,7 +32,7 @@ class zramcfg: def save(self, force): if not glob.glob('/sys/class/zram-control'): - print 'zram not present, not saving configuration' + print('zram not present, not saving configuration') try: if force: os.remove(self.cfgfile) @@ -45,7 +45,7 @@ class zramcfg: if not self.is_active(zram): continue # Save current configuration - print 'Save configuration for /dev/' + zram + print('Save configuration for /dev/' + zram) self.config.add_section(zram) for attr in self.cfgnames: attrname = '/sys/block/' + zram + '/' + attr @@ -64,7 +64,7 @@ class zramcfg: with open(self.cfgfile, 'wb') as configfile: self.config.write(configfile) else: - print 'zram not configured, not saving configuration' + print('zram not configured, not saving configuration') try: if (force): os.remove(self.cfgfile) @@ -74,24 +74,24 @@ class zramcfg: def load(self): # Read configuration file if not self.config.read(self.cfgfile): - print 'Could not load configuration file ' + self.cfgfile + print('Could not load configuration file ' + self.cfgfile) exit(0) for zram in self.config.sections(): m = re.match(r"zram([0-9]*)", zram) if not m.group(1): - print 'Invalid group name ' + zram + print('Invalid group name ' + zram) continue zram_num = m.group(1) - print 'Load configuration for /dev/zram' + str(zram_num) + print('Load configuration for /dev/zram' + str(zram_num)) # Activate zram device while not glob.glob('/sys/block/' + zram): if not glob.glob('/sys/module/zram'): if subprocess.call(["/sbin/modprobe","zram"]): - print 'Cannot load zram module' + print('Cannot load zram module') exit(1) if not glob.glob('/sys/class/zram-control'): - print 'zram-control not present, cannot configure ' + zram + print('zram-control not present, cannot configure ' + zram) exit(1) with open('/sys/class/zram-control/hot_add', 'r') as f: value = f.read() @@ -101,18 +101,18 @@ class zramcfg: # Not able to configure device if not glob.glob('/sys/block/' + zram): - print '/dev/' + zram + ' is not configured' + print('/dev/' + zram + ' is not configured') continue # check if zram device is active if self.is_active(zram): - print '/dev/' + zram + ' already active, skipping' + print('/dev/' + zram + ' already active, skipping') continue # Write out configuration to sysfs attributes for attr in self.cfgnames: value = self.config.get(zram, attr) - attrname = '/sys/block/' + zram + '/' + attr - with open(attrname, 'w') as f: + attrname = '/sys/block/' + zram + '/' + attr + with open(attrname, 'w') as f: f.write(value) f.close() -- 2.26.2