| 1 |
\documentclass{ydoc} |
| 2 |
|
| 3 |
\title{The \textsf{ctanupload} script} |
| 4 |
\author{Martin Scharrer} |
| 5 |
\email{[email protected]} |
| 6 |
\date{Version v1.2c -- 2012/05/08} |
| 7 |
\repository{https://bitbucket.org/martin_scharrer/ctanupload/} |
| 8 |
|
| 9 |
|
| 10 |
\providecommand\envvar{\texttt} |
| 11 |
|
| 12 |
\makeatletter |
| 13 |
\define@Macro@handler\DescribeScript{} |
| 14 |
\makeatother |
| 15 |
|
| 16 |
\begin{document} |
| 17 |
\maketitle |
| 18 |
\begin{abstract} |
| 19 |
This Perl script allows the uploads of a contribution to CTAN from the command line. |
| 20 |
It is intended to simplify the release process for LaTeX package authors. |
| 21 |
\end{abstract} |
| 22 |
|
| 23 |
\section{Introduction} |
| 24 |
The Comprehensive TeX Archive Network (CTAN) is the place to get materials related to the \TeX\ typesetting system. |
| 25 |
It provides an web form to upload contributions, like \LaTeX\ packages, to one of the main servers |
| 26 |
\url{http://dante.ctan.org/upload} (DANTE server, German TeX users group) or |
| 27 |
\url{http://www.tex.ac.uk/upload/} (UK-TUG server, UK TeX users group). |
| 28 |
The third main server \url{http://tug.ctan.org/} (TUG, US and International TeX users group) currently does not accept uploads. |
| 29 |
After uploading the contribution to one of these servers it will be distributed to the CTAN mirrors where it can be downloaded by other users. |
| 30 |
|
| 31 |
The \texttt{ctanupload} script allows to automate these uploads which is from benefit for \LaTeX\ package authors which |
| 32 |
write and maintain a larger number of packages. The script is designed to be used from the command line or from a Makefile or other script |
| 33 |
in a full or semi-automatic way. Constant data like the package and author names can be passed automatically to the script while the |
| 34 |
variable fields like the version number or announcement text can be entered manually. |
| 35 |
|
| 36 |
The script first collects the required data, applies some sanity checks before it is displayed again for confirmation. |
| 37 |
If the data is correct it is uploaded and the status and response from the CTAN upload server is printed. |
| 38 |
|
| 39 |
\clearpage |
| 40 |
\section{Usage} |
| 41 |
\DescribeScript{ctanupload}<options>~'--'<name>'='<value>~!\ldots! |
| 42 |
\DescribeScript{ctanupload}<options>~'--'<name>~<value>~!\ldots! |
| 43 |
\DescribeScript{ctanupload}<options>~'--'<name>'-file='<file with value>~!\ldots! |
| 44 |
\DescribeScript{ctanupload}<options>~'--'<name>'-file'~<file with value>~!\ldots! |
| 45 |
|
| 46 |
The script accepts single letter options and awaits the upload form fields as double slash arguments. |
| 47 |
These fields can also be read from text files or given using environment variables in the form |
| 48 |
\MacroArgs'CTAN_'<NAME>, \MacroArgs'CTAN_'<name>, \MacroArgs<NAME> or \MacroArgs<name>\relax (in this order). |
| 49 |
The support of environment variable simplifies the usage inside Makefiles. |
| 50 |
|
| 51 |
All arguments can also be given using the \envvar{CTANUPLOAD} environment variable which are processed first, so that |
| 52 |
explicit arguments will overwrite them. |
| 53 |
|
| 54 |
\subsubsection*{Options} |
| 55 |
The following options control the behaviour of the script. They can also be grouped together, i.e.\ a single dash |
| 56 |
followed by multiple options. |
| 57 |
|
| 58 |
\par\medskip\par\noindent |
| 59 |
\begin{tabular}{>{\ttfamily}ll} |
| 60 |
\toprule |
| 61 |
\normalfont Option & Description \\ |
| 62 |
\midrule |
| 63 |
-p & Prompt for missing values.\\ |
| 64 |
-P & Do not prompt for missing values. (default)\\ |
| 65 |
-y & Do not ask for confirmation, but submit immediately.\\ |
| 66 |
-u <URL> & CTAN URL to upload to.\\ |
| 67 |
-U <name> & CTAN server to upload to, either 'dante' or 'uktug'.\\ |
| 68 |
-F <file> & Read all data from file. (See below)\\ |
| 69 |
-f & Force upload even if input seems incorrect (unknown license etc.).\\ |
| 70 |
-l & Write log file. \\ |
| 71 |
-L & Do not write log file. (default) \\ |
| 72 |
-o <file> & Define log file. (still requires -l) \\ |
| 73 |
-v & Verbose mode. (Passed to the underlying WWW Perl module)\\ |
| 74 |
-q & Quiet mode. (Passed to the underlying WWW Perl module)\\ |
| 75 |
-h & Print help and exit.\\ |
| 76 |
-V & Print version number.\\ |
| 77 |
\bottomrule |
| 78 |
\end{tabular} |
| 79 |
|
| 80 |
\subsubsection*{Fields} |
| 81 |
The following fields exists in the CTAN upload form. At least the ones marked as mandatory must be provided. |
| 82 |
\par\medskip\par\noindent |
| 83 |
\begin{tabular}{>{\ttfamily}llc} |
| 84 |
\toprule |
| 85 |
\normalfont Field & Description & ~~~~~\llap{Mandatory} \\ |
| 86 |
\midrule |
| 87 |
contribution & Name of your contribution & * \\ |
| 88 |
version & Version number & *\\ |
| 89 |
name & Your name & *\\ |
| 90 |
email & Your email & *\\ |
| 91 |
summary & Summary description & *\\ |
| 92 |
directory & Suggested CTAN directory\\ |
| 93 |
DoNotAnnounce & No need to announce this update\\ |
| 94 |
announce & Short description for announcement\\ |
| 95 |
notes & Optional notes to the CTAN maintainers (DANTE only)\\ |
| 96 |
license & License type (see below) & *\\ |
| 97 |
freeversion & Which free license (see below)\\ |
| 98 |
file & File to upload & *\\ |
| 99 |
\bottomrule |
| 100 |
\end{tabular} |
| 101 |
|
| 102 |
\subsubsection*{Valid license types} |
| 103 |
The \texttt{license} field can have the following values to indicate the license type: |
| 104 |
\par\medskip\par\noindent |
| 105 |
\begin{tabular}{>{\ttfamily}ll} |
| 106 |
\toprule |
| 107 |
\normalfont License Type & Description \\ |
| 108 |
\midrule |
| 109 |
free & Free\\ |
| 110 |
nocommercial & Nocommercial\\ |
| 111 |
nosell & Nosell\\ |
| 112 |
nosource & Nosource\\ |
| 113 |
shareware & Shareware\\ |
| 114 |
artistic & Perl Artistic (Clarified or later)\\ |
| 115 |
other-nonfree & Other nonfree License\\ |
| 116 |
\bottomrule |
| 117 |
\end{tabular} |
| 118 |
|
| 119 |
\subsubsection*{Valid free licenses} |
| 120 |
If a free license was choosen using \texttt{license=free} |
| 121 |
the specific free license can be selected using the \texttt{freeversion} field which |
| 122 |
can have one of the following values: |
| 123 |
|
| 124 |
\par\medskip\par\noindent |
| 125 |
\begin{tabular}{>{\ttfamily}ll} |
| 126 |
\toprule |
| 127 |
\normalfont License Type & Description \\ |
| 128 |
\midrule |
| 129 |
apache2 & Apache License v2.0\\ |
| 130 |
artistic & Perl Artistic License (version 2)\\ |
| 131 |
fdl & GNU Free Documentation License\\ |
| 132 |
gfl & GUST Font License\\ |
| 133 |
gpl & GNU General Public License\\ |
| 134 |
lgpl & Lesser GPL\\ |
| 135 |
lppl & LaTeX Project\\ |
| 136 |
ofl & Open Font License\\ |
| 137 |
pd & Public Domain\\ |
| 138 |
other-free & Other Free\\ |
| 139 |
\bottomrule |
| 140 |
\end{tabular} |
| 141 |
|
| 142 |
\subsubsection*{File input and output} |
| 143 |
|
| 144 |
The upload fields can also be loaded from a text file using the \texttt{-F} option. |
| 145 |
Such a file needs to hold one field per line in the form `|name = value|'. |
| 146 |
The name should start at the very beginning of a new line. The rest of the line after the equal sign is taken as value. |
| 147 |
The \texttt{announce} and \texttt{notes} field can be followed by additional lines of content. |
| 148 |
These lines should not start with any content similar to the `|name =|' format, where `|name|' is a single word. |
| 149 |
Simply indenting such lines with a space suffices. |
| 150 |
Empty lines and line which start with a `|#|', with or without leading spaces, are ignored. |
| 151 |
|
| 152 |
This format is also used when the upload fields are written to a file. This is done when the edit (`|e|') or save (`|s|') option |
| 153 |
is selected. This allows the direct editing of this file or the later reuse of all or selected fields, respectively. |
| 154 |
|
| 155 |
Using the \texttt{-l} option the upload data and response can be stored in a log file. |
| 156 |
This file is generated in the above format with all extra information starting with `|#|', so that it can be loaded again afterwards. |
| 157 |
The log file name can be given using the \texttt{-o} option or using the \texttt{CTANUPLOAD\_LOGFILE} environment variable. |
| 158 |
Otherwise the log file name defaults to \MacroArgs'ctanupload_'<contribution>'_'<date (YYYY-MM-DD\_HH-mm-SS)>'.log' |
| 159 |
|
| 160 |
|
| 161 |
\section{Examples} |
| 162 |
|
| 163 |
\def\example#1{\par\medskip\par\noindent\textbf{#1}\par} |
| 164 |
\lstset{numbers=none,basicstyle=\ttfamily\small} |
| 165 |
|
| 166 |
\example{Interactive mode (prompt for all values not read from environment variables):} |
| 167 |
\begin{lstlisting} |
| 168 |
ctanupload -p |
| 169 |
\end{lstlisting} |
| 170 |
|
| 171 |
\example{Fill complete form:} |
| 172 |
\begin{lstlisting} |
| 173 |
ctanupload --contribution=somepackage --version=v0.1 \ |
| 174 |
--name "John Doe" [email protected] \ |
| 175 |
--summary "New package to do something." \ |
| 176 |
--directory=/macros/latex/contrib/somepackage \ |
| 177 |
--DoNotAnnounce=0 \ |
| 178 |
--announce "This package allows to ..." \ |
| 179 |
--notes "Some note to the CTAN admins (if required)" \ |
| 180 |
--license=free --freeversion=lppl |
| 181 |
--file=somepackage.tar.gz |
| 182 |
\end{lstlisting} |
| 183 |
|
| 184 |
\example{Use of environment variables:} |
| 185 |
\noindent |
| 186 |
The environment variables can be given in the command line or in a user specific configuration file |
| 187 |
which is read by the shell (e.g.\ \texttt{~/.bashrc} for the Bash shell). |
| 188 |
Shown here is the Bash shell syntax, which is the common shell for Linux. |
| 189 |
The static author data is given as environment variables and the contribution name as argument, while |
| 190 |
the script will prompt the user for the rest. |
| 191 |
|
| 192 |
\par\noindent |
| 193 |
\begin{lstlisting} |
| 194 |
export CTAN_NAME="John Doe" |
| 195 |
export CTAN_EMAIL="[email protected]" |
| 196 |
ctanupload --contribution=somepackage -p |
| 197 |
\end{lstlisting} |
| 198 |
|
| 199 |
\example{Read date from file:} |
| 200 |
\noindent |
| 201 |
Here the announcement text is read from a file \texttt{announcement.txt} while the script will prompt the user |
| 202 |
for the rest of the fields. |
| 203 |
|
| 204 |
\par\noindent |
| 205 |
\begin{lstlisting} |
| 206 |
ctanupload --announce-file announcement.txt -p |
| 207 |
\end{lstlisting} |
| 208 |
|
| 209 |
|
| 210 |
\example{Example Makefile:} |
| 211 |
\noindent |
| 212 |
The following Makefile (see \url{http://www.gnu.org/software/make/manual/make.html}) uses the \texttt{ctanify} script (\url{http://www.ctan.org/pkg/ctanify}) |
| 213 |
to create a compressed file for submission using \texttt{ctanupload}. |
| 214 |
|
| 215 |
\lstinputlisting[basicstyle=\ttfamily\scriptsize,frame=lrbt]{Makefile.example} |
| 216 |
|
| 217 |
\end{document} |