Feature KoLmafia version as a SVN dependency

fronobulax

Developer
Staff member
I am about to update a script that now uses the new versions of take_shop. It occurs to me that people will need r12905 or newer. Since the script is being distributed by SVN and we already have a dependencies, my request would be that dependencies.txt support a dependency of the form rxyzzy which is a KoLmafia revision.

The simplest thing would be to inform the user of a version mismatch if the mafia version was too old, but refusing to update the script would be even better.
 

Bale

Minion
I quite like the idea of failing to update, along with an error message, if the script is dependent on a higher version of KoLmafia.

That will keep scripts from automatically updating themselves into being unable to execute. Then if the version of KoLmafia gets updated, the script will finally update next time svn update is execute. An elegant solution.

Roippi, please do this! Please!
 

xKiv

Active member
I quite like the idea of failing to update, along with an error message, if the script is dependent on a higher version of KoLmafia.

You could even design it to look at earlier script revisions (not just HEAD) and update to the latest that still declares compatibility with the running revision of mafia!
 

roippi

Developer
There's a number of moving parts, but in general:

- There is no (reasonable) way to fail before a checkout (or update) operation. You have to have the file before you can read it. There are some server-unfriendly ways around this that I won't explore.
- It is possible to fail in between the checkout (or update) steps and pushing the files locally.

There are still issues to be worked around. The biggest that I can think of is that the current system is event driven - namely, file updates are pushed when an SVN_UPDATE event (those lines prepended with 'U' in the svn CLI) is triggered. In the proposed system, those will (correctly) fail if the mafia version does not meet what is required by dependencies.txt. However, then consider what happens when the user updates their mafia. They want svn update to push those now-okay files, but it won't. Why? In the svn/ folder, all the files are up-to-date. No SVN_UPDATE events will fire - until those files are again updated in the repository. Which could be a short time, or a long time.

This is a more serious problem than it sounds at first blush and I'm not sure how to get around it. We may just be limited to a warning message here.
 

Bale

Minion
Even a warning message would be a good thing. It will let the user know why his script might be failing and give advice about upgrading to a daily build along with a link to help him find that build.
 

fronobulax

Developer
Staff member
When I tried to specify what I wanted to happen at the level of tasks to be accomplished, I realized this was not going to be server friendly, easy or both. If I had to have the functionality I would probably keep reverting until I got something that met the version requirements but that is a lot of unnecessary server and file system activity.

I vote for recognizing "r" followed by digits as a KoLmafia revision number and if the number of what is running is "less than" the specified version, spitting out a message would be fine.
 

xKiv

Active member
I think that's good. Let the user decide between upgrading mafia, downgrading scripts, and errors.
 
Top