Closed LeSpocky closed 9 years ago
So what I tried to test is the regexes. For that I used the following shell-script:
#!/bin/bash
echo $1 \
| sed -e 's/^\(v[^-]\+\)-\([0-9]\+-g[0-9a-f]\{7\}.*\)$$/\1+\2/' \
| sed -e 's/^\(v[^-]\+\)-\(beta.*\)$$/\1~\2/' \
| sed -e 's/^\(v[^~]\+~beta[^-]\+\)-\([0-9]\+-g[0-9a-f]\{7\}.*\)$$/\1+\2/' \
| sed -e 's/^v//'
With the result, that the first replacement works, the others don't i.e. # v0.31-4-gf390c9d --> v0.31+4-gf390c9d works the other replacements suggested from the comments don't.
@bastinat0r Could you please revert the escape sequences necessary for makefiles in your shell script? Just replace $$ with $.
So, nochmal getestet, die Testcases in site.mk
waren falsch, richtig (direkt aus meinem Test-Skript):
v0.31-4-gf390c9d --> 0.31+4-gf390c9d
v0.32-beta.1 --> 0.32~beta.1
v0.30-beta.1-2-g11c8a08-dirty --> 0.30~beta.1+2-g11c8a08-dirty
v0.31-beta.1 --> 0.31~beta.1
v0.31 --> 0.31
v0.31-1-gf00b455 --> 0.31+1-gf00b455
v0.32-beta.1-1-gfad0123 --> 0.32~beta.1+1-gfad0123
v0.31-beta.1-dirty --> 0.31~beta.1-dirty
v0.31-beta.1-2-g1234567 --> 0.31~beta.1+2-g1234567
v0.32-dirty --> 0.32-dirty
v0.32-3-g7654321 --> 0.32+3-g7654321
v0.32-3-g7654321-dirty --> 0.32+3-g7654321-dirty
…anch
actually for beta first '-' is replaced by '~', for experimental first '-' is replaced by '+' with an additional rule for experimental builds following a beta tag. This allows version order recognized by opkg as follows:
v0.31~beta.1 < v0.31 < v0.31+1-gf00b455 < v0.32~beta.1 < v0.32~beta.1+1-gfad0123
And even more:
v0.31~beta.1-dirty < v0.31~beta.1+2-g1234567 v0.32-dirty < v0.32+3-g7654321 < v0.32+3-g7654321-dirty
Ich hoffe, ich habe keine Fehler in die Reg-Ex gebaut. Testen ist leider nicht so ganz trivial, weil man diese changes hier extrahieren müsste, verschiedene alte Versionsstände auschecken und dagegen prüfen. Fehler finden in RegEx durch scharf klappt vielleicht auch? ;-)