This commit is contained in:
sam boyer 2016-06-30 22:03:11 -04:00
Родитель a36b9bf6c3
Коммит a329ae4882
4 изменённых файлов: 22 добавлений и 8 удалений

Просмотреть файл

@ -46,7 +46,7 @@ func init() {
// fileRoot = "/home/user/go/src/github.com/foo/bar" // fileRoot = "/home/user/go/src/github.com/foo/bar"
// importRoot = "github.com/foo/bar" // importRoot = "github.com/foo/bar"
// //
// Where the fileRoot and importRoot align. However, if you provide: // where the fileRoot and importRoot align. However, if you provide:
// //
// fileRoot = "/home/user/workspace/path/to/repo" // fileRoot = "/home/user/workspace/path/to/repo"
// importRoot = "github.com/foo/bar" // importRoot = "github.com/foo/bar"

17
hash.go
Просмотреть файл

@ -72,9 +72,24 @@ func (s *solver) HashInputs() ([]byte, error) {
} }
} }
// Add the package ignores, if any.
if len(s.args.Ignore) > 0 {
// Dump and sort the ignores
ig := make([]string, len(s.args.Ignore))
k := 0
for pkg := range s.args.Ignore {
ig[k] = pkg
k++
}
sort.Strings(ig)
for _, igp := range ig {
h.Write([]byte(igp))
}
}
// TODO overrides // TODO overrides
// TODO aliases // TODO aliases
// TODO ignores
return h.Sum(nil), nil return h.Sum(nil), nil
} }

Просмотреть файл

@ -13,6 +13,10 @@ func TestHashInputs(t *testing.T) {
Root: string(fix.ds[0].Name()), Root: string(fix.ds[0].Name()),
Name: fix.ds[0].Name(), Name: fix.ds[0].Name(),
Manifest: fix.ds[0], Manifest: fix.ds[0],
Ignore: map[string]bool{
"foo": true,
"bar": true,
},
} }
// prep a fixture-overridden solver // prep a fixture-overridden solver
@ -33,7 +37,7 @@ func TestHashInputs(t *testing.T) {
} }
h := sha256.New() h := sha256.New()
for _, v := range []string{"a", "a", "1.0.0", "b", "b", "1.0.0", stdlibPkgs, "root", "", "root", "a", "b"} { for _, v := range []string{"a", "a", "1.0.0", "b", "b", "1.0.0", stdlibPkgs, "root", "", "root", "a", "b", "bar", "foo"} {
h.Write([]byte(v)) h.Write([]byte(v))
} }
correct := h.Sum(nil) correct := h.Sum(nil)

Просмотреть файл

@ -998,7 +998,6 @@ func (b *depspecBridge) computeRootReach() ([]string, error) {
return nil, err return nil, err
} }
//pruneIgnoredPackages(ptree, dsm.ignore())
return ptree.ListExternalImports(true, true, dsm.ignore()) return ptree.ListExternalImports(true, true, dsm.ignore())
} }
@ -1014,10 +1013,6 @@ func (b *depspecBridge) verifyRoot(path string) error {
func (b *depspecBridge) listPackages(id ProjectIdentifier, v Version) (PackageTree, error) { func (b *depspecBridge) listPackages(id ProjectIdentifier, v Version) (PackageTree, error) {
return b.sm.(fixSM).ListPackages(b.key(id), v) return b.sm.(fixSM).ListPackages(b.key(id), v)
//if err == nil {
//pruneIgnoredPackages(ptree, dsm.ignore())
//}
//return ptree, err
} }
// override deduceRemoteRepo on bridge to make all our pkg/project mappings work // override deduceRemoteRepo on bridge to make all our pkg/project mappings work