Accepting request 573247 from home:LPechacek:branches:filesystems
Making the defrag plugin Python 2+3 compatible. https://bugzilla.suse.com/show_bug.cgi?id=1070322 https://github.com/kdave/btrfsmaintenance/pull/47 OBS-URL: https://build.opensuse.org/request/show/573247 OBS-URL: https://build.opensuse.org/package/show/filesystems/btrfsmaintenance?expand=0&rev=33
This commit is contained in:
parent
d8536ea64f
commit
ddbc41e41f
@ -1,3 +1,8 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Feb 5 15:13:00 UTC 2018 - lpechacek@suse.com
|
||||||
|
|
||||||
|
- Move the defrag plugin over to Python 3. (bsc#1070322)
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Mon Jan 15 00:00:00 CET 2018 - dsterba@suse.cz
|
Mon Jan 15 00:00:00 CET 2018 - dsterba@suse.cz
|
||||||
|
|
||||||
|
@ -29,9 +29,10 @@ License: GPL-2.0
|
|||||||
Group: System/Base
|
Group: System/Base
|
||||||
Url: https://github.com/kdave/btrfsmaintenance
|
Url: https://github.com/kdave/btrfsmaintenance
|
||||||
Source0: %{name}-%{version}.tar.bz2
|
Source0: %{name}-%{version}.tar.bz2
|
||||||
|
Patch0: python3-support-bsc1070322.diff
|
||||||
BuildRequires: systemd
|
BuildRequires: systemd
|
||||||
Requires: btrfsprogs
|
Requires: btrfsprogs
|
||||||
Requires: zypp-plugin-python
|
Requires: python3-zypp-plugin
|
||||||
Requires: libzypp(plugin:commit)
|
Requires: libzypp(plugin:commit)
|
||||||
Supplements: btrfsprogs
|
Supplements: btrfsprogs
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
@ -43,6 +44,7 @@ on selected mountpoints or directories.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
|
%patch0 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
|
|
||||||
|
41
python3-support-bsc1070322.diff
Normal file
41
python3-support-bsc1070322.diff
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
Index: btrfsmaintenance-0.4/btrfs-defrag-plugin.py
|
||||||
|
===================================================================
|
||||||
|
--- btrfsmaintenance-0.4.orig/btrfs-defrag-plugin.py
|
||||||
|
+++ btrfsmaintenance-0.4/btrfs-defrag-plugin.py
|
||||||
|
@@ -1,4 +1,4 @@
|
||||||
|
-#!/usr/bin/python
|
||||||
|
+#!/usr/bin/python3
|
||||||
|
|
||||||
|
# This plugin defragments rpm files after update.
|
||||||
|
#
|
||||||
|
@@ -17,14 +17,19 @@
|
||||||
|
# contiguous space, the bigger the extent is, the worse and the extent
|
||||||
|
# size hint is not reached anyway
|
||||||
|
|
||||||
|
-from sys import stderr
|
||||||
|
+import sys
|
||||||
|
+if sys.version_info[0] >= 3:
|
||||||
|
+ from builtins import str
|
||||||
|
+ popen_kwargs = { 'encoding': 'ascii' }
|
||||||
|
+else:
|
||||||
|
+ popen_kwargs = { }
|
||||||
|
from zypp_plugin import Plugin
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
DEBUG=False
|
||||||
|
EXTENT_SIZE=64*1024*1024
|
||||||
|
LOGFILE='/tmp/btrfs-defrag-plugin.log'
|
||||||
|
-PATH=subprocess.check_output(["rpm", "--eval", "%_dbpath"]).strip()
|
||||||
|
+PATH=subprocess.check_output(["rpm", "--eval", "%_dbpath"], **popen_kwargs).strip()
|
||||||
|
|
||||||
|
def dbg(args):
|
||||||
|
if not DEBUG: return
|
||||||
|
@@ -34,7 +39,7 @@ def dbg(args):
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
def qx(args):
|
||||||
|
- out=subprocess.Popen(args, shell=True, stdout=subprocess.PIPE).stdout
|
||||||
|
+ out=subprocess.Popen(args, shell=True, stdout=subprocess.PIPE, **popen_kwargs).stdout
|
||||||
|
outstr="".join(out.readlines())
|
||||||
|
out.close()
|
||||||
|
return outstr
|
Loading…
Reference in New Issue
Block a user