The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/distrobuilder/pull/173
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === Signed-off-by: Thomas Hipp <[email protected]>
From 2dd2a9a84697fec25e8bbdc9b7100a5fa45fcdb5 Mon Sep 17 00:00:00 2001 From: Thomas Hipp <[email protected]> Date: Tue, 7 May 2019 12:18:30 +0200 Subject: [PATCH] sources: Use fallback openSUSE image if needed Signed-off-by: Thomas Hipp <[email protected]> --- sources/opensuse-http.go | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/sources/opensuse-http.go b/sources/opensuse-http.go index bac65aa..0889ef2 100644 --- a/sources/opensuse-http.go +++ b/sources/opensuse-http.go @@ -11,6 +11,7 @@ import ( "path" "path/filepath" "regexp" + "sort" "strings" lxd "github.com/lxc/lxd/shared" @@ -166,14 +167,27 @@ func (s *OpenSUSEHTTP) getTarballName(u *url.URL, release, arch string) string { nodes := htmlquery.Find(doc, `//a/@href`) re := regexp.MustCompile(fmt.Sprintf("^opensuse-%s-image.*%s.*\\.tar.xz$", release, arch)) + var builds []string + for _, n := range nodes { text := htmlquery.InnerText(n) - if !re.MatchString(text) || strings.Contains(text, "Build") { + if !re.MatchString(text) { continue } - return text + if strings.Contains(text, "Build") { + builds = append(builds, text) + } else { + return text + } + } + + if len(builds) > 0 { + // Unfortunately, the link to the latest build is missing, hence we need + // to manually select the latest build. + sort.Strings(builds) + return builds[len(builds)-1] } return ""
_______________________________________________ lxc-devel mailing list [email protected] http://lists.linuxcontainers.org/listinfo/lxc-devel
