Closed davidcassany closed 6 years ago
Wouldn't it be easier to name the parameter "major-version" and use the regexp ?
Interesting idea, I have done it this way to be flexible, but it is true that probably there aren't many other use cases and having the regexp fixed makes it simpler to use, less error prone and _service
file cleaner. My doubt here is that ideally I'd like to be capable to catch three different cases at least (major
, major.minor
, major.minor.patch
) so it would lead to three different expressions: (\d+)
, (\d+(\.\d+){0,1})
and (\d+(\.\d+){0,2})
. Consider the following
<service name="replace_using_package_version" mode="buildtime">
<param name="file">mariadb-image.kiwi</param>
<param name="regex">%%TAG%%</param>
<param name="package">mariadb</param>
<param name="filter">minor</param>
</service>
Where filter
(or any other more convenient name) could only be: major | minor | patch
. Do you think it would make sense?
Wouldn't it be easier to name the parameter "major-version" and use the regexp ?
Interesting idea, I have done it this way to be flexible, but it is true that probably there aren't many other use cases and having the regexp fixed makes it simpler to use, less error prone and
_service
file cleaner. My doubt here is that ideally I'd like to be capable to catch three different cases at least (major
,major.minor
,major.minor.patch
) so it would lead to three different expressions:(\d+)
,(\d+(\.\d+){0,1})
and(\d+(\.\d+){0,2})
. Consider the following<service name="replace_using_package_version" mode="buildtime"> <param name="file">mariadb-image.kiwi</param> <param name="regex">%%TAG%%</param> <param name="package">mariadb</param> <param name="filter">minor</param> </service>
Where
filter
(or any other more convenient name) could only be:major | minor | patch
. Do you think it would make sense?
I think it would be easier, so yes.
The regexp can be a bit difficult to write and read.
Still internally you can use the regexp and if there is the use case about using a regexp in the _service file, it will be 80% implemented already.
This new flag is mostly used to match just a portion of the version of the requested package. This is handy when the package version includes more information of what we need (.e.g imagine we just want to use the major version).