Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update OnlineInstallerScript Default check wine settings #1264

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Applications/Accessories/MobilePASS/Online/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ new PlainInstaller().withScript(() => {
"MobilePass",
"upstream",
"x86",
getLatestStableVersion(setupWizard, "x86")
getLatestStableVersion(setupWizard, null, null, "x86")
)
.create();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ new PlainInstaller().withScript(() => {

const wine = new Wine()
.wizard(setupWizard)
.prefix("InternetExplorer6", "upstream", "x86", getLatestStableVersion(setupWizard, "x86"))
.prefix("InternetExplorer6", "upstream", "x86", getLatestStableVersion(setupWizard, null, null, "x86"))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you try this? PlainInstaller is not a QuickScript, so I don't see how this._wineDistribution etc. should be set. Generally, I think it would be better to explicitly pass all parameters everywhere (Versions should provide a set of functions and not depend on QuickScript).

.create();

new Msls31(wine).go();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ new PlainInstaller().withScript(() => {

const wine = new Wine()
.wizard(setupWizard)
.prefix("InternetExplorer7", "upstream", "x86", getLatestStableVersion(setupWizard, "x86"))
.prefix("InternetExplorer7", "upstream", "x86", getLatestStableVersion(setupWizard, null, null, "x86"))
.create();

new Sandbox(wine).go();
Expand Down
26 changes: 16 additions & 10 deletions Engines/Wine/Engine/Versions/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ const propertyReader = Bean("propertyReader");
* @returns {void}
*/
function sortVersions(versions) {
versions.sort((a, b) =>
{
versions.sort((a, b) => {
// check version format
const versionRegExp = /^(\d+\.\d+(\.\d+)?)(.*)?$/;
if (!versionRegExp.test(a.version)) {
Expand Down Expand Up @@ -88,8 +87,10 @@ function getLatestVersion(wizard, category, regex) {
const versions = packages
.filter(({ version }) => regExp.test(version))
.map(packageData => packageData.version);

return versions[versions.length-1];
if (versions.length === 0) {
throw new Error('No valid versions for category ' + category);
}
return versions[versions.length - 1];
}

/**
Expand Down Expand Up @@ -121,16 +122,21 @@ module.getAvailableVersions = function (wizard) {
}


module.getLatestStableVersion = function (wizard, architecture) {
return getLatestVersion(wizard, "upstream-linux-" + architecture, /^\d+\.0(\.\d+)?$/);

module.getLatestStableVersion = function (wizard, distribution, _package, architecture) {
const wineDistribution = distribution != null ? distribution : this._wineDistribution;
const winePackage = _package != null ? _package : this._winePackage;
const wineArchitecture = architecture != null ? architecture : this._wineArchitecture;
return getLatestVersion(wizard, `${wineDistribution}-${winePackage}-${wineArchitecture}`, /^\d+\.0(\.\d+)?$/);
}

module.getLatestDevelopmentVersion = function (wizard, architecture) {
return getLatestVersion(wizard, "upstream-linux-" + architecture, /^\d+\.\d+(\.\d+)?$/);
module.getLatestDevelopmentVersion = function (wizard) {
return getLatestVersion(wizard, `${this._wineDistribution}-${this._winePackage}-${this._wineArchitecture}`, /^\d+\.0(\.\d+)?$/);
}

module.getLatestStagingVersion = function (wizard, architecture) {
return getLatestVersion(wizard, "staging-linux-" + architecture, /^\d+\.\d+(\.\d+)?$/);
module.getLatestStagingVersion = function (wizard) {
const wineDistribution = this._winePackage === "darwin" ? "cx" : "staging";
return getLatestVersion(wizard, `${wineDistribution}-${this._winePackage}-${this._wineArchitecture}`, /^\d+\.0(\.\d+)?$/);
}

module.getLatestDosSupportVersion = function (/*wizard, architecture*/) {
Expand Down
1 change: 0 additions & 1 deletion Engines/Wine/QuickScript/Online Installer Script/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const { createTempFile } = include("utils.functions.filesystem.files");
module.default = class OnlineInstallerScript extends InstallerScript {
constructor() {
super();

this._installationArgs = [];
}

Expand Down
8 changes: 5 additions & 3 deletions Engines/Wine/QuickScript/Quick Script/script.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
const { getLatestStableVersion } = include("engines.wine.engine.versions");
const WineShortcut = include("engines.wine.shortcuts.wine");
const operatingSystemFetcher = Bean("operatingSystemFetcher");

module.default = class QuickScript {
constructor() {
this._winePackage = operatingSystemFetcher.fetchCurrentOperationSystem().getWinePackage()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
this._winePackage = operatingSystemFetcher.fetchCurrentOperationSystem().getWinePackage()
this._winePackage = operatingSystemFetcher.fetchCurrentOperationSystem().getWinePackage();

this._wineArchitecture = this._winePackage === "darwin" ? "x86on64" : "x86";
this._wineDistribution = this._winePackage === "darwin" ? "cx" : "upstream";
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prototyped field wineDistribution

this._wineVersionFunction = getLatestStableVersion;
this._wineArchitecture = "x86";
this._wineDistribution = "upstream";
this._wineUserSettings = false;

this._type = "Applications";
Expand Down Expand Up @@ -154,7 +156,7 @@ module.default = class QuickScript {
* @returns {void}
*/
_determineWineVersion(wizard) {
this._wineVersion = this._wineVersionFunction(wizard, this._wineArchitecture);
this._wineVersion = this._wineVersionFunction(wizard, this._wineDistribution, this._winePackage, this._wineArchitecture);
}

/**
Expand Down