pharo-project / pharo-launcher

Lets you manage your pharo images and download new ones
https://pharo-project.github.io/pharo-launcher/
MIT License
108 stars 46 forks source link

Image create command with implicit template uses older stable version #652

Open Bajger opened 5 months ago

Bajger commented 5 months ago

Describe the bug When creating new image, without specifying template, old version of stable Pharo is used.

To Reproduce Steps to reproduce the behavior:

  1. Execute: ./pharo-launcher image create my2
  2. See log:
    Creating the local Pharo image based on template: Pharo 10.0 - 64bit (stable).
    Please wait a moment.
    Done!
  3. P10 version for stable version is used, but should be P11.

Expected behavior Latest stable Pharo version should be used P11 (instead of P10).

Screenshots If applicable, add screenshots to help explain your problem.

Version information:

Expected development cost Probably it has something to do with dowloading sources template list. I tried following, but it didn't really help:


cmd := PhLImageCreateCliCommand new.
cmd pharoLauncherModel: PharoLauncherCLIModel fromDefaultConfiguration.
PhLPharoTemplateSources checkForUpdates.
cmd latestStableTemplate 
demarey commented 5 months ago

It is working for me. It is because you have an outdated sources.list file. By the way, there is a missing feature to check if the official sources file changed (as for UI version)

Bajger commented 5 months ago

t is because you have an outdated sources.list file.

It could be, but it didn't help even if I called PhLPharoTemplateSources checkForUpdates. It should update list templates, right?

By the way, there is a missing feature to check if the official sources file changed (as for UI version)

Do we want to have explicit command for this? I guess it shouldn't be updated everytime I invoke CLI command. What do you think?

demarey commented 5 months ago

t is because you have an outdated sources.list file.

It could be, but it didn't help even if I called PhLPharoTemplateSources checkForUpdates. It should update list templates, right?

It will just check but if you had no notification and did not accept the update, nothing will happen.

Do we want to have explicit command for this? I guess it shouldn't be updated everytime I invoke CLI command. What do you think?

Not every time. With poor (or no) internet connexion, pharo launcher will be unusable. We should have a way to determine the last check. I think one time a day is already enough. A command is not mandatory if we do so.

Bajger commented 5 months ago

I used this, seen UI to check updates (notification), but still image templates aren't updated.

|cmd|
PhLTemplateSourcesUpdateChecker uniqueInstance check.
cmd := PhLImageCreateCliCommand new.
cmd pharoLauncherModel: PharoLauncherCLIModel fromDefaultConfiguration.

cmd latestStableTemplate 
demarey commented 5 months ago

PhLTemplateSourcesUpdateChecker>>#basicUpdateTemplateSources is in charge of updating sources. But it uses PharoLauncherApplication. so, not so good for CI. What should be done in CLI:

  1. Check for a new possible sources file: PhLTemplateSourcesUpdateChecker uniqueInstance check.. It will fetch a sources.list.dl file and compare it againts the sources.listfile. If they are different, a PhLSourcesFileUpdateAvailableannoucement is announced. PhLTemplateSourcesUpdateChecker listen to this announcement and will trigger: PhLTemplateSourcesUpdateChecker>>#updateTemplateSources:.
  2. Probably PhLTemplateSourcesUpdateChecker should be updated to better handle both UI and CLI update because we have refererences to PharoLauncherApplication in the code
    
    updateTemplateSources: announcement
    PharoLauncherApplication default shouldUpdateTemplateSources ifFalse: [ ^ self ].
    self basicUpdateTemplateSources

basicUpdateTemplateSources PhLPharoTemplateSources fromFile updateSourcesFile. PharoLauncherApplication resetTemplateRepository. PharoLauncherApplication default resetTemplateRepository.



- `PharoLauncherApplication default shouldUpdateTemplateSources ifFalse: [ ^ self ].` should be updated to do not reference directly the PharoLauncherApplication. Then we could either ask the update confirmation with a spec dialog (UI) or in the console (CLI)
Bajger commented 5 months ago

PharoLauncherApplication default shouldUpdateTemplateSources ifFalse: [ ^ self ]. should be updated to do not reference directly the PharoLauncherApplication.

This is because to get rid of dependency / separation of business logic and UI?

Then we could either ask the update confirmation with a spec dialog (UI) or in the console (CLI)

Do we want to have interactive confirmation (Y/N) also in CLI? Or you mean non interactive (proceed with update will be always Yes).

Bajger commented 5 months ago

One other catchup: I think there is something wrong with update checker, I've worked on P11 image with loaded dev branch of PharoLauncher and it freezes after restart of image. I think it is related to template update checker. Maybe to report in separate issue? image

Update: Reported additional issue: #658