[latex3-commits] [git/LaTeX3-latex3-l3build] master: add --debug (da0784c)

Will Robertson wspr81 at gmail.com
Mon Jan 7 16:10:41 CET 2019


Repository : https://github.com/latex3/l3build
On branch  : master
Link       : https://github.com/latex3/l3build/commit/da0784cead7cc517a34a4efbf922e37ba93b4900

>---------------------------------------------------------------

commit da0784cead7cc517a34a4efbf922e37ba93b4900
Author: Will Robertson <wspr81 at gmail.com>
Date:   Mon Jan 7 23:10:41 2019 +0800

    add --debug
    
    (open for discussion)


>---------------------------------------------------------------

da0784cead7cc517a34a4efbf922e37ba93b4900
 l3build-arguments.lua |    5 +++++
 l3build-upload.lua    |   19 ++++++++++++++++---
 l3build.dtx           |    4 ++++
 3 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/l3build-arguments.lua b/l3build-arguments.lua
index 63f7db7..a6a13a4 100644
--- a/l3build-arguments.lua
+++ b/l3build-arguments.lua
@@ -47,6 +47,11 @@ option_list =
         desc  = "Sets the date to insert into sources",
         type  = "string"
       },
+    debug =
+      {
+        desc = "Runs target in debug mode (not supported by all targets)",
+        type = "boolean"
+      },
     dirty =
       {
         desc = "Skip cleaning up the test area",
diff --git a/l3build-upload.lua b/l3build-upload.lua
index a428dd6..4afee06 100644
--- a/l3build-upload.lua
+++ b/l3build-upload.lua
@@ -113,7 +113,16 @@ function upload(tagnames)
     error("Missing zip file '" .. tostring(uploadfile) .. "'")
   end
 
-  ctan_post = construct_ctan_post(uploadfile)
+  ctan_post = construct_ctan_post(uploadfile,options["debug"])
+
+  if options["debug"] then
+    fp_return = shell(ctan_post)
+    print('\n\nCURL COMMAND:')
+    print(ctan_post)
+    print("\n\nHTTP RESPONSE:")
+    print(fp_return)
+    return 1
+  end
 
   -- call post command to validate the upload at CTAN's validate URL
   local exit_status=0
@@ -183,7 +192,7 @@ function shell(s)
   return t
 end
 
-function construct_ctan_post(uploadfile)
+function construct_ctan_post(uploadfile,debug)
 
   -- start building the curl command:
   ctan_post = curlexe .. " "
@@ -217,7 +226,11 @@ function construct_ctan_post(uploadfile)
     qq = '\"'
   end
   ctan_post = ctan_post .. ' --form ' .. qq .. 'file=@' .. tostring(uploadfile) .. ';filename=' .. tostring(uploadfile) .. qq
-  ctan_post = ctan_post ..  ' https://ctan.org/submit/'
+  if debug then
+    ctan_post = ctan_post ..  ' https://httpbin.org/post'
+  else
+    ctan_post = ctan_post ..  ' https://ctan.org/submit/'
+  end
 
   return ctan_post
 
diff --git a/l3build.dtx b/l3build.dtx
index 1607c64..d517490 100644
--- a/l3build.dtx
+++ b/l3build.dtx
@@ -334,6 +334,7 @@
 % \begin{itemize}
 % \item |--config| (|-c|) Configuration(s) to use for testing
 % \item |--date| Date to use when tagging data
+% \item |--debug| Runs the target in debug mode (not supported by all targets)
 % \item |--dirty| Skip cleaning up of the test area
 % \item |--dry-run| Runs the \texttt{install} target but does not copy
 %   any files: simply lists those that would be installed
@@ -1328,6 +1329,9 @@
 % non-existing package or if you attempt to upload a new package with the same name as a
 % pre-existing one.
 %
+% If you have have difficulty with the upload process, add the option |--debug| to divert
+% the request from CTAN to a service that redirects the input back again so it can be examined.
+%
 % \begin{table}[p]
 %   \def\YES{\textbullet}
 %   \caption{Fields used in the \texttt{uploadconfig} setup table. The first section of fields are \emph{required} and if they are omitted the user will be interactively prompted for further input. Most commands take string input, but those that are indicated with `Multi' accept more than one entry using an array of strings.}





More information about the latex3-commits mailing list