summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/l3build/l3build-upload.lua
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2021-08-29 03:02:07 +0000
committerNorbert Preining <norbert@preining.info>2021-08-29 03:02:07 +0000
commit66f6e60b6dc60cc08482030b92df223b6a51b15f (patch)
treee64c800b73c0989d7e812b4a703088ceb131e0c4 /macros/latex/contrib/l3build/l3build-upload.lua
parentb11ef0810f2b6a651ce97d7e639f9c85efeedbd5 (diff)
CTAN sync 202108290302
Diffstat (limited to 'macros/latex/contrib/l3build/l3build-upload.lua')
-rw-r--r--macros/latex/contrib/l3build/l3build-upload.lua40
1 files changed, 32 insertions, 8 deletions
diff --git a/macros/latex/contrib/l3build/l3build-upload.lua b/macros/latex/contrib/l3build/l3build-upload.lua
index 629d2ee7c7..47268f5b6a 100644
--- a/macros/latex/contrib/l3build/l3build-upload.lua
+++ b/macros/latex/contrib/l3build/l3build-upload.lua
@@ -116,11 +116,24 @@ function upload(tagnames)
end
-- avoid lower level error from post command if zip file missing
- local zip=open(trim_space(tostring(uploadfile)),"r")
- if zip~=nil then
- close(zip)
- else
- error("Missing zip file '" .. tostring(uploadfile) .. "'")
+ local ziptime = lfs.attributes(trim_space(tostring(uploadfile)), 'modification')
+ if not ziptime then
+ error("Missing zip file '" .. tostring(uploadfile) .. "'. \z
+ Maybe you forgot to run 'l3build ctan' first?")
+ end
+ local age = os.time() - ziptime
+ if age >= 86400 then
+ print(string.format("------------------------------------------\n\z
+ | The local archive is older than %3i days. |\n\z
+ | Are you sure that you executed 'l3build ctan' first? |\n\z
+ --------------------------------------------------------",
+ age // 86400))
+ print("Are you sure you want to continue? [y/n]" )
+ io.stdout:write("> "):flush()
+ if lower(read(),1,1) ~= "y" then
+ print'Aborting'
+ return 1
+ end
end
ctan_post = construct_ctan_post(uploadfile,options["debug"])
@@ -174,12 +187,23 @@ end
end
-- if upload requested and validation succeeded repost to the upload URL
- if (exit_status==0 or exit_status==nil) then
+ if (exit_status==0 or exit_status==nil) then
if (ctanupload ~=nil and ctanupload ~=false and ctanupload ~= true) then
if (match(fp_return,"WARNING")) then
- print("Warnings from CTAN package validation:" .. fp_return:gsub("%[","\n["):gsub("%]%]","]\n]"))
+ print("Warnings from CTAN package validation:" .. fp_return:gsub("%[","\n["):gsub("%]%]","]\n]"))
else
- print("Validation successful." )
+ print("Validation successful." )
+ end
+ print("" )
+ if age < 86400 and age >= 60 then
+ if age >= 3600 then
+ print("----------------------------------------------------" )
+ print(string.format("| The local archive is older than %2i hours. |", age//3600 ))
+ print("| Have you executed l3build ctan first? If so ... |" )
+ print("----------------------------------------------------" )
+ else
+ print(string.format("The local archive is %i minutes old.", age//60 ))
+ end
end
print("Do you want to upload to CTAN? [y/n]" )
local answer=""