theos
theos copied to clipboard
Use plistutil instead of plutil on Linux
This is on head and on linux.
when doing:
FOR_RELEASE=1 make package
theos will assume the existence of plutil
which does not exist on Linux. and hence will crap out on
.theos/_ \( -name \*.plist -or -name \*.strings \) -exec plutil -convert binary1 {} \;
find: `plutil': No such file or directory
There is apparently a linux version called plistutil
but theos doesn't pick the right one appropriately. I will try to fix this as well and submit upstream when have time.
The relevant code is line 12 of makefiles/package.mk
Good catch. I'll wait for you to send a pull request.
Maybe have a _THEOS_PLATFORM_PLUTIL
on each makefiles/platform/*.mk?
This will require another dependency on linux either way, being as plistutils is not installed by default, package name on ubuntu/debian is libplist-utils
plutil
isn't a builtin tool on iOS either so it requires Erica Utilities.
(it didnt fix anything :(()
Want to get this fixed, but plistutil (and Apple’s open source plconvert) is really awful to automate as it assumes you know what the input is and that the output you want is the opposite (so binary plist always becomes XML; XML/NeXT always becomes binary). I’ll have to add a script that checks the first few bytes of the file for the binary plist magic bytes bplist
, and if not present then run plconvert.
This is still unresolved, so let’s keep this open.
I've created a somewhat decent wrapper for plistutil
on linux (it can only convert) that could be used. It requires (on Arch) libxml2
and plistutil
. Its here: https://gist.github.com/Finermeerkat137/e8119a8a8c82ab9c483ff3ccc2a5ea52
That looks like a good workaround. Thanks for sharing! I’ll play around with a solution soon.
Hi! I ran across this thread while Googling for the same thing myself. After looking at a few solutions for my own company (Screenplay) I decided to fork and iterate on a open-source, cross-platform, drop-in replacement for plutil
:
https://github.com/screenplaydev/plutil
It's forked from Facebook's xcbuild (a tool developed by them to build xcode projects on Linux), but stripped down to just provide plist-editting functionality. That way you won't need to maintain separate code-paths for Mac and Linux environments.
Hope that's helpful!
@tomasreimers That’s really useful, thanks! Too bad xcbuild was abandoned, there’s some solid work in there. Good to see people step up to maintaining forks of those tools.
In this case I’m thinking we may still just go ahead with using plistutil
, with a wrapper script that looks for the bplist magic bytes to decide whether conversion is needed. Just easier for distribution this way, since Theos itself doesn’t actually ship any binaries, and libplist-utils
should be in every distro.
@tomasreimers That’s really useful, thanks! Too bad xcbuild was abandoned, there’s some solid work in there. Good to see people step up to maintaining forks of those tools.
In this case I’m thinking we may still just go ahead with using
plistutil
, with a wrapper script that looks for the bplist magic bytes to decide whether conversion is needed. Just easier for distribution this way, since Theos itself doesn’t actually ship any binaries, andlibplist-utils
should be in every distro.
Since plutil is a macOS exclusive and both plutil and plistutil require an accompanying script to check for the bplist bytes anyway, was the idea to move the conversion over to plistutil for all platforms?
It looks like it's already available on every platform Theos supports -- jailbroken iOS via Elucubratus/Procursus' respective repos, macOS via brew, and common Linux distros via their accompanying stable/extra repos.
It would be ideal to just use plutil when it’s available to avoid an additional dependency when on macOS. iOS has sbingner’s plutil, which means the logic to support plistutil would only be required on Linux.
edit: I should clarify actually, it would just use one or the other based on what it finds in $PATH, so iOS with plistutil but no plutil would also work.
Gotcha. Okay, I might try and implement some or all of that when I get some free time. Will make a pr if I make any progress
Want to get this fixed, but plistutil (and Apple’s open source plconvert) is really awful to automate as it assumes you know what the input is and that the output you want is the opposite (so binary plist always becomes XML; XML/NeXT always becomes binary). I’ll have to add a script that checks the first few bytes of the file for the binary plist magic bytes
bplist
, and if not present then run plconvert.
plistutil has had -f
for a while which can be used to force a specific output format.
Fixed with c6da661
plistutil
has no support for NeXT style, so conversion from NeXT to binary will always fail.
I'm using WSL and got plutil.exe from the Apple Application Support
folder in my path. It would be great if theos could use that instead, since it supports NeXT style just fine.
I don't necessarily think adding explicit support for a platform-dependent tool is worthwhile when alternatives like ply
exist and work on all of the platforms supported by theos.
If you want to continue to use the .exe over ply
, I might recommend just creating an alias for plutil
so no edits or symlinks are required for the conversion script to work as-is.
I've actually created an alias for plutil, but the conversion script doesn't seem to care. Even though I get the alias when running command -v plutil
manually, the script keeps telling me that no supported pl tool was found. I might give ply a try though.
aliases don't work in scripts, you need to put a plutil
wrapper binary somewhere in your PATH.