From 4c7ddc0e6775e2127eed65ec1107565e6e7e6319 Mon Sep 17 00:00:00 2001 From: Thomas Hipp Date: Wed, 1 Dec 2021 10:54:39 +0100 Subject: [PATCH 1/2] sources: Drop Sabayon The sabayon project no longer exists. Signed-off-by: Thomas Hipp --- sources/sabayon.go | 73 ---------------------------------------------- sources/source.go | 1 - 2 files changed, 74 deletions(-) delete mode 100644 sources/sabayon.go diff --git a/sources/sabayon.go b/sources/sabayon.go deleted file mode 100644 index 757faf0b..00000000 --- a/sources/sabayon.go +++ /dev/null @@ -1,73 +0,0 @@ -package sources - -import ( - "crypto/md5" - "fmt" - "net/http" - "net/url" - "path" - "path/filepath" - - lxd "github.com/lxc/lxd/shared" - - "github.com/lxc/distrobuilder/shared" -) - -type sabayon struct { - common -} - -// Run downloads a Sabayon tarball. -func (s *sabayon) Run() error { - var baseURL string - - fname := fmt.Sprintf("Sabayon_Linux_DAILY_%s_tarball.tar.gz", - s.definition.Image.ArchitectureMapped) - tarballPath := fmt.Sprintf("%s/%s", s.definition.Source.URL, fname) - - var ( - resp *http.Response - err error - ) - - err = shared.Retry(func() error { - resp, err = http.Head(tarballPath) - if err != nil { - return fmt.Errorf("Failed to HEAD %q: %w", tarballPath, err) - } - - return nil - }, 3) - if err != nil { - return err - } - - baseURL, fname = path.Split(resp.Request.URL.String()) - - url, err := url.Parse(fmt.Sprintf("%s/%s", baseURL, fname)) - if err != nil { - return fmt.Errorf("Failed to parse URL %q: %w", fmt.Sprintf("%s/%s", baseURL, fname), err) - } - - var fpath string - - // From sabayon currently we have only MD5 checksum for now. - if s.definition.Source.SkipVerification { - fpath, err = s.DownloadHash(s.definition.Image, url.String(), "", nil) - } else { - fpath, err = s.DownloadHash(s.definition.Image, url.String(), url.String()+".md5", md5.New()) - } - if err != nil { - return fmt.Errorf("Failed to download %q: %w", url.String(), err) - } - - s.logger.Infow("Unpacking image", "file", filepath.Join(fpath, fname)) - - // Unpack - err = lxd.Unpack(filepath.Join(fpath, fname), s.rootfsDir, false, false, nil) - if err != nil { - return fmt.Errorf("Failed to unpack %q: %w", filepath.Join(fpath, fname), err) - } - - return nil -} diff --git a/sources/source.go b/sources/source.go index f07a1434..c597de34 100644 --- a/sources/source.go +++ b/sources/source.go @@ -42,7 +42,6 @@ var downloaders = map[string]func() downloader{ "plamolinux-http": func() downloader { return &plamolinux{} }, "rockylinux-http": func() downloader { return &rockylinux{} }, "rootfs-http": func() downloader { return &rootfs{} }, - "sabayon-http": func() downloader { return &sabayon{} }, "springdalelinux-http": func() downloader { return &springdalelinux{} }, "ubuntu-http": func() downloader { return &ubuntu{} }, "voidlinux-http": func() downloader { return &voidlinux{} }, From 1eb815c5193679b0532799362cc013f0f9a06c14 Mon Sep 17 00:00:00 2001 From: Thomas Hipp Date: Wed, 1 Dec 2021 10:55:04 +0100 Subject: [PATCH 2/2] managers: Drop luet This manager was used by Sabayon which no longer exists. Signed-off-by: Thomas Hipp --- managers/luet.go | 87 --------------------------------------------- managers/manager.go | 1 - 2 files changed, 88 deletions(-) delete mode 100644 managers/luet.go diff --git a/managers/luet.go b/managers/luet.go deleted file mode 100644 index 150e8f23..00000000 --- a/managers/luet.go +++ /dev/null @@ -1,87 +0,0 @@ -package managers - -import ( - "errors" - "fmt" - "os" - "path/filepath" - "strings" - - lxd "github.com/lxc/lxd/shared" - - "github.com/lxc/distrobuilder/shared" -) - -type luet struct { - common -} - -func (m *luet) load() error { - m.commands = managerCommands{ - clean: "luet", - install: "luet", - refresh: "luet", - remove: "luet", - update: "luet", - } - - m.flags = managerFlags{ - global: []string{}, - clean: []string{ - "cleanup", - }, - install: []string{ - "install", - }, - refresh: []string{ - "repo", "update", - }, - remove: []string{ - "uninstall", - }, - update: []string{ - "upgrade", - }, - } - - return nil -} - -func (m *luet) manageRepository(repoAction shared.DefinitionPackagesRepository) error { - var targetFile string - - if repoAction.Name == "" { - return errors.New("Invalid repository name") - } - - if repoAction.URL == "" { - return errors.New("Invalid repository url") - } - - if strings.HasSuffix(repoAction.Name, ".yml") { - targetFile = filepath.Join("/etc/luet/repos.conf.d", repoAction.Name) - } else { - targetFile = filepath.Join("/etc/luet/repos.conf.d", repoAction.Name+".yml") - } - - if !lxd.PathExists(filepath.Dir(targetFile)) { - err := os.MkdirAll(filepath.Dir(targetFile), 0755) - if err != nil { - return fmt.Errorf("Failed to create directory %q: %w", filepath.Dir(targetFile), err) - } - } - - f, err := os.OpenFile(targetFile, os.O_CREATE|os.O_WRONLY, 0644) - if err != nil { - return fmt.Errorf("Failed to open file %q: %w", targetFile, err) - } - defer f.Close() - - // NOTE: repo.URL is not an URL but the content of the file. - _, err = f.WriteString(repoAction.URL) - if err != nil { - return fmt.Errorf("Failed to write string to %q: %w", targetFile, err) - } - - return nil -} diff --git a/managers/manager.go b/managers/manager.go index d1d859cb..1fd72bab 100644 --- a/managers/manager.go +++ b/managers/manager.go @@ -64,7 +64,6 @@ var managers = map[string]func() manager{ "dnf": func() manager { return &dnf{} }, "egoportage": func() manager { return &egoportage{} }, "equo": func() manager { return &equo{} }, - "luet": func() manager { return &luet{} }, "opkg": func() manager { return &opkg{} }, "pacman": func() manager { return &pacman{} }, "portage": func() manager { return &portage{} },