Make merge_zips -stripFile use blueprint style globs

merge_zips -stripFile was only considering the name of the file and
ignoring the path.  Make it more useful by supporting blueprint style
globs.  The previous behavior can be recreated by prefixing with **/.

Bug: 111389216
Test: m checkbuild
Change-Id: I25760fe3f1f77704dd9da9d107d9a38a415d681f
This commit is contained in:
Colin Cross
2018-07-15 08:16:31 -07:00
parent 2486065c43
commit 4c03f68763
5 changed files with 72 additions and 20 deletions

View File

@@ -135,13 +135,33 @@ func TestMergeZips(t *testing.T) {
stripDirEntries: true,
},
{
name: "strip files",
in: [][]testZipEntry{
{a, bDir, bbDir, bbb, bc, bd, be},
},
out: []testZipEntry{a, bDir, bbDir, bbb, bc},
stripFiles: []string{"b/d", "b/e"},
},
{
// merge_zips used to treat -stripFile a as stripping any file named a, it now only strips a in the
// root of the zip.
name: "strip file name",
in: [][]testZipEntry{
{a, bDir, ba},
},
out: []testZipEntry{bDir, ba},
stripFiles: []string{"a"},
},
{
name: "strip files glob",
in: [][]testZipEntry{
{a, bDir, ba},
},
out: []testZipEntry{bDir},
stripFiles: []string{"a"},
stripFiles: []string{"**/a"},
},
{
name: "strip dirs",
@@ -152,6 +172,15 @@ func TestMergeZips(t *testing.T) {
stripDirs: []string{"b"},
},
{
name: "strip dirs glob",
in: [][]testZipEntry{
{a, bDir, bbDir, bbb, bc, bd, be},
},
out: []testZipEntry{a, bDir, bc, bd, be},
stripDirs: []string{"b/*"},
},
{
name: "zips to not strip",
in: [][]testZipEntry{