]> xenbits.xensource.com Git - people/gdunlap/xsatool/commitdiff
A number of miscellaneous fixes
authorGeorge Dunlap <george.dunlap@citrix.com>
Fri, 5 May 2017 14:04:58 +0000 (15:04 +0100)
committerGeorge Dunlap <george.dunlap@citrix.com>
Fri, 5 May 2017 14:23:38 +0000 (15:23 +0100)
* In main(), actually include the xsa number in the printf when the load fails

* Load and save the actual xsa file (xsa.git/xsaNNN.meta) rather than
  the global meta file.  "Normalize" (set the xsa number for recipes) on load.

* Use the correct path for QEMU_TRADITIONAL_URL

Signed-off-by: George Dunlap <george.dunlap@citrix.com>
main.go
meta.go
recipe.go

diff --git a/main.go b/main.go
index e8437066b1e50f146de38efd2b0e6416fcd7ba50..7c737c160dbb8ed8fc618ac5b33ceac236b2e555 100644 (file)
--- a/main.go
+++ b/main.go
@@ -132,8 +132,8 @@ func main() {
        if loadXSA {
                err = xsa.Load(xsanum)
                if err != nil {
-                       fmt.Printf("Loading xsa%d metadata: %v\n",
-                               err)
+                       fmt.Printf("Loading xsa-%d metadata: %v\n",
+                               xsanum, err)
                        os.Exit(1)
                }
        }
diff --git a/meta.go b/meta.go
index 33e8091bf7e85a6d623b6efde29f67cc6324bc02..511384d49201665a90dd5102b4e1cb1e888246b5 100644 (file)
--- a/meta.go
+++ b/meta.go
@@ -216,10 +216,8 @@ func (m *XSAMeta) GetRecipe(v XenVersion) (*Recipe) {
        return nil
 }
 
-func (m *XSAMeta) Normalize() {
-       for i := range m.Recipes {
-               m.Recipes[i].xsa = m.XSA
-       }
+func getXSAPath(xsanum int) (string) {
+       return fmt.Sprintf("%s/xsa%d.meta", config.Tool.GetPath(TreeXSA), xsanum)
 }
 
 func (xm *XSAMeta) Load(xsanum int) (err error) {
@@ -227,8 +225,7 @@ func (xm *XSAMeta) Load(xsanum int) (err error) {
                return fmt.Errorf("Tool config not loaded")
        }
 
-       filename := fmt.Sprintf("%s/xsa%d.meta",
-               config.Tool.GetPath(TreeXSA), xsanum)
+       filename := getXSAPath(xsanum)
        
        b, err := ioutil.ReadFile(filename)
        if err != nil {
@@ -237,7 +234,7 @@ func (xm *XSAMeta) Load(xsanum int) (err error) {
                        xm.XSA = xsanum
                        return nil
                } else {
-                       return fmt.Errorf("Opening global metadata file %s: %v\n", filename, err)
+                       return fmt.Errorf("Opening xsa metadata file %s: %v\n", filename, err)
                }
        }
 
@@ -250,6 +247,11 @@ func (xm *XSAMeta) Load(xsanum int) (err error) {
                return fmt.Errorf("Invalid input: Expecting xsa %d, got %d\n",
                        xsanum, xm.XSA)
        }
+
+       for i := range xm.Recipes {
+               xm.Recipes[i].xsa = xm.XSA
+       }
+
        return
 }
 
@@ -263,7 +265,10 @@ func (xm *XSAMeta) Save() (err error) {
                return fmt.Errorf("Marshalling config: %v", err)
        }
 
-       filename := config.Tool.GetPath(TreeXSA) + "/" + GlobalMetaFilename
+       filename := getXSAPath(xm.XSA)
+
+       fmt.Printf("Saving metadata in file %s\n", filename)
+       
        err = ioutil.WriteFile(filename, b, 0666)
        if err != nil {
                return fmt.Errorf("Writing config: %v", err)
index 9378179caab80f7edb5a1250c7c0e40fd7a93f82..48e28fbc18d678f5e9f4a4ba8a49b06075a7a116 100644 (file)
--- a/recipe.go
+++ b/recipe.go
@@ -376,7 +376,7 @@ func (r *Recipe) Build(prefix string) (err error) {
        config += "SEABIOS_UPSTREAM_URL ?= file://"+mirrorpath+"seabios.git\n"
        config += "MINIOS_UPSTREAM_URL ?= file://"+mirrorpath+"mini-os.git\n"
        config += "QEMU_UPSTREAM_URL ?= file://"+repos.XenRepos[TreeQemuU].GetPath()+"\n"
-       config += "QEMU_TRADITIONAL_URL ?= file://"+repos.XenRepos[TreeQemuU].GetPath()+"\n"
+       config += "QEMU_TRADITIONAL_URL ?= file://"+repos.XenRepos[TreeQemuT].GetPath()+"\n"
        
        if r.Recipes[TreeQemuU].HasPatches() {
                config += "QEMU_UPSTREAM_REVISION = origin/"+branch+"\n"