mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-04 05:10:40 +00:00
Final round of updates, everything except mirror download should be ready
This commit is contained in:
+33
-39
@@ -2,12 +2,11 @@ package deb
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"os"
|
||||
"io/ioutil"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
|
||||
"github.com/smira/aptly/files"
|
||||
"github.com/smira/aptly/utils"
|
||||
|
||||
. "gopkg.in/check.v1"
|
||||
)
|
||||
@@ -367,15 +366,12 @@ func (s *PackageSuite) TestLinkFromPool(c *C) {
|
||||
publishedStorage := files.NewPublishedStorage(c.MkDir(), "", "")
|
||||
p := NewPackageFromControlFile(s.stanza)
|
||||
|
||||
poolPath, _ := packagePool.Path(p.Files()[0].Filename, p.Files()[0].Checksums)
|
||||
err := os.MkdirAll(filepath.Dir(poolPath), 0755)
|
||||
c.Assert(err, IsNil)
|
||||
tmpFilepath := filepath.Join(c.MkDir(), "file")
|
||||
c.Assert(ioutil.WriteFile(tmpFilepath, nil, 0777), IsNil)
|
||||
|
||||
file, err := os.Create(poolPath)
|
||||
c.Assert(err, IsNil)
|
||||
file.Close()
|
||||
p.Files()[0].PoolPath, _ = packagePool.Import(tmpFilepath, p.Files()[0].Filename, &p.Files()[0].Checksums, false)
|
||||
|
||||
err = p.LinkFromPool(publishedStorage, packagePool, "", "non-free", false)
|
||||
err := p.LinkFromPool(publishedStorage, packagePool, "", "non-free", false)
|
||||
c.Check(err, IsNil)
|
||||
c.Check(p.Files()[0].Filename, Equals, "alien-arena-common_7.40-2_i386.deb")
|
||||
c.Check(p.Files()[0].downloadPath, Equals, "pool/non-free/a/alien-arena")
|
||||
@@ -396,48 +392,46 @@ func (s *PackageSuite) TestFilepathList(c *C) {
|
||||
}
|
||||
|
||||
func (s *PackageSuite) TestDownloadList(c *C) {
|
||||
packagePool := files.NewPackagePool(c.MkDir())
|
||||
p := NewPackageFromControlFile(s.stanza)
|
||||
p.Files()[0].Checksums.Size = 5
|
||||
poolPath, _ := packagePool.Path(p.Files()[0].Filename, p.Files()[0].Checksums)
|
||||
c.Fail()
|
||||
/*
|
||||
packagePool := files.NewPackagePool(c.MkDir())
|
||||
p := NewPackageFromControlFile(s.stanza)
|
||||
p.Files()[0].Checksums.Size = 5
|
||||
poolPath, _ := packagePool.Path(p.Files()[0].Filename, p.Files()[0].Checksums)
|
||||
|
||||
list, err := p.DownloadList(packagePool)
|
||||
c.Check(err, IsNil)
|
||||
c.Check(list, DeepEquals, []PackageDownloadTask{
|
||||
{
|
||||
RepoURI: "pool/contrib/a/alien-arena/alien-arena-common_7.40-2_i386.deb",
|
||||
DestinationPath: poolPath,
|
||||
Checksums: utils.ChecksumInfo{Size: 5,
|
||||
MD5: "1e8cba92c41420aa7baa8a5718d67122",
|
||||
SHA1: "46955e48cad27410a83740a21d766ce362364024",
|
||||
SHA256: "eb4afb9885cba6dc70cccd05b910b2dbccc02c5900578be5e99f0d3dbf9d76a5"}}})
|
||||
list, err := p.DownloadList(packagePool)
|
||||
c.Check(err, IsNil)
|
||||
c.Check(list, DeepEquals, []PackageDownloadTask{
|
||||
{
|
||||
RepoURI: "pool/contrib/a/alien-arena/alien-arena-common_7.40-2_i386.deb",
|
||||
DestinationPath: poolPath,
|
||||
Checksums: utils.ChecksumInfo{Size: 5,
|
||||
MD5: "1e8cba92c41420aa7baa8a5718d67122",
|
||||
SHA1: "46955e48cad27410a83740a21d766ce362364024",
|
||||
SHA256: "eb4afb9885cba6dc70cccd05b910b2dbccc02c5900578be5e99f0d3dbf9d76a5"}}})
|
||||
|
||||
err = os.MkdirAll(filepath.Dir(poolPath), 0755)
|
||||
c.Assert(err, IsNil)
|
||||
err = os.MkdirAll(filepath.Dir(poolPath), 0755)
|
||||
c.Assert(err, IsNil)
|
||||
|
||||
file, err := os.Create(poolPath)
|
||||
c.Assert(err, IsNil)
|
||||
file.WriteString("abcde")
|
||||
file.Close()
|
||||
file, err := os.Create(poolPath)
|
||||
c.Assert(err, IsNil)
|
||||
file.WriteString("abcde")
|
||||
file.Close()
|
||||
|
||||
list, err = p.DownloadList(packagePool)
|
||||
c.Check(err, IsNil)
|
||||
c.Check(list, DeepEquals, []PackageDownloadTask{})
|
||||
list, err = p.DownloadList(packagePool)
|
||||
c.Check(err, IsNil)
|
||||
c.Check(list, DeepEquals, []PackageDownloadTask{})*/
|
||||
}
|
||||
|
||||
func (s *PackageSuite) TestVerifyFiles(c *C) {
|
||||
p := NewPackageFromControlFile(s.stanza)
|
||||
|
||||
packagePool := files.NewPackagePool(c.MkDir())
|
||||
poolPath, _ := packagePool.Path(p.Files()[0].Filename, p.Files()[0].Checksums)
|
||||
|
||||
err := os.MkdirAll(filepath.Dir(poolPath), 0755)
|
||||
c.Assert(err, IsNil)
|
||||
tmpFilepath := filepath.Join(c.MkDir(), "file")
|
||||
c.Assert(ioutil.WriteFile(tmpFilepath, []byte("abcde"), 0777), IsNil)
|
||||
|
||||
file, err := os.Create(poolPath)
|
||||
c.Assert(err, IsNil)
|
||||
file.WriteString("abcde")
|
||||
file.Close()
|
||||
p.Files()[0].PoolPath, _ = packagePool.Import(tmpFilepath, p.Files()[0].Filename, &p.Files()[0].Checksums, false)
|
||||
|
||||
result, err := p.VerifyFiles(packagePool)
|
||||
c.Check(err, IsNil)
|
||||
|
||||
Reference in New Issue
Block a user