Changes to 'refs/tags/spacewalk-java-1.7.9-1'
by Tomas Lestach
Tag 'spacewalk-java-1.7.9-1' created by Tomas Lestach <tlestach(a)redhat.com> at 2012-01-23 19:08 +0000
Tagging package [spacewalk-java] version [1.7.9-1] in directory [java/].
Changes since spacewalk-java-1.7.8-1:
Tomas Lestach (2):
include Base64 from gpache.commons.codec.binary
Automatic commit of package [spacewalk-java] release [1.7.9-1].
---
java/code/src/com/redhat/rhn/frontend/xmlrpc/serializer/ConfigRevisionSerializer.java | 14 ++++++++--
java/spacewalk-java.spec | 5 ++-
rel-eng/packages/spacewalk-java | 2 -
3 files changed, 17 insertions(+), 4 deletions(-)
---
12 years, 4 months
2 commits - java/code java/spacewalk-java.spec rel-eng/packages
by Tomas Lestach
java/code/src/com/redhat/rhn/frontend/xmlrpc/serializer/ConfigRevisionSerializer.java | 14 ++++++++--
java/spacewalk-java.spec | 5 ++-
rel-eng/packages/spacewalk-java | 2 -
3 files changed, 17 insertions(+), 4 deletions(-)
New commits:
commit 09ba74fcfe536748113c806a0305cccec2664a32
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Mon Jan 23 20:08:08 2012 +0100
Automatic commit of package [spacewalk-java] release [1.7.9-1].
diff --git a/java/spacewalk-java.spec b/java/spacewalk-java.spec
index 859eaf1..89680e0 100644
--- a/java/spacewalk-java.spec
+++ b/java/spacewalk-java.spec
@@ -17,7 +17,7 @@ Name: spacewalk-java
Summary: Spacewalk Java site packages
Group: Applications/Internet
License: GPLv2
-Version: 1.7.8
+Version: 1.7.9
Release: 1%{?dist}
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
@@ -555,6 +555,9 @@ fi
%{jardir}/postgresql-jdbc.jar
%changelog
+* Mon Jan 23 2012 Tomas Lestach <tlestach(a)redhat.com> 1.7.9-1
+- include Base64 from gpache.commons.codec.binary (tlestach(a)redhat.com)
+
* Mon Jan 23 2012 Tomas Lestach <tlestach(a)redhat.com> 1.7.8-1
- enable requesting base64 encoded config file ervisions (tlestach(a)redhat.com)
- 702019 - use --log option for anaconda script logging starting from rhel6
diff --git a/rel-eng/packages/spacewalk-java b/rel-eng/packages/spacewalk-java
index bc95a35..fa58900 100644
--- a/rel-eng/packages/spacewalk-java
+++ b/rel-eng/packages/spacewalk-java
@@ -1 +1 @@
-1.7.8-1 java/
+1.7.9-1 java/
commit 9bc0fb332afbd027ebecf0749b1a264444ef60c4
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Mon Jan 23 20:01:52 2012 +0100
include Base64 from gpache.commons.codec.binary
not from com.sun.org.apache.xml.internal.security.utils
adressing:
[javac] /builddir/build/BUILD/spacewalk-java-1.7.8/code/src/com/redhat/rhn/frontend/xmlrpc/serializer/ConfigRevisionSerializer.java:22: package com.sun.org.apache.xml.internal.security.utils does not exist
[javac] import com.sun.org.apache.xml.internal.security.utils.Base64;
[javac] ^
[javac] /builddir/build/BUILD/spacewalk-java-1.7.8/code/src/com/redhat/rhn/frontend/xmlrpc/serializer/ConfigRevisionSerializer.java:152: cannot find symbol
[javac] symbol : variable Base64
[javac] location: class com.redhat.rhn.frontend.xmlrpc.serializer.ConfigRevisionSerializer
[javac] helper.add(CONTENTS, Base64.encode(content.getBytes()));
[javac] ^
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/serializer/ConfigRevisionSerializer.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/serializer/ConfigRevisionSerializer.java
index 1a788f8..ceab039 100644
--- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/serializer/ConfigRevisionSerializer.java
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/serializer/ConfigRevisionSerializer.java
@@ -14,14 +14,16 @@
*/
package com.redhat.rhn.frontend.xmlrpc.serializer;
+import com.redhat.rhn.FaultException;
import com.redhat.rhn.common.util.StringUtil;
import com.redhat.rhn.domain.config.ConfigRevision;
import com.redhat.rhn.domain.config.EncodedConfigRevision;
import com.redhat.rhn.frontend.xmlrpc.serializer.util.SerializerHelper;
-import com.sun.org.apache.xml.internal.security.utils.Base64;
+import org.apache.commons.codec.binary.Base64;
import java.io.IOException;
+import java.io.UnsupportedEncodingException;
import java.io.Writer;
import java.text.DecimalFormat;
@@ -149,7 +151,15 @@ public class ConfigRevisionSerializer implements XmlRpcCustomSerializer {
protected void addEncodedFileContent(ConfigRevision rev, SerializerHelper helper) {
String content = rev.getConfigContent().getContentsString();
- helper.add(CONTENTS, Base64.encode(content.getBytes()));
+ try {
+ helper.add(CONTENTS, new String(Base64.encodeBase64(content.getBytes("UTF-8")),
+ "UTF-8"));
+ }
+ catch (UnsupportedEncodingException e) {
+ String msg = "Following errors were encountered " +
+ "when creating the config file.\n" + e.getMessage();
+ throw new FaultException(1023, "ConfgFileError", msg);
+ }
helper.add(CONTENTS_ENC64, Boolean.TRUE);
if (!rev.getConfigContent().isBinary()) {
helper.add(MACRO_START, rev.getConfigContent().getDelimStart());
12 years, 4 months
Changes to 'refs/tags/spacewalk-java-1.7.8-1'
by Tomas Lestach
Tag 'spacewalk-java-1.7.8-1' created by Tomas Lestach <tlestach(a)redhat.com> at 2012-01-23 18:40 +0000
Tagging package [spacewalk-java] version [1.7.8-1] in directory [java/].
Changes since spacewalk-schema-1.7.19-1:
Tomas Lestach (2):
enable requesting base64 encoded config file ervisions
Automatic commit of package [spacewalk-java] release [1.7.8-1].
---
java/code/src/com/redhat/rhn/domain/config/ConfigRevision.java | 16 +--
java/code/src/com/redhat/rhn/domain/config/EncodedConfigRevision.java | 40 +++++++++
java/code/src/com/redhat/rhn/frontend/xmlrpc/configchannel/ConfigChannelHandler.java | 25 ++++++
java/code/src/com/redhat/rhn/frontend/xmlrpc/serializer/ConfigRevisionSerializer.java | 41 ++++++++--
java/spacewalk-java.spec | 14 +++
rel-eng/packages/spacewalk-java | 2
6 files changed, 120 insertions(+), 18 deletions(-)
---
12 years, 4 months
2 commits - java/code java/spacewalk-java.spec rel-eng/packages
by Tomas Lestach
java/code/src/com/redhat/rhn/domain/config/ConfigRevision.java | 16 +--
java/code/src/com/redhat/rhn/domain/config/EncodedConfigRevision.java | 40 +++++++++
java/code/src/com/redhat/rhn/frontend/xmlrpc/configchannel/ConfigChannelHandler.java | 25 ++++++
java/code/src/com/redhat/rhn/frontend/xmlrpc/serializer/ConfigRevisionSerializer.java | 41 ++++++++--
java/spacewalk-java.spec | 14 +++
rel-eng/packages/spacewalk-java | 2
6 files changed, 120 insertions(+), 18 deletions(-)
New commits:
commit 3c1de8b2d70981c042403c6bf1f88d0f0c639c69
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Mon Jan 23 19:40:31 2012 +0100
Automatic commit of package [spacewalk-java] release [1.7.8-1].
diff --git a/java/spacewalk-java.spec b/java/spacewalk-java.spec
index f70652b..859eaf1 100644
--- a/java/spacewalk-java.spec
+++ b/java/spacewalk-java.spec
@@ -17,7 +17,7 @@ Name: spacewalk-java
Summary: Spacewalk Java site packages
Group: Applications/Internet
License: GPLv2
-Version: 1.7.7
+Version: 1.7.8
Release: 1%{?dist}
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
@@ -555,6 +555,18 @@ fi
%{jardir}/postgresql-jdbc.jar
%changelog
+* Mon Jan 23 2012 Tomas Lestach <tlestach(a)redhat.com> 1.7.8-1
+- enable requesting base64 encoded config file ervisions (tlestach(a)redhat.com)
+- 702019 - use --log option for anaconda script logging starting from rhel6
+ (tlestach(a)redhat.com)
+- 648483 - setting kickstart host for virtual guest provisioning
+ (tlestach(a)redhat.com)
+- 702019 - add extra newline to ks file (tlestach(a)redhat.com)
+- Error banner on (re)login page indicating schema upgrade is required.
+ (mzazrivec(a)redhat.com)
+- make sure a request url gets displayed in the traceback e-mail
+ (tlestach(a)redhat.com)
+
* Wed Jan 18 2012 Tomas Lestach <tlestach(a)redhat.com> 1.7.7-1
- 725889 - cannot compare an Object with null using equals
(tlestach(a)redhat.com)
diff --git a/rel-eng/packages/spacewalk-java b/rel-eng/packages/spacewalk-java
index dea9533..bc95a35 100644
--- a/rel-eng/packages/spacewalk-java
+++ b/rel-eng/packages/spacewalk-java
@@ -1 +1 @@
-1.7.7-1 java/
+1.7.8-1 java/
commit a532229630ff01b91807236b94016b9eca6200a5
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Mon Jan 23 16:49:10 2012 +0100
enable requesting base64 encoded config file ervisions
diff --git a/java/code/src/com/redhat/rhn/domain/config/ConfigRevision.java b/java/code/src/com/redhat/rhn/domain/config/ConfigRevision.java
index a463116..3d16638 100644
--- a/java/code/src/com/redhat/rhn/domain/config/ConfigRevision.java
+++ b/java/code/src/com/redhat/rhn/domain/config/ConfigRevision.java
@@ -25,14 +25,14 @@ import java.util.Date;
*/
public class ConfigRevision extends BaseDomainHelper {
- private Long id;
- private Long revision;
- private ConfigFile configFile;
- private ConfigContent configContent;
- private ConfigInfo configInfo;
- private ConfigFileType configFileType;
-
- private Long changedById;
+ protected Long id;
+ protected Long revision;
+ protected ConfigFile configFile;
+ protected ConfigContent configContent;
+ protected ConfigInfo configInfo;
+ protected ConfigFileType configFileType;
+
+ protected Long changedById;
/**
* Protected constructor
diff --git a/java/code/src/com/redhat/rhn/domain/config/EncodedConfigRevision.java b/java/code/src/com/redhat/rhn/domain/config/EncodedConfigRevision.java
new file mode 100644
index 0000000..9a825de
--- /dev/null
+++ b/java/code/src/com/redhat/rhn/domain/config/EncodedConfigRevision.java
@@ -0,0 +1,40 @@
+/**
+ * Copyright (c) 2011 Red Hat, Inc.
+ *
+ * This software is licensed to you under the GNU General Public License,
+ * version 2 (GPLv2). There is NO WARRANTY for this software, express or
+ * implied, including the implied warranties of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+ * along with this software; if not, see
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+ *
+ * Red Hat trademarks are not licensed under GPLv2. No permission is
+ * granted to use or replicate Red Hat trademarks that are incorporated
+ * in this software or its documentation.
+ */
+package com.redhat.rhn.domain.config;
+
+
+/**
+ * empty class, just to distinguish
+ * when to return base64 encoded content
+ * in the ConfigRevisionSerializer
+ * EncodedConfigRevision
+ * @version $Rev$
+ */
+public class EncodedConfigRevision extends ConfigRevision {
+
+ /**
+ * construct object from ConfigRevision
+ * @param cr config revision
+ */
+ public EncodedConfigRevision(ConfigRevision cr) {
+ id = cr.getId();
+ revision = cr.getRevision();
+ configFile = cr.getConfigFile();
+ configContent = cr.getConfigContent();
+ configInfo = cr.getConfigInfo();
+ configFileType = cr.getConfigFileType();
+ changedById = cr.getChangedById();
+ }
+}
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/configchannel/ConfigChannelHandler.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/configchannel/ConfigChannelHandler.java
index 299037c..edbf105 100644
--- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/configchannel/ConfigChannelHandler.java
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/configchannel/ConfigChannelHandler.java
@@ -25,6 +25,7 @@ import com.redhat.rhn.domain.config.ConfigFile;
import com.redhat.rhn.domain.config.ConfigFileType;
import com.redhat.rhn.domain.config.ConfigRevision;
import com.redhat.rhn.domain.config.ConfigurationFactory;
+import com.redhat.rhn.domain.config.EncodedConfigRevision;
import com.redhat.rhn.domain.server.Server;
import com.redhat.rhn.domain.user.User;
import com.redhat.rhn.frontend.dto.ConfigChannelDto;
@@ -201,10 +202,34 @@ public class ConfigChannelHandler extends BaseHandler {
ConfigRevision cr = cm.lookupConfigRevisionByRevId(loggedInUser, cf,
revision.longValue());
+
return cr;
}
/**
+ * Get base64 encoded revision for specified config file
+ * @param sessionKey User's session key.
+ * @param configChannelLabel Config channel label.
+ * @param filePath The configuration file path.
+ * @param revision The configuration file revision.
+ * @return Revisions of the configuration file, errors out otherwise.
+ *
+ * @xmlrpc.doc Get revision of the specified config file
+ * @xmlrpc.param #session_key()
+ * @xmlrpc.param #param_desc("string", "configChannelLabel",
+ * "label of config channel to lookup on")
+ * @xmlrpc.param #param_desc("string", "filePath", "config file path to examine")
+ * @xmlrpc.param #param_desc("int", "revision", "config file revision to examine")
+ * @xmlrpc.returntype
+ * $ConfigRevisionSerializer
+ */
+ public EncodedConfigRevision getEncodedFileRevision(String sessionKey,
+ String configChannelLabel, String filePath, Integer revision) {
+ return new EncodedConfigRevision(getFileRevision(sessionKey, configChannelLabel,
+ filePath, revision));
+ }
+
+ /**
* Return a struct of config channel details.
* @param sessionKey User's session key.
* @param configChannelLabel Config channel label.
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/serializer/ConfigRevisionSerializer.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/serializer/ConfigRevisionSerializer.java
index de9a0bf..1a788f8 100644
--- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/serializer/ConfigRevisionSerializer.java
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/serializer/ConfigRevisionSerializer.java
@@ -16,8 +16,11 @@ package com.redhat.rhn.frontend.xmlrpc.serializer;
import com.redhat.rhn.common.util.StringUtil;
import com.redhat.rhn.domain.config.ConfigRevision;
+import com.redhat.rhn.domain.config.EncodedConfigRevision;
import com.redhat.rhn.frontend.xmlrpc.serializer.util.SerializerHelper;
+import com.sun.org.apache.xml.internal.security.utils.Base64;
+
import java.io.IOException;
import java.io.Writer;
import java.text.DecimalFormat;
@@ -43,7 +46,9 @@ import redstone.xmlrpc.XmlRpcSerializer;
* #prop_desc("string", "target_path","Symbolic link Target File Path.
* Present for Symbolic links only.")
* #prop_desc("string", "channel","Channel Name")
- * #prop_desc("string", "contents","File contents for text files only.")
+ * #prop_desc("string", "contents","File contents (base64 encoded according
+ to the contents_enc64 attribute)")
+ * #prop_desc("boolean", "contents_enc64"," Identifies base64 encoded content")
* #prop_desc("int", "revision","File Revision")
* #prop_desc($date, "creation","Creation Date")
* #prop_desc($date, "modified","Last Modified Date")
@@ -118,17 +123,37 @@ public class ConfigRevisionSerializer implements XmlRpcCustomSerializer {
if (rev.isFile()) {
helper.add(BINARY, rev.getConfigContent().isBinary());
helper.add("md5", rev.getConfigContent().getChecksum().getChecksum());
- if (!rev.getConfigContent().isBinary()) {
- String content = rev.getConfigContent().getContentsString();
- if (!StringUtil.containsInvalidXmlChars2(content)) {
- helper.add(CONTENTS, content);
- }
- helper.add(MACRO_START, rev.getConfigContent().getDelimStart());
- helper.add(MACRO_END, rev.getConfigContent().getDelimEnd());
+ if (rev instanceof EncodedConfigRevision) {
+ addEncodedFileContent(rev, helper);
+ }
+ else {
+ addFileContent(rev, helper);
}
+
}
helper.add("channel", rev.getConfigFile().getConfigChannel().getName());
helper.writeTo(output);
}
+ protected void addFileContent(ConfigRevision rev, SerializerHelper helper) {
+ if (!rev.getConfigContent().isBinary()) {
+ String content = rev.getConfigContent().getContentsString();
+ if (!StringUtil.containsInvalidXmlChars2(content)) {
+ helper.add(CONTENTS, content);
+ helper.add(CONTENTS_ENC64, Boolean.FALSE);
+ }
+ helper.add(MACRO_START, rev.getConfigContent().getDelimStart());
+ helper.add(MACRO_END, rev.getConfigContent().getDelimEnd());
+ }
+ }
+
+ protected void addEncodedFileContent(ConfigRevision rev, SerializerHelper helper) {
+ String content = rev.getConfigContent().getContentsString();
+ helper.add(CONTENTS, Base64.encode(content.getBytes()));
+ helper.add(CONTENTS_ENC64, Boolean.TRUE);
+ if (!rev.getConfigContent().isBinary()) {
+ helper.add(MACRO_START, rev.getConfigContent().getDelimStart());
+ helper.add(MACRO_END, rev.getConfigContent().getDelimEnd());
+ }
+ }
}
12 years, 4 months
Branch 'errata-date' - 3 commits - utils/cloneByDate.py
by Justin Sherrill
utils/cloneByDate.py | 170 +++++++++++++++++++++++++++++++++++++++++----------
1 file changed, 139 insertions(+), 31 deletions(-)
New commits:
commit 7dcc26ec1a6c4774219c708533a6cddb19241381
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Mon Jan 23 13:34:50 2012 -0500
errata clone by datete - adding channel cloning
diff --git a/utils/cloneByDate.py b/utils/cloneByDate.py
index 2327f6e..1189e47 100644
--- a/utils/cloneByDate.py
+++ b/utils/cloneByDate.py
@@ -23,6 +23,7 @@ import time
import copy
import shutil
import tempfile
+from depsolver import DepSolver
try:
import json
@@ -42,29 +43,44 @@ except:
from common import CFG, initCFG
+def confirm(txt, options):
+ if not options.assumeyes:
+ confirm = raw_input(txt)
+ while ['y', 'n'].count(confirm.lower()) == 0:
+ confirm = raw_input(txt)
+ if confirm.lower() == "n":
+ print "Cancelling"
+ sys.exit(0)
+
+
def main(options):
xmlrpc = RemoteApi(options.server, options.username, options.password)
db = DBApi()
cloners = []
+ needed_channels = []
for list in options.channels:
tree_cloner = ChannelTreeCloner(list, xmlrpc, db, options.to_date)
cloners.append(tree_cloner)
+ needed_channels += tree_cloner.needing_create()
+
+ if len(needed_channels) > 0:
+ print "\nBy continuing the following channels will be created: "
+ print ", ".join(needed_channels)
+ confirm("\nContinue with channel creation (y/n)?", options)
+ for cloner in cloners:
+ cloner.create_channels()
+
+
+
+ for tree_cloner in cloners:
tree_cloner.prepare();
print "\nBy continuing the following will be cloned:"
for cloner in cloners:
cloner.pre_summary()
print "\n"
-
- if not options.assumeyes:
- txt = "Continue with clone (y/n)?"
- confirm = raw_input(txt)
- while ['y', 'n'].count(confirm.lower()) == 0:
- confirm = raw_input(txt)
- if confirm.lower() == "n":
- print "Cancelling"
- sys.exit(0)
+ confirm("Continue with clone (y/n)?", options)
for cloner in cloners:
cloner.clone()
@@ -79,14 +95,39 @@ class ChannelTreeCloner:
self.channel_map = channels
self.to_date = to_date
self.cloners = []
+ self.validate_source_channels()
- def validate_channels(self):
- self.channel_details = self.remote_api.channel_details(self.channel_map)
+ def needing_create(self):
+ to_ret = []
+ existing = self.remote_api.list_channel_labels()
+ for label in self.channel_map.values():
+ if existing.count(label) == 0:
+ to_ret.append(label)
+ return to_ret
+
+
+ def create_channels(self):
+ to_create = self.needing_create()
+ if len(to_create) == 0:
+ return
+ dest_parent = self.channel_map[self.src_parent]
+ if to_create.count(dest_parent) > 0:
+ self.remote_api.clone_channel(self.src_parent, dest_parent, None)
+ to_create.remove(dest_parent)
+ for from_label, to_label in self.channel_map.items():
+ if to_create.count(to_label) > 0:
+ self.remote_api.clone_channel(from_label, to_label, dest_parent)
+
+
+ def validate_source_channels(self):
+ self.channel_details = self.remote_api.channel_details(self.channel_map, values=False)
self.src_parent = self.find_parent(self.channel_map.keys())
- self.validate_children(self.src_parent, self.channel_map.keys())
- self.dest_parent = self.find_parent(self.channel_map.values())
- self.validate_children(self.dest_parent, self.channel_map.values())
- return self.channel_details
+ self.validate_children(self.src_parent, self.channel_map.keys())
+
+ def validate_dest_channels(self):
+ self.channel_details = self.remote_api.channel_details(self.channel_map)
+ self.dest_parent = self.find_parent(self.channel_map.values())
+ self.validate_children(self.dest_parent, self.channel_map.values())
def validate_children(self, parent, label_list):
""" Make sure all children are children of the parent"""
@@ -113,11 +154,10 @@ class ChannelTreeCloner:
list.insert(0,self.src_parent)
return list
-
- def prepare(self):
- self.validate_channels()
+ def prepare(self):
for from_label in self.ordered_labels():
to_label = self.channel_map[from_label]
+ self.validate_dest_channels()
cloner = ChannelCloner(from_label, to_label, self.to_date, self.remote_api, self.db_api)
self.cloners.append(cloner)
cloner.prepare()
@@ -161,6 +201,9 @@ class ChannelCloner:
deps = []### dep solve on diff
dep_package_ids = []
+
+ #solver = DepSolver([{"id":self.from_label, "relative_path":repo_dir}])
+
#self.remote_api.add_packages()
@@ -214,6 +257,8 @@ class ChannelCloner:
class RemoteApi:
""" Class for connecting to the XMLRPC spacewalk interface"""
+ cache = {}
+
def __init__(self, server_url, username, password):
self.client = xmlrpclib.Server(server_url)
try:
@@ -222,18 +267,33 @@ class RemoteApi:
raise UserError(e.faultString)
- def list_channels(self):
- ""
+ def list_channel_labels(self):
+ key = "chan_labels"
+ if self.cache.has_key(key):
+ return self.cache[key]
+
+ list = self.client.channel.listAllChannels(self.auth_token)
+ to_ret = []
+ for item in list:
+ to_ret.append(item["label"])
+ self.cache[key] = to_ret
+ return to_ret
- def channel_details(self, label_hash):
+ def channel_details(self, label_hash, keys=True, values=True):
to_ret = {}
- for src, dst in label_hash.items():
- to_ret[src] = self.get_details(src)
- to_ret[dst] = self.get_details(dst)
+ for src, dst in label_hash.items():
+ if keys:
+ to_ret[src] = self.get_details(src)
+ if values:
+ to_ret[dst] = self.get_details(dst)
return to_ret
def list_packages(self, label):
- return self.client.channel.software.listAllPackages(self.auth_token, label)
+ list = self.client.channel.software.listAllPackages(self.auth_token, label)
+ #name-ver-rel.arch,
+ for pkg in list:
+ pkg['nvrea'] = "%s-%s-%s.%s" % (pkg['name'], pkg['version'], pkg['release'], pkg['arch_label'])
+ return list
def clone_errata(self, to_label, errata_list):
self.client.errata.cloneAsOriginal(self.auth_token, to_label, errata_list)
@@ -249,6 +309,14 @@ class RemoteApi:
set = package_ids[:20]
del package_ids[:20]
self.client.channel.software.addPackages(self.auth_token, label, package_ids)
+
+ def clone_channel(self, original_label, new_label, parent):
+ details = {'name': new_label, 'label':new_label, 'summary': new_label}
+ if parent and parent != '':
+ details['parent_label'] = parent
+ print "Cloning %s to %s with original package set." % (original_label, new_label)
+ self.client.channel.software.clone(self.auth_token, original_label, details, True)
+
class DBApi:
commit d493306485fd39d8e11346ba9d5689e3c5e31cde
Merge: df25ba7 5d472e3
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Mon Jan 23 11:08:31 2012 -0500
Merge branch 'errata-date' of ssh://git.fedorahosted.org/git/spacewalk into errata-date
commit df25ba75641b426d75dff9a78bab5bd989d2003a
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Mon Jan 23 10:56:34 2012 -0500
errata date clone - adding package diffing to know what changed
diff --git a/utils/cloneByDate.py b/utils/cloneByDate.py
index 2100614..2327f6e 100644
--- a/utils/cloneByDate.py
+++ b/utils/cloneByDate.py
@@ -21,6 +21,8 @@ import pdb
import sys
import time
import copy
+import shutil
+import tempfile
try:
import json
@@ -78,8 +80,8 @@ class ChannelTreeCloner:
self.to_date = to_date
self.cloners = []
- def validate_channels(self):
- self.channel_details = self.remote_api.list_channels(self.channel_map)
+ def validate_channels(self):
+ self.channel_details = self.remote_api.channel_details(self.channel_map)
self.src_parent = self.find_parent(self.channel_map.keys())
self.validate_children(self.src_parent, self.channel_map.keys())
self.dest_parent = self.find_parent(self.channel_map.values())
@@ -126,7 +128,7 @@ class ChannelTreeCloner:
def clone(self):
for cloner in self.cloners:
- cloner.clone()
+ cloner.process()
@@ -151,18 +153,38 @@ class ChannelCloner:
def process(self):
self.clone();
- self.new_packages = self.remote_api.list_packages(self.to_label)
- print "%i, %i" % (len(self.original_packages), len(self.new_packages))
- ### diff lists
- ### dep solve on diff
- ### added found deps
+ new_packages = self.remote_api.list_packages(self.to_label)
+ pkg_idiff = self.diff_packages(self.original_packages, new_packages)
+
+ print "New packages added: %i" % len(pkg_idiff)
+ repo_dir = self.repodata(self.from_label)
+
+ deps = []### dep solve on diff
+ dep_package_ids = []
+ #self.remote_api.add_packages()
+
+
+
+ def diff_packages(self, old, new):
+ old_hash = {}
+ new_hash = {}
+ to_ret = []
+
+ for pkg in old:
+ old_hash[pkg["id"]] = pkg
+ for pkg in new:
+ new_hash[pkg["id"]] = pkg
+ id_diff = set(new_hash.keys()) - set(old_hash.keys())
+ for id in id_diff:
+ to_ret.append(new_hash[id])
+ return to_ret
def clone(self):
errata_ids = self.collect(self.errata_to_clone, "advisory_name")
while(len(errata_ids) > 0):
- set = errata_ids[:5]
- del errata_ids[:5]
+ set = errata_ids[:10]
+ del errata_ids[:10]
print "Cloning set:"
print set
self.remote_api.clone_errata(self.to_label, set)
@@ -172,6 +194,12 @@ class ChannelCloner:
for item in items:
to_ret.append(item[attribute])
return to_ret
+
+ def repodata(self, label):
+ repo_dir = "/var/cache/rhn/repodata/%s" % label
+ tmp_dir = tempfile.mkdtemp(suffix="clone-by-date") + "/repo/"
+ shutil.copytree(repo_dir, tmp_dir)
+ return tmp_dir
def get_errata(self):
""" Returns tuple of all available for cloning, and what falls in teh date range"""
@@ -193,7 +221,11 @@ class RemoteApi:
except xmlrpclib.Fault, e:
raise UserError(e.faultString)
- def list_channels(self, label_hash):
+
+ def list_channels(self):
+ ""
+
+ def channel_details(self, label_hash):
to_ret = {}
for src, dst in label_hash.items():
to_ret[src] = self.get_details(src)
@@ -211,6 +243,12 @@ class RemoteApi:
return self.client.channel.software.getDetails(self.auth_token, label)
except xmlrpclib.Fault, e:
raise UserError(e.faultString + ": " + label)
+
+ def add_packages(self, label, package_ids):
+ while(len(package_ids) > 0):
+ set = package_ids[:20]
+ del package_ids[:20]
+ self.client.channel.software.addPackages(self.auth_token, label, package_ids)
class DBApi:
@@ -222,6 +260,8 @@ class DBApi:
db_string = CFG.DEFAULT_DB #"rhnsat/rhnsat@rhnsat"
rhnSQL.initDB(db_string)
+
+
def applicable_errata(self, from_label, to_label):
"""list of errata that is applicable to be cloned, used db because we need to exclude cloned errata too"""
h = rhnSQL.prepare("""
12 years, 4 months
Changes to 'refs/tags/spacewalk-schema-1.7.19-1'
by Jan Pazdziora
Tag 'spacewalk-schema-1.7.19-1' created by Jan Pazdziora <jpazdziora(a)redhat.com> at 2012-01-23 16:15 +0000
Tagging package [spacewalk-schema] version [1.7.19-1] in directory [schema/spacewalk/].
Changes since spacewalk-schema-1.7.18-1:
Jan Pazdziora (2):
Dropping rhn_bl_obs_mod_trig_fun which was not dropped when rhnBlacklistObsoletes was being removed.
Automatic commit of package [spacewalk-schema] release [1.7.19-1].
---
rel-eng/packages/spacewalk-schema | 2 +-
schema/spacewalk/spacewalk-schema.spec | 6 +++++-
schema/spacewalk/upgrade/spacewalk-schema-1.6-to-spacewalk-schema-1.7/010-rhn_bl_obs_mod_trig_fun-drop.sql.oracle | 1 +
schema/spacewalk/upgrade/spacewalk-schema-1.6-to-spacewalk-schema-1.7/010-rhn_bl_obs_mod_trig_fun-drop.sql.postgresql | 3 +++
4 files changed, 10 insertions(+), 2 deletions(-)
---
12 years, 4 months
rel-eng/packages schema/spacewalk
by Jan Pazdziora
rel-eng/packages/spacewalk-schema | 2 +-
schema/spacewalk/spacewalk-schema.spec | 6 +++++-
2 files changed, 6 insertions(+), 2 deletions(-)
New commits:
commit cd6604f6c53942d0c9e5c13be8383c1396a83c5d
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Jan 23 17:15:10 2012 +0100
Automatic commit of package [spacewalk-schema] release [1.7.19-1].
diff --git a/rel-eng/packages/spacewalk-schema b/rel-eng/packages/spacewalk-schema
index f3aa9a5..02acfdf 100644
--- a/rel-eng/packages/spacewalk-schema
+++ b/rel-eng/packages/spacewalk-schema
@@ -1 +1 @@
-1.7.18-1 schema/spacewalk/
+1.7.19-1 schema/spacewalk/
diff --git a/schema/spacewalk/spacewalk-schema.spec b/schema/spacewalk/spacewalk-schema.spec
index cde2aaf..a06c17d 100644
--- a/schema/spacewalk/spacewalk-schema.spec
+++ b/schema/spacewalk/spacewalk-schema.spec
@@ -2,7 +2,7 @@ Name: spacewalk-schema
Group: Applications/Internet
Summary: Oracle SQL schema for Spacewalk server
-Version: 1.7.18
+Version: 1.7.19
Release: 1%{?dist}
Source0: %{name}-%{version}.tar.gz
@@ -66,6 +66,10 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man1/spacewalk-sql*
%changelog
+* Mon Jan 23 2012 Jan Pazdziora 1.7.19-1
+- Dropping rhn_bl_obs_mod_trig_fun which was not dropped when
+ rhnBlacklistObsoletes was being removed.
+
* Mon Jan 23 2012 Jan Pazdziora 1.7.18-1
- Drop any three-parameter rhn_prepare_install.
12 years, 4 months
schema/spacewalk
by Jan Pazdziora
schema/spacewalk/upgrade/spacewalk-schema-1.6-to-spacewalk-schema-1.7/010-rhn_bl_obs_mod_trig_fun-drop.sql.oracle | 1 +
schema/spacewalk/upgrade/spacewalk-schema-1.6-to-spacewalk-schema-1.7/010-rhn_bl_obs_mod_trig_fun-drop.sql.postgresql | 3 +++
2 files changed, 4 insertions(+)
New commits:
commit ce04034693747c20d1d29b303848b562295870ea
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Jan 23 17:14:39 2012 +0100
Dropping rhn_bl_obs_mod_trig_fun which was not dropped when rhnBlacklistObsoletes was being removed.
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-1.6-to-spacewalk-schema-1.7/010-rhn_bl_obs_mod_trig_fun-drop.sql.oracle b/schema/spacewalk/upgrade/spacewalk-schema-1.6-to-spacewalk-schema-1.7/010-rhn_bl_obs_mod_trig_fun-drop.sql.oracle
new file mode 100644
index 0000000..b7b00b1
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-1.6-to-spacewalk-schema-1.7/010-rhn_bl_obs_mod_trig_fun-drop.sql.oracle
@@ -0,0 +1 @@
+-- This file is intentionally left empty.
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-1.6-to-spacewalk-schema-1.7/010-rhn_bl_obs_mod_trig_fun-drop.sql.postgresql b/schema/spacewalk/upgrade/spacewalk-schema-1.6-to-spacewalk-schema-1.7/010-rhn_bl_obs_mod_trig_fun-drop.sql.postgresql
new file mode 100644
index 0000000..1708fe9
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-1.6-to-spacewalk-schema-1.7/010-rhn_bl_obs_mod_trig_fun-drop.sql.postgresql
@@ -0,0 +1,3 @@
+-- oracle equivalent source sha1 b14267384bc104605623a41b755e68e0103b5aa8
+
+drop function if exists rhn_bl_obs_mod_trig_fun();
12 years, 4 months
Branch 'errata-date' - utils/depsolver.py
by Pradeep Kilambi
utils/depsolver.py | 186 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 186 insertions(+)
New commits:
commit 5d472e3138f75532d592775fe6c9274b9620414f
Author: Pradeep Kilambi <pkilambi(a)redhat.com>
Date: Mon Jan 23 11:07:42 2012 -0500
dependency lookup for errata clone-by-date
diff --git a/utils/depsolver.py b/utils/depsolver.py
new file mode 100644
index 0000000..f0eb4ba
--- /dev/null
+++ b/utils/depsolver.py
@@ -0,0 +1,186 @@
+#!/usr/bin/python
+#
+# -*- coding: utf-8 -*-
+#
+# Copyright (c) 2012 Red Hat, Inc.
+#
+# Lookup package dependencies in a yum repository
+#
+# This software is licensed to you under the GNU General Public License,
+# version 2 (GPLv2). There is NO WARRANTY for this software, express or
+# implied, including the implied warranties of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+# along with this software; if not, see
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+#
+# Red Hat trademarks are not licensed under GPLv2. No permission is
+# granted to use or replicate Red Hat trademarks that are incorporated
+# in this software or its documentation
+
+import logging
+import shutil
+import sys
+import yum
+from yum.misc import prco_tuple_to_string
+from yum.packageSack import ListPackageSack
+from yum.repos import RepoStorage
+
+log = logging.getLogger(__name__)
+
+CACHE_DIR="/tmp/cache/yum"
+
+class DepSolver:
+ def __init__(self, repos, pkgs=[]):
+ self.pkgs = pkgs
+ self.repos = repos
+ self._repostore = RepoStorage(self)
+ self.setup()
+ self.loadPackages()
+
+ def setup(self):
+ """
+ Load the repos into repostore to query package dependencies
+ """
+ for repo in self.repos:
+ self.yrepo = yum.yumRepo.YumRepository(repo['id'])
+ self.yrepo.baseurl = ["file://%s/" % str(repo['relative_path'])]
+ self.yrepo.basecachedir = CACHE_DIR
+ self._repostore.add(self.yrepo)
+
+ def loadPackages(self):
+ """
+ populate the repostore with packages
+ """
+ self._repostore._setup = True
+ self._repostore.populateSack(which='all')
+
+ def cleanup(self):
+ """
+ clean up the repo metadata cache from /tmp/cache/yum
+ """
+ for repo in self._repostore.repos:
+ cachedir = "%s/%s" % (constants.CACHE_DIR, repo)
+ shutil.rmtree(cachedir)
+
+ def getDependencylist(self):
+ """
+ Get dependency list and suggested packages for package names provided.
+ The dependency lookup is only one level in this case.
+ The package name format could be any of the following:
+ name, name.arch, name-ver-rel.arch, name-ver, name-ver-rel,
+ epoch:name-ver-rel.arch, name-epoch:ver-rel.arch
+ """
+ ematch, match, unmatch = self._repostore.pkgSack.matchPackageNames(self.pkgs)
+ pkgs = []
+ for po in ematch + match:
+ pkgs.append(po)
+ results = self.__locateDeps(pkgs)
+ return results
+
+ def getRecursiveDepList(self):
+ """
+ Get dependency list and suggested packages for package names provided.
+ The dependency lookup is recursive. All available packages in the repo
+ are returned matching whatprovides.
+ The package name format could be any of the following:
+ name, name.arch, name-ver-rel.arch, name-ver, name-ver-rel,
+ epoch:name-ver-rel.arch, name-epoch:ver-rel.arch
+ returns a dictionary of {'n-v-r.a' : [n,v,e,r,a],...}
+ """
+ solved = []
+ to_solve = self.pkgs
+ all_results = {}
+ while to_solve:
+ log.debug("Solving %s \n\n" % to_solve)
+ results = self.getDependencylist()
+ all_results.update(results)
+ found = self.processResults(results)[0]
+ solved += to_solve
+ to_solve = []
+ for dep, pkgs in found.items():
+ for pkg in pkgs:
+ name, version, epoch, release, arch = pkg
+ ndep = "%s-%s-%s.%s" % (name, version, release, arch)
+ solved = list(set(solved))
+ if ndep not in solved:
+ to_solve.append(ndep)
+ self.pkgs = to_solve
+ return all_results
+
+ def __locateDeps(self, pkgs):
+ results = {}
+ for pkg in pkgs:
+ results[pkg] = {}
+ reqs = pkg.requires
+ reqs.sort()
+ pkgresults = results[pkg]
+ for req in reqs:
+ (r, f, v) = req
+ if r.startswith('rpmlib('):
+ continue
+ satisfiers = []
+ for po in self.__whatProvides(r, f, v):
+ satisfiers.append(po)
+ pkgresults[req] = satisfiers
+ return results
+
+ def __whatProvides(self, name, flags, version):
+ try:
+ return ListPackageSack(self._repostore.pkgSack.searchProvides((name, flags, version)))
+ except:
+ #perhaps we're on older version of yum try old style
+ return ListPackageSack(self._repostore.pkgSack.searchProvides(name))
+
+ def processResults(self, results):
+ reqlist = {}
+ notfound = {}
+ for pkg in results:
+ if len(results[pkg]) == 0:
+ continue
+ for req in results[pkg]:
+ rlist = results[pkg][req]
+ if not rlist:
+ # Unsatisfied dependency
+ notfound[prco_tuple_to_string(req)] = []
+ continue
+ reqlist[prco_tuple_to_string(req)] = rlist
+ found = {}
+ for req, rlist in reqlist.items():
+ found[req] = []
+ for r in rlist:
+ dep = [r.name, r.version, r.epoch, r.release, r.arch]
+ if dep not in found[req]:
+ found[req].append(dep)
+ return found, notfound
+
+ def printable_result(self, results):
+ print_doc_str = ""
+ for pkg in results:
+ if len(results[pkg]) == 0:
+ continue
+ for req in results[pkg]:
+ rlist = results[pkg][req]
+ print_doc_str += "\n dependency: %s \n" % prco_tuple_to_string(req)
+ if not rlist:
+ # Unsatisfied dependency
+ print_doc_str += " Unsatisfied dependency \n"
+ continue
+
+ for po in rlist:
+ print_doc_str += " provider: %s\n" % po.compactPrint()
+ return print_doc_str
+
+
+if __name__ == '__main__':
+ if len(sys.argv) < 3:
+ print "USAGE: python depsolver.py <repoid> <repodata_path> <pkgname1> <pkgname2> ....<pkgnameN>"
+ sys.exit(0)
+ import pprint
+ repo = {'id' : sys.argv[1],
+ 'relative_path' : sys.argv[2],} #path to where repodata is located
+ pkgs = sys.argv[3:]
+ dsolve = DepSolver([repo], pkgs)
+ deplist = dsolve.getDependencylist()
+ result_set = dsolve.processResults(deplist)
+ print result_set
+ print "Printable dependency Results: \n\n %s" % dsolve.printable_result(deplist)
12 years, 4 months
Changes to 'refs/tags/spacewalk-schema-1.7.18-1'
by Jan Pazdziora
Tag 'spacewalk-schema-1.7.18-1' created by Jan Pazdziora <jpazdziora(a)redhat.com> at 2012-01-23 15:40 +0000
Tagging package [spacewalk-schema] version [1.7.18-1] in directory [schema/spacewalk/].
Changes since spacewalk-config-1.7.1-1:
Jan Pazdziora (2):
Drop any three-parameter rhn_prepare_install.
Automatic commit of package [spacewalk-schema] release [1.7.18-1].
---
rel-eng/packages/spacewalk-schema | 2 +-
schema/spacewalk/spacewalk-schema.spec | 5 ++++-
schema/spacewalk/upgrade/spacewalk-schema-1.6-to-spacewalk-schema-1.7/009-rhn_prepare_install.sql.postgresql | 3 ++-
3 files changed, 7 insertions(+), 3 deletions(-)
---
12 years, 4 months