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

fix(decompress): use innoextract if innounp fails #4192

Closed
wants to merge 10 commits into from

Conversation

PorridgePi
Copy link

Right now, the latest version of innounp (0.49) does not support newer versions of Inno Setup (like version 6.1.0). While the issue has already been raised on its SourceForge (here and here), an update to innounp does not seem imminent.

As a result, many applications could not be installed due to decompress error. These include ScoopInstaller/Extras#5223 ScoopInstaller/Extras#5213 and many more which I would list at the end.

I found dscharrer/innoextract. It is well supported and updated, and it works with the newer versions of Inno Setup. Thus, I edited decompress.ps1 so that if innounp fails, innoextract will be tried. I have also edited the code of depends.ps1 and core.ps1 to make innoextract dependent.

I apologise in advance if my pull request and/or commit is not up to the standard because I am somewhat inexperienced. However, I still hope this would help others who are facing this issue.

Thanks!

Known Issues:
ScoopInstaller/Extras#5223
ScoopInstaller/Extras#5213
ScoopInstaller/Extras#5218
ScoopInstaller/Extras#5136
ScoopInstaller/Extras#5127
ScoopInstaller/Extras#5186
ScoopInstaller/Extras#5225

Copy link
Contributor

@Ash258 Ash258 left a comment

Choose a reason for hiding this comment

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

Unacceptable to have two same dependencies for one thing. Allow it as config option.

Same as for lessmsi

  • Do not use tabs
  • Never ever use 'linux-like' commands/aliases in powershell scripts

@PorridgePi
Copy link
Author

I have changed according to your suggestions.
I am only unsure of the config name. For now, I left it as innoex as the prefix instead of the original inno.

lib/install.ps1 Outdated
@@ -582,6 +582,8 @@ function dl_urls($app, $version, $manifest, $bucket, $architecture, $dir, $use_c
$extract_fn = $null
if ($manifest.innosetup) {
$extract_fn = 'Expand-InnoArchive'
} elseif($manifest.innoexsetup) {
$extract_fn = 'Expand-InnoExArchive'
} elseif($fname -match '\.zip$') {
# Use 7zip when available (more fast)
if (((get_config 7ZIPEXTRACT_USE_EXTERNAL) -and (Test-CommandAvailable 7z)) -or (Test-HelperInstalled -Helper 7zip)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

You need to use something like this:

Best possible add simple switch parameter (-UseInnoExtract or just -InnoExtract) to expand-innoarchive function

Copy link
Contributor

@Ash258 Ash258 Dec 2, 2020

Choose a reason for hiding this comment

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

I take it back. Sorry.

Only use this in depends:

if ($manifest.innosetup) { if (get_config 'INNOSETUP_USE_INNOEXTRACT' $false) { $depends += 'innoextract' } } else { $depends += 'innounp' }

And then inside decompress, inside function Expand-InnoArchive use same logic:

if get_config ''... {
 $Stratus = INvoke-external Innoextract
} else  {
$status = Invoke-External innounp }

Copy link
Author

@PorridgePi PorridgePi Dec 2, 2020

Choose a reason for hiding this comment

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

You need to use something like this:

Thanks! I did not understand at first.

Best possible add simple switch parameter (-UseInnoExtract or just -InnoExtract) to expand-innoarchive function

Yea, that is indeed better. I shall try that out later in the day.

Copy link
Author

Choose a reason for hiding this comment

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

Hi, to add the switch parameter/option, do I edit scoop-install.ps1 and scoop-update.ps1 in scoop\libexec?

Copy link
Author

Choose a reason for hiding this comment

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

@Ash258 May I know how exactly do I add a switch parameter? Thanks.

@rasa
Copy link
Member

rasa commented Dec 3, 2020

To implement a complete solution, I searched for innounp and found we should consider also updating:

  1. appveyor.yml
  2. test/bin/init.psl
  3. libexec/scoop-checkup.ps1

@PorridgePi
Copy link
Author

Hi, may I know if there is anything else for me to improve on? Maybe other than the switch parameter @Ash258 suggested?

@Ash258
Copy link
Contributor

Ash258 commented Dec 7, 2020

Well this will not work for most of the packages.

Since innoextract is only simple implementation it cannot be used the same way as innounp. See all manifests, which have two different architectures coming from single inno archive.

It does not support extraction the same way as innounp, which will break lots of other stuff if this is configured.

It would make sense to force it only for the relevant. So introducing new switch to the Expand-Inno function and then change all the relevant manifests should solve it.

The configuration option could stay for some experiments and for future when innoextract catch up.

So I would propose to just add new switch UseInnoextract to the function and then apply simple condition if get_config -or $UseInnoextract, then use innoextract, with message to user, that it could fail in some use cases

@PorridgePi
Copy link
Author

Apologies for not responding.

Thank you so much for your guidance and explanation.

Following your instructions, I have added the new switch parameter UseInnoextract to both scoop install and scoop update, as well as an warning when the user tries to use this parameter to install and/or update an application.

lib/decompress.ps1 Outdated Show resolved Hide resolved
lib/install.ps1 Outdated
@@ -9,7 +9,7 @@ function nightly_version($date, $quiet = $false) {
"nightly-$date_str"
}

function install_app($app, $architecture, $global, $suggested, $use_cache = $true, $check_hash = $true) {
function install_app($app, $architecture, $global, $suggested, $use_cache = $true, $check_hash = $true, $useinnoextract) {
Copy link
Contributor

@Ash258 Ash258 Dec 12, 2020

Choose a reason for hiding this comment

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

It will be patched in manifests itself. with Expand-InnoArchive -UseInnoextract

It is nonsense to have additional switch, and 20 checks for this.

Remove

Copy link
Author

Choose a reason for hiding this comment

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

Sorry, I did not understand the part about the patch being in the manifest instead. Really sorry for the hassle caused.

Copy link
Author

Choose a reason for hiding this comment

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

The patches in the manifest should be something similar to the instaler script in this manifest, right?

lib/install.ps1 Outdated Show resolved Hide resolved
lib/install.ps1 Outdated Show resolved Hide resolved
lib/install.ps1 Outdated Show resolved Hide resolved
libexec/scoop-update.ps1 Outdated Show resolved Hide resolved
libexec/scoop-update.ps1 Outdated Show resolved Hide resolved
libexec/scoop-update.ps1 Outdated Show resolved Hide resolved
libexec/scoop-update.ps1 Outdated Show resolved Hide resolved
libexec/scoop-update.ps1 Outdated Show resolved Hide resolved
@Ash258 Ash258 mentioned this pull request Dec 26, 2020
21 tasks
@niheaven
Copy link
Member

Not needed.

@niheaven niheaven closed this May 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants