From abb6d2e7e6c0b2567cae220de463bd054e399bb9 Mon Sep 17 00:00:00 2001 From: KatolaZ Date: Wed, 17 Jan 2018 12:17:41 +0000 Subject: tiny tweaks in parallel version -- working --- config_full.yml | 150 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ d1pkgweb.go | 27 +++++----- 2 files changed, 162 insertions(+), 15 deletions(-) create mode 100644 config_full.yml diff --git a/config_full.yml b/config_full.yml new file mode 100644 index 0000000..8d1ac97 --- /dev/null +++ b/config_full.yml @@ -0,0 +1,150 @@ +--- +PkgSets: + [ + { + Release: "jessie", + RepoURL: "http://pkgmaster.devuan.org", + Suites: + [ + { Name: "jessie", + Components: + [ + { Name: "main", URL: "/merged/dists/jessie/main/binary-amd64/Packages.gz"}, + { Name: "contrib", URL: "/merged/dists/jessie/contrib/binary-amd64/Packages.gz"}, + { Name: "non-free", URL: "/merged/dists/jessie/non-free/binary-amd64/Packages.gz"} + ] + }, + { Name: "jessie-updates", + Components: + [ + { Name: "main", URL: "/merged/dists/jessie-updates/main/binary-amd64/Packages.gz"}, + { Name: "contrib", URL: "/merged/dists/jessie-updates/contrib/binary-amd64/Packages.gz"}, + { Name: "non-free", URL: "/merged/dists/jessie-updates/non-free/binary-amd64/Packages.gz"} + ] + }, + { Name: "jessie-security", + Components: + [ + { Name: "main", URL: "/merged/dists/jessie-security/main/binary-amd64/Packages.gz"}, + { Name: "contrib", URL: "/merged/dists/jessie-security/contrib/binary-amd64/Packages.gz"}, + { Name: "non-free", URL: "/merged/dists/jessie-security/non-free/binary-amd64/Packages.gz"} + ] + }, + { Name: "jessie-backports", + Components: + [ + { Name: "main", URL: "/merged/dists/jessie-backports/main/binary-amd64/Packages.gz"}, + { Name: "contrib", URL: "/merged/dists/jessie-backports/contrib/binary-amd64/Packages.gz"}, + { Name: "non-free", URL: "/merged/dists/jessie-backports/non-free/binary-amd64/Packages.gz"} + ] + }, + { Name: "jessie-proposed-updates", + Components: + [ + { Name: "main", URL: "/merged/dists/jessie-proposed-updates/main/binary-amd64/Packages.gz"}, + { Name: "contrib", URL: "/merged/dists/jessie-proposed-updates/contrib/binary-amd64/Packages.gz"}, + { Name: "non-free", URL: "/merged/dists/jessie-proposed-updates/non-free/binary-amd64/Packages.gz"} + ] + }, + { Name: "jessie-proposed", + Components: + [ + { Name: "main", URL: "/devuan/dists/jessie-proposed/main/binary-amd64/Packages.gz"}, + { Name: "contrib", URL: "/devuan/dists/jessie-proposed/contrib/binary-amd64/Packages.gz"}, + { Name: "non-free", URL: "/devuan/dists/jessie-proposed/non-free/binary-amd64/Packages.gz"} + ] + } + ] + }, + { + Release: "ascii", + RepoURL: "http://pkgmaster.devuan.org", + Suites: + [ + { Name: "ascii", + Components: + [ + { Name: "main", URL: "/merged/dists/ascii/main/binary-amd64/Packages.gz"}, + { Name: "contrib", URL: "/merged/dists/ascii/contrib/binary-amd64/Packages.gz"}, + { Name: "non-free", URL: "/merged/dists/ascii/non-free/binary-amd64/Packages.gz"} + ] + }, + { Name: "ascii-updates", + Components: + [ + { Name: "main", URL: "/merged/dists/ascii-updates/main/binary-amd64/Packages.gz"}, + { Name: "contrib", URL: "/merged/dists/ascii-updates/contrib/binary-amd64/Packages.gz"}, + { Name: "non-free", URL: "/merged/dists/ascii-updates/non-free/binary-amd64/Packages.gz"} + ] + }, + { Name: "ascii-security", + Components: + [ + { Name: "main", URL: "/merged/dists/ascii-security/main/binary-amd64/Packages.gz"}, + { Name: "contrib", URL: "/merged/dists/ascii-security/contrib/binary-amd64/Packages.gz"}, + { Name: "non-free", URL: "/merged/dists/ascii-security/non-free/binary-amd64/Packages.gz"} + ] + }, + { Name: "ascii-backports", + Components: + [ + { Name: "main", URL: "/merged/dists/ascii-backports/main/binary-amd64/Packages.gz"}, + { Name: "contrib", URL: "/merged/dists/ascii-backports/contrib/binary-amd64/Packages.gz"}, + { Name: "non-free", URL: "/merged/dists/ascii-backports/non-free/binary-amd64/Packages.gz"} + ] + }, + { Name: "ascii-proposed-updates", + Components: + [ + { Name: "main", URL: "/merged/dists/ascii-proposed-updates/main/binary-amd64/Packages.gz"}, + { Name: "contrib", URL: "/merged/dists/ascii-proposed-updates/contrib/binary-amd64/Packages.gz"}, + { Name: "non-free", URL: "/merged/dists/ascii-proposed-updates/non-free/binary-amd64/Packages.gz"} + ] + }, + { Name: "ascii-proposed", + Components: + [ + { Name: "main", URL: "/devuan/dists/ascii-proposed/main/binary-amd64/Packages.gz"}, + { Name: "contrib", URL: "/devuan/dists/ascii-proposed/contrib/binary-amd64/Packages.gz"}, + { Name: "non-free", URL: "/devuan/dists/ascii-proposed/non-free/binary-amd64/Packages.gz"} + ] + } + ] + }, + { + Release: "ceres", + RepoURL: "http://pkgmaster.devuan.org", + Suites: + [ + { + Name: "ceres", + Components: + [ + { Name: "main", URL: "/merged/dists/ceres/main/binary-amd64/Packages.gz"}, + { Name: "contrib", URL: "/merged/dists/ceres/contrib/binary-amd64/Packages.gz"}, + { Name: "non-free", URL: "/merged/dists/ceres/non-free/binary-amd64/Packages.gz"} + ] + } + ] + }, + { + Release: "experimental", + RepoURL: "http://pkgmaster.devuan.org", + Suites: + [ + { + Name: "experimental", + Components: + [ + { Name: "main", URL: "/devuan/dists/experimental/main/binary-amd64/Packages.gz"}, + { Name: "contrib", URL: "/devuan/dists/experimental/contrib/binary-amd64/Packages.gz"}, + { Name: "non-free", URL: "/devuan/dists/experimental/non-free/binary-amd64/Packages.gz"} + ] + } + ] + } +] + + + + diff --git a/d1pkgweb.go b/d1pkgweb.go index d78f004..4fde257 100644 --- a/d1pkgweb.go +++ b/d1pkgweb.go @@ -40,20 +40,19 @@ func processSuite(suiteCfg SuiteCfg, relCfg ReleaseCfg, baseDir string, result c func processRelease(relCfg ReleaseCfg, baseDir string, result chan error) { - c := make(chan error) + children := make(chan error) numWorkers := 0 - for _, suiteCfg := range relCfg.Suites { // For each suite of the release + for _, suiteCfg := range relCfg.Suites { // For each suite in the release, run a processSuite numWorkers++ - go processSuite(suiteCfg, relCfg, baseDir, c) + go processSuite(suiteCfg, relCfg, baseDir, children) } - select { - case e := <-c: + for { + <-children numWorkers-- if numWorkers == 0 { - result <- e - return + break } } result <- nil @@ -72,22 +71,20 @@ func main() { confFile := args[1] conf := readConfig(confFile) - c := make(chan error) + children := make(chan error) numWorkers := 0 - for _, relCfg := range conf.PkgSets { // For each release... + for _, relCfg := range conf.PkgSets { // For each release, run a new processRelease... numWorkers++ - go processRelease(relCfg, ".", c) + go processRelease(relCfg, ".", children) } - var err = make([]error, numWorkers) - select { - case e := <-c: + for { + <-children numWorkers-- - err[numWorkers] = e if numWorkers == 0 { fmt.Fprintf(os.Stderr, "Exiting from main....") - os.Exit(0) + break } } } -- cgit v1.2.3