Sophie

Sophie

distrib > Mageia > 3 > i586 > media > core-release-src > by-pkgid > 03c7be59b52dc9fb87015775eab75aad > files > 16

smart-1.4.1-8.mga3.src.rpm

--- smart-1.4.1/smart/backends/rpm/header.py.rpm-suggests~	2011-10-09 10:50:25.000000000 +0200
+++ smart-1.4.1/smart/backends/rpm/header.py	2012-01-20 21:12:55.508404004 +0100
@@ -295,7 +295,9 @@ class RPMHeaderLoader(Loader):
                 reqdict = {}
                 for i in range(len(n)):
                     ni = n[i]
-                    if ni[:7] not in ("rpmlib(", "config("):
+                    hint = (f[i]&1 << 19) # RPMSENSE_MISSINGOK
+                    if ni[:7] not in ("rpmlib(", "config(") and (not hint
+                      or sysconf.get("install-suggests", False)):
                         vi = v[i] or None
                         if vi and vi[:2] == "0:":
                             vi = vi[2:]
@@ -312,7 +314,38 @@ class RPMHeaderLoader(Loader):
                                      intern(ni), r, vi)] = True
                 reqargs = collapse_libc_requires(reqdict.keys())
             else:
-                reqargs = None
+                reqargs = []
+
+            n = h[1156] # RPMTAG_SUGGESTSNAME
+            if n:
+                f = h[1158] # RPMTAG_SUGGESTSFLAGS
+                v = h[1157] # RPMTAG_SUGGESTSVERSION
+                if f == None:
+                    f = [0]
+                elif type(f) != list:
+                    f = [f]
+                reqdict = {}
+                for i in range(len(n)):
+                    ni = n[i]
+                    strong = (f[i]&1 << 27) # RPMSENSE_STRONG
+                    if ni[:7] not in ("rpmlib(", "config(") and (
+                      (strong and sysconf.get("install-recommends", True) or
+                      (not strong and sysconf.get("install-suggests", False)))):
+                        vi = v[i] or None
+                        if vi and vi[:2] == "0:":
+                            vi = vi[2:]
+                        r = CM.get(f[i]&CF)
+                        if not ((r is None or "=" in r) and
+                                (Prv, ni, vi) in prvdict or
+                                system_provides.match(ni, r, vi)):
+                            # RPMSENSE_PREREQ |
+                            # RPMSENSE_SCRIPT_PRE |
+                            # RPMSENSE_SCRIPT_PREUN |
+                            # RPMSENSE_SCRIPT_POST |
+                            # RPMSENSE_SCRIPT_POSTUN == 7744
+                            reqdict[(f[i]&7744 and PreReq or Req,
+                                     intern(ni), r, vi)] = True
+                reqargs.extend(reqdict.keys())
 
             n = h[1054] # RPMTAG_CONFLICTNAME
             if n:
--- smart-1.4.1/smart/backends/rpm/metadata.py.rpm-suggests~	2011-10-09 10:50:25.000000000 +0200
+++ smart-1.4.1/smart/backends/rpm/metadata.py	2012-01-20 21:12:55.508404004 +0100
@@ -144,6 +144,8 @@ class RPMMetaDataLoader(Loader):
         LICENSE     = nstag(NS_RPM, "license")
         ENTRY       = nstag(NS_RPM, "entry")
         REQUIRES    = nstag(NS_RPM, "requires")
+        SUGGESTS    = nstag(NS_RPM, "suggests")
+        RECOMMENDS  = nstag(NS_RPM, "recommends")
         PROVIDES    = nstag(NS_RPM, "provides")
         CONFLICTS   = nstag(NS_RPM, "conflicts")
         OBSOLETES   = nstag(NS_RPM, "obsoletes")
@@ -290,7 +292,18 @@ class RPMMetaDataLoader(Loader):
                         if elem.get("pre") == "1":
                             reqdict[(RPMPreRequires,
                                      ename, erelation, eversion)] = True
-                        else:
+                        elif (not elem.get("hint") == "1"
+                          or sysconf.get("install-suggests", False)):
+                            reqdict[(RPMRequires,
+                                     ename, erelation, eversion)] = True
+
+                    elif lasttag == RECOMMENDS:
+                          if sysconf.get("install-recommends", True):
+                            reqdict[(RPMRequires,
+                                     ename, erelation, eversion)] = True
+
+                    elif lasttag == SUGGESTS:
+                          if sysconf.get("install-suggests", False):
                             reqdict[(RPMRequires,
                                      ename, erelation, eversion)] = True