aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPapoteur <papoteur@mageialinux-online.org>2016-02-21 12:35:07 +0100
committerPapoteur <papoteur@mageialinux-online.org>2016-02-21 12:35:07 +0100
commiteeb0721539c3e389fde2a65b8406392a83473e63 (patch)
treea19091dde771f9fcdc2c7f488289d655f4260d1c
parentb09cf55fc133349845f5bfed78335d93594f73a0 (diff)
downloadmgarepo-eeb0721539c3e389fde2a65b8406392a83473e63.tar
mgarepo-eeb0721539c3e389fde2a65b8406392a83473e63.tar.gz
mgarepo-eeb0721539c3e389fde2a65b8406392a83473e63.tar.bz2
mgarepo-eeb0721539c3e389fde2a65b8406392a83473e63.tar.xz
mgarepo-eeb0721539c3e389fde2a65b8406392a83473e63.zip
Revert "Restablish a print after a svn command"
-rw-r--r--MgaRepo/log.py23
-rw-r--r--MgaRepo/rpmutil.py10
-rw-r--r--MgaRepo/util.py23
-rwxr-xr-xbash-completion/mgarepo6
4 files changed, 24 insertions, 38 deletions
diff --git a/MgaRepo/log.py b/MgaRepo/log.py
index e02547f..692e3d2 100644
--- a/MgaRepo/log.py
+++ b/MgaRepo/log.py
@@ -2,7 +2,6 @@
from MgaRepo import Error, config, layout
from MgaRepo.svn import SVN
from MgaRepo.util import execcmd
-from MgaRepo.util import get_output_exec
from io import StringIO
@@ -15,6 +14,7 @@ import glob
import tempfile
import shutil
import subprocess
+import select
locale.setlocale(locale.LC_ALL, "C")
@@ -44,7 +44,26 @@ def getrelease(pkgdirurl, rev=None, macros=[], exported=None):
command = (("rpm -q --qf '%%{EPOCH}:%%{VERSION}-%%{RELEASE}\n' "
"--specfile %s %s") %
(specpath, options))
- output = get_output_exec(command)
+ output = StringIO()
+ err = StringIO()
+ p = subprocess.Popen(command, shell=True,
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ of = p.stdout.fileno()
+ ef = p.stderr.fileno()
+ while True:
+ r,w,x = select.select((of,ef), (), ())
+ odata = None
+ if of in r:
+ odata = (os.read(of, 8192)).decode('utf8')
+ output.write(odata)
+ edata = None
+ if ef in r:
+ edata = (os.read(ef, 8192)).decode('utf8')
+ err.write(edata)
+ status = p.poll()
+ if status is not None and odata == '' and edata == '':
+ break
+ output = output.getvalue()
releases = output.split()
try:
epoch, vr = releases[0].split(":", 1)
diff --git a/MgaRepo/rpmutil.py b/MgaRepo/rpmutil.py
index 01de502..8c00da9 100644
--- a/MgaRepo/rpmutil.py
+++ b/MgaRepo/rpmutil.py
@@ -5,8 +5,6 @@ from MgaRepo.svn import SVN
from MgaRepo.simplerpm import SRPM
from MgaRepo.util import execcmd
from MgaRepo.command import default_parent
-from MgaRepo.util import get_output_exec
-
import rpm
import urllib.parse
import tempfile
@@ -684,13 +682,7 @@ def obsolete(pkgdirurl, branch=None, distro=None, backports=None, commit=False,
svn.mv(pkgdirurl, pkgdest, message=log)
if commit:
svn.commit(path, log=log)
- #command = "rpm -q --specfile %s --qf 'Obsoletes: %{name} <= %{evr}\n'" % specpath
- #output = get_output_exec(command)
- #print(output)
- #command = "rpm -q --specfile %s --qf 'Provides: %{name}\n'" % specpath
- #output = get_output_exec(command)
- #print(output)
-
+
def switch(mirrorurl=None):
svn = SVN()
topdir = getpkgtopdir()
diff --git a/MgaRepo/util.py b/MgaRepo/util.py
index 4b1308a..2ffd1b4 100644
--- a/MgaRepo/util.py
+++ b/MgaRepo/util.py
@@ -74,32 +74,9 @@ def execcmd(*cmd, **kwargs):
else:
raise Error("command failed: %s\n%s\n" % (cmdstr, output))
if verbose:
- print(output)
sys.stdout.write(output)
return status, output
-def get_output_exec(cmdstr):
- output = StringIO()
- err = StringIO()
- p = subprocess.Popen(cmdstr, shell=True,
- stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- of = p.stdout.fileno()
- ef = p.stderr.fileno()
- while True:
- r,w,x = select.select((of,ef), (), ())
- odata = None
- if of in r:
- odata = (os.read(of, 8192)).decode('utf8')
- output.write(odata)
- edata = None
- if ef in r:
- edata = (os.read(ef, 8192)).decode('utf8')
- err.write(edata)
- status = p.poll()
- if status is not None and odata == '' and edata == '':
- break
- return output.getvalue()
-
def get_auth(username=None, password=None):
set_username = 1
set_password = 1
diff --git a/bash-completion/mgarepo b/bash-completion/mgarepo
index c094956..e27f12f 100755
--- a/bash-completion/mgarepo
+++ b/bash-completion/mgarepo
@@ -11,7 +11,7 @@ _mgarepo_actions()
{
COMPREPLY=( $( compgen -W 'co ci sync \
submit putsrpm getspec rpmlog getsrpm maintdb create changed \
- authoremail switch upload del up obsolete' -- $cur ) )
+ authoremail switch upload del up' -- $cur ) )
}
_mgarepo()
@@ -64,8 +64,6 @@ _mgarepo()
;;
changed)
options="-a -s -M"
- obsolete)
- options="-m"
;;
esac
options="$options --help"
@@ -80,7 +78,7 @@ _mgarepo()
_filedir
return 0
;;
- @(co|getspec|rpmlog|getsrpm|changed|obsolete))
+ @(co|getspec|rpmlog|getsrpm|changed))
_cauldron_packages
return 0
;;