-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
clamav-server: Fix startupitems for MacPorts 2.6.3 #7917
Conversation
Travis Build #13052 Failed. Lint results
Port clamav-server fail on xcode10.3. Log |
Note that if you don't want MacPorts to interpolate variable values and procedure calls inside a string, you can save yourself a lot of backslashes by using |
However |
@ryandesign Do you know a one-liner to coax tcl into prepending a tab onto a This obvious answer doesn’t work and ignores the leading whitespace: $ echo [concat "\t" {foo bar}]
foo bar |
The simplest workaround would be to use spaces instead of tabs. |
I found a less morally objectionable approach: % echo [string replace {\tfoo bar} 0 1 "\t"]
foo bar |
That works. But isn't indenting with spaces easier to read in the portfile, and isn't whitespace irrelevant in the resulting shell script? |
echo { foo bar}
foo bar 🤯 🤓 Been thinking way too hard about this one. |
2840035
to
448ec22
Compare
The trailing backslashes present other issues with tcl strings. It's easiest just to do string control within |
Travis Build #13443 Passed. Lint results
Port clamav-server success on xcode10.3. Log |
I'll merge this, but I hope you will continue to work toward simplifying the port and making it easier to read. In its current state, it is too complex for any other developer to be likely to want to touch it, and that would become a problem for us if at some point you became unable to continue maintaining the port. The same applies to some of your other ports. Just to speak one last time about the backslashes and provide a concrete example, your portfile now says:
I find that hard to read with all the backslashes. I find the following a little easier to read:
It could even be:
You don't have to use the same string style on every line. If you want variable interpolation on some lines, you can use Just some things to think about. |
@ryandesign I have a version that does what you suggest; it’s also important to keep the bash script readable. I threw in the towel when none of the tcl tricks I’m aware of worked to add a trailing backslash If you or someone knows the trick for that, please post, and I’ll convert to more readable strings within the Portfile. |
Perhaps this is the answer. |
I don't recall encountering this situation before, but, trying it now, I see what you mean. I just think it reinforces what I said before elsewhere: constructing a shell script or function line by line in Tcl code is going to be inherently cumbersome and difficult to read. Yes, startupitems has this capability to build up scripts by specifying successive lines as arguments, but the feature is so seldom used that I don't know of any ports that use it other than yours. Especially when you don't need to interpolate values from Tcl, it could be easier to put the script into a separate file in the files directory—easier to read, easier to edit. You could install the separate scripts somewhere and have the script in startupitems call them. Or with a little more work you could have the portfile read in the contents of those separate scripts, perhaps even replace some placeholders with variable values if needed, and then pass the contents directly to startupitems. |
…sible * See macports#7917 (comment) * Add necessary Full Disk Access notes for macOS 10.14+
…sible * See #7917 (comment) * Add necessary Full Disk Access notes for macOS 10.14+
clamav-server: Fix startupitems for MacPorts 2.6.3
Description
Type(s)
Tested on
macOS 10.15.6 19G73
Xcode 11.6 11E708
Verification
Have you
port lint
?sudo port test
?sudo port -vst install
?