diff options
author | Karl Berry <karl@freefriends.org> | 2021-08-28 20:36:53 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-08-28 20:36:53 +0000 |
commit | 36898810305246554a1e0e8a046879cb7c9e6db3 (patch) | |
tree | 7ca67e99234c74c5b48eea2cb29813b5b374e3bf /Master/texmf-dist/scripts/l3build/l3build-upload.lua | |
parent | a89cabb9a47555bb218f126342a0a986236b2a02 (diff) |
l3build (28aug21)
git-svn-id: svn://tug.org/texlive/trunk@60344 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/l3build/l3build-upload.lua')
-rw-r--r-- | Master/texmf-dist/scripts/l3build/l3build-upload.lua | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/Master/texmf-dist/scripts/l3build/l3build-upload.lua b/Master/texmf-dist/scripts/l3build/l3build-upload.lua index 629d2ee7c77..47268f5b6a9 100644 --- a/Master/texmf-dist/scripts/l3build/l3build-upload.lua +++ b/Master/texmf-dist/scripts/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="" |