-
Notifications
You must be signed in to change notification settings - Fork 21
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
version feature naming restriction is problematic #18
Comments
Looking into this a little more, digging through the commits that went into v2, it seems that the My crates do not conform to the 'v1_0' naming scheme, being of the form 'pa_v1'. This makes v2 impossible to use for my Although the v2 documentation for the crate says that crates "should" use the 'v1_0' scheme, it does not state that you absolutely must, or rather does not specifically state that whatever scheme you use, that it must start with a 'v'. Nor does it mention there being any difference from past versions. This was unhelpful. Additionally it would have been helpful/nice if there were a changelog or migration-guide highlighting such compatibility breaking differences between the versions, to assist users of older versions know what they need to know to upgrade. Now that I understand what the problem is, and considering that I can't just stick to v1 forever, and have no wish to switch naming schemes for my crate even if it were easy to do, I'll have a look at your code and have a think about how to remove the restriction you introduced under the new design. Going a little off topic now, but well... I'm also interested in how exactly version checks are being handled with respect to feature combinations. From your versioning example in the documentation, flag Edit: I should have read the docs more carefully before writing that paragraph, they clearly state that the highest version is picked. Additionally, I'm not a fan of the replacement of [package.metadata.system-deps.gstreamer_1_0]
name = "gstreamer-1.0"
version = "1.0"
v1_2.version = "1.2"
v1_4.version = "1.4"
v1_6.version = "1.6" Can that be combined with the If I'm correct, perhaps the documentation could be modified to cover this style instead or as well. It may help avoid potential users being put off using your crate by the messier form of version expression of v2. Edit: I guess maybe this might be another way, or more correct way, of expressing the above, and addresses one of the two aspects I needed to check: [package.metadata.system-deps.gstreamer_1_0]
name = "gstreamer-1.0"
version = "1.0"
v1_2 = { version = "1.2" }
v1_4 = { version = "1.4", name = "foo" }
v1_6 = { version = "1.6" } |
Sorry about the bumpy transition to v2. I (wrongly) assumed that gtk-rs & friends were the only users of I'm enforcing the I agree that the latest example is simpler and more elegant so I updated the doc to use this pattern. Thanks for the suggestion.
|
Well, no, you weren't wrong AFAIK; as I said, I was just the other day experimenting with switching to using Edit: I hope that my earlier criticisms did not come across as overly harsh.
Ok, great :) I had intended to spend some time thinking it through on Monday, but I became swamped with stuff I'm still working through and so all I accomplished was familiarising myself with some of the code a little and producing a trivial formatting improvement which I've not even PR'd yet. I'll get back to this as soon as I can.
👍
Great 👍 |
@jnqnfe : any specific improvement you'd need to be able to use |
Hi, very sorry, my attention got taken completely away from this for much longer than I expected. I'm afraid that not expecting to take so long to respond, I did not bother to write down the possible concepts that I had thought of to address the problem, and my recollection of them has become a little hazy :/, but let's see... So the key requirement was removing the feature naming restriction introduced in v2, but keeping in mind your forwards compatibility concern over the possibility of a need to introduce new keys in future. In no particular order... Solution 1 One thought was that version feature names usually if not always contain at least one numeric symbol, while your keys do not and highly likely never will. So a naming convention requirement of containing at least one numeric symbol instead of 'starts with a In fact your current solution to this forwards compatibility concern obviously only allows you to freely add new keys that do not start with a Solution 2 Another possible idea might have been to provide a key with which to override the prefix checked for ( Solution 3 Another idea was that it might simply be best to revert back to something more like what was done with v1: [package.metadata.system-deps.gstreamer_1_0]
name = "gstreamer-1.0"
version = "1.0"
feature-versions = {
v1_2 = { version = "1.2" }
v1_4 = { version = "1.4", name = "foo" }
v1_6 = { version = "1.6" }
} Thus all keys under I presume cargo toml allows this multi-line nested form? Solution 4 A final solution was a change in logic based upon presuming that it is possible to check a string against the list of available feature names (is this possible?) in order to try to determine what each key is. So for each key:
Evaluation
So essentially I guess I'd prefer solution 3 if possible. An aside A thought - v1 simply used key=value style for each feature, whilst v2 switched to tables. The dependency keys in cargo toml files are flexible, allowing either just a version to be specified in key=value form, or a table to be provided where multiple key=value properties need to be given. It might make things cleaner if each feature-version key could similarly offer such flexibility. |
We dropped [package.metadata.system-deps.gstreamer_gl_wayland_1_0.v1_16]
version = "1.16"
[package.metadata.system-deps.gstreamer_gl_wayland_1_0.v1_18]
name = "gstreamer-gl-wayland-1.0"
version = "1.18" So I'd rather not revert to the old format, discarding Solution 3. I don't think we can (easily) get the list of all features and I'd rather not reparse the whole That leaves us with solution 1, but we are replacing one syntax trick but another one. It will fix your specific use case but not the overall issue. @sdroege : any smart idea here? :) |
We have to be careful with assuming that keys containing numeric symbols are versions. With #33 we can now have this for example: [package.metadata.system-deps.'cfg(target_pointer_width = "64")'] |
Hi,
I'm exploring switching my
libpulse_sys
crate and its companions over tosystem-deps
frompkg-config
. Converting to v1.3 it seems to work, but upgrading to v2.0 I'm getting an error:Could you please take a look.
I've pushed the change to my
next
branch: https://github.com/jnqnfe/pulse-binding-rust/tree/nextThe second to last commit there is the conversion to v1.3 and the last commit is the problematic upgrade to v2.0.
Thanks. :)
The text was updated successfully, but these errors were encountered: