[lxc-devel] [distrobuilder/master] sources: Use correct openSUSE tarball
monstermunchkin on Github
lxc-bot at linuxcontainers.org
Thu Feb 28 13:03:04 UTC 2019
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 364 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190228/954fcebc/attachment.bin>
-------------- next part --------------
From 9298056d8fa1802bee753db103672a00f11eae2a Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Thu, 28 Feb 2019 14:01:07 +0100
Subject: [PATCH] sources: Use correct openSUSE tarball
Signed-off-by: Thomas Hipp <thomas.hipp at canonical.com>
---
sources/opensuse-http.go | 26 ++++----------------------
1 file changed, 4 insertions(+), 22 deletions(-)
diff --git a/sources/opensuse-http.go b/sources/opensuse-http.go
index 4bb29c9..753e17d 100644
--- a/sources/opensuse-http.go
+++ b/sources/opensuse-http.go
@@ -12,9 +12,9 @@ import (
"path/filepath"
"strings"
- "github.com/lxc/distrobuilder/shared"
lxd "github.com/lxc/lxd/shared"
- "gopkg.in/antchfx/htmlquery.v1"
+
+ "github.com/lxc/distrobuilder/shared"
)
// OpenSUSEHTTP represents the OpenSUSE HTTP downloader.
@@ -102,25 +102,6 @@ func (s *OpenSUSEHTTP) Run(definition shared.Definition, rootfsDir string) error
return lxd.Unpack(filepath.Join(fpath, fname), rootfsDir, false, false, nil)
}
-func (s *OpenSUSEHTTP) getLatestBuild(URL string) string {
- doc, err := htmlquery.LoadURL(URL)
- if err != nil {
- return ""
- }
-
- if doc == nil {
- return ""
- }
-
- nodes := htmlquery.Find(doc, `//a[starts-with(text(),'opensuse')][ends-with(text(), 'tar.xz')][@href]/text()`)
-
- if nodes == nil {
- return ""
- }
-
- return nodes[len(nodes)-1].Data
-}
-
func (s *OpenSUSEHTTP) getPathToTarball(baseURL string, release string, arch string) string {
u, err := url.Parse(baseURL)
if err != nil {
@@ -157,7 +138,8 @@ func (s *OpenSUSEHTTP) getPathToTarball(baseURL string, release string, arch str
u.Path = path.Join(u.Path, "containers_ports")
}
- u.Path = path.Join(u.Path, s.getLatestBuild(u.String()))
+ u.Path = path.Join(u.Path, fmt.Sprintf("opensuse-leap-%s-image.%s-lxc.tar.xz", release,
+ arch))
}
return u.String()
More information about the lxc-devel
mailing list