-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Add support for resetting of apps to be imported #5572
base: develop
Are you sure you want to change the base?
Add support for resetting of apps to be imported #5572
Conversation
if ($reset) { | ||
& "$PSScriptRoot\scoop-reset.ps1" $app | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should not be necessary, because juntion/shims/shorts/etc. of apps is point the latest version when update app.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it should not, but it is. As I described in the issue #5525 if install different versions of the same app, no install or update command gives you what you want.
Example: I have the apps python310 and python311 out of the versions bucket installed. python311 was the last one and so the shim python.exe points to that of python311. If I now import a scoopfile.json refering to python310, nothing is changed during import. I end up with the wrong python.exe in the PATH. Therefore the reset argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This happens after both python310
and python311
have been installed already, then the import operation is performed right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xxthunder technically, this is also not required. To see what I mean:
Lines 58 to 66 in 6cdcc75
create_shims $manifest $dir $global $architecture | |
create_startmenu_shortcuts $manifest $dir $global $architecture | |
install_psmodule $manifest $dir $global | |
env_add_path $manifest $dir $global $architecture | |
env_set $manifest $dir $global $architecture | |
# persist data | |
persist_data $manifest $original_dir $persist_dir | |
persist_permission $manifest $global |
The functions that scoop-reset
will run (see below) have already been run by scoop-install
(see above).
Lines 80 to 87 in 6cdcc75
create_shims $manifest $dir $global $architecture | |
create_startmenu_shortcuts $manifest $dir $global $architecture | |
env_add_path $manifest $dir $global $architecture | |
env_set $manifest $dir $global $architecture | |
# unlink all potential old link before re-persisting | |
unlink_persist_data $manifest $original_dir | |
persist_data $manifest $original_dir $persist_dir | |
persist_permission $manifest $global |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rashil2000 @HUMORCE I think this is not true. I want the reset no matter what is already installed. So if I import with, e.g., cmake version 3.24 in my scoopfile.json and cmake 3.24 and 3.26 both already installed and p3.26 was installed the last time. Then the shim cmake points to cmake 3.26. Now I can import my scoopfile as often as I want, nothing will be installed because 3.24 is already installed and nothing will be resetted. So the shim cmake points to cmake 3.26. Exactly this my problem with scoop import. My option --reset solves this.
6fab401
to
2811956
Compare
@xxthunder I don't think the update flag is required at all. There are basically three types of apps in the imported scoopfile: $app = if ($item.Source -in $bucket_names) {
"$($item.Source)/$($item.Name)"
} elseif ($item.Source -eq '<auto-generated>') {
"$($item.Name)@$($item.Version)"
} else {
$item.Source
}
Basically, only those apps, which belong to a particular bucket, are eligible for updates. And this is covered in the (1) scenario (because buckets are always up-to-date, as Scoop follows the rolling release model of updates). |
8ee47fb
to
2fa0e4f
Compare
@rashil2000 you are right, removed the update flag again. Added two small fixes in import and install. Please have a look when you have time. |
2fa0e4f
to
68c8ae1
Compare
68c8ae1
to
adce1ed
Compare
Check my comment on HUMORCE's thread. |
Description
Added a command line option for scoop import:
Motivation and Context
I use the import command quite often to define apps and their versions as dependencies in my projects. The reason for this is of course reproducibility of builds. But when different versions from different buckets of an app are already installed, it might still happen that the wrong apps and/or versions are used.
Closes #5525
How Has This Been Tested?
As there are no unit tests available for the changes file (actually there are no functions in scoop-import.ps1) I tested the changes exploratorily with my local scoopfile.json's.
My changes do affect the scoop import feature only.
Checklist:
develop
branch.