Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools: fix timezone update tool #44870

Closed

Conversation

RaisinTen
Copy link
Member

@RaisinTen RaisinTen commented Oct 3, 2022

tools: fix timezone update tool

The spawnSync() call was previously silently failing with this error:

icupkg: unable to open input file "icudt*.dat"

because spawnSync() doesn't support globbing. This change replaces the spawnSync() call with execSync() because that supports globbing.

I have tested this workflow with some minor modifications in my fork and I can confirm that it works as expected now. The bot opened this PR - RaisinTen#2 which updates deps/icu-small/source/data/in/icudt71l.dat.bz2 in RaisinTen@44c2400.

Fixes: #44865
Signed-off-by: Darshan Sen raisinten@gmail.com


tools: remove faulty early termination logic from update-timezone.mjs

We do not build Node.js in the workflow so

const currentVersion = process.versions.tz;

is actually the version of tzdata in the Node.js in the runner instead
of what's in main.

The script is pretty fast even when the versions differ and there is an
update, so this optimization doesn't seem to be worth having given the
problem.

Signed-off-by: Darshan Sen raisinten@gmail.com

@nodejs-github-bot nodejs-github-bot added the tools Issues and PRs related to the tools directory. label Oct 3, 2022
The spawnSync call was previously silently failing with this error:
```sh
icupkg: unable to open input file "icudt*.dat"
```
because spawnSync doesn't support globbing. This change replaces the
spawnSync call with execSync because that supports globbing.

I have tested this workflow with some minor modifications in my fork and
I can confirm that it works as expected now. The bot opened this PR -
#2 which updates
deps/icu-small/source/data/in/icudt71l.dat.bz2.

Fixes: nodejs#44865
Signed-off-by: Darshan Sen <raisinten@gmail.com>
@RaisinTen RaisinTen force-pushed the fix-timezone-update-workflow-tool branch from 9d26788 to 0210498 Compare Oct 3, 2022
Copy link
Member

@richardlau richardlau left a comment

Do you think we should be checking the sync calls for errors?

Also I've spotted another problem -- we do not build Node.js in the workflow so

const currentVersion = process.versions.tz;
is actually the version of tzdata in the Node.js in the runner instead of what's in main. I'm not even sure what version of Node.js that is as the workflow doesn't appear to specify.

@RaisinTen
Copy link
Member Author

RaisinTen commented Oct 3, 2022

Do you think we should be checking the sync calls for errors?

execSync() already throws when there is an error unlike spawnSync() which puts it on the returned object, so I don't think it's strictly necessary.

Also I've spotted another problem -- we do not build Node.js in the workflow so

Good find! I've removed that optimization because the script is pretty fast anyways, PTAL.

We do not build Node.js in the workflow so
https://github.com/nodejs/node/blob/f4815fcd7691364d8139b44c1295dbc46f6ee4a8/tools/update-timezone.mjs#L18
is actually the version of `tzdata` in the Node.js in the runner instead
of what's in `main`.

The script is pretty fast even when the versions differ and there is an
update, so this optimization doesn't seem to be worth having given the
problem.

Signed-off-by: Darshan Sen <raisinten@gmail.com>
@RaisinTen RaisinTen force-pushed the fix-timezone-update-workflow-tool branch from 302d48d to 33d4ff6 Compare Oct 3, 2022
@RaisinTen RaisinTen added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Oct 3, 2022
'icudt*.dat',
], { cwd: 'deps/icu-small/source/data/in/' }
);
execSync(`icupkg -a ${file} icudt*.dat`, { cwd: 'deps/icu-small/source/data/in/' });
Copy link
Contributor

@aduh95 aduh95 Oct 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this be an issue if file contains "weird" characters?

Copy link
Member Author

@RaisinTen RaisinTen Oct 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe but that's never supposed to happen because file is always gonna be one of

const fileNames = [
'zoneinfo64.res',
'windowsZones.res',
'timezoneTypes.res',
'metaZones.res',
];
and I think this list is unlikely to change.

aduh95
aduh95 approved these changes Oct 10, 2022
@aduh95 aduh95 added the commit-queue Add this label to land a pull request using GitHub Actions. label Oct 10, 2022
@nodejs-github-bot nodejs-github-bot added commit-queue-failed An error occurred while landing this pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Oct 10, 2022
@nodejs-github-bot
Copy link
Contributor

nodejs-github-bot commented Oct 10, 2022

Commit Queue failed
- Loading data for nodejs/node/pull/44870
✔  Done loading data for nodejs/node/pull/44870
----------------------------------- PR info ------------------------------------
Title      tools: fix timezone update tool (#44870)
Author     Darshan Sen  (@RaisinTen)
Branch     RaisinTen:fix-timezone-update-workflow-tool -> nodejs:main
Labels     tools, author ready
Commits    2
 - tools: fix timezone update tool
 - tools: remove faulty early termination logic from update-timezone.mjs
Committers 1
 - Darshan Sen 
PR-URL: https://github.com/nodejs/node/pull/44870
Fixes: https://github.com/nodejs/node/issues/44865
Reviewed-By: Richard Lau 
Reviewed-By: Antoine du Hamel 
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/44870
Fixes: https://github.com/nodejs/node/issues/44865
Reviewed-By: Richard Lau 
Reviewed-By: Antoine du Hamel 
--------------------------------------------------------------------------------
   ℹ  This PR was created on Mon, 03 Oct 2022 06:31:26 GMT
   ✔  Approvals: 2
   ✔  - Richard Lau (@richardlau) (TSC): https://github.com/nodejs/node/pull/44870#pullrequestreview-1128150857
   ✔  - Antoine du Hamel (@aduh95) (TSC): https://github.com/nodejs/node/pull/44870#pullrequestreview-1136162346
   ✔  Last GitHub CI successful
   ℹ  Green GitHub CI is sufficient
--------------------------------------------------------------------------------
   ✔  No git cherry-pick in progress
   ✔  No git am in progress
   ✔  No git rebase in progress
--------------------------------------------------------------------------------
- Bringing origin/main up to date...
From https://github.com/nodejs/node
 * branch                  main       -> FETCH_HEAD
✔  origin/main is now up-to-date
- Downloading patch for 44870
From https://github.com/nodejs/node
 * branch                  refs/pull/44870/merge -> FETCH_HEAD
✔  Fetched commits as 78d280a76821..33d4ff6c52fb
--------------------------------------------------------------------------------
[main bf715e2db2] tools: fix timezone update tool
 Author: Darshan Sen 
 Date: Mon Oct 3 10:46:48 2022 +0530
 1 file changed, 2 insertions(+), 8 deletions(-)
[main cf8eca8e4f] tools: remove faulty early termination logic from update-timezone.mjs
 Author: Darshan Sen 
 Date: Mon Oct 3 15:48:06 2022 +0530
 1 file changed, 7 deletions(-)
   ✔  Patches applied
There are 2 commits in the PR. Attempting autorebase.
Rebasing (2/4)

Executing: git node land --amend --yes
⚠ Found Fixes: #44865, skipping..
--------------------------------- New Message ----------------------------------
tools: fix timezone update tool

The spawnSync call was previously silently failing with this error:

icupkg: unable to open input file "icudt*.dat"

because spawnSync doesn't support globbing. This change replaces the
spawnSync call with execSync because that supports globbing.

I have tested this workflow with some minor modifications in my fork and
I can confirm that it works as expected now. The bot opened this PR -
RaisinTen#2 which updates
deps/icu-small/source/data/in/icudt71l.dat.bz2.

Fixes: #44865
Signed-off-by: Darshan Sen raisinten@gmail.com
PR-URL: #44870
Reviewed-By: Richard Lau rlau@redhat.com
Reviewed-By: Antoine du Hamel duhamelantoine1995@gmail.com

[detached HEAD 374c459989] tools: fix timezone update tool
Author: Darshan Sen raisinten@gmail.com
Date: Mon Oct 3 10:46:48 2022 +0530
1 file changed, 2 insertions(+), 8 deletions(-)
Rebasing (3/4)
Rebasing (4/4)

Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
tools: remove faulty early termination logic from update-timezone.mjs

We do not build Node.js in the workflow so

const currentVersion = process.versions.tz;

is actually the version of tzdata in the Node.js in the runner instead
of what's in main.

The script is pretty fast even when the versions differ and there is an
update, so this optimization doesn't seem to be worth having given the
problem.

Signed-off-by: Darshan Sen raisinten@gmail.com
PR-URL: #44870
Fixes: #44865
Reviewed-By: Richard Lau rlau@redhat.com
Reviewed-By: Antoine du Hamel duhamelantoine1995@gmail.com

[detached HEAD bab7e83e62] tools: remove faulty early termination logic from update-timezone.mjs
Author: Darshan Sen raisinten@gmail.com
Date: Mon Oct 3 15:48:06 2022 +0530
1 file changed, 7 deletions(-)

Successfully rebased and updated refs/heads/main.

ℹ Add commit-queue-squash label to land the PR as one commit, or commit-queue-rebase to land as separate commits.

https://github.com/nodejs/node/actions/runs/3220375855

@RaisinTen RaisinTen added commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-rebase Add this label to allow the Commit Queue to land a PR in several commits. and removed commit-queue-failed An error occurred while landing this pull request using GitHub Actions. labels Oct 10, 2022
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Oct 10, 2022
@nodejs-github-bot
Copy link
Contributor

nodejs-github-bot commented Oct 10, 2022

Landed in 22c39b1...b5add97

nodejs-github-bot pushed a commit that referenced this pull request Oct 10, 2022
The spawnSync call was previously silently failing with this error:
```sh
icupkg: unable to open input file "icudt*.dat"
```
because spawnSync doesn't support globbing. This change replaces the
spawnSync call with execSync because that supports globbing.

I have tested this workflow with some minor modifications in my fork and
I can confirm that it works as expected now. The bot opened this PR -
RaisinTen#2 which updates
deps/icu-small/source/data/in/icudt71l.dat.bz2.

Fixes: #44865
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: #44870
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
nodejs-github-bot pushed a commit that referenced this pull request Oct 10, 2022
We do not build Node.js in the workflow so
https://github.com/nodejs/node/blob/f4815fcd7691364d8139b44c1295dbc46f6ee4a8/tools/update-timezone.mjs#L18
is actually the version of `tzdata` in the Node.js in the runner instead
of what's in `main`.

The script is pretty fast even when the versions differ and there is an
update, so this optimization doesn't seem to be worth having given the
problem.

Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: #44870
Fixes: #44865
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
@RaisinTen RaisinTen deleted the fix-timezone-update-workflow-tool branch Oct 10, 2022
danielleadams pushed a commit that referenced this pull request Oct 11, 2022
The spawnSync call was previously silently failing with this error:
```sh
icupkg: unable to open input file "icudt*.dat"
```
because spawnSync doesn't support globbing. This change replaces the
spawnSync call with execSync because that supports globbing.

I have tested this workflow with some minor modifications in my fork and
I can confirm that it works as expected now. The bot opened this PR -
RaisinTen#2 which updates
deps/icu-small/source/data/in/icudt71l.dat.bz2.

Fixes: #44865
Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: #44870
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
danielleadams pushed a commit that referenced this pull request Oct 11, 2022
We do not build Node.js in the workflow so
https://github.com/nodejs/node/blob/f4815fcd7691364d8139b44c1295dbc46f6ee4a8/tools/update-timezone.mjs#L18
is actually the version of `tzdata` in the Node.js in the runner instead
of what's in `main`.

The script is pretty fast even when the versions differ and there is an
update, so this optimization doesn't seem to be worth having given the
problem.

Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: #44870
Fixes: #44865
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue-rebase Add this label to allow the Commit Queue to land a PR in several commits. tools Issues and PRs related to the tools directory.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Timezone update workflow/tool doesn't work?
4 participants