revisor/kickstart.py | 8 ++++----
revisor/misc.py | 48 ++++++++++++++++++++++++++++++++++++++++--------
unity/scripts/respin.sh | 4 ++--
3 files changed, 46 insertions(+), 14 deletions(-)
New commits:
commit 33d202ba4d749590122561443059e6409c563a7a
Author: Jeroen van Meeuwen (Fedora Unity) <kanarip(a)fedoraunity.org>
Date: Sun Apr 26 00:25:08 2009 +0200
Handle wildcard matches in revisor.misc.resolve_pkgs() and make sure
we use revisor.misc.resolve_pkgs() when excluding packages
diff --git a/revisor/kickstart.py b/revisor/kickstart.py
index b7c3caa..3c8911c 100644
--- a/revisor/kickstart.py
+++ b/revisor/kickstart.py
@@ -331,7 +331,7 @@ def pkglist_from_ksdata_livecdtools(
## Exclude packages from ksdata
##
if not cfg.kickstart_uses_pkgsack_exclude:
- for pkg in excludedList:
+ for pkg in revisor.misc.resolve_pkgs(cfg.yumobj, excludedList, log=log):
current += 1.0
try:
pkgs = cfg.yumobj.pkgSack.returnNewestByName(pkg)
@@ -347,7 +347,7 @@ def pkglist_from_ksdata_livecdtools(
if len(warnings) > 0:
log.warning(_("\nThe following errors occured when selecting groups and packages from kickstart:\n\n- %s\n\nYou can continue with these minor errors but obviously the results may not be what you expected.") % '\n- '.join(warnings))
-# self.cfg.yumobj.tsInfo.makelists()
+ cfg.yumobj.tsInfo.makelists()
cfg.ts_length_pre_depsolve = len(cfg.yumobj.tsInfo.getMembers())
@@ -595,7 +595,7 @@ def pkglist_from_ksdata_normal(
## Exclude packages from ksdata
##
if not cfg.kickstart_uses_pkgsack_exclude:
- for pkg in excludedList:
+ for pkg in revisor.misc.resolve_pkgs(cfg.yumobj, excludedList, log=log):
current += 1.0
try:
pkgs = cfg.yumobj.pkgSack.returnNewestByName(pkg)
@@ -714,7 +714,7 @@ def pkglist_from_ksdata_respin(
## Exclude packages from ksdata
##
if not cfg.kickstart_uses_pkgsack_exclude:
- for pkg in excludedList:
+ for pkg in revisor.misc.resolve_pkgs(cfg.yumobj, excludedList, log=log):
current += 1.0
try:
pkgs = cfg.yumobj.pkgSack.returnNewestByName(pkg)
diff --git a/revisor/misc.py b/revisor/misc.py
index 481f046..b3fc685 100644
--- a/revisor/misc.py
+++ b/revisor/misc.py
@@ -18,6 +18,7 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
import datetime
+import fnmatch
import logging
import os
import re
@@ -191,15 +192,46 @@ def resolve_pkgs(yumobj, package_list, log=None):
if not log == None:
log.debug(_("Resolved %s") % (pkg), level=9)
else:
- # If the package isn't in, search the provides
- pkgs = yumobj.whatProvides(pkg, None, None).returnPackages()
- if len(pkgs) > 0:
- final_package_list.append(pkg)
- if not log == None:
- log.debug(_("Resolved %s") % (pkg), level=9)
+ if "*" in pkg:
+ try:
+ pkglist = yumobj.pkgSack.simplePkgList()
+ # anything we couldn't find a match for
+ # could mean it's not there, could mean it's a wildcard
+ if re.match('.*[\*,\[,\],\{,\},\?].*', pkg):
+ restring = fnmatch.translate(pkg)
+ regex = re.compile(restring, flags=re.I) # case insensitive
+ for item in pkglist:
+ if regex.match(item[0]):
+ final_package_list.append(item[0])
+ log.debug(_("Found packages matching '%s': %s") % (pkg,item[0]), level=9)
+
+ except yum.Errors.PackageSackError, e:
+ pass
+
+ # Here's where we try and see if this is a rpm -qa list
+ elif re.match('.*-.*-.*', pkg):
+ (name, epoch, ver, rel, arch) = return_pkg_tuple(pkg)
+
+ pkgs = yumobj.pkgSack.searchNevra(name=name, epoch=epoch, ver=ver, rel=rel, arch=arch)
+
+ if len(pkgs) > 1:
+ warnings.append(_("More then one package found for %s-%s-%s.%s") % (name,ver,rel,arch))
+ elif len(pkgs) < 1:
+ warnings.append(_("Could not find package %s-%s-%s.%s") % (name,ver,rel,arch))
+ for po in pkgs:
+ final_package_list.append(po.name)
+ log.debug(_("From Packages (exact string %s-%s-%s.%s), selecting %s-%s-%s.%s") % (name,ver,rel,arch,po.name,po.version,po.release,po.arch), level=9)
+
else:
- if not log == None:
- log.debug(_("Looking to resolve package %s to a Provides, but we still can't find it.") % pkg, level=2)
+ # If the package isn't in, search the provides
+ pkgs = yumobj.whatProvides(pkg, None, None).returnPackages()
+ if len(pkgs) > 0:
+ final_package_list.append(pkg)
+ if not log == None:
+ log.debug(_("Resolved %s") % (pkg), level=9)
+ else:
+ if not log == None:
+ log.debug(_("Looking to resolve package %s to a Provides, but we still can't find it.") % pkg, level=2)
return final_package_list
commit bdb07ba2f03ce2bcc1897411f6775d89f925dc5c
Author: Jeroen van Meeuwen (Fedora Unity) <kanarip(a)fedoraunity.org>
Date: Sat Apr 25 21:36:27 2009 +0200
Look for rpms-$spin.log, not rpms-*.log
diff --git a/unity/scripts/respin.sh b/unity/scripts/respin.sh
index ebb79ec..2fb043d 100755
--- a/unity/scripts/respin.sh
+++ b/unity/scripts/respin.sh
@@ -348,8 +348,8 @@ for version in ${VERSIONS}; do
for i in `seq 28`; do
hist_date=`date --date="$i days ago" +"%Y%m%d"`
- rpms_log_history=`find ${REVISORDIR}/$hist_date/$spin/log/ -name "rpms-*.log" 2>/dev/null`
- rpms_log_today=`find ${REVISORDIR}/$datestamp/$spin/log/ -name "rpms-*.log" 2>/dev/null`
+ rpms_log_history=`find ${REVISORDIR}/$hist_date/$spin/log/ -name "rpms-$spin.log" 2>/dev/null`
+ rpms_log_today=`find ${REVISORDIR}/$datestamp/$spin/log/ -name "rpms-$spin.log" 2>/dev/null`
if [ ! -z "$rpms_log_history" -a ! -z "$rpms_log_today" ]; then
`pwd`/unity/scripts/live-respin-size-diff.py $rpms_log_history $rpms_log_today > ${TMPDIR:-/tmp}/rpms-diff-${hist_date}-$datestamp.log && \
sudo mv ${TMPDIR:-/tmp}/rpms-diff-${hist_date}-$datestamp.log ${REVISORDIR}/$datestamp/$spin/log/