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

Upload validation with --dry-run still asks for upload to CTAN #264

Open
muzimuzhi opened this issue Jan 14, 2023 · 1 comment
Open

Upload validation with --dry-run still asks for upload to CTAN #264

muzimuzhi opened this issue Jan 14, 2023 · 1 comment

Comments

@muzimuzhi
Copy link
Contributor

muzimuzhi commented Jan 14, 2023

Originally found in pgf workflow run, see https://github.com/hmenke/pgf/actions/runs/3913264885/jobs/6688947232.

To reproduce,

  • clone l3build repo
  • run l3build ctan
  • run texlua l3build.lua upload --dry-run 1.2.3 and enter dummy announcement, email, and uploader.
    (texlua l3build.lua is used to run the latest, perhaps change-contained l3build.lua in cloned repo instead of the one installed from tex distribution.)

Finally one will get

Validation successful.

The local archive is xx minutes old. <<<--- optional
Do you want to upload to CTAN? [y/n]
> 

Current logic:

  • l3build.lua first loads l3build-upload.lua then l3build-variables.lua.
  • If --dry-run is set, l3build-upload.lua sets ctanupload = false
  • l3build-variables.lua sets ctanupload = ctanupload or "ask"

But, when --dry-run is set hence ctanupload is false, in loading l3build-variables.lua, ctanupload = ctanupload or "ask" will always reset ctanupload to "ask", because both false and nil are false values.

This turns out #247 is not really fixed.

Proposal

diff --git a/l3build-variables.lua b/l3build-variables.lua
index 51f9270..a00d7a1 100644
--- a/l3build-variables.lua
+++ b/l3build-variables.lua
@@ -238,4 +238,8 @@ tdsdirs = tdsdirs or {}
 -- Upload settings
 curlexe  = curlexe  or "curl"
 uploadconfig = uploadconfig or {}
-ctanupload   = ctanupload   or "ask"
+-- Skip the case when ctanupload == false.
+-- This happens when --dry-run is passed.
+if ctanupload == nil then
+  ctanupload = "ask"
+end

The inline version ctanupload = ctanupload == nil and ctanupload or "ask" looks less understandable to me, but if that's more in line with Lua conventions...

@muzimuzhi
Copy link
Contributor Author

Or, maybe

if options["dry-run"] then
ctanupload = false
end

could be moved to l3build-variables.lua, after ctanupload = ctanupload or "ask" as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant