diff --git a/AUTHORS b/AUTHORS index 166ad68c..8301df2c 100644 --- a/AUTHORS +++ b/AUTHORS @@ -23,3 +23,4 @@ List of contributors, in chronological order: * Benoit Foucher (https://github.com/bentoi) * Geoffrey Thomas (https://github.com/geofft) * Oliver Sauder (https://github.com/sliverc) +* Harald Sitter (https://github.com/apachelogger) diff --git a/api/graph.go b/api/graph.go index 66ed4444..0d11d706 100644 --- a/api/graph.go +++ b/api/graph.go @@ -39,6 +39,13 @@ func apiGraph(c *gin.Context) { buf := bytes.NewBufferString(graph.String()) + if ext == "dot" || ext == "gv" { + // If the raw dot data is requested, return it as string. + // This allows client-side rendering rather than server-side. + c.String(200, buf.String()) + return + } + command := exec.Command("dot", "-T"+ext) command.Stderr = os.Stderr diff --git a/deb/publish.go b/deb/publish.go index 98deb4c5..04dd221c 100644 --- a/deb/publish.go +++ b/deb/publish.go @@ -5,11 +5,6 @@ import ( "bytes" "encoding/json" "fmt" - "github.com/smira/aptly/aptly" - "github.com/smira/aptly/database" - "github.com/smira/aptly/utils" - "github.com/smira/go-uuid/uuid" - "github.com/ugorji/go/codec" "io/ioutil" "log" "os" @@ -18,6 +13,13 @@ import ( "strings" "sync" "time" + + "github.com/smira/go-uuid/uuid" + "github.com/ugorji/go/codec" + + "github.com/smira/aptly/aptly" + "github.com/smira/aptly/database" + "github.com/smira/aptly/utils" ) type repoSourceItem struct { @@ -677,7 +679,14 @@ func (p *PublishedRepo) Publish(packagePool aptly.PackagePool, publishedStorageP release["Components"] = strings.Join(p.Components(), " ") - for path, info := range indexes.generatedFiles { + sortedPaths := make([]string, 0, len(indexes.generatedFiles)) + for path := range indexes.generatedFiles { + sortedPaths = append(sortedPaths, path) + } + sort.Strings(sortedPaths) + + for _, path := range sortedPaths { + info := indexes.generatedFiles[path] release["MD5Sum"] += fmt.Sprintf(" %s %8d %s\n", info.MD5, info.Size, path) release["SHA1"] += fmt.Sprintf(" %s %8d %s\n", info.SHA1, info.Size, path) release["SHA256"] += fmt.Sprintf(" %s %8d %s\n", info.SHA256, info.Size, path) diff --git a/system/t12_api/graph.py b/system/t12_api/graph.py index 2f2a9f10..bc024fc2 100644 --- a/system/t12_api/graph.py +++ b/system/t12_api/graph.py @@ -15,3 +15,7 @@ class GraphAPITest(APITest): resp = self.get("/api/graph.svg") self.check_equal(resp.headers["Content-Type"], "image/svg+xml") self.check_equal(resp.content[:4], '