From 2f02d27744e2f3c6e437223b24740cf28b77a625 Mon Sep 17 00:00:00 2001 From: sid Date: Wed, 25 Jun 2014 18:30:38 +0530 Subject: [PATCH] Fixed FreeBSD ports install issue --- packaging/portinstall | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/packaging/portinstall b/packaging/portinstall index 88e654b8db4..068f413af72 100644 --- a/packaging/portinstall +++ b/packaging/portinstall @@ -99,15 +99,14 @@ def query_package(module, name): def matching_packages(module, name): ports_glob_path = module.get_bin_path('ports_glob', True) - rc, out, err = module.run_command("%s %s | wc" % (ports_glob_path, name)) - parts = out.split() - occurrences = int(parts[0]) + rc, out, err = module.run_command("%s %s" % (ports_glob_path, name)) + #counts the numer of packages found + occurrences = out.count('\n') if occurrences == 0: name_without_digits = re.sub('[0-9]', '', name) if name != name_without_digits: - rc, out, err = module.run_command("%s %s | wc" % (ports_glob_path, name_without_digits)) - parts = out.split() - occurrences = int(parts[0]) + rc, out, err = module.run_command("%s %s" % (ports_glob_path, name_without_digits)) + occurrences = out.count('\n') return occurrences