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

Improve error message when dashes are used in PROVIDES or REQUIRES entries #240

Open
ghost opened this issue Feb 21, 2023 · 7 comments
Open

Comments

@ghost
Copy link

ghost commented Feb 21, 2023

I'm trying to package a command call diff-so-fancy.
The script is just a single perl script downloaded from github without external deps, hence a rather easy recipe.

I have in my recipe:

PROVIDES="
	cmd:diff-so-fancy
	"

Now this gives me the error

        recipe for diff_so_fancy-1.4.3 is still broken:
        Error: evaluating file /boot/home/proj/haikuports/app-misc/diff-so-fancy/work-1.4.3/port.recipe produced illegal value "cmd:diff-so-fancy" for key PROVIDES
        Error: dashes are not allowed in provides- or requires declarations

What should be done instead? escaping does not work. Is it ment to not be possible to package command names with dashes in them?

@augiedoggie
Copy link
Contributor

augiedoggie commented Feb 21, 2023

https://github.com/haikuports/haikuports/wiki/HaikuPorter-HandlingRequirements#requiring-a-command

This is for REQUIRES instead of PROVIDES, but the same applies.

@ghost
Copy link
Author

ghost commented Feb 21, 2023

This would mean that haikuporter cannot distinquish between underscores and dashes?

@pulkomandy
Copy link
Member

Yes, but it never was a problem so far.

@ghost
Copy link
Author

ghost commented Feb 21, 2023

Alright. That seems really strange to me, I'll assume it's a problem with using sh.
Anyhow, this should be better documented in the error that haikuporter spits out.

@augiedoggie
Copy link
Contributor

I don't recall the exact reason but I believe it's to make parsing of package names/contents easier since a dash will always be a separator and not part of the package name or something.

@pulkomandy
Copy link
Member

yes, this is not a bug but an intentional choice. The provides/requires can't have dashes so the dash always separates the package name and the package version and there is no risk of confusion.

It seems unlikely we could have two different commands, one with underscores and the other with dashes. If that was the case, we would probably rename one to avoid the risof mixing them up? So this restriction is acceptable and solves a lot of other possible confusion cases.

What do you want to be documented? "replace dashes with underscores"?

@ghost
Copy link
Author

ghost commented Feb 21, 2023

the line that haikuporter gives " Error: dashes are not allowed in provides- or requires declarations"
doesn't give any indication what can be done to mitigate it, which leads to some guessing what to do:
rename the command in the recipe?
substitute the char with something else?
escape the chars?

It wasn't obvious, atleast to me, that the solution is "replace with underscore", so i think haikuporter should simply suggest this when encountering it.
e.g " Error: dashes are not allowed in provides- or requires declarations. Underscores can be used instead"

@pulkomandy pulkomandy changed the title Can't package command with dashes in it Improve error message when dashes are used in PROVIDES or REQUIRES entries Mar 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants