Skip to content
This repository has been archived by the owner on Feb 20, 2020. It is now read-only.

Commit

Permalink
Merge pull request #130 from taskcluster/bug1506621
Browse files Browse the repository at this point in the history
Bug 1506621 - update code to use new (v3) github.com/mholt/archiver interface
  • Loading branch information
petemoore committed Nov 12, 2018
2 parents 28e23cf + 3688818 commit d08a368
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 4 additions & 4 deletions mounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -650,13 +650,13 @@ func extract(fsContent FSContent, format string, dir string, task *TaskRun) erro
task.Infof("[mounts] Extracting %v file %v to '%v'", format, cacheFile, dir)
switch format {
case "zip":
return archiver.Zip.Open(cacheFile, dir)
return archiver.DefaultZip.Unarchive(cacheFile, dir)
case "tar.gz":
return archiver.TarGz.Open(cacheFile, dir)
return archiver.DefaultTarGz.Unarchive(cacheFile, dir)
case "rar":
return archiver.Rar.Open(cacheFile, dir)
return archiver.DefaultRar.Unarchive(cacheFile, dir)
case "tar.bz2":
return archiver.TarBz2.Open(cacheFile, dir)
return archiver.DefaultTarBz2.Unarchive(cacheFile, dir)
}
log.Fatalf("Unsupported format %v", format)
return fmt.Errorf("Unsupported archive format %v", format)
Expand Down
5 changes: 5 additions & 0 deletions mounts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"encoding/json"
"io/ioutil"
"os"
"path/filepath"
"regexp"
"runtime"
Expand Down Expand Up @@ -472,6 +473,10 @@ func LogTest(m *MountsLoggingTestCase) {
m.Test.Fatalf("Was expecting log line to match pattern '%v', but it does not:\n%v", run[i], mountsLogLines[i])
}
}
err = os.RemoveAll(taskContext.TaskDir)
if err != nil {
m.Test.Fatalf("Could not delete task directory: %v", err)
}
}
}

Expand Down

0 comments on commit d08a368

Please sign in to comment.