提交 de9816ee 编写于 作者: S Stephen Connolly

[FIXED JENKINS-19739] When installing a plugin and the needed dependencies...

[FIXED JENKINS-19739] When installing a plugin and the needed dependencies have compatibility issues, warn the user
上级 01d5fbc2
......@@ -728,6 +728,43 @@ public class UpdateSite {
}
}
public VersionNumber getNeededDependenciesRequiredCore() {
VersionNumber versionNumber = null;
try {
versionNumber = requiredCore == null ? null : new VersionNumber(requiredCore);
} catch (NumberFormatException nfe) {
// unable to parse version
}
for (Plugin p: getNeededDependencies()) {
VersionNumber v = p.getNeededDependenciesRequiredCore();
if (versionNumber == null || v.isNewerThan(versionNumber)) versionNumber = v;
}
return versionNumber;
}
public boolean isNeededDependenciesForNewerJenkins() {
for (Plugin p: getNeededDependencies()) {
if (p.isForNewerHudson() || p.isNeededDependenciesForNewerJenkins()) return true;
}
return false;
}
/**
* If at least some of the plugin's needed dependencies are already installed, and the new version of the
* needed dependencies plugin have a "compatibleSinceVersion"
* value (i.e., it's only directly compatible with that version or later), this will check to
* see if the installed version is older than the compatible-since version. If it is older, it'll return false.
* If it's not older, or it's not installed, or it's installed but there's no compatibleSinceVersion
* specified, it'll return true.
*/
public boolean isNeededDependenciesCompatibleWithInstalledVersion() {
for (Plugin p: getNeededDependencies()) {
if (!p.isCompatibleWithInstalledVersion() || !p.isNeededDependenciesCompatibleWithInstalledVersion())
return false;
}
return true;
}
/**
* @deprecated as of 1.326
* Use {@link #deploy()}.
......
......@@ -103,6 +103,12 @@ THE SOFTWARE.
<j:if test="${p.isForNewerHudson()}">
<div class="compatWarning">${%coreWarning(p.requiredCore)}</div>
</j:if>
<j:if test="${!p.isNeededDependenciesCompatibleWithInstalledVersion()}">
<div class="compatWarning">${%depCompatWarning}</div>
</j:if>
<j:if test="${p.isNeededDependenciesForNewerJenkins()}">
<div class="compatWarning">${%depCoreWarning(p.getNeededDependenciesRequiredCore().toString())}</div>
</j:if>
</td>
<td class="pane"><st:out value="${p.version}" /></td>
<j:if test="${isUpdates}">
......
......@@ -25,3 +25,13 @@ compatWarning=\
coreWarning=\
Warning: This plugin is built for Jenkins {0} or newer. \
It may or may not work in your Jenkins.
depCompatWarning=\
Warning: This plugin requires dependent plugins be upgraded \
and some of these dependent plugins are not compatible \
with the current installed version. Jobs using these \
dependent plugins may need to be reconfigured.
depCoreWarning=\
Warning: This plugin requires dependent plugins that are \
built for Jenkins {0} or newer. The dependent plugins may \
or may not work in your Jenkins and consenquently this \
plugin may or may not work in your Jenkins.
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册