Accepting request 580565 from filesystems

Automatic submission by obs-autosubmit

OBS-URL: https://build.opensuse.org/request/show/580565
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/btrfsmaintenance?expand=0&rev=15
This commit is contained in:
Dominique Leuenberger 2018-02-27 16:00:10 +00:00 committed by Git OBS Bridge
commit 1194b72296
3 changed files with 50 additions and 1 deletions

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon Feb 5 15:13:00 UTC 2018 - lpechacek@suse.com
- Move the defrag plugin over to Python 3. (bsc#1070322)
- Added patch: python3-support-bsc1070322.diff
-------------------------------------------------------------------
Mon Jan 15 00:00:00 CET 2018 - dsterba@suse.cz

View File

@ -29,9 +29,10 @@ License: GPL-2.0
Group: System/Base
Url: https://github.com/kdave/btrfsmaintenance
Source0: %{name}-%{version}.tar.bz2
Patch0: python3-support-bsc1070322.diff
BuildRequires: systemd
Requires: btrfsprogs
Requires: zypp-plugin-python
Requires: python3-zypp-plugin
Requires: libzypp(plugin:commit)
Supplements: btrfsprogs
BuildArch: noarch
@ -43,6 +44,7 @@ on selected mountpoints or directories.
%prep
%setup -q
%patch0 -p1
%build

View 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