[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Spacewalk-devel] [PATCH] fix metadata - generate pre flag into primary.xml



Hi,

we found a bug in how spacewalk generate the repomd metadata.
PreRequires are not flagged in primary.xml.

The attached patch fixes this problem.

-- 
Regards

	Michael Calmer

--------------------------------------------------------------------------
Michael Calmer
SUSE LINUX Products GmbH, Maxfeldstr. 5, D-90409 Nuernberg
T: +49 (0) 911 74053 0
F: +49 (0) 911 74053575  - e-mail: Michael Calmer suse com
--------------------------------------------------------------------------
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imend├Ârffer
HRB 16746 (AG N├╝rnberg)
>From 5908262665c2db84246ddf6d3739d58ce5c4f6a4 Mon Sep 17 00:00:00 2001
From: Michael Calmer <mc suse de>
Date: Fri, 5 Jul 2013 13:52:34 +0200
Subject: [PATCH] Generate pre flag into the metadata

---
 .../redhat/rhn/taskomatic/task/repomd/PrimaryXmlWriter.java   | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/java/code/src/com/redhat/rhn/taskomatic/task/repomd/PrimaryXmlWriter.java b/java/code/src/com/redhat/rhn/taskomatic/task/repomd/PrimaryXmlWriter.java
index 512520b..5df0d87 100644
--- a/java/code/src/com/redhat/rhn/taskomatic/task/repomd/PrimaryXmlWriter.java
+++ b/java/code/src/com/redhat/rhn/taskomatic/task/repomd/PrimaryXmlWriter.java
@@ -303,6 +303,10 @@ public class PrimaryXmlWriter extends RepomdWriter {
                 attr.addAttribute("rel", evrMap.get("release"));
             }
 
+            if (hasPreFlag(pkgCapIter.getNumber("sense").longValue())) {
+                attr.addAttribute("pre", "1");
+            }
+
             localHandler.startElement("rpm:entry", attr);
             localHandler.endElement("rpm:entry");
         }
@@ -403,4 +407,11 @@ public class PrimaryXmlWriter extends RepomdWriter {
         }
     }
 
+    /**
+     * @param senseIn package sense
+     * @return true in case the pre flag is set, otherwise false
+     */
+    private boolean hasPreFlag(long senseIn) {
+        return ((senseIn & (1 << 6)) > 0) ? true : false;
+    }
 }
-- 
1.8.1.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]