]> Cypherpunks repositories - gostls13.git/commit
cmd/dist: remove deptab and cleanlist in favor of gentab
authorAustin Clements <austin@google.com>
Tue, 6 Jun 2023 01:48:59 +0000 (21:48 -0400)
committerAustin Clements <austin@google.com>
Tue, 6 Jun 2023 15:33:04 +0000 (15:33 +0000)
commitf6ec9b11a6e139aa7e3a63739c588264ed89cbbe
treeb645364dcb13afc50bdbdbd24b8d656fea62244d
parent896e55fb49b1ec4ef924f9925ec55c090e14f34f
cmd/dist: remove deptab and cleanlist in favor of gentab

dist's deptab is a list of changes to the automatically derived set of
package dependencies. It's as old as dist itself, and the first
version of deptab in CL 5620045 was quite complex. From the beginning,
some of the entries in deptab have been for generated files that need
to be added to the dependency set because they can't be discovered if
they don't exist. gentab is also as old as dist itself, and lists the
generated dependency files.

The interaction between deptab and gentab is rather odd. gentab
contains only base file names, not whole paths. To figure out what
files to generate, dist takes a Cartesian product of deptab and gentab
and calls the generator wherever the basename of a path in deptab
matches an entry in gentab. This perhaps made sense at the time
because some of the generated files appeared in more than one package
in deptab.

These days, deptab consists exclusively of generated files because
dist can correctly derive all other dependencies, and all of the
generated files have unique paths. This makes the Cartesian product
approach needlessly complex (and so confusing!), and means that the
only purpose served by deptab is to provide full paths for generated
files.

Furthermore, in the dist clean command, it also needed to expand the
file names in gentab to complete paths, but it did so using a
different list, cleanlist, and the same Cartesian product algorithm.

This CL drops all of this complexity by putting full paths into
gentab, which lets us delete deptab and cleanlist.

Change-Id: Ie3993983734f6da3be453bb4c17a64e22dcf3e8f
Reviewed-on: https://go-review.googlesource.com/c/go/+/501137
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
src/cmd/dist/build.go
src/cmd/distpack/pack.go