2017w49-50: obs-service-tar_scm version rewrite regular expression
Spent time working on setting up this blog and writing initial posts, issue triage, and package list wrapper rewrite. Otherwise, no outcomes of interest.
last year
Added version rewrite using a regex pattern and replacement to obs-service-tar_scm
. Rather than workaround version with a leading v
like v1.0.0
, as is common, the version is rewritten during execution of the _service
file to 1.0.0
. An example can be found in the adminer
package that I maintain.
<services>
<service name="tar_scm" mode="disabled">
<param name="versionformat">@PARENT_TAG@</param>
<param name="versionrewrite-pattern">v(.*)</param>
<param name="revision">refs/tags/v4.4.0</param>
<param name="url">https://github.com/vrana/adminer.git</param>
<param name="scm">git</param>
<param name="changesgenerate">enable</param>
</service>
<service name="recompress" mode="disabled">
<param name="compression">xz</param>
<param name="file">*.tar</param>
</service>
<service name="set_version" mode="disabled"/>
</services>
The relevant bit being:
<param name="versionrewrite-pattern">v(.*)</param>
as the default for versionrewrite-replacement
is \1
. This approach ends up with a cleanly named:
adminer-1.0.0.tar.xz
that is consistent with the spec Version
of 1.0.0
instead of
adminer-v1.0.0.tar.xz
A goal was to eventually expand this to support revision
patterns like 1.*.*
, or similar, so the service can be run in such a way as to update the version, but is still reproducible rather than pointing at head
. The same concept behind the lock file in many language specific package managers.