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

_init_repo.sh (for Linux) doesn't work at all because it's missing a shebang (and other issues) #93

Closed
T3HM3T4L opened this issue Jan 25, 2023 · 28 comments

Comments

@T3HM3T4L
Copy link
Contributor

The _init_repo.sh doesn't start off with the usual "#!/bin/bash" so it wasn't able to run.
Adding it as the first line made it at least successfully create the .git folder and pull the main branch.

The second problem is _init_repo.sh is looking for "_build_ps3.sh" and "_build_xbox.sh" which do not exist, they're .bat files.

I'm willing to take a shot at rewriting these to .sh because they don't seem to be very long and even with what little experience I have, they just seem to do the following:

  • Pull main branch
  • Move the PS3/X360 files (whichever aren't needed) to a temporary location
  • Build the ark using dir2ark, if there's an error: tell the user the ark build failed
  • Move the PS3/X360 files (whichever weren't needed) back
  • Successful ark build message A, failed ark build message B

As long as dir2ark works on Linux, I think I should be able to do this.

@jnackmclain
Copy link
Member

The sh files were removed months ago. If you like, you can try out the refactoring branch of this repo. The scripts were rewritten in python to be platform agnostic to avoid this exact problem. This branch is very new and hasn't been fully tested yet to merge into main

@T3HM3T4L
Copy link
Contributor Author

The sh files were removed months ago. If you like, you can try out the refactoring branch of this repo. The scripts were rewritten in python to be platform agnostic to avoid this exact problem. This branch is very new and hasn't been fully tested yet to merge into main

Neat. So I pull the refactoring branch and run the "build_ps3.py" to do it this way?

The reason I tried building instead of continue using the pre-built Actions is because I wanted to try out a little something regarding album art.

RB3's QOTSA's No One Knows album art isn't the same as RB1's Go With the Flow. One of them is stretched slightly differently vertically. I think people may not have noticed (or paid attention to) this before since there's officially only 2 songs off that album, meaning RB3 doesn't group them together as an album.

@jnackmclain
Copy link
Member

Build_ps3.py should be correct

@T3HM3T4L
Copy link
Contributor Author

Build_ps3.py should be correct

I gave it a shot and the terminal hit me with:

"dir2ark: line 1: dependenciesarkhelper.exe: command not found"

I suppose that has to be "dependencies/arkhelper.exe" or for Linux specifically likely "dependencies/arkhelper".

@jnackmclain
Copy link
Member

@rjkiv
Like I said, brand new has some kinks. But yeah should be dependencies/arkhelper

@T3HM3T4L
Copy link
Contributor Author

@rjkiv Like I said, brand new has some kinks. But yeah should be dependencies/arkhelper

No problem. I'll just await the eventual merge before doing anything else then I guess.
Feel free to contact me if there's a need to do any Linux testing.

@jnackmclain
Copy link
Member

Well, that's the thing, you testing right now is the perfect opportunity to try out the refactoring branch. We barely get any Linux users so if there is someone verifying things work there while we verify windows, it would be greatly appreciated

@T3HM3T4L
Copy link
Contributor Author

Well, that's the thing, you testing right now is the perfect opportunity to try out the refactoring branch. We barely get any Linux users so if there is someone verifying things work there while we verify windows, it would be greatly appreciated

Would love to. How would I best be able to help?
Just keeping an eye out on updates and trying it out from time to time while opening issues?

@jnackmclain
Copy link
Member

Well, I'm not in a position to push a fix to the script at the moment. Can you try updating that line locally and see if it works? If it does I'll push at my next availability. Better than waiting for an update if you are already in it

@T3HM3T4L
Copy link
Contributor Author

Changing the line from

cmd_build = f"dependencies\arkhelper.exe dir2ark _ark {build_location} -n {patch_hdr_version} -e -v 6".split()
to
cmd_build = f"dependencies/arkhelper dir2ark _ark {build_location} -n {patch_hdr_version} -e -v 6".split()

got rid of the "command not found" prompt, it now opens up arkhelper in the terminal with arkhelper saying

"ERROR(S):
No verb selected."

Followed by

Traceback (most recent call last):
File "/mnt/Archive/ROCK BAND 3 WORKING FOLDER/RB3D/user_scripts/build_ps3.py", line 6, in
build_patch_ark(False)
File "/mnt/Archive/ROCK BAND 3 WORKING FOLDER/RB3D/user_scripts/../dependencies/dev_scripts/build_ark.py", line 54, in build_patch_ark
rm_tree(root_dir.joinpath("_tmp"))
File "/mnt/Archive/ROCK BAND 3 WORKING FOLDER/RB3D/user_scripts/../dependencies/dev_scripts/build_ark.py", line 13, in rm_tree
pth.rmdir()
File "/usr/lib/python3.10/pathlib.py", line 1215, in rmdir
self._accessor.rmdir(self)
FileNotFoundError: [Errno 2] No such file or directory: '/mnt/Archive/ROCK BAND 3 WORKING FOLDER/RB3D/_tmp'

Which I understand to be Python trying to remove the tmp directory which wasn't created.
I think the problem is getting the "arkhelper dir2ark _ark {build_location} -n {patch_hdr_version} -e -v 6" information input into "dependencies/arkhelper" location, if that makes sense.

@jnackmclain
Copy link
Member

Sounds like hugh has some issues to work through. Thanks for checking

@rjkiv
Copy link
Contributor

rjkiv commented Jan 25, 2023

@T3HM3T4L try the build script now

@T3HM3T4L
Copy link
Contributor Author

@T3HM3T4L try the build script now

Tried it but still the same result with "dir2ark: line 1: dependenciesarkhelper: command not found" popping up again, so it doesn't correctly run through the if/else.
When I removed the if/else, the "dir2ark command not found" error went away, but just the same situation as before the last updates.

@rjkiv
Copy link
Contributor

rjkiv commented Jan 25, 2023

@T3HM3T4L try the build script now

Tried it but still the same result with "dir2ark: line 1: dependenciesarkhelper: command not found" popping up again, so it doesn't correctly run through the if/else. When I removed the if/else, the "dir2ark command not found" error went away, but just the same situation as before the last updates.

Apologies, try running it now - I think the issue might be the fact that UNIX likes forward slashes over backslashes for paths.

@T3HM3T4L
Copy link
Contributor Author

No problem.

This time we get

File "/mnt/Archive/ROCK BAND 3 WORKING FOLDER/RB3D/user_scripts/build_ps3.py", line 4, in
from build_ark import build_patch_ark
File "/mnt/Archive/ROCK BAND 3 WORKING FOLDER/RB3D/user_scripts/../dependencies/dev_scripts/build_ark.py", line 45
cmd_build = f"dependencies/arkhelper dir2ark _ark {build_location.replace('\','/')} -n {patch_hdr_version} -e -v 6".split()
^
SyntaxError: f-string expression part cannot include a backslash

Getting closer.

@rjkiv
Copy link
Contributor

rjkiv commented Jan 25, 2023

ok now try

@T3HM3T4L
Copy link
Contributor Author

T3HM3T4L commented Jan 26, 2023

Good news: we're making progress.

I successfully built an ark using the terminal so we just need to make some adjustments to fit that into the python script.

I moved arkhelper and dtab (I explicitly had to make both of them executable to get around "permission denied") to the root directory (RB3D) and ran
"./arkhelper dir2ark _ark _build/ps3/USRDIR/gen -n patch_ps3 -e -v 6"
which to my knowledge was executed successfully in a gen folder with patch_ps3.hdr (184,9 kb) and patch_ps3_0.ark (305,6 mb).

So it comes down to a matter of formatting the cmd_build command for Linux in a way it understands it needs to target arkhelper (the file) and input "dir2ark _ark _build/ps3/USRDIR/gen -n patch_ps3 -e -v 6" into it.
Currently the Python script seems to be targeting the entirety of the command in full.

Build location will still need the backslashes replaced by forward slashes, which I see you've tried to implement but it hasn't come into play yet.

Also note that it looks like you currently replace double \ with / on line 27, but singular backslashes will also need to be replaced by /.

Perhaps this would be useful to solve both problems at once
https://medium.com/@ageitgey/python-3-quick-tip-the-easy-way-to-deal-with-file-paths-on-windows-mac-and-linux-11a072b58d5f

@rjkiv
Copy link
Contributor

rjkiv commented Jan 27, 2023

I looked at the build_ark and process_textures scripts once more, and pushed a new commit that hopefully fixes things this time. Thanks for bearing with me during this!

@T3HM3T4L
Copy link
Contributor Author

No, thank you guys for putting in the effort to make the project platform agnostic. Lesser devs wouldn't have bothered and say something like "Just use the pre-built Actions" instead.
Two days ago I didn't even know how to run a Python script at all so we're all better off now.

Pulled the refactoring branch from scratch into a new folder, ran the build_ps3.py script and it worked without a hitch!
I tested the newly built ark in RPCS3 to be sure and it works fine.

Additional questions

  • How do I build the "additional keys" version? Do I run "add_rb3_plus_keys.py" once or do I have to do it every time I wish to build a newer version of the ark?
  • How would I go about replacing RB3's No One Knows album art? I noticed "_ark/songs/radarlove/gen" exists for example, to change main setlist art. The reason I ask is because as I mentioned earlier, the album art for RB3's No One Knows and RB1's Go With the Flow are not the same file. I was willing to figure it out myself but perhaps it would be better for it to be handled by someone upstream who already handled those other art updates?

@exoticri
Copy link
Contributor

to change the album art, create a directory named nooneknows/gen in the _ark/songs folder and add the .png_xbox or .png_ps3 there

@T3HM3T4L
Copy link
Contributor Author

to change the album art, create a directory named nooneknows/gen in the _ark/songs folder and add the .png_xbox or .png_ps3 there

Worked like a charm.

I tried running the "add_rb3_plus_keys.py" script but it spit back
"line 6, in
import git
ModuleNotFoundError: No module named 'git'"

I assume it's a remnant from before what was changed add_devbuild.py last week.

@rjkiv
Copy link
Contributor

rjkiv commented Jan 30, 2023

In the refactoring branch, keys have now been pre-installed into an action build exclusively - it got to be too cumbersome to be able to toggle it locally.

As for your "No module named git" error, you need to install the gitpython module - do that by running "pip install gitpython". You should only need this module if you plan on toggling animations, though - no other script requires this locally.

@rjkiv
Copy link
Contributor

rjkiv commented Jan 30, 2023

The way this branch was refactored, anything the end-user would need to run in order to modify their game is under the user_scripts directory - I believe the keys script is in dev_scripts, to be run on GitHub Actions when preparing the keys build of RB3DX.

@rjkiv
Copy link
Contributor

rjkiv commented Jan 30, 2023

But at any rate, is your build of RB3DX pulled from this branch lookin' good? All the scripts work as intended?

@T3HM3T4L
Copy link
Contributor Author

I'm fine with using the keys Action build in the future. I only really wanted to build RB3DX locally for that album art issue.
Can the changed album art be added to the project? I made the folder and included both the ps3 and xbox version of the png.

I ran all the user scripts and besides the me-issue of trying to run them with a parent folder containing spaces (ROCK BAND 3 WORKING FOLDER), they all ran fine after moving everything to a different path location without spaces.
Everything seemed to be in order but animated objects (gems, smashers etc) were invisible but otherwise worked.

I manually copied all the textures to the _ark/ui/track location, rebuilt and then it all worked.

I think it's line 32 in enable_animation.py
repo_root_path = str(f).replace(f"{str(root_dir)}\dependencies\rbdx_animated_textures\", "")
that needs reworking.

@rjkiv
Copy link
Contributor

rjkiv commented Jan 31, 2023

fixed. NOW, everything should be good to go

@T3HM3T4L
Copy link
Contributor Author

T3HM3T4L commented Feb 1, 2023

fixed. NOW, everything should be good to go

Yup, works like a charm now.

@jnackmclain
Copy link
Member

refactoring branch officially merged into main

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

No branches or pull requests

4 participants