You are not logged in.
I'm working on a git package for the fork of openscenegraph at https://github.com/OpenMW/osg .
The package will built recommended plugins for openmw only.
$ git describe --long | sed 's/^OpenSceneGraph-//;s/\([^-]*-g\)/r\1/;s/-/./g'
$ 3.5.10.r289.gecedf3232
This looks ok at first , but the 3.5.10 doesn't match CMakelists.txt and the 289 is only relevant against 3.5.10 tag.
$ echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
$ 15768.ecedf3232
This gives number of commits since start and short hash, which is useful.
top of CMakelIsts.txt
#
# OpenSceneGraph CMake build file
#
SET(OPENSCENEGRAPH_MAJOR_VERSION 3)
SET(OPENSCENEGRAPH_MINOR_VERSION 7)
SET(OPENSCENEGRAPH_PATCH_VERSION 0)
SET(OPENSCENEGRAPH_SOVERSION 160)
How can I extract the 3 7 0 from CMakelists.txt and combine them with $(git rev-list --count HEAD).$(git rev-parse --short HEAD) so it forms 3.7.0.15768.ecedf3232 as version ?
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
clean chroot building not flexible enough ?
Try clean chroot manager by graysky
Offline
untested:
_major_ver=$(sed -n '/^SET(OPENSCENEGRAPH_MAJOR_VERSION .*)$/ {s/[^0-9]//g;p}' CMakelists.txt)
awk match would work just as well.
Last edited by Scimmia (2019-12-25 06:07:43)
Offline
If you are going to use sed, you may as well get all three numbers with one invocation:
sed -n '
1,9 {
/^SET.*_VERSION/ {
s/[^0-9]*\([0-9]*\).*/\1/
H
}
}
$ {
x
s/^\n//
s/\n/./g
p
}
' CMakeLists.txt
Or if you prefer a single but ugly (and butt-ugly) line:
sed -n '1,9{/^SET.*_VERSION/{s/[^0-9]*\([0-9]*\).*/\1/;H;};};${x;s/^\n//;s/\n/./g;p;}' CMakeLists.txt
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
Sorry for not answering sooner.
I did start an awk tutorial and tried to understand the sed miltiliner, but both gave me the feeling I was using a supercomputer to play twonky .
For those who never heard of twonky :
It's a text based maze game that was popular when a tty was a physical device that connected you with a mini computer or mainframe in another room.
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
clean chroot building not flexible enough ?
Try clean chroot manager by graysky
Offline