Skip to content

Commit

Permalink
tools: improved newgtlds.go, removed replace-between.
Browse files Browse the repository at this point in the history
Previously the `tools/newgtlds.go` utility was difficult to use with the
new Github action based pull-request workflow because it _always_
updated the timestamp in the header comment in the gTLD section of
`public_suffix_list.dat` when it was run, even if no gTLD data changed.
This meant there was a diff in the workdir after the tool ran that would
cause a PR to be opened by the action.

In the old travis version of the automation I used some gross shell-fu
to exclude the header comment when deciding if there was a diff or not.
With the new action it's not possible to change how the diff status is
determined, it's a matter of `git diff` saying there's a diff locally
after the script runs or not. E.g. we need the script to be idempotent
when there's no true data change.

To do this I reworked `newgtlds.go` to be able to consume the existing
`public_suffix_list.dat` in order to be able to determine if there is
a data change or not. If there's no change in the data specifically then
the file is left untouched. If there is a change then the file is
updated and only then is the header comment with the date stamp updated
along with the new data. Conveniently this also lets us remove the
`tools/replace-between` Perl script reducing the number of languages in
play for this process.
  • Loading branch information
cpu committed Feb 7, 2021
1 parent 3c1add0 commit d996dad
Show file tree
Hide file tree
Showing 5 changed files with 783 additions and 99 deletions.
2 changes: 1 addition & 1 deletion .gitignore
@@ -1,3 +1,3 @@
linter/log
libpsl

coverage.out

0 comments on commit d996dad

Please sign in to comment.