java/code/src/com/redhat/rhn/domain/channel/Channel.java | 57 +--------- java/code/src/com/redhat/rhn/domain/channel/ChannelFactory.java | 10 - java/code/src/com/redhat/rhn/frontend/action/channel/ssm/BaseSubscribeAction.java | 23 ++-- java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java | 43 +++---- java/spacewalk-java.spec | 14 ++ rel-eng/packages/spacewalk-java | 2 6 files changed, 60 insertions(+), 89 deletions(-)
New commits: commit e250c586a3038c94be142ce78971f7cfa9b7702b Author: Tomas Lestach tlestach@redhat.com Date: Fri Apr 5 18:51:11 2013 +0200
Automatic commit of package [spacewalk-java] release [1.10.44-1].
diff --git a/java/spacewalk-java.spec b/java/spacewalk-java.spec index 8b6fd8b..6bd7145 100644 --- a/java/spacewalk-java.spec +++ b/java/spacewalk-java.spec @@ -28,7 +28,7 @@ Name: spacewalk-java Summary: Spacewalk Java site packages Group: Applications/Internet License: GPLv2 -Version: 1.10.43 +Version: 1.10.44 Release: 1%{?dist} URL: https://fedorahosted.org/spacewalk Source0: https://fedorahosted.org/releases/s/p/spacewalk/%%7Bname%7D-%%7Bversion%7D.t... @@ -678,6 +678,18 @@ fi %{jardir}/postgresql-jdbc.jar
%changelog +* Fri Apr 05 2013 Tomas Lestach tlestach@redhat.com 1.10.44-1 +- 896566 - a channel may have multiple dcms: lookupDistChannelMap -> + listDistChannelMaps +- 896566 - simplify Channel.isChannelRepodataRequired method +- link channel labels on /rhn/channels/manage/DistChannelMap.do page +- 948185 - fixing checkstyle +- 948185 - fix system.listSystemEvents on PG +- removing unnecessary cast +- removing unnecessarily nested else statement +- enhance /rhn/errata/AllErrata.do +- enhance /rhn/errata/RelevantErrata.do + * Thu Apr 04 2013 Grant Gainey 1.10.43-1 - 948605: checkstyle whitespace fixes. Sigh.
diff --git a/rel-eng/packages/spacewalk-java b/rel-eng/packages/spacewalk-java index 8f06ddb..9637d96 100644 --- a/rel-eng/packages/spacewalk-java +++ b/rel-eng/packages/spacewalk-java @@ -1 +1 @@ -1.10.43-1 java/ +1.10.44-1 java/
commit 09371cc6fbaed01f57428c0b1845a96824c55e60 Author: Tomas Lestach tlestach@redhat.com Date: Fri Apr 5 16:34:20 2013 +0200
896566 - a channel may have multiple dcms: lookupDistChannelMap -> listDistChannelMaps
diff --git a/java/code/src/com/redhat/rhn/domain/channel/ChannelFactory.java b/java/code/src/com/redhat/rhn/domain/channel/ChannelFactory.java index b37c19a..84c5164 100644 --- a/java/code/src/com/redhat/rhn/domain/channel/ChannelFactory.java +++ b/java/code/src/com/redhat/rhn/domain/channel/ChannelFactory.java @@ -904,17 +904,17 @@ public class ChannelFactory extends HibernateFactory { }
/** - * Lookup the dist channel map for the given channel. - * Returns null if none is found. + * Lookup dist channel mappings for the given channel. + * Returns empty list if none is found. * * @param c Channel to lookup mapping for - * @return DistChannelMap, null if none is found + * @return list of dist channel mappings, empty list if none is found */ - public static DistChannelMap lookupDistChannelMap(Channel c) { + public static List<DistChannelMap> listDistChannelMaps(Channel c) {
Map params = new HashMap(); params.put("channel", c); - return (DistChannelMap)singleton.lookupObjectByNamedQuery( + return singleton.listObjectsByNamedQuery( "DistChannelMap.findByChannel", params); }
diff --git a/java/code/src/com/redhat/rhn/frontend/action/channel/ssm/BaseSubscribeAction.java b/java/code/src/com/redhat/rhn/frontend/action/channel/ssm/BaseSubscribeAction.java index 346ad4a..4b3de84 100644 --- a/java/code/src/com/redhat/rhn/frontend/action/channel/ssm/BaseSubscribeAction.java +++ b/java/code/src/com/redhat/rhn/frontend/action/channel/ssm/BaseSubscribeAction.java @@ -164,16 +164,19 @@ public class BaseSubscribeAction extends RhnLookupDispatchAction { // First add an entry for the default base channel: if (newBaseChannelId.intValue() == -1) { log.debug("Default system base channel was selected."); - DistChannelMap dcm = ChannelFactory.lookupDistChannelMap(oldBase); - if (dcm != null && oldBase != null) { - String version = dcm.getRelease(); - DistChannelMap defaultDcm = - ChannelManager.lookupDistChannelMapByPnReleaseArch( - ChannelManager.RHEL_PRODUCT_NAME, version, - oldBase.getChannelArch()); - newBase = defaultDcm.getChannel(); - log.debug("Determined default base channel will be: " + - newBase.getLabel()); + List<DistChannelMap> dcms = ChannelFactory.listDistChannelMaps(oldBase); + if (!dcms.isEmpty() && oldBase != null) { + for (DistChannelMap dcm : dcms) { + String version = dcm.getRelease(); + DistChannelMap defaultDcm = + ChannelManager.lookupDistChannelMapByPnReleaseArch( + ChannelManager.RHEL_PRODUCT_NAME, version, + oldBase.getChannelArch()); + newBase = defaultDcm.getChannel(); + log.debug("Determined default base channel will be: " + + newBase.getLabel()); + break; + } } else { // Looks like an EUS or custom channel, need to get a little crazy :( 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 ec20878..d82b30a 100644 --- a/java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java +++ b/java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java @@ -2076,30 +2076,31 @@ public class ChannelManager extends BaseManager {
List<EssentialChannelDto> eusBaseChans = new LinkedList<EssentialChannelDto>();
- DistChannelMap dcm = ChannelFactory.lookupDistChannelMap(inChan); + List<DistChannelMap> dcms = ChannelFactory.listDistChannelMaps(inChan); ReleaseChannelMap rcm = lookupDefaultReleaseChannelMapForChannel(inChan); - if (dcm != null) { - log.debug("Found dist channel map"); - String version = dcm.getRelease(); // bad naming in rhnDistChannelMap - - // If the inChan is the default base channel, that channel will not have - // compatibility entries in rhnReleaseChannelMap, and we are to assume - // that ALL entries in that table for the product/version/channel arch - // are valid replacement base channels: - if (isDefaultBaseChannel(inChan, version)) { - log.debug("inChan is default base channel"); - EssentialChannelDto latestEus = lookupLatestEusChannelForRhelVersion(u, - version, inChan.getChannelArch().getId()); - if (latestEus != null) { - log.debug("Including latest EUS channel: " + - latestEus.getLabel()); - eusBaseChans.add(latestEus); - } - else { - log.warn("Unable to lookup the latest EUS channel!"); + if (!dcms.isEmpty()) { + for (DistChannelMap dcm : dcms) { + log.debug("Found dist channel map"); + String version = dcm.getRelease(); // bad naming in rhnDistChannelMap + + // If the inChan is the default base channel, that channel will not have + // compatibility entries in rhnReleaseChannelMap, and we are to assume + // that ALL entries in that table for the product/version/channel arch + // are valid replacement base channels: + if (isDefaultBaseChannel(inChan, version)) { + log.debug("inChan is default base channel"); + EssentialChannelDto latestEus = lookupLatestEusChannelForRhelVersion(u, + version, inChan.getChannelArch().getId()); + if (latestEus != null) { + log.debug("Including latest EUS channel: " + + latestEus.getLabel()); + eusBaseChans.add(latestEus); + } + else { + log.warn("Unable to lookup the latest EUS channel!"); + } } } - } else if (rcm != null) { log.debug("Found release channel map");
commit 525eb9b116a99815bf1437e50584500f660bdf85 Author: Tomas Lestach tlestach@redhat.com Date: Fri Apr 5 16:12:49 2013 +0200
896566 - simplify Channel.isChannelRepodataRequired method
diff --git a/java/code/src/com/redhat/rhn/domain/channel/Channel.java b/java/code/src/com/redhat/rhn/domain/channel/Channel.java index 49b1a62..f091476 100644 --- a/java/code/src/com/redhat/rhn/domain/channel/Channel.java +++ b/java/code/src/com/redhat/rhn/domain/channel/Channel.java @@ -52,9 +52,6 @@ public class Channel extends BaseDomainHelper implements Comparable { public static final String PROTECTED = "protected"; public static final String PRIVATE = "private";
- private static List<String> releaseToSkipRepodata = new ArrayList<String>(Arrays - .asList("2.1AS", "2.1ES", "2.1WS", "3AS", "3ES", "3WS", "3Desktop", "4AS", - "4ES", "4WS", "4Desktop")); private static List<String> archesToSkipRepodata = new ArrayList<String>(Arrays .asList("channel-sparc-sun-solaris", "channel-i386-sun-solaris", "channel-sparc")); @@ -804,58 +801,16 @@ public class Channel extends BaseDomainHelper implements Comparable { }
/** - * does this Channel need repodata generated for it Criteria: 1. All custom - * channels need repodata 2. RH channels need it if: They are made by RH The - * top-most channel in their hierarchy (yes we currently only have 1 level - * deep, but you know what assumptions make...) has a 'minor' version of 5 - * or higher Note: This makes an assumption that taxonomy will work the way - * that it continues to work, or at least that version.compareTo will remain - * valid and function only on minor version - * @return Returns a boolena if repodata generation Required + * Does this channel need repodata generated + * @return Returns a boolean if repodata generation Required */ public boolean isChannelRepodataRequired() { - boolean repodataRequired = false; - // generate repodata for all custom channels except solaris - if (this.isCustom() && - !archesToSkipRepodata.contains(this.channelArch.getLabel())) { - repodataRequired = true; - log.debug("isChannelRepodataRequired for channel(" + this.id + - ") set to true because it is a custom Channel"); - } - - // Walk to the top of the tree - Channel toConsider = this; - while (toConsider.getParentChannel() != null) { - toConsider = toConsider.getParentChannel(); - } - - String release = null; - DistChannelMap channelDist = ChannelFactory.lookupDistChannelMap(toConsider); - if (channelDist != null) { - release = channelDist.getRelease(); - } - else { // and now again for zstreams - ReleaseChannelMap channelRelease = - ChannelFactory.lookupDefaultReleaseChannelMapForChannel(toConsider); - if (channelRelease != null) { - release = channelRelease.getRelease(); - } - } - if (release != null) { - if (!releaseToSkipRepodata.contains(release)) { - repodataRequired = true; - log.debug("isChannelRepodataRequired for channel(" + this.id + ") " + - "set to true because top level parent has a release of " + release); - } - else { - log.debug("isChannelRepodataRequired for channel(" + this.id + ") " + - "set to false because we have'nt met the minimum release"); - } + // generate repodata for all channels having channel checksum set except solaris + if (archesToSkipRepodata.contains(this.channelArch.getLabel())) { + return true; }
- log.debug("isChannelRepodataRequired for channel(" + this.id + ") = " + - repodataRequired); - return repodataRequired; + return checksumType != null; }
/**
spacewalk-commits@lists.fedorahosted.org