@@ -17,8 +17,9 @@ import (
1717 "syscall"
1818
1919 "github.com/docker-slim/docker-slim/messages"
20+ "github.com/docker-slim/docker-slim/pkg/utils/errutils"
21+ "github.com/docker-slim/docker-slim/pkg/utils/fsutils"
2022 "github.com/docker-slim/docker-slim/report"
21- "github.com/docker-slim/docker-slim/utils"
2223
2324 log "github.com/Sirupsen/logrus"
2425)
@@ -239,7 +240,7 @@ func (p *artifactStore) saveArtifacts() {
239240 //TODO: use exludePaths to filter discovered links
240241 for linkName , linkProps := range p .linkMap {
241242 linkPath := fmt .Sprintf ("%s/files%s" , p .storeLocation , linkName )
242- linkDir := utils .FileDir (linkPath )
243+ linkDir := fsutils .FileDir (linkPath )
243244 err := os .MkdirAll (linkDir , 0777 )
244245 if err != nil {
245246 log .Warn ("saveArtifacts - dir error => " , err )
@@ -264,7 +265,7 @@ func (p *artifactStore) saveArtifacts() {
264265 for inPath , isDir := range includePaths {
265266 dstPath := fmt .Sprintf ("%s/files%s" , p .storeLocation , inPath )
266267 if isDir {
267- err , errs := utils .CopyDir (inPath , dstPath , true , true , nil , nil , nil )
268+ err , errs := fsutils .CopyDir (inPath , dstPath , true , true , nil , nil , nil )
268269 if err != nil {
269270 log .Warnf ("CopyDir(%v,%v) error: %v" , inPath , dstPath , err )
270271 }
@@ -273,7 +274,7 @@ func (p *artifactStore) saveArtifacts() {
273274 log .Warnf ("CopyDir(%v,%v) copy errors: %+v" , inPath , dstPath , errs )
274275 }
275276 } else {
276- if err := utils .CopyFile (inPath , dstPath , true ); err != nil {
277+ if err := fsutils .CopyFile (inPath , dstPath , true ); err != nil {
277278 log .Warnf ("CopyFile(%v,%v) error: %v" , inPath , dstPath , err )
278279 }
279280 }
@@ -301,17 +302,17 @@ func (p *artifactStore) saveReport() {
301302 if os .IsNotExist (err ) {
302303 os .MkdirAll (artifactDirName , 0777 )
303304 _ , err = os .Stat (artifactDirName )
304- utils .FailOn (err )
305+ errutils .FailOn (err )
305306 }
306307
307308 reportFilePath := filepath .Join (artifactDirName , reportName )
308309 log .Debug ("sensor: monitor - saving report to " , reportFilePath )
309310
310311 reportData , err := json .MarshalIndent (creport , "" , " " )
311- utils .FailOn (err )
312+ errutils .FailOn (err )
312313
313314 err = ioutil .WriteFile (reportFilePath , reportData , 0644 )
314- utils .FailOn (err )
315+ errutils .FailOn (err )
315316}
316317
317318func getFileHash (artifactFileName string ) (string , error ) {
@@ -357,7 +358,7 @@ func cpFile(src, dst string) error {
357358 }
358359 defer s .Close ()
359360
360- dstDir := utils .FileDir (dst )
361+ dstDir := fsutils .FileDir (dst )
361362 err = os .MkdirAll (dstDir , 0777 )
362363 if err != nil {
363364 log .Warnln ("sensor: monitor - dir error =>" , err )
@@ -400,7 +401,7 @@ func cpFile(src, dst string) error {
400401 }
401402
402403 //note: need to do the same for symlinks too
403- if err := utils .UpdateFileTimes (dst , sysStat .Atim , sysStat .Mtim ); err != nil {
404+ if err := fsutils .UpdateFileTimes (dst , sysStat .Atim , sysStat .Mtim ); err != nil {
404405 log .Warnln ("sensor: cpFile - UpdateFileTimes error =>" , dst )
405406 return err
406407 }
@@ -476,7 +477,7 @@ func createDummyFile(src, dst string) error {
476477 }
477478
478479 //note: need to do the same for symlinks too
479- if err := utils .UpdateFileTimes (dst , sysStat .Mtim , sysStat .Atim ); err != nil {
480+ if err := fsutils .UpdateFileTimes (dst , sysStat .Mtim , sysStat .Atim ); err != nil {
480481 log .Warnln ("sensor: createDummyFile - UpdateFileTimes error =>" , dst )
481482 return err
482483 }
0 commit comments