java/code web/html
by Partha Aji
java/code/src/com/redhat/rhn/frontend/taglibs/list/ListTag.java | 17 +++
java/code/src/com/redhat/rhn/frontend/taglibs/list/SelectableColumnTag.java | 48 ++++++++--
web/html/javascript/check_all.js | 45 +++++++--
3 files changed, 92 insertions(+), 18 deletions(-)
New commits:
commit 87a023860be9cf80c12ec55e56d102dc723e6ae5
Author: Partha Aji <paji(a)redhat.com>
Date: Fri Apr 30 18:27:51 2010 -0400
Needed to add more JS magic to get selections to work
diff --git a/java/code/src/com/redhat/rhn/frontend/taglibs/list/ListTag.java b/java/code/src/com/redhat/rhn/frontend/taglibs/list/ListTag.java
index 90d74b5..8488e2a 100644
--- a/java/code/src/com/redhat/rhn/frontend/taglibs/list/ListTag.java
+++ b/java/code/src/com/redhat/rhn/frontend/taglibs/list/ListTag.java
@@ -21,6 +21,7 @@ import com.redhat.rhn.domain.user.User;
import com.redhat.rhn.frontend.context.Context;
import com.redhat.rhn.frontend.html.HtmlTag;
import com.redhat.rhn.frontend.struts.RequestContext;
+import com.redhat.rhn.frontend.taglibs.RhnListTagFunctions;
import com.redhat.rhn.frontend.taglibs.list.decorators.ListDecorator;
import com.redhat.rhn.frontend.taglibs.list.decorators.PageSizeDecorator;
import com.redhat.rhn.frontend.taglibs.list.helper.ListHelper;
@@ -63,6 +64,7 @@ public class ListTag extends BodyTagSupport {
private List pageData;
private Iterator iterator;
private Object currentObject;
+ private Object parentObject;
private String styleClass = "list";
private String styleId;
private int rowCounter = -1;
@@ -341,6 +343,14 @@ public class ListTag extends BodyTagSupport {
}
/**
+ * The parent if this list is dealing with expandable objects
+ * @return the parent of the current object being displayed
+ */
+ public Object getParentObject() {
+ return parentObject;
+ }
+
+ /**
* Name used to store the currentObject in the page
* @param nameIn row name
* @throws JspException if row name is empty
@@ -514,7 +524,11 @@ public class ListTag extends BodyTagSupport {
ListTagUtil.setCurrentCommand(pageContext, getUniqueName(),
ListCommand.RENDER);
if (iterator.hasNext()) {
- currentObject = iterator.next();
+ Object obj = iterator.next();
+ if (RhnListTagFunctions.isExpandable(obj)) {
+ parentObject = obj;
+ }
+ currentObject = obj;
}
else {
currentObject = null;
@@ -644,6 +658,7 @@ public class ListTag extends BodyTagSupport {
pageData = null;
iterator = null;
currentObject = null;
+ parentObject = null;
styleClass = "list";
styleId = null;
rowCounter = -1;
diff --git a/java/code/src/com/redhat/rhn/frontend/taglibs/list/SelectableColumnTag.java b/java/code/src/com/redhat/rhn/frontend/taglibs/list/SelectableColumnTag.java
index 4f9cabd..7cb860d 100644
--- a/java/code/src/com/redhat/rhn/frontend/taglibs/list/SelectableColumnTag.java
+++ b/java/code/src/com/redhat/rhn/frontend/taglibs/list/SelectableColumnTag.java
@@ -34,7 +34,7 @@ public class SelectableColumnTag extends TagSupport {
private static final long serialVersionUID = 2749189931275777440L;
private static final String CHECKBOX_CLICKED_SCRIPT =
- "process_checkbox_clicked(this,'%s', this.form.%s, %s)";
+ "process_checkbox_clicked(this,'%s', this.form.%s, %s, %s, '%s')";
private String valueExpr;
private String selectExpr;
private String disabledExpr;
@@ -244,18 +244,39 @@ public class SelectableColumnTag extends TagSupport {
*/
private void renderOnClick() throws JspException {
if (!StringUtils.isBlank(rhnSet)) {
+ Object current = getCurrent();
+ Object parent = getParentObject();
+ String childIds = "[]";
+ String memberIds = "[]";
+ String parentId = "";
+
+ if (RhnListTagFunctions.isExpandable(current)) {
+ childIds = getChildIds(current);
+ }
+ else {
+ parentId = getParentId(current, parent);
+ memberIds = getMemberIds(current, parent);
+ }
+
ListTagUtil.write(pageContext, " onclick=\"");
ListTagUtil.write(pageContext, String.format(CHECKBOX_CLICKED_SCRIPT,
- rhnSet, makeSelectAllCheckboxName(), getChildIds()));
+ rhnSet, makeSelectAllCheckboxName(),
+ childIds, memberIds, parentId));
ListTagUtil.write(pageContext, "\" ");
}
}
- private String getChildIds() {
- Object current = getCurrent();
- if (RhnListTagFunctions.isExpandable(current)) {
+ private String getParentId(Object current, Object parent) {
+ if (parent != null && parent != current) {
+ return makeCheckboxId(ListTagHelper.getObjectId(parent));
+ }
+ return "";
+ }
+
+ private String getChildIds(Object parent) {
+ if (RhnListTagFunctions.isExpandable(parent)) {
StringBuilder buf = new StringBuilder();
- for (Object child : ((Expandable)current).expand()) {
+ for (Object child : ((Expandable)parent).expand()) {
if (buf.length() > 0) {
buf.append(",");
}
@@ -272,6 +293,15 @@ public class SelectableColumnTag extends TagSupport {
return "[]";
}
+
+ private String getMemberIds(Object current, Object parent) {
+ if (parent != null && parent != current) {
+ return getChildIds(parent);
+ }
+ return "[]";
+
+ }
+
private void renderHiddenItem(String listId, String value) throws JspException {
ListTagUtil.write(pageContext, "<input type=\"hidden\" ");
@@ -327,4 +357,10 @@ public class SelectableColumnTag extends TagSupport {
BodyTagSupport.findAncestorWithClass(this, ListTag.class);
return parent.getCurrentObject();
}
+
+ private Object getParentObject() {
+ ListTag parent = (ListTag)
+ BodyTagSupport.findAncestorWithClass(this, ListTag.class);
+ return parent.getParentObject();
+ }
}
diff --git a/web/html/javascript/check_all.js b/web/html/javascript/check_all.js
index e4b8281..dacdfe5 100644
--- a/web/html/javascript/check_all.js
+++ b/web/html/javascript/check_all.js
@@ -62,14 +62,33 @@ function checkbox_clicked(thebox, set_label) {
form_name = thebox.form.id;
}
var checkall = eval("document.forms['" + form_name + "'].checkall");
- process_checkbox_clicked(thebox, set_label, checkall, []);
+ process_checkbox_clicked(thebox, set_label, checkall, [], [],"");
}
-function process_checkbox_clicked(thebox, set_label, checkall, children) {
- process_single_checkbox(thebox, set_label, checkall);
+
+/**
+ * This method is called when a single checkbox is clicked
+ * thebox - The check box that was clicked
+ * set_label - The rhnSet label of the checkbox that was clicked
+ * checkall - The link to the select all box
+ *
+ * If this list tag is using some sort of tree/grouping structure
+ *
+ * children - if this is a parent node then list the children or [] otherwise
+ * members - if this is a child node then list the siblings and include the child or [] otherwise
+ * parent_id - if this is a child node then list the parent_id or [] otherwise
+ **/
+
+function process_checkbox_clicked(thebox, set_label, checkall, children, members, parent_id ) {
+ var form_name = thebox.form.name;
+ if (form_name == "") {
+ form_name = thebox.form.id;
+ }
+ var cboxes = eval("document.forms['" + form_name + "']." + thebox.name);
+ process_single_checkbox(cboxes, checkall);
var a = new Array();
a.push(thebox.value);
-
+
var checkboxes = new Array();
for (var i = 0; i < children.length; i++) {
var checkbox = document.getElementById(children[i]);
@@ -79,17 +98,21 @@ function process_checkbox_clicked(thebox, set_label, checkall, children) {
if (checkboxes.length > 0) {
process_group(set_label, checkboxes, thebox.checked);
}
+
+ if (parent_id) {
+ var parentBox = document.getElementById(parent_id);
+ var boxes = new Array();
+ for (var i = 0; i < members.length; i++) {
+ var checkbox = document.getElementById(members[i]);
+ boxes.push(checkbox);
+ }
+ process_single_checkbox(boxes, parentBox);
+ }
update_server_set("ids", set_label, thebox.checked, a);
}
-function process_single_checkbox(thebox, set_label, checkall) {
- var form_name = thebox.form.name;
- if (form_name == "") {
- form_name = thebox.form.id;
- }
+function process_single_checkbox(cboxes, checkall) {
var i;
- var cboxes = eval("document.forms['" + form_name + "']." + thebox.name);
-
var count_checked_or_disabled = 0;
var all_checked = false;
if (cboxes.length) {
13 years, 1 month
java/code
by Partha Aji
java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
New commits:
commit 4a12466c39a4f963d3f554876c46f4ea7edce08a
Author: Partha Aji <paji(a)redhat.com>
Date: Fri Apr 30 17:11:14 2010 -0400
Quick fix to deal with a null pointer that would ve occued on a logdebg
diff --git a/java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java b/java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java
index 7c88f4d..a16baee 100644
--- a/java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java
+++ b/java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java
@@ -2128,7 +2128,10 @@ public class ChannelManager extends BaseManager {
// Find all of the obvious matches
for (EssentialChannelDto ecd : channels) {
Channel c = ChannelFactory.lookupByIdAndUser(ecd.getId().longValue(), u);
- log.debug(" " + c.getName());
+ if (log.isDebugEnabled()) {
+ log.debug(c == null ? "<null>" : c.getName());
+ }
+
if (c != null &&
(c.getOrg() != null ||
inChan.getChannelArch().equals(c.getChannelArch())) &&
13 years, 1 month
java/code web/html
by Partha Aji
java/code/src/com/redhat/rhn/frontend/taglibs/list/SelectableColumnTag.java | 59 +++++++---
web/html/javascript/check_all.js | 32 ++++-
2 files changed, 70 insertions(+), 21 deletions(-)
New commits:
commit 4c408bbafd329524cded32459d4b683fee3eb336
Author: Partha Aji <paji(a)redhat.com>
Date: Fri Apr 30 17:06:24 2010 -0400
Added code to get checkbox grouping to work
diff --git a/java/code/src/com/redhat/rhn/frontend/taglibs/list/SelectableColumnTag.java b/java/code/src/com/redhat/rhn/frontend/taglibs/list/SelectableColumnTag.java
index 768ea63..4f9cabd 100644
--- a/java/code/src/com/redhat/rhn/frontend/taglibs/list/SelectableColumnTag.java
+++ b/java/code/src/com/redhat/rhn/frontend/taglibs/list/SelectableColumnTag.java
@@ -15,6 +15,8 @@
package com.redhat.rhn.frontend.taglibs.list;
import com.redhat.rhn.common.localization.LocalizationService;
+import com.redhat.rhn.frontend.struts.Expandable;
+import com.redhat.rhn.frontend.taglibs.RhnListTagFunctions;
import org.apache.commons.lang.StringUtils;
@@ -31,7 +33,8 @@ import javax.servlet.jsp.tagext.TagSupport;
public class SelectableColumnTag extends TagSupport {
private static final long serialVersionUID = 2749189931275777440L;
-
+ private static final String CHECKBOX_CLICKED_SCRIPT =
+ "process_checkbox_clicked(this,'%s', this.form.%s, %s)";
private String valueExpr;
private String selectExpr;
private String disabledExpr;
@@ -196,6 +199,7 @@ public class SelectableColumnTag extends TagSupport {
ListTagUtil.write(pageContext, "this.form." +
ListTagUtil.makeSelectedItemsName(listName));
ListTagUtil.write(pageContext, ", this.checked)");
+
ListTagUtil.write(pageContext, "\" />");
}
private void renderCheckbox() throws JspException {
@@ -204,8 +208,7 @@ public class SelectableColumnTag extends TagSupport {
private void render(String value) throws JspException {
writeStartingTd();
- String counterName = "list_sel_" + listName;
- Long id = ListTagUtil.incrementPersistentCounter(pageContext, counterName);
+ String id = ListTagHelper.getObjectId(getCurrent());
renderHiddenItem(id, value);
ListTagUtil.write(pageContext, "<input type=\"checkbox\" ");
if (isSelected()) {
@@ -222,9 +225,8 @@ public class SelectableColumnTag extends TagSupport {
ListTagUtil.write(pageContext, "value=\"");
ListTagUtil.write(pageContext, value);
ListTagUtil.write(pageContext, "\" ");
- if (rhnSet != null) {
- renderRhnSetOnClick();
- }
+ renderOnClick();
+
ListTagUtil.write(pageContext, "/>");
}
@@ -232,7 +234,7 @@ public class SelectableColumnTag extends TagSupport {
return "list_" + listName + "_sel_all";
}
- private String makeCheckboxId(Long id) {
+ private String makeCheckboxId(String id) {
return "list_" + listName + "_" + id;
}
/**
@@ -240,15 +242,38 @@ public class SelectableColumnTag extends TagSupport {
* //onclick="checkbox_clicked(this, '$rhnSet')"
*
*/
- private void renderRhnSetOnClick() throws JspException {
- ListTagUtil.write(pageContext, " onclick=\"process_checkbox_clicked(this,'");
- ListTagUtil.write(pageContext, rhnSet);
- ListTagUtil.write(pageContext, "',");
- ListTagUtil.write(pageContext, "this.form." + makeSelectAllCheckboxName());
- ListTagUtil.write(pageContext, ")\" ");
+ private void renderOnClick() throws JspException {
+ if (!StringUtils.isBlank(rhnSet)) {
+ ListTagUtil.write(pageContext, " onclick=\"");
+ ListTagUtil.write(pageContext, String.format(CHECKBOX_CLICKED_SCRIPT,
+ rhnSet, makeSelectAllCheckboxName(), getChildIds()));
+ ListTagUtil.write(pageContext, "\" ");
+ }
}
- private void renderHiddenItem(Long listId, String value) throws JspException {
+ private String getChildIds() {
+ Object current = getCurrent();
+ if (RhnListTagFunctions.isExpandable(current)) {
+ StringBuilder buf = new StringBuilder();
+ for (Object child : ((Expandable)current).expand()) {
+ if (buf.length() > 0) {
+ buf.append(",");
+ }
+ buf.append("'");
+ buf.append(makeCheckboxId(ListTagHelper.getObjectId(child)));
+ buf.append("'");
+ }
+
+ buf.insert(0, "[");
+ buf.append("]");
+
+ return buf.toString();
+ }
+ return "[]";
+
+ }
+
+ private void renderHiddenItem(String listId, String value) throws JspException {
ListTagUtil.write(pageContext, "<input type=\"hidden\" ");
ListTagUtil.write(pageContext, "id=\"");
ListTagUtil.write(pageContext, "list_items_" + listName + "_" + listId);
@@ -296,4 +321,10 @@ public class SelectableColumnTag extends TagSupport {
}
ListTagUtil.write(pageContext, ">");
}
+
+ private Object getCurrent() {
+ ListTag parent = (ListTag)
+ BodyTagSupport.findAncestorWithClass(this, ListTag.class);
+ return parent.getCurrentObject();
+ }
}
diff --git a/web/html/javascript/check_all.js b/web/html/javascript/check_all.js
index 62fce00..e4b8281 100644
--- a/web/html/javascript/check_all.js
+++ b/web/html/javascript/check_all.js
@@ -29,6 +29,10 @@ function check_all_on_page(form, set_label) {
}
function process_check_all(set_label, cboxes, flag) {
+ update_server_set("ids", set_label, flag, process_group(set_label, cboxes, flag));
+}
+
+function process_group(set_label, cboxes, flag) {
var i;
var changed = new Array();
@@ -49,8 +53,7 @@ function process_check_all(set_label, cboxes, flag) {
}
cboxes.checked = flag;
}
-
- update_server_set("ids", set_label, flag, changed);
+ return changed;
}
function checkbox_clicked(thebox, set_label) {
@@ -59,10 +62,27 @@ function checkbox_clicked(thebox, set_label) {
form_name = thebox.form.id;
}
var checkall = eval("document.forms['" + form_name + "'].checkall");
- process_checkbox_clicked(thebox, set_label, checkall);
+ process_checkbox_clicked(thebox, set_label, checkall, []);
}
-function process_checkbox_clicked(thebox, set_label, checkall) {
+function process_checkbox_clicked(thebox, set_label, checkall, children) {
+ process_single_checkbox(thebox, set_label, checkall);
+ var a = new Array();
+ a.push(thebox.value);
+
+ var checkboxes = new Array();
+ for (var i = 0; i < children.length; i++) {
+ var checkbox = document.getElementById(children[i]);
+ checkboxes.push(checkbox);
+ a.push(checkbox.value);
+ }
+ if (checkboxes.length > 0) {
+ process_group(set_label, checkboxes, thebox.checked);
+ }
+ update_server_set("ids", set_label, thebox.checked, a);
+}
+
+function process_single_checkbox(thebox, set_label, checkall) {
var form_name = thebox.form.name;
if (form_name == "") {
form_name = thebox.form.id;
@@ -88,15 +108,13 @@ function process_checkbox_clicked(thebox, set_label, checkall) {
all_checked = true;
}
}
- var a = new Array();
- a[0] = thebox.value;
if (checkall) {
checkall.checked = all_checked;
}
- update_server_set("ids", set_label, thebox.checked, a);
}
+
function update_server_set(variable, set_label, checked, values) {
var url = "/rhn/SetItemSelected.do";
body = "set_label=" + set_label + "&";
13 years, 1 month
java/code
by Partha Aji
java/code/src/com/redhat/rhn/frontend/taglibs/list/DataSetManipulator.java | 2 +-
java/code/src/com/redhat/rhn/frontend/taglibs/list/ListFilterHelper.java | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
New commits:
commit 53e735377ffd21f0d6146cf911ae657862c4d0e0
Author: Partha Aji <paji(a)redhat.com>
Date: Fri Apr 30 11:08:23 2010 -0400
Got the tree filters working
diff --git a/java/code/src/com/redhat/rhn/frontend/taglibs/list/DataSetManipulator.java b/java/code/src/com/redhat/rhn/frontend/taglibs/list/DataSetManipulator.java
index dfd44e6..cb7c1f7 100644
--- a/java/code/src/com/redhat/rhn/frontend/taglibs/list/DataSetManipulator.java
+++ b/java/code/src/com/redhat/rhn/frontend/taglibs/list/DataSetManipulator.java
@@ -357,7 +357,7 @@ public class DataSetManipulator {
return;
}
else {
-
+ filter = f;
HtmlTag filterClass = new HtmlTag("input");
filterClass.setAttribute("type", "hidden");
filterClass.setAttribute("name", ListTagUtil.makeFilterClassLabel(uniqueName));
diff --git a/java/code/src/com/redhat/rhn/frontend/taglibs/list/ListFilterHelper.java b/java/code/src/com/redhat/rhn/frontend/taglibs/list/ListFilterHelper.java
index ea33b61..8c2d41a 100644
--- a/java/code/src/com/redhat/rhn/frontend/taglibs/list/ListFilterHelper.java
+++ b/java/code/src/com/redhat/rhn/frontend/taglibs/list/ListFilterHelper.java
@@ -75,8 +75,8 @@ public class ListFilterHelper {
for (Object object : dataSet) {
if (object instanceof Expandable) {
parent = (Expandable) object;
- for (Object obj : parent.expand()) {
- if (filter.filter(object, filterBy, filterValue)) {
+ for (Object child : parent.expand()) {
+ if (filter.filter(child, filterBy, filterValue)) {
filteredData.add(parent);
break;
}
13 years, 1 month
java/code
by Partha Aji
java/code/src/com/redhat/rhn/frontend/taglibs/list/row/ExpandableRowRenderer.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
New commits:
commit e4728cf08e76e1511138a596461b42c1bc52a489
Author: Partha Aji <paji(a)redhat.com>
Date: Fri Apr 30 10:48:34 2010 -0400
Fixed a checkstyle error
diff --git a/java/code/src/com/redhat/rhn/frontend/taglibs/list/row/ExpandableRowRenderer.java b/java/code/src/com/redhat/rhn/frontend/taglibs/list/row/ExpandableRowRenderer.java
index 47f7919..03ee4f3 100644
--- a/java/code/src/com/redhat/rhn/frontend/taglibs/list/row/ExpandableRowRenderer.java
+++ b/java/code/src/com/redhat/rhn/frontend/taglibs/list/row/ExpandableRowRenderer.java
@@ -41,10 +41,10 @@ public class ExpandableRowRenderer extends RowRenderer {
public String getRowClass(Object current) {
if (RhnListTagFunctions.isExpandable(current)) {
rowNum++;
- return rowClasses[rowNum%rowClasses.length];
+ return rowClasses[rowNum % rowClasses.length];
}
else {
- return rowClasses[rowNum%rowClasses.length];
+ return rowClasses[rowNum % rowClasses.length];
}
}
13 years, 1 month
client/tools
by Joshua Roys
client/tools/rhncfg/config_client/rhncfg-client.8 | 9 ++++++---
client/tools/rhncfg/config_client/rhncfg-client.sgml | 4 ++++
2 files changed, 10 insertions(+), 3 deletions(-)
New commits:
commit e0b2e919cc22b557c60f1285a32d4849fe48151e
Author: Joshua Roys <joshua.roys(a)gtri.gatech.edu>
Date: Fri Apr 30 09:14:06 2010 -0400
Add new rhncfg-client verify --only option to manpage
diff --git a/client/tools/rhncfg/config_client/rhncfg-client.8 b/client/tools/rhncfg/config_client/rhncfg-client.8
index 28a72e3..1ca9481 100644
--- a/client/tools/rhncfg/config_client/rhncfg-client.8
+++ b/client/tools/rhncfg/config_client/rhncfg-client.8
@@ -1,5 +1,5 @@
-.\\" auto-generated by docbook2man-spec $Revision: 1.1 $
-.TH "RHNCFG-CLIENT" "8" "15 December 2008" "Version 4.0" ""
+.\\" auto-generated by docbook2man-spec $Revision: 1.2 $
+.TH "RHNCFG-CLIENT" "8" "30 April 2010" "Version 4.0" ""
.SH NAME
rhncfg-client \- a tool used for system configuration querying and deployment.
.SH SYNOPSIS
@@ -7,7 +7,7 @@ rhncfg-client \- a tool used for system configuration querying and deployment.
.nf
.sp
-\fBrhncfg-client\fR [ \fBmode \fR ] [ \fBoptions \fI...\fB\fR ] [ \fBarguments \fI...\fB\fR ]
+\fBrhncfg-client\fR [ \fBmode \fR ] [ \fBoptions \fI\&...\fB\fR ] [ \fBarguments \fI\&...\fB\fR ]
.sp
.fi
.SH "DESCRIPTION"
@@ -55,6 +55,9 @@ option. E.g., rhncfg-client diff --topdir /home/test/foo/
\fBverify\fR
Quick verification to see if files are different than those
associated with it on Red Hat Network.
+
+All files are displayed unless called with the -o or --only
+option, in which case only files with differences are displayed.
.TP
\fB-h, --help\fR
Display the help screen with a list of options.
diff --git a/client/tools/rhncfg/config_client/rhncfg-client.sgml b/client/tools/rhncfg/config_client/rhncfg-client.sgml
index 41484f3..8fcccac 100644
--- a/client/tools/rhncfg/config_client/rhncfg-client.sgml
+++ b/client/tools/rhncfg/config_client/rhncfg-client.sgml
@@ -108,6 +108,10 @@
Quick verification to see if files are different than those
associated with it on &RHN;.
</para>
+ <para>
+ All files are displayed unless called with the -o or --only
+ option, in which case only files with differences are displayed.
+ </para>
</listitem>
</varlistentry>
<varlistentry>
13 years, 1 month
Changes to 'refs/tags/spacewalk-backend-1.1.10-1'
by Miroslav Suchý
Tag 'spacewalk-backend-1.1.10-1' created by Miroslav Suchý <msuchy(a)redhat.com> at 2010-04-30 11:44 +0000
Tagging package [spacewalk-backend] version [1.1.10-1] in directory [backend/].
Changes since spacewalk-backend-1.1.9-1:
Lukáš Ďurfina (1):
Support for uploading deb packages
Miroslav Suchý (1):
Automatic commit of package [spacewalk-backend] release [1.1.10-1].
Simon Lukasik (1):
Adding port number to command line args
---
backend/server/importlib/Makefile | 2
backend/server/importlib/debPackage.py | 152 ++++++++++++
backend/server/importlib/mpmSource.py | 4
backend/server/rhnPackageUpload.py | 27 +-
backend/spacewalk-backend.spec | 8
backend/spacewalk/common/rhn_deb.py | 148 +++++++++++
backend/spacewalk/common/rhn_mpm.py | 4
backend/upload_server/handlers/package_push/package_push.py | 2
client/rhel/rhnlib/test/23-digest-auth.py | 1
rel-eng/packages/spacewalk-backend | 2
10 files changed, 338 insertions(+), 12 deletions(-)
---
13 years, 1 month
2 commits - backend/server backend/spacewalk backend/spacewalk-backend.spec backend/upload_server rel-eng/packages
by Miroslav Suchý
backend/server/importlib/Makefile | 2
backend/server/importlib/debPackage.py | 152 ++++++++++++
backend/server/importlib/mpmSource.py | 4
backend/server/rhnPackageUpload.py | 27 +-
backend/spacewalk-backend.spec | 8
backend/spacewalk/common/rhn_deb.py | 148 +++++++++++
backend/spacewalk/common/rhn_mpm.py | 4
backend/upload_server/handlers/package_push/package_push.py | 2
rel-eng/packages/spacewalk-backend | 2
9 files changed, 337 insertions(+), 12 deletions(-)
New commits:
commit 36c281ebd9bd11e357a3878c6e3a892f9397e4f0
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Fri Apr 30 13:44:56 2010 +0200
Automatic commit of package [spacewalk-backend] release [1.1.10-1].
diff --git a/backend/spacewalk-backend.spec b/backend/spacewalk-backend.spec
index c84d256..fe09cec 100644
--- a/backend/spacewalk-backend.spec
+++ b/backend/spacewalk-backend.spec
@@ -8,7 +8,7 @@ Name: spacewalk-backend
Summary: Common programs needed to be installed on the Spacewalk servers/proxies
Group: Applications/Internet
License: GPLv2
-Version: 1.1.9
+Version: 1.1.10
Release: 1%{?dist}
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
@@ -632,6 +632,9 @@ rm -f %{rhnconf}/rhnSecret.py*
# $Id$
%changelog
+* Fri Apr 30 2010 Miroslav Suchý <msuchy(a)redhat.com> 1.1.10-1
+- Support for uploading deb packages (lukas.durfina(a)gmail.com)
+
* Fri Apr 30 2010 Jan Pazdziora 1.1.9-1
- 585233 - use log2stderr instead of the (debugging) print.
- 585233 - fix the logic handling has_comps and missing comps_last_modified.
diff --git a/rel-eng/packages/spacewalk-backend b/rel-eng/packages/spacewalk-backend
index 6ae0e0e..e3c9b5e 100644
--- a/rel-eng/packages/spacewalk-backend
+++ b/rel-eng/packages/spacewalk-backend
@@ -1 +1 @@
-1.1.9-1 backend/
+1.1.10-1 backend/
commit aa2b087df2bdb42680493bbbedd11d29a1a74af0
Author: Lukáš Ďurfina <lukas.durfina(a)gmail.com>
Date: Sat Apr 10 20:47:23 2010 +0200
Support for uploading deb packages
diff --git a/backend/server/importlib/Makefile b/backend/server/importlib/Makefile
index 84d5414..bda76a9 100644
--- a/backend/server/importlib/Makefile
+++ b/backend/server/importlib/Makefile
@@ -8,7 +8,7 @@ SUBDIR = server/importlib
FILES = __init__ archImport backendLib backendOracle backend \
blacklistImport \
- channelImport errataCache errataImport headerSource importLib \
+ channelImport debPackage errataCache errataImport headerSource importLib \
kickstartImport mpmSource \
packageImport productNamesImport packageUpload userAuth
diff --git a/backend/server/importlib/debPackage.py b/backend/server/importlib/debPackage.py
new file mode 100644
index 0000000..ed22ca7
--- /dev/null
+++ b/backend/server/importlib/debPackage.py
@@ -0,0 +1,152 @@
+#!/usr/bin/python
+#
+# Copyright (c) 2010 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.
+#
+#
+# Converts headers to the intermediate format
+#
+
+import headerSource
+import os
+import time
+import string
+from importLib import File, Dependency, ChangeLog, Channel, \
+ IncompletePackage, Package, SourcePackage
+from backendLib import gmtime, localtime
+from types import ListType, TupleType, IntType
+
+
+class debBinaryPackage(headerSource.rpmBinaryPackage):
+
+ def __init__(self, header, size, checksum_type, checksum, path=None, org_id=None,
+ channels=[]):
+
+ headerSource.rpmBinaryPackage.__init__(self)
+
+ self.tagMap = headerSource.rpmBinaryPackage.tagMap.copy()
+
+ # Remove already-mapped tags
+ self._already_mapped = [
+ 'rpm_version', 'payload_size', 'payload_format',
+ 'package_group', 'build_time', 'build_host'
+ ]
+
+ for t in self._already_mapped:
+ if self.tagMap.has_key(t):
+ del self.tagMap[t]
+
+ # XXX is seems to me that this is the place that 'source_rpm' is getting
+ # set
+ for f in self.keys():
+ field = f
+ if self.tagMap.has_key(f):
+ field = self.tagMap[f]
+ if not field:
+ # Unsupported
+ continue
+
+ # get the db field value from the header
+ val = header[field]
+ if f == 'build_time':
+ if val is not None and isinstance(val, IntType):
+ # A UNIX timestamp
+ val = gmtime(val)
+ elif val:
+ # Convert to strings
+ if isinstance(val, unicode):
+ val = unicode.encode(val, 'utf-8')
+ else:
+ val = str(val)
+ elif val == []:
+ val = None
+ self[f] = val
+
+ self['package_size'] = size
+ self['checksum_type'] = checksum_type
+ self['checksum'] = checksum
+ self['path'] = path
+ self['org_id'] = org_id
+ self['header_start'] = None
+ self['header_end'] = None
+ self['last_modified'] = localtime(time.time())
+ if self['sigmd5']:
+ self['sigchecksum_type'] = 'md5'
+ self['sigchecksum'] = self['sigmd5']
+ del(self['sigmd5'])
+
+ # Fix some of the information up
+ vendor = self['vendor']
+ if vendor is None:
+ self['vendor'] = 'Debian'
+ payloadFormat = self['payload_format']
+ if payloadFormat is None:
+ self['payload_format'] = 'ar'
+ if self['payload_size'] is None:
+ self['payload_size'] = 0
+
+ # Populate file information
+ self._populateFiles(header)
+ # Populate dependency information
+ self._populateDependencyInformation(header)
+ # Populate changelogs
+ self._populateChangeLog(header)
+ # Channels
+ self._populateChannels(channels)
+
+ self['source_rpm'] = None
+
+ group = self.get('package_group', '')
+ if group == '' or group is None:
+ self['package_group'] = 'NoGroup'
+
+
+ def _populateFiles(self, header):
+ files = []
+ #for f in header.get('files', []):
+ # fc = headerSource.rpmFile()
+ # fc.populate(f)
+ # files.append(fc)
+ self['files'] = files
+
+ def _populateDependencyInformation(self, header):
+ mapping = {
+ 'provides' : headerSource.rpmProvides,
+ 'requires' : headerSource.rpmRequires,
+ 'conflicts' : headerSource.rpmConflicts,
+ 'obsoletes' : headerSource.rpmObsoletes,
+ }
+ for k, dclass in mapping.items():
+ l = []
+ #for dinfo in header.get(k, []):
+ # finst = dclass()
+ # finst.populate(dinfo)
+ # l.append(finst)
+ self[k] = l
+
+ def _populateChangeLog(self, header):
+ l = []
+ #for cinfo in header.get('changelog', []):
+ # cinst = headerSource.rpmChangeLog()
+ # cinst.populate(cinfo)
+ # l.append(cinst)
+ self['changelog'] = l
+
+ def _populateChannels(self, channels):
+ l = []
+ for channel in channels:
+ dict = {'label' : channel}
+ obj = Channel()
+ obj.populate(dict)
+ l.append(obj)
+ self['channels'] = l
diff --git a/backend/server/importlib/mpmSource.py b/backend/server/importlib/mpmSource.py
index a7224b9..4bc27a4 100644
--- a/backend/server/importlib/mpmSource.py
+++ b/backend/server/importlib/mpmSource.py
@@ -18,6 +18,7 @@
#
import headerSource
+import debPackage
from importLib import SolarisPatchInfo, \
SolarisPatchPackagesInfo, SolarisPatchSetInfo, \
SolarisPatchSetMember, SolarisPackageInfo
@@ -219,6 +220,9 @@ def create_package(header, size, checksum_type, checksum, relpath, org_id, heade
checksum_type=checksum_type, checksum=checksum,
relpath=relpath, org_id=org_id, header_start=header_start,
header_end=header_end, channels=channels)
+ if header.packaging == 'deb':
+ return debPackage.debBinaryPackage(header, size=size, checksum_type=checksum_type, checksum=checksum, path=relpath,
+ org_id=org_id, channels=channels)
if header.is_source:
raise NotImplementedError()
p = mpmBinaryPackage()
diff --git a/backend/server/rhnPackageUpload.py b/backend/server/rhnPackageUpload.py
index 24d07e0..6c3e3a6 100644
--- a/backend/server/rhnPackageUpload.py
+++ b/backend/server/rhnPackageUpload.py
@@ -19,7 +19,7 @@ import os
import tempfile
from common import CFG, log_debug, rhnFault, UserDictCase
-from spacewalk.common import rhn_mpm
+from spacewalk.common import rhn_mpm, rhn_deb
from spacewalk.common.checksum import getFileChecksum
from spacewalk.common.rhn_rpm import get_header_byte_range
@@ -40,11 +40,14 @@ def source_match(v1, v2):
return 0
-def write_temp_file(req, buffer_size):
+def write_temp_file(req, buffer_size, packaging=None):
""" Write request to temporary file (write max. buffer_size at once).
Returns the file object.
"""
- t = tempfile.TemporaryFile()
+ suffix = ''
+ if packaging == 'deb':
+ suffix = '.deb'
+ t = tempfile.NamedTemporaryFile(suffix=suffix)
while 1:
buf = req.read(buffer_size)
if not buf:
@@ -148,6 +151,8 @@ def push_package(header, payload_stream, checksum_type, checksum, org_id=None, f
raise rhnFault(50, "Package upload failed: %s" % e)
except importLib.FileConflictError:
raise rhnFault(50, "File already exists")
+ except:
+ raise rhnFault(50, "File error")
pkg = mpmSource.create_package(header, size=payload_size,
checksum_type=checksum_type, checksum=checksum,
@@ -290,13 +295,19 @@ def _key_ids(sigs):
return l
def load_package(package_stream):
- try:
- header, payload_stream = rhn_mpm.load(file=package_stream)
- except rhn_mpm.InvalidPackageError, e:
- raise rhnFault(50, "Unable to load package", explain=0)
+ if package_stream.name.endswith('.deb'):
+ try:
+ header, payload_stream = rhn_deb.load(filename=package_stream.name)
+ except:
+ raise rhnFault(50, "Unable to load package", explain=0)
+ else:
+ try:
+ header, payload_stream = rhn_mpm.load(file=package_stream)
+ except:
+ raise rhnFault(50, "Unable to load package", explain=0)
payload_stream.seek(0, 0)
- if header.packaging == "mpm":
+ if header.packaging == "mpm" or header.packaging == "deb":
header.header_start = header.header_end = 0
(header_start, header_end) = (0, 0)
else:
diff --git a/backend/spacewalk-backend.spec b/backend/spacewalk-backend.spec
index 71466cb..c84d256 100644
--- a/backend/spacewalk-backend.spec
+++ b/backend/spacewalk-backend.spec
@@ -18,6 +18,8 @@ Requires: python, rpm-python
# /etc/rhn is provided by spacewalk-proxy-common or by spacewalk-config
Requires: /etc/rhn
Requires: rhnlib >= 1.8
+# for Debian support
+Requires: python-debian
Requires: %{name}-libs = %{version}-%{release}
BuildRequires: /usr/bin/msgfmt
BuildRequires: /usr/bin/docbook2man
@@ -382,6 +384,7 @@ rm -f %{rhnconf}/rhnSecret.py*
%{rhnroot}/server/importlib/backendOracle.py*
%{rhnroot}/server/importlib/blacklistImport.py*
%{rhnroot}/server/importlib/channelImport.py*
+%{rhnroot}/server/importlib/debPackage.py*
%{rhnroot}/server/importlib/errataCache.py*
%{rhnroot}/server/importlib/errataImport.py*
%{rhnroot}/server/importlib/headerSource.py*
diff --git a/backend/spacewalk/common/rhn_deb.py b/backend/spacewalk/common/rhn_deb.py
new file mode 100644
index 0000000..b108ecb
--- /dev/null
+++ b/backend/spacewalk/common/rhn_deb.py
@@ -0,0 +1,148 @@
+#
+# Copyright (c) 2010 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.
+#
+#
+# Meta-package manager
+#
+# $Id$
+#
+# Author: Lukas Durfina <lukas.durfina(a)gmail.com>
+
+import os
+import gzip
+import cStringIO
+import tempfile
+from rhn.rpclib import xmlrpclib
+
+from debian import debfile
+import struct
+
+from types import ListType, TupleType, DictType
+
+DEB_CHECKSUM_TYPE = 'md5' # FIXME: this should be a configuration option
+
+def get_package_header(filename=None, file=None, fd=None):
+ return load(filename=filename, file=file, fd=fd)[0]
+
+# Loads DEB and returns its header and its payload
+def load(filename=None, file=None, fd=None):
+ if (filename is None):
+ raise ValueError, "filename has to be passed"
+ if (filename is None and file is None and fd is None):
+ raise ValueError, "No parameters passed"
+
+ if filename is not None:
+ f = open(filename)
+ elif file is not None:
+ f = file
+ else: # fd is not None
+ f = os.fdopen(os.dup(fd), "r")
+
+ f.seek(0, 0)
+ return load_deb(f, filename)
+
+def load_deb(stream, filename):
+
+ # Dup the file descriptor, we don't want it to get closed before we read
+ # the payload
+ newfd = os.dup(stream.fileno())
+ stream = os.fdopen(newfd, "r")
+
+ stream.flush()
+ stream.seek(0, 0)
+
+
+ try:
+ #header = rhn_deb.get_package_header(file=stream)
+ header = deb_Header(filename)
+ except:
+ raise InvalidPackageError(e)
+ stream.seek(0, 0)
+
+ return header, stream
+
+class deb_Header:
+ "Wrapper class for an deb header - we need to store a flag is_source"
+ def __init__(self, name):
+ self.hdr = {}
+ self.packaging = 'deb'
+ self.signatures = []
+ self.name = ''
+ self.version = 0
+ self.release = 0
+ self.arch = 'all'
+ self.is_source = 0
+ self.deb = None
+
+ try:
+ self.deb = debfile.DebFile(name)
+ except Exception, e:
+ raise InvalidPackageError(e)
+
+ try:
+ # Fill info about package
+ self.name = self.deb.debcontrol().get_as_string('Package')
+ self.arch = self.deb.debcontrol().get_as_string('Architecture') + '-deb'
+ version = self.deb.debcontrol().get_as_string('Version')
+ version_tmpArr = version.split('-')
+ if len(version_tmpArr) == 1:
+ self.version = version
+ self.release = "X"
+ else:
+ self.version = version_tmpArr[0]
+ self.release = version_tmpArr[1]
+ except Exception, e:
+ raise InvalidPackageError(e)
+
+ def checksum_type(self):
+ return DEB_CHECKSUM_TYPE
+
+ def is_signed(self):
+ return 0
+
+ def __getitem__(self, name):
+ name = str(name)
+ if name == 'name':
+ return self.name
+ elif name == 'arch':
+ return self.arch
+ elif name == 'release':
+ return self.release
+ elif name == 'version':
+ return self.version
+ elif name == 'epoch':
+ return ''
+ elif name == 'summary':
+ return self.deb.debcontrol().get_as_string('Description').splitlines()[0]
+ elif name == 'vendor':
+ return self.deb.debcontrol().get_as_string('Maintainer')
+ elif name == 'package_group':
+ return self.deb.debcontrol().get_as_string('Section')
+ if self.deb.debcontrol().has_key(name):
+ return self.deb.debcontrol().get_as_string(name)
+ else:
+ return None
+"""
+ def __setitem__(self, name, item):
+ self.hdr[name] = item
+
+ def __delitem__(self, name):
+ del self.hdr[name]
+
+ def __getattr__(self, name):
+ return getattr(self.hdr, name)
+"""
+
+class InvalidPackageError(Exception):
+ pass
diff --git a/backend/spacewalk/common/rhn_mpm.py b/backend/spacewalk/common/rhn_mpm.py
index 7868a79..12bea83 100644
--- a/backend/spacewalk/common/rhn_mpm.py
+++ b/backend/spacewalk/common/rhn_mpm.py
@@ -58,6 +58,8 @@ def load(filename=None, file=None, fd=None):
return load_rpm(f)
except InvalidPackageError:
raise e
+ except:
+ raise e
return p.header, p.payload_stream
@@ -83,6 +85,8 @@ def load_rpm(stream):
raise apply(InvalidPackageError, e.args)
except rhn_rpm.error, e:
raise InvalidPackageError(e)
+ except:
+ raise InvalidPackageError
stream.seek(0, 0)
return header, stream
diff --git a/backend/upload_server/handlers/package_push/package_push.py b/backend/upload_server/handlers/package_push/package_push.py
index e1b1052..e3dac16 100644
--- a/backend/upload_server/handlers/package_push/package_push.py
+++ b/backend/upload_server/handlers/package_push/package_push.py
@@ -108,7 +108,7 @@ class PackagePush(basePackageUpload.BasePackageUpload):
if ret != apache.OK:
return ret
- temp_stream = rhnPackageUpload.write_temp_file(req, 16384)
+ temp_stream = rhnPackageUpload.write_temp_file(req, 16384, self.packaging)
header, payload_stream, header_start, header_end = \
rhnPackageUpload.load_package(temp_stream)
13 years, 1 month
client/rhel
by Šimon Lukašík
client/rhel/rhnlib/test/23-digest-auth.py | 1 +
1 file changed, 1 insertion(+)
New commits:
commit 417b386e9c8d4c9f1147f31cd93832a1d107fa3b
Author: Simon Lukasik <slukasik(a)redhat.com>
Date: Fri Apr 30 12:39:29 2010 +0200
Adding port number to command line args
diff --git a/client/rhel/rhnlib/test/23-digest-auth.py b/client/rhel/rhnlib/test/23-digest-auth.py
index d99fce0..ad27f9a 100755
--- a/client/rhel/rhnlib/test/23-digest-auth.py
+++ b/client/rhel/rhnlib/test/23-digest-auth.py
@@ -25,6 +25,7 @@ PORT = "1234"
HANDLER = "/XMLRPC"
try:
SERVER = sys.argv[1]
+ PORT = sys.argv[2]
except:
pass
13 years, 1 month
Changes to 'refs/tags/spacewalk-backend-1.1.9-1'
by Jan Pazdziora
Tag 'spacewalk-backend-1.1.9-1' created by Jan Pazdziora <jpazdziora(a)redhat.com> at 2010-04-30 07:49 +0000
Tagging package [spacewalk-backend] version [1.1.9-1] in directory [backend/].
Changes since spacewalk-java-1.1.9-1:
Jan Pazdziora (1):
Automatic commit of package [spacewalk-backend] release [1.1.9-1].
Justin Sherrill (1):
fixing RowRenderer, to do coloring more like the mockups
Partha Aji (1):
Made the post reactivation key logic more fail safe..
---
backend/spacewalk-backend.spec | 7 +++
java/code/src/com/redhat/rhn/frontend/taglibs/list/DataSetManipulator.java | 2 -
java/code/src/com/redhat/rhn/frontend/taglibs/list/row/ExpandableRowRenderer.java | 5 +-
java/code/webapp/WEB-INF/pages/systems/duplicate/duplicateIPList.jsp | 2 -
java/conf/cobbler/snippets/post_reactivation_key | 18 ++++++----
rel-eng/packages/spacewalk-backend | 2 -
6 files changed, 24 insertions(+), 12 deletions(-)
---
13 years, 1 month