New upstream version 1.3.0

This commit is contained in:
Sébastien Delafond
2018-06-21 15:14:48 +02:00
parent bed9fffa94
commit 09ad0121c6
2288 changed files with 452573 additions and 68516 deletions
+2 -2
View File
@@ -1,8 +1,8 @@
package files
import (
"github.com/smira/aptly/aptly"
"github.com/smira/aptly/utils"
"github.com/aptly-dev/aptly/aptly"
"github.com/aptly-dev/aptly/utils"
)
type mockChecksumStorage struct {
+2 -2
View File
@@ -11,8 +11,8 @@ import (
"github.com/smira/go-uuid/uuid"
"github.com/smira/aptly/aptly"
"github.com/smira/aptly/utils"
"github.com/aptly-dev/aptly/aptly"
"github.com/aptly-dev/aptly/utils"
)
// PackagePool is deduplicated storage of package files on filesystem
+2 -2
View File
@@ -8,8 +8,8 @@ import (
"runtime"
"syscall"
"github.com/smira/aptly/aptly"
"github.com/smira/aptly/utils"
"github.com/aptly-dev/aptly/aptly"
"github.com/aptly-dev/aptly/utils"
. "gopkg.in/check.v1"
)
+15 -4
View File
@@ -8,8 +8,8 @@ import (
"strings"
"syscall"
"github.com/smira/aptly/aptly"
"github.com/smira/aptly/utils"
"github.com/aptly-dev/aptly/aptly"
"github.com/aptly-dev/aptly/utils"
)
// PublishedStorage abstract file system with public dirs (published repos)
@@ -97,12 +97,18 @@ func (storage *PublishedStorage) PutFile(path string, sourceFilename string) err
// Remove removes single file under public path
func (storage *PublishedStorage) Remove(path string) error {
if len(path) <= 0 {
panic("trying to remove empty path")
}
filepath := filepath.Join(storage.rootPath, path)
return os.Remove(filepath)
}
// RemoveDirs removes directory structure under public path
func (storage *PublishedStorage) RemoveDirs(path string, progress aptly.Progress) error {
if len(path) <= 0 {
panic("trying to remove the root directory")
}
filepath := filepath.Join(storage.rootPath, path)
if progress != nil {
progress.Printf("Removing %s...\n", filepath)
@@ -267,7 +273,12 @@ func (storage *PublishedStorage) FileExists(path string) (bool, error) {
return true, nil
}
// ReadLink returns the symbolic link pointed to by path
// ReadLink returns the symbolic link pointed to by path (relative to storage
// root)
func (storage *PublishedStorage) ReadLink(path string) (string, error) {
return os.Readlink(path)
absPath, err := os.Readlink(filepath.Join(storage.rootPath, path))
if err != nil {
return absPath, err
}
return filepath.Rel(storage.rootPath, absPath)
}
+22 -2
View File
@@ -6,8 +6,8 @@ import (
"path/filepath"
"syscall"
"github.com/smira/aptly/aptly"
"github.com/smira/aptly/utils"
"github.com/aptly-dev/aptly/aptly"
"github.com/aptly-dev/aptly/utils"
. "gopkg.in/check.v1"
)
@@ -129,6 +129,10 @@ func (s *PublishedStorageSuite) TestSymLink(c *C) {
exists, _ := s.storage.FileExists("ppa/dists/squeeze/InRelease")
c.Check(exists, Equals, true)
linkTarget, err := s.storage.ReadLink("ppa/dists/squeeze/InRelease")
c.Assert(err, IsNil)
c.Assert(linkTarget, Equals, "ppa/dists/squeeze/Release")
}
func (s *PublishedStorageSuite) TestHardLink(c *C) {
@@ -316,3 +320,19 @@ func (s *PublishedStorageSuite) TestLinkFromPool(c *C) {
err = s.storageCopySize.LinkFromPool(filepath.Join("", "pool", "main", "m/mars-invaders"), "mars-invaders_1.03.deb", pool, srcPoolPath, sourceChecksum, false)
c.Check(err, IsNil)
}
func (s *PublishedStorageSuite) TestRootRemove(c *C) {
// Prevent deletion of the root directory by passing empty subpaths.
pwd := c.MkDir()
// Symlink
linkedDir := filepath.Join(pwd, "linkedDir")
os.Symlink(s.root, linkedDir)
linkStorage := NewPublishedStorage(linkedDir, "", "")
c.Assert(func() { linkStorage.Remove("") }, PanicMatches, "trying to remove empty path")
// Actual dir
dirStorage := NewPublishedStorage(pwd, "", "")
c.Assert(func() { dirStorage.RemoveDirs("", nil) }, PanicMatches, "trying to remove the root directory")
}