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

Updates using factorio-updater do not work for 2.x #207

Open
bioxz opened this issue Oct 21, 2024 · 5 comments · May be fixed by #209
Open

Updates using factorio-updater do not work for 2.x #207

bioxz opened this issue Oct 21, 2024 · 5 comments · May be fixed by #209

Comments

@bioxz
Copy link
Contributor

bioxz commented Oct 21, 2024

I guess due to a changed package name, using the update function does not work for 2.x

Due to a change of the --version output of the binary, updates are not working for the 2.x version.

$ /opt/factorio/factorio-init/factorio update -l

Running updater in --dry-run mode, no patches will be applied
Checking for updates...
Traceback (most recent call last):
  File "/opt/factorio/factorio-updater/update_factorio.py", line 295, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/factorio/factorio-updater/update_factorio.py", line 279, in main
    updates, latest = pick_updates(j, args.package, for_version, args.experimental)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/factorio/factorio-updater/update_factorio.py", line 85, in pick_updates
    for row in updater_json[factorio_package]:
               ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
KeyError: 'core-linux_headless'
Update check failed!

Factorio 1.x prints a Binary version, while 2.x prints just a Version:

Version: 1.1.108 (build 62305, linux64, headless)
Binary version: 64
Map input version: 0.18.0-0
Map output version: 1.1.108-0
Version: 2.0.8 (build 79416, linux64, headless)
Version: 64
Map input version: 1.0.0-0
Map output version: 2.0.8-1

This leads to the 64 missing in the package name.

Running the updater by hand did work (at least from 2.0.7 stable to 2.0.8 experimental). The server-init itself is also still running well.

@Beanux
Copy link

Beanux commented Oct 26, 2024

quick answer to patch it on the related issue of the related repos.
narc0tiq/factorio-updater#66 (comment)

@narc0tiq
Copy link

I will not accept a patch to mangle the provided input; please either make factorio-init supply the correct argument to --package or don't send one at all.

@narc0tiq
Copy link

narc0tiq commented Oct 26, 2024

Here is the relevant place to fix in factorio-init:

factorio-init/factorio

Lines 559 to 561 in 94e9499

function get_bin_arch(){
as_user "$BINARY --version |egrep '^Binary version: ' |egrep -o '[0-9]{2}'"
}

You can't look only for Binary version because now it might be Version; honestly, given that 32-bit versions stopped existing many years ago, you can probably just keep it a static 64 and be fine for the next few decades (indeed, that's what #209 does).

@Beanux
Copy link

Beanux commented Oct 26, 2024

You were just too fast for me.

Here is what's returned by factorio --version and than can be helped to determine the version:

Version: 2.0.10 (build 79578, linux64, headless)
Version: 64

Either Version: 64 or linux64 could be the one to determine arch.
I'll make something work based on linux64 and provide it here, but i don't have the knowledge of previous versions and if it would work or if you want to keep support 32 bit version that's not existent anymore.

Edit: here is the patch proposed, it detect 64 bit version, and keep the same system (just returning the command rather than conditionnal test).

diff --git a/factorio b/factorio
index 3fb7ad3..b9389d1 100755
--- a/factorio
+++ b/factorio
@@ -557,7 +557,7 @@ function get_bin_version(){
 }
 
 function get_bin_arch(){
-  as_user "$BINARY --version |egrep '^Binary version: ' |egrep -o '[0-9]{2}'"
+  as_user "$BINARY --version |egrep '^Version: ' |egrep -o 'linux[0-9]{2}' |egrep -o '[0-9]{2}'"
 }

@bioxz
Copy link
Contributor Author

bioxz commented Oct 27, 2024

Here is the relevant place to fix in factorio-init:

factorio-init/factorio

Lines 559 to 561 in 94e9499

function get_bin_arch(){
as_user "$BINARY --version |egrep '^Binary version: ' |egrep -o '[0-9]{2}'"
}

You can't look only for Binary version because now it might be Version; honestly, given that 32-bit versions stopped existing many years ago, you can probably just keep it a static 64 and be fine for the next few decades (indeed, that's what #209 does).

Right, I did not comment here again, but I don't think it's worth to fix the architecture detection (which is always dangerous, as it does not rely on a documented API, it could break at any time again) and instead just assume it's always the 64 bit build. I can't really image that there are any users who want to use the latest version of this repo to update a years old Factorio version. In the worst case one could always take an old version of this repo, which was fully working for the older versions of Factorio.

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 a pull request may close this issue.

3 participants