diff --git a/aptly/interfaces.go b/aptly/interfaces.go index 22b14d43..47cf1140 100644 --- a/aptly/interfaces.go +++ b/aptly/interfaces.go @@ -33,7 +33,7 @@ type PublishedStorage interface { // CreateFile creates file for writing under public path CreateFile(path string) (*os.File, error) // RemoveDirs removes directory structure under public path - RemoveDirs(path string) error + RemoveDirs(path string, progress Progress) error // Remove removes single file under public path Remove(path string) error // LinkFromPool links package file from pool to dist's pool location diff --git a/files/public.go b/files/public.go index d0fa340c..4891d793 100644 --- a/files/public.go +++ b/files/public.go @@ -1,7 +1,6 @@ package files import ( - "fmt" "github.com/smira/aptly/aptly" "github.com/smira/aptly/utils" "os" @@ -41,14 +40,15 @@ func (storage *PublishedStorage) CreateFile(path string) (*os.File, error) { // Remove removes single file under public path func (storage *PublishedStorage) Remove(path string) error { filepath := filepath.Join(storage.rootPath, path) - fmt.Printf("Removing %s...\n", filepath) return os.Remove(filepath) } // RemoveDirs removes directory structure under public path -func (storage *PublishedStorage) RemoveDirs(path string) error { +func (storage *PublishedStorage) RemoveDirs(path string, progress aptly.Progress) error { filepath := filepath.Join(storage.rootPath, path) - fmt.Printf("Removing %s...\n", filepath) + if progress != nil { + progress.Printf("Removing %s...\n", filepath) + } return os.RemoveAll(filepath) } diff --git a/files/public_test.go b/files/public_test.go index 615251bf..0f70eb96 100644 --- a/files/public_test.go +++ b/files/public_test.go @@ -84,7 +84,7 @@ func (s *PublishedStorageSuite) TestRemoveDirs(c *C) { c.Assert(err, IsNil) defer file.Close() - err = s.storage.RemoveDirs("ppa/dists/") + err = s.storage.RemoveDirs("ppa/dists/", nil) _, err = os.Stat(filepath.Join(s.storage.rootPath, "ppa/dists/squeeze/Release")) c.Assert(err, NotNil)