Am Dienstag, 13. September 2011, 12:58:33 schrieb Troy Telford:
On 2011-09-13 10:38:08 +0000, Togan Muftuoglu said:
Is there a way to store the output of various commands ie "hg log" "hg parents" in a variable when using service files like tar_scm or set_version
Writing/editing the source service scripts isn't particularly hard - but it requires you have root access on the OBS server. (Not a problem if you run your own OBS service like I do, but it's much more difficult if you're using build.opensuse.org).
If you do have root access, you can modify (or better copy & modify) tar_scm so that it stores the output of your scm output ('hg log', etc.) in a file located in ${MYOUTDIR} - then the file becomes "known" to OBS as _service:tar_scm:somefile.txt.
Of course, this assumes you have root access to the obs server.
Or just make a patch which makes general sense and we take it for the official obs-service packages :)
If nothting else, it may be instructive to look at the tar_scm source code (it's just a shell script) to understand how it works. I know with git, there is an auto versioning code path that puts the git commit sha1 in the tarball's version string. I imagine hg has something similar.
That is not such a good idea, because the version would not be steady increasing anymore. That will cause problems with rpm, zypper and friends.