File tree Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,12 @@ func Generate() error {
42
42
43
43
// Write out the concatenated spec.
44
44
var spec bytes.Buffer
45
+
46
+ // First add a comment with the best guess of version
47
+ spec .WriteString ("\n ##QEMU SPECIFICATION VERSION: " )
48
+ spec .WriteString (tryGetVersionFromSpecPath (* inputSpec ))
49
+ spec .WriteString ("\n \n " )
50
+
45
51
for _ , def := range defs {
46
52
spec .WriteString (def .Docstring )
47
53
spec .WriteByte ('\n' )
Original file line number Diff line number Diff line change @@ -585,6 +585,18 @@ func pyToJSON(py []byte) []byte {
585
585
return ret
586
586
}
587
587
588
+ func tryGetVersionFromSpecPath (specPath string ) string {
589
+ retVersion := "UNKNOWN"
590
+ verPath , err := resolvePath (specPath , "VERSION" )
591
+ if err == nil {
592
+ verBuf , err := getQAPI (verPath )
593
+ if err == nil {
594
+ return string (verBuf )
595
+ }
596
+ }
597
+ return retVersion
598
+ }
599
+
588
600
func resolvePath (orig , new string ) (string , error ) {
589
601
u , err := url .Parse (orig )
590
602
if err != nil {
Original file line number Diff line number Diff line change
1
+
2
+ ##QEMU SPECIFICATION VERSION: 2.10.50
3
+
4
+
1
5
# Whitelists to permit QAPI rule violations; think twice before you
2
6
# add to them!
3
7
{
You can’t perform that action at this time.
0 commit comments