summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGunnar Wrobel <p@rdus.de>2008-11-14 20:58:07 +0000
committerGunnar Wrobel <p@rdus.de>2008-11-14 20:58:07 +0000
commit9a2684da6dec776f074def7e656736aec404a476 (patch)
treee5a9e1362af4fce8a29237fe9b390546605b2de2
parentd81bfb86c68b86532a1eb8853b182987583e38fb (diff)
downloadlayman-9a2684da6dec776f074def7e656736aec404a476.tar.gz
layman-9a2684da6dec776f074def7e656736aec404a476.tar.bz2
layman-9a2684da6dec776f074def7e656736aec404a476.zip
* layman/db.py (RemoteDB.path): Use the hashlib library (#237625).
http://bugs.gentoo.org/show_bug.cgi?id=237625 * layman/overlays/overlay.py (Overlay.cmd): Use the subprocess module (#237625). http://bugs.gentoo.org/show_bug.cgi?id=237625
-rw-r--r--ChangeLog7
-rw-r--r--layman/db.py10
-rw-r--r--layman/overlays/overlay.py9
3 files changed, 15 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 428c9dc..3d87c66 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2008-11-14 Gunnar Wrobel <p@rdus.de>
+ * layman/db.py (RemoteDB.path): Use the hashlib library (#237625).
+ http://bugs.gentoo.org/show_bug.cgi?id=237625
+
+ * layman/overlays/overlay.py (Overlay.cmd): Use the subprocess
+ module (#237625).
+ http://bugs.gentoo.org/show_bug.cgi?id=237625
+
* layman/overlays/git.py (GitOverlay.add): layman git: handle
git+ssh://, ssh:// correctly
http://bugs.gentoo.org/show_bug.cgi?id=230702
diff --git a/layman/db.py b/layman/db.py
index edb8ac0..64b2421 100644
--- a/layman/db.py
+++ b/layman/db.py
@@ -24,7 +24,7 @@ __version__ = "$Id: db.py 309 2007-04-09 16:23:38Z wrobel $"
#
#-------------------------------------------------------------------------------
-import os, codecs, os.path, urllib2, re, md5
+import os, codecs, os.path, urllib2, re, hashlib
from layman.utils import path
from layman.overlay import Overlays
@@ -321,7 +321,7 @@ class RemoteDB(Overlays):
OUT.debug('Generating cache path.', 6)
- return base + '_' + md5.md5(url).hexdigest() + '.xml'
+ return base + '_' + hashlib.md5(url).hexdigest() + '.xml'
#===============================================================================
#
@@ -335,7 +335,7 @@ class MakeConf:
Check that an add/remove cycle does not modify the make.conf:
- >>> import md5
+ >>> import hashlib
>>> write = os.tmpnam()
>>> here = os.path.dirname(os.path.realpath(__file__))
>>> config = {'local_list' :
@@ -346,7 +346,7 @@ class MakeConf:
... 'quietness':3}
>>> b = DB(config)
>>> a = MakeConf(config, b.overlays)
- >>> o_md5 = str(md5.md5(open(here + '/tests/testfiles/make.conf').read()).hexdigest())
+ >>> o_md5 = str(hashlib.md5(open(here + '/tests/testfiles/make.conf').read()).hexdigest())
>>> a.path = write
>>> a.add(b.overlays['wrobel-stable'])
>>> [i.name for i in a.overlays]
@@ -361,7 +361,7 @@ class MakeConf:
>>> [i.name for i in a.overlays]
[u'wrobel', u'wrobel-stable']
>>> a.delete(b.overlays['wrobel'])
- >>> n_md5 = str(md5.md5(open(write).read()).hexdigest())
+ >>> n_md5 = str(hashlib.md5(open(write).read()).hexdigest())
>>> o_md5 == n_md5
True
>>> os.unlink(write)
diff --git a/layman/overlays/overlay.py b/layman/overlays/overlay.py
index 56186d8..51463db 100644
--- a/layman/overlays/overlay.py
+++ b/layman/overlays/overlay.py
@@ -24,7 +24,7 @@ __version__ = "$Id: overlay.py 273 2006-12-30 15:54:50Z wrobel $"
#
#-------------------------------------------------------------------------------
-import sys, types, re, os, os.path, shutil, popen2
+import sys, types, re, os, os.path, shutil, subprocess
from layman.utils import node_to_dict, dict_to_node, path
@@ -161,12 +161,9 @@ class Overlay:
if not self.quiet:
return os.system(command)
else:
- cmd = popen2.Popen4(command)
- cmd.fromchild.readlines()
+ cmd = subprocess.Popen([command], stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE, close_fds=True)
result = cmd.wait()
- cmd.fromchild.readlines()
- cmd.fromchild.close()
- cmd.tochild.close()
return result
def __str__(self):