[latex3-commits] [git/LaTeX3-latex3-l3build] ctan-post: remove arguments to upload function so can be configured by global variables from l3build settings (33c61f3)
David Carlisle
d.p.carlisle at gmail.com
Mon Jul 23 15:23:58 CEST 2018
Repository : https://github.com/latex3/l3build
On branch : ctan-post
Link : https://github.com/latex3/l3build/commit/33c61f371452519ef1e7a01a113cbd66140e08c0
>---------------------------------------------------------------
commit 33c61f371452519ef1e7a01a113cbd66140e08c0
Author: David Carlisle <d.p.carlisle at gmail.com>
Date: Mon Jul 23 14:23:58 2018 +0100
remove arguments to upload function so can be configured by global variables from l3build settings
>---------------------------------------------------------------
33c61f371452519ef1e7a01a113cbd66140e08c0
build.lua | 30 +++++++++++++++++++++++++++++-
l3build-ctan-post.lua | 32 +++++++++++++++++++++++---------
l3build-stdmain.lua | 2 +-
3 files changed, 53 insertions(+), 11 deletions(-)
diff --git a/build.lua b/build.lua
index 796a786..09d113f 100644
--- a/build.lua
+++ b/build.lua
@@ -48,7 +48,35 @@ function tag_hook(tagname)
os.execute('git tag -a -m "" ' .. tagname)
end
-require("z")
+
+-- ctan upload settings
+ctan_pkg="l3build"
+ctan_version=[[2018/05/20]]
+ctan_author=[[latex3 project]]
+ctan_email='me at example.com'
+ctan_uploader=[[me]]
+ctan_ctanPath=[[]]
+ctan_license="lppl"
+
+-- ctan_sumary is mandatory: not setting it will trigger interaction
+
+ctan_announcement='ask' -- this is optional: setting it to "ask" forces interaction
+
+ctan_update=true
+
+ctan_note=[[
+this
+is
+a note
+just to myself
+]]
+
+ctan_file="l3build.zip"
+
+ctanupload="ask"
+
+
+-- end of ctan upload settings
if not release_date then
dofile("./l3build.lua")
diff --git a/l3build-ctan-post.lua b/l3build-ctan-post.lua
index 753cd47..dc857a4 100644
--- a/l3build-ctan-post.lua
+++ b/l3build-ctan-post.lua
@@ -47,18 +47,23 @@ for those people who are interested.
-- a version using ctan-o-mat is available in the ctan-post github repo
-- the main interface is
--- ctan_upload (upload)
+-- ctan_upload ()
-- with a configuration table c and optional upload parameter
--- if upload is omitted or nil or false, only validation is attempted
--- if upload is true the ctan upload URL will be used after validation
--- if upload is anything else, the user will be prompted whether to upload.
+
local ctan_post_command = ctan_post_command or "curl"
local curl_debug=false -- posting is disabled while testing
-local ctanconfig = ctanconfig or {}
+
+
+
local ctanupload= ctanupload or "ask"
+-- if ctanupload is nil or false, only validation is attempted
+-- if ctanupload is true the ctan upload URL will be used after validation
+-- if upload is anything else, the user will be prompted whether to upload.
+
+
-function ctan_upload (upload)
+function ctan_upload ()
ctan_post=ctan_post_command .. " "
@@ -117,17 +122,17 @@ ctan_post=ctan_post_command .. " "
-- if upload requested and validation succeeded repost to the upload URL
if (exit_status==0 or exit_status==nil) then
- if(upload ~=nil and upload ~=false and upload ~= true) then
+ if(ctanupload ~=nil and ctanupload ~=false and ctanupload ~= true) then
print("Validation successful, do you want to upload to CTAN?" )
local answer=""
io.write("> ")
io.flush()
answer=io.read()
if(string.lower(answer,1,1)=="y") then
- upload=true
+ ctanupload=true
end
end
- if(upload==true) then
+ if(ctanupload==true) then
local fp = assert(io.popen(ctan_post .. "upload", 'r'))
fp_return = assert(fp:read('*a'))
fp:close()
@@ -144,6 +149,7 @@ ctan_post=ctan_post_command .. " "
else
error("Warnings from CTAN package validation:\n" .. fp_return)
end
+ return exit_status
end
function trim_space(s)
@@ -162,6 +168,14 @@ end
function ctan_single_field(fname,fvalue,max,desc,mandatory)
+print('@@' .. fname .. tostring(fvalue or '??'))
+ if((fvalue==nil and mandatory) or (fvalue == 'ask')) then
+ if (max < 256) then
+ fvalue=input_single_line_field(fname)
+ else
+ fvalue=input_multi_line_field(fname)
+ end
+ end
if(fvalue==nil or type(fvalue)~="table") then
local vs=trim_space(tostring(fvalue))
if (mandatory==true and (fvalue == nil or vs=="")) then
diff --git a/l3build-stdmain.lua b/l3build-stdmain.lua
index 5f95920..d4ef7f1 100644
--- a/l3build-stdmain.lua
+++ b/l3build-stdmain.lua
@@ -65,7 +65,7 @@ function stdmain(target, names)
elseif target == "ctan" then
errorlevel = ctan()
elseif target == "ctanpost" then
- errorlevel = ctan_upload(ctanconfig,ctanupload)
+ errorlevel = ctan_upload()
elseif target == "install" then
errorlevel = call(modules, "install")
elseif target == "tag" then
More information about the latex3-commits
mailing list