Rewrote parts of pkgorder script to improve it's speed. (#451083)
Function printMatchingPkgs() was making glob.glob calls everytime it was used.
Rewrote parts of the script to build the list of the packages just once,
and then use fnmatch() to print the matching packages.
Also some unnecessary import calls were removed.
---
scripts/pkgorder | 23 +++++++++++++----------
1 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/scripts/pkgorder b/scripts/pkgorder
index 7722718..aa67791 100755
--- a/scripts/pkgorder
+++ b/scripts/pkgorder
@@ -9,12 +9,11 @@
# You should have received a copy of the GNU Library Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-import os.path
-import glob
+import os
+import fnmatch
import rpm
import rpmUtils
import shutil
-import string
import sys
import yum
@@ -31,7 +30,6 @@ from optparse import OptionParser
from yum.packageSack import PackageSack
from yum.packages import PackageObject
from yuminstall import YumSorter
-import iutil
class PackageOrderer(YumSorter):
@@ -88,13 +86,9 @@ def processTransaction(ds):
def printMatchingPkgs(fpattern):
global processed
+ global packages