% !TEX root = BuildWithGBP.nw% ===> this file was generated automatically by noweave --- better not edit it
\part{Plugins and Scripts}  

\chapter{Java-Plugin} 

\nwfilename{Part6.nw}\nwbegincode{1}\sublabel{NW4NcYAq-1Vt6yy-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-1Vt6yy-1}}}\moddef{build-gbp-java-plugin.sh~{\nwtagstyle{}\subpageref{NW4NcYAq-1Vt6yy-1}}}\endmoddef\nwstartdeflinemarkup\nwenddeflinemarkup 
#!/usr/bin/bash  

# Copyright 2019-2023 Mechtilde and Michael Stehmann <mechtilde@debian.org>
# version 0.1.1  

# java plugin for build-gbp.sh  

 # This program is free software; you can redistribute it and/or modify 
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 3 of the License, or 
 # (at your option) any later version.  

 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 # GNU General Public License for more details.  

 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 # MA 02110-1301, USA.  

\LA{}Rules4Java~{\nwtagstyle{}\subpageref{NW4NcYAq-15sQn8-1}}\RA{} \nwnotused{build-gbp-java-plugin.sh}\nwendcode{}\nwbegindocs{2}\nwdocspar 

\section{Adjustments for \texttt{Java} package} \label{sec:JavaAdaption} 

In the \textit{debian/rules} file (chapter \ref{subsec:rules}, page \pageref{subsec:rules}), the following lines are added for compiling with \texttt{Java}  

\nwenddocs{}\nwbegincode{3}\sublabel{NW4NcYAq-15sQn8-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-15sQn8-1}}}\moddef{Rules4Java~{\nwtagstyle{}\subpageref{NW4NcYAq-15sQn8-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-1Vt6yy-1}}\nwenddeflinemarkup 
function Rules4Java \{ 
    echo "export JAVA_TOOL_OPTIONS := -Dfile.encoding=UTF8" >> $\{GitPath\}/debian/rules 
    echo -e "export JAVA_HOME := /usr/lib/jvm/default-java\\n" >> $\{GitPath\}/debian/rules
\} \LA{}build-gbp-java- plugin~{\nwtagstyle{}\subpageref{NW4NcYAq-2UVuFb-1}}\RA{} \nwused{\\{NW4NcYAq-1Vt6yy-1}}\nwendcode{}\nwbegindocs{4}\nwdocspar 

This means that: \begin{enumerate} \item{Always use the UTF-8 encoding} \item{the variable \textit{JAVA\_HOME} is set}. \end{enumerate} 

% Todo mit oder ohne export beschreiben
Only a minimal configuration of the \textit{rules} file is provided by the script. This must often be supplemented still meaningfully. For building the JAVA packages the following options are often needed.  

\begin{verbatim} JMODS := /usr/lib/jvm/default-java/jmods 
JAVACMD="\$JAVA\_HOME/bin/java" \end{verbatim} 

It also happens that \textit{JDK\_HOME} is used instead of \textit{JAVA\_HOME}.  

%Es muss ausprobiert werden, ob noch jeweils ein "export" davor gesetzt 
%werden muss
% Der folgende Abschnitt muss noch dazu überprüft werden, was davon im 
%Maven-Plugin untergebracht werden muss.
These additions are provided for packages built with the \textit{maven} build system by the \textit{Maven plugin} (chapter \ref{chap:MavenPlugin}, page \pageref{chap:MavenPlugin}).  

In the line with \textit{dh \$@} options can be inserted.  

\begin{description} \item[-{}-with javahelper] 
\item[-{}-buildsystem=maven] 
\item[-{}-buildsystem=ant] 
\item[-{}-buildsystem=gradle]
 \end{description} 

\nwenddocs{}\nwbegincode{5}\sublabel{NW4NcYAq-2UVuFb-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-2UVuFb-1}}}\moddef{build-gbp-java-plugin~{\nwtagstyle{}\subpageref{NW4NcYAq-2UVuFb-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-15sQn8-1}}\nwenddeflinemarkup 

whiptail --title "Java plugin found" \\ 
--msgbox "build-gbp-java-plugin.sh was loaded." 15 60  

echo "build-gbp-java-plugin.sh was loaded." >> $\{log\} 
\nwused{\\{NW4NcYAq-15sQn8-1}}\nwendcode{}\nwbegindocs{6}\nwdocspar 

\chapter{Maven-Plugin} \label{chap:MavenPlugin} 

The \texttt{Maven} plugin supports building \texttt{Java} packages using the \texttt{Java} build system \textit{maven} (chapter \ref{subsec:JavaPaketMaven}, page \pageref{subsec:JavaPaketMaven}).  

\section{Head of the Maven plugin} 

The header of the plugin contains information about the creators and the license.  

It also notes which \texttt{Debian} packages must be installed for the program script to run.  

\nwenddocs{}\nwbegincode{7}\sublabel{NW4NcYAq-3bFwd5-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-3bFwd5-1}}}\moddef{build-gbp-maven-plugin.sh~{\nwtagstyle{}\subpageref{NW4NcYAq-3bFwd5-1}}}\endmoddef\nwstartdeflinemarkup\nwenddeflinemarkup 
#!/usr/bin/bash  

# Copyright 2019-2023 Mechtilde and Michael Stehmann <mechtilde@debian.org>
# version 0.1.1  

# maven plugin for build-gbp.sh  

 # This program is free software; you can redistribute it and/or modify 
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 3 of the License, or 
 # (at your option) any later version.  

 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 # GNU General Public License for more details.  

 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 # MA 02110-1301, USA.  

# Dependencies: maven-debian-helper licensecheck apt-file  

\LA{}Rules4MavenDH~{\nwtagstyle{}\subpageref{NW4NcYAq-1X9Cb6-1}}\RA{} \nwnotused{build-gbp-maven-plugin.sh}\nwendcode{}\nwbegindocs{8}\nwdocspar 

\section{Notice} 

The plugin script tells that it has been loaded. Thus the code of the plugin is part of the (main) program script.  

\nwenddocs{}\nwbegincode{9}\sublabel{NW4NcYAq-47i6FT-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-47i6FT-1}}}\moddef{MavenPlugin~{\nwtagstyle{}\subpageref{NW4NcYAq-47i6FT-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-SN6sE-1}}\nwenddeflinemarkup 
whiptail --title "maven plugin found" \\ 
--msgbox "build-gbp-maven-plugin.sh was loaded." 15 60  

echo "build-gbp-maven-plugin.sh was loaded." >> $\{log\} 
# Next the function MakeMaven is executed by the main script. 
# This is the end, my friend \nwused{\\{NW4NcYAq-SN6sE-1}}\nwendcode{}\nwbegindocs{10}\nwdocspar 

\begin{figure}[!h] \centering

\includegraphics[width=25em,height=30ex]{Pictures/MavenPluginLoaded.png} \caption{Maven Plugin loaded} \end{figure} 

\section{Building with Maven} \label{sec:BuildWithMaven} 

This function is called by the \textit{BuildNewVersion} function of the (main) program script after loading the plugin when building a new revision (chapter \ref{sec:AnlegenDebianVerzeichnis}, page \pageref{sec:AnlegenDebianVerzeichnis}).  

The execution of \textit{mh\_make} is done in a \textit{chroot} environment. If the \textit{chroot} does not yet exist, it must first be created as described in chapter \ref{sec:MoreChrootSystems}, page \pageref{sec:MoreChrootSystems}.  

\nwenddocs{}\nwbegincode{11}\sublabel{NW4NcYAq-ZOhlV-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-ZOhlV-1}}}\moddef{MakeMaven~{\nwtagstyle{}\subpageref{NW4NcYAq-ZOhlV-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-28IS2D-1}}\nwenddeflinemarkup 
function MakeMaven \{ 
    # Called by BuildNewRevision  

    cd $\{GitPath\} 
    IdentifyMavenChrootPath  

\LA{}MakeMaven1~{\nwtagstyle{}\subpageref{NW4NcYAq-gqeVW-1}}\RA{} \nwused{\\{NW4NcYAq-28IS2D-1}}\nwendcode{}\nwbegindocs{12}\nwdocspar 

\nwenddocs{}\nwbegincode{13}\sublabel{NW4NcYAq-3UsGlp-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-3UsGlp-1}}}\moddef{IdentifyMavenChrootPath~{\nwtagstyle{}\subpageref{NW4NcYAq-3UsGlp-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-2JSWnR-1}}\nwenddeflinemarkup 
function IdentifyMavenChrootPath \{ 
    # Called by MakeMaven and itself  

    if [ -n "$\{ChrootPath\}" ] 
    then 
        if ! whiptail --title "Maven chroot path " \\ 
        --yesno "Is $\{ChrootPath\}\\nthe right path to\\n\\ 
        maven chroot directory on the host?" \\ 
        --yes-button "Yes" \\ 
        --no-button "No" 15 60
\LA{}IdentifyMavenChrootPath1~{\nwtagstyle{}\subpageref{NW4NcYAq-wD95N-1}}\RA{} \nwused{\\{NW4NcYAq-2JSWnR-1}}\nwendcode{}\nwbegindocs{14}
\nwdocspar 

\begin{figure}[!h] \centering

\includegraphics[width=25em,height=30ex]{Pictures/IdentifyMavenChrootPath.png} \caption{Determine path to Maven chroot} \end{figure} 

\nwenddocs{}\nwbegincode{15}\sublabel{NW4NcYAq-wD95N-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-wD95N-1}}}\moddef{IdentifyMavenChrootPath1~{\nwtagstyle{}\subpageref{NW4NcYAq-wD95N-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-3UsGlp-1}}\nwenddeflinemarkup 
        then 
            OldCP=$\{ChrootPath\} 
            AskChrootPath 
        fi 
    else 
        AskChrootPath 
    fi  

\LA{}IdentifyMavenChrootPath2~{\nwtagstyle{}\subpageref{NW4NcYAq-3SKWcr-1}}\RA{} \nwused{\\{NW4NcYAq-3UsGlp-1}}\nwendcode{}\nwbegindocs{16}\nwdocspar 

\nwenddocs{}\nwbegincode{17}\sublabel{NW4NcYAq-2yU147-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-2yU147-1}}}\moddef{AskChrootPath~{\nwtagstyle{}\subpageref{NW4NcYAq-2yU147-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-TDih7-1}}\nwenddeflinemarkup 
function AskChrootPath \{ 
    # Called by IdentifyMavenChrootPath  

    # This is the way from GitPath To /srv/maven-chroot 
    ChrootPath=$(whiptail --title "Maven chroot path" \\ 
    --inputbox "Please insert the path\\nto the maven chroot directory\\n\\ 
    on the host:" \\ --nocancel 15 60 3>&2 2>&1 1>&3) 
\LA{}AskChrootPath1~{\nwtagstyle{}\subpageref{NW4NcYAq-2HDZQq-1}}\RA{} \nwused{\\{NW4NcYAq-TDih7-1}}\nwendcode{}\nwbegindocs{18}\nwdocspar 

\begin{figure}[!h] \centering

\includegraphics[width=25em,height=30ex]{Pictures/MavenChrootPath.png} \caption{Specify path to Maven chroot} \end{figure} 

\nwenddocs{}\nwbegincode{19}\sublabel{NW4NcYAq-2HDZQq-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-2HDZQq-1}}}\moddef{AskChrootPath1~{\nwtagstyle{}\subpageref{NW4NcYAq-2HDZQq-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-2yU147-1}}\nwenddeflinemarkup 

    if [ -n "$\{OldCP\}" ] 
    then 
        ReplaceConfigLines "ChrootPath" $\{ChrootPath\} 
    else 
        echo "### Maven chroot path" 
        echo "ChrootPath="$\{ChrootPath\} >> $\{ConfigPath\}$\{OrigName\} 
    fi 
    OldCP=""
 \} 

\LA{}AskWorkspacePath~{\nwtagstyle{}\subpageref{NW4NcYAq-32GbAG-1}}\RA{} \nwused{\\{NW4NcYAq-2yU147-1}}\nwendcode{}\nwbegindocs{20}\nwdocspar 

\nwenddocs{}\nwbegincode{21}\sublabel{NW4NcYAq-3SKWcr-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-3SKWcr-1}}}\moddef{IdentifyMavenChrootPath2~{\nwtagstyle{}\subpageref{NW4NcYAq-3SKWcr-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-wD95N-1}}\nwenddeflinemarkup 
    # Create Maven-Chroot if not exists 
    if ! [ -d $\{ChrootPath\} ] 
    then 
        echo "Please enter your SUDO password!" 
        sudo mkdir --parents $\{ChrootPath\} 
    fi  

    if ! [ -d $\{ChrootPath\}/usr ] 
    then 
        echo "Please enter your SUDO password!" 
        sudo /usr/sbin/debootstrap --arch amd64 sid \\ 
        $\{ChrootPath\} http://ftp.de.debian.org/debian 
        echo "The maven chroot has been created." >> $\{log\} 
    fi
 

\LA{}IdentifyMavenChrootPath3~{\nwtagstyle{}\subpageref{NW4NcYAq-1Ll2nB-1}}\RA{} \nwused{\\{NW4NcYAq-wD95N-1}}\nwendcode{}\nwbegindocs{22}\nwdocspar 

\nwenddocs{}\nwbegincode{23}\sublabel{NW4NcYAq-1Ll2nB-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-1Ll2nB-1}}}\moddef{IdentifyMavenChrootPath3~{\nwtagstyle{}\subpageref{NW4NcYAq-1Ll2nB-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-3SKWcr-1}}\nwenddeflinemarkup 
    # The workspace is /home/user 
    if [ -n "$\{Path2Workspace\}" ] 
    then 
        if ! whiptail --title "Maven chroot path " \\ 
        --yesno "Is $\{Path2Workspace\}\\nthe workspace in the maven chroot?" \\ 
        --yes-button "Yes" \\ 
        --no-button "No" 15 60 
\LA{}IdentifyMavenChrootPath4~{\nwtagstyle{}\subpageref{NW4NcYAq-4b0e0v-1}}\RA{} \nwused{\\{NW4NcYAq-3SKWcr-1}}\nwendcode{}\nwbegindocs{24}\nwdocspar 

\begin{figure}[!h] \centering

\includegraphics[width=25em,height=30ex]{Pictures/WorkspaceMavenChroot.png} \caption{Determine working directory in the Maven chroot} \end{figure} 

\nwenddocs{}\nwbegincode{25}\sublabel{NW4NcYAq-4b0e0v-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-4b0e0v-1}}}\moddef{IdentifyMavenChrootPath4~{\nwtagstyle{}\subpageref{NW4NcYAq-4b0e0v-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-1Ll2nB-1}}\nwenddeflinemarkup 
        then 
            OldP2W=$\{Path2Workspace\} 
            AskWorkspacePath 
        fi 
    else 
        AskWorkspacePath 
    fi 
\LA{}IdentifyMavenChrootPath5~{\nwtagstyle{}\subpageref{NW4NcYAq-Fuuhl-1}}\RA{} \nwused{\\{NW4NcYAq-1Ll2nB-1}}\nwendcode{}\nwbegindocs{26}\nwdocspar 

\nwenddocs{}\nwbegincode{27}\sublabel{NW4NcYAq-32GbAG-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-32GbAG-1}}}\moddef{AskWorkspacePath~{\nwtagstyle{}\subpageref{NW4NcYAq-32GbAG-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-2HDZQq-1}}\nwenddeflinemarkup 
function AskWorkspacePath \{ 
    # Called by IdentifyMavenChrootPath  

    # This is the way to /home/user/ 
    Path2Workspace=$(whiptail --title "Maven chroot path" \\ 
    --inputbox "Please insert the path\\nto the workspace directory:" \\ 
    --nocancel 15 60 3>&2 2>&1 1>&3) 
\LA{}AskWorkspacePath2~{\nwtagstyle{}\subpageref{NW4NcYAq-2JSWnR-1}}\RA{} \nwused{\\{NW4NcYAq-2HDZQq-1}}\nwendcode{}\nwbegindocs{28}\nwdocspar 

\begin{figure}[!h] \centering

\includegraphics[width=25em,height=30ex]{Pictures/InsertMavenChrootWorkspace.png} \caption{Specify working directory in the Maven chroot} \end{figure} 

\nwenddocs{}\nwbegincode{29}\sublabel{NW4NcYAq-2JSWnR-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-2JSWnR-1}}}\moddef{AskWorkspacePath2~{\nwtagstyle{}\subpageref{NW4NcYAq-2JSWnR-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-32GbAG-1}}\nwenddeflinemarkup 

    if [ -n "$\{OldP2W\}" ] 
    then 
        ReplaceConfigLines "Path2Workspace" $\{Path2Workspace\}
    else 
        echo "Path2Workspace="$\{Path2Workspace\} >> $\{ConfigPath\}$\{OrigName\} 
    fi 
    OldP2W=""
 \} 

\LA{}IdentifyMavenChrootPath~{\nwtagstyle{}\subpageref{NW4NcYAq-3UsGlp-1}}\RA{}  

\nwused{\\{NW4NcYAq-32GbAG-1}}\nwendcode{}\nwbegindocs{30}\nwdocspar 

\nwenddocs{}\nwbegincode{31}\sublabel{NW4NcYAq-Fuuhl-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-Fuuhl-1}}}\moddef{IdentifyMavenChrootPath5~{\nwtagstyle{}\subpageref{NW4NcYAq-Fuuhl-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-4b0e0v-1}}\nwenddeflinemarkup 
    # Replace / at the end 
    Path2Workspace=$(echo $\{Path2Workspace\} | sed --expression="s/\\/$//")
    MavenChrootPath=$\{ChrootPath\}$\{Path2Workspace\} 
    if ! [ -d $\{MavenChrootPath\} ] 
    then 
        whiptail --title "Error!" \\ 
        --msgbox "$\{MavenChrootPath\} does not exist.\\n\\ 
        It will be created now." 15 60 
\LA{}IdentifyMavenChrootPath7~{\nwtagstyle{}\subpageref{NW4NcYAq-28IS2D-1}}\RA{} \nwused{\\{NW4NcYAq-4b0e0v-1}}\nwendcode{}\nwbegindocs{32}\nwdocspar 

\begin{figure}[!h] \centering

\includegraphics[width=25em,height=30ex]{Pictures/NonExistingMavenChroot.png} \caption{Maven chroot does not exist} \end{figure} 

If the \textit{chroot} does not exist, create it as described in chapter \ref{sec:MoreChrootSystems}, page \pageref{sec:MoreChrootSystems}.  

\nwenddocs{}\nwbegincode{33}\sublabel{NW4NcYAq-28IS2D-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-28IS2D-1}}}\moddef{IdentifyMavenChrootPath7~{\nwtagstyle{}\subpageref{NW4NcYAq-28IS2D-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-Fuuhl-1}}\nwenddeflinemarkup 
        echo "Please enter your SUDO password!" 
        sudo mkdir --parents $\{MavenChrootPath\} 
        echo "The maven work space has been created." >> $\{log\} 
    fi
 \} 

\LA{}MakeMaven~{\nwtagstyle{}\subpageref{NW4NcYAq-ZOhlV-1}}\RA{} \nwused{\\{NW4NcYAq-Fuuhl-1}}\nwendcode{}\nwbegindocs{34}\nwdocspar 

\nwenddocs{}\nwbegincode{35}\sublabel{NW4NcYAq-gqeVW-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-gqeVW-1}}}\moddef{MakeMaven1~{\nwtagstyle{}\subpageref{NW4NcYAq-gqeVW-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-ZOhlV-1}}\nwenddeflinemarkup 
    # Copy workspace to maven chroot 
    sudo cp --archive $\{GitPath\} 
    $\{MavenChrootPath\} 

    # Because mh_make has to run in the directory, where pom.xml is 
    echo "pom.xml is here:" find . -name 'pom.xml' -print 
    echo "Please switch to the Maven chroot in another terminal." 
    echo "Use these commands:" 
    echo 
    echo "# sudo mount -o bind /proc /srv/maven-chroot/proc" 
    echo "# sudo mount devpts /dev/pts -t devpts" 
    echo 
    echo "sudo LANG=C chroot "$\{ChrootPath\}" /usr/bin/bash" 
    echo "cd "$\{Path2Workspace\}"/"$\{SourceName\}" 
    echo "try: apt install maven-debian-helper" 
    echo "apt update  &&apt upgrade"" 
    echo "mh_make --verbose "$\{SourceName\}"" 
    echo 
    echo "Then follow the questions of mh_make" 
    echo 
    echo "You can leave the chroot with 'exit'." 
    echo 
    echo "After finishing press return to go on!" 
    read a  

    #--run-tests=true --javadoc=true --verbose 
    #mh_make --package=$\{SourceName\} --bin-package=$\{PackName\} \\ 
    #--run-tests=false --javadoc=false --verbose 
    #if [ $? -ne 0 ] 
    #then 
        # echo "mh_make failed!" 
        # exit 
    #else 
       # echo "mh_make has been executed for "$\{PackName\} >> $\{log\} 
    #fi 
 

    cp --recursive --update $\{MavenChrootPath\}/$\{SourceName\}/debian \\
    $\{GitPath\} 

\LA{}MakeMaven5~{\nwtagstyle{}\subpageref{NW4NcYAq-SN6sE-1}}\RA{} \nwused{\\{NW4NcYAq-ZOhlV-1}}\nwendcode{}\nwbegindocs{36}\nwdocspar 

When running the program \textit{mh\_make} the following questions must be answered. This program itself in also a shell script.  

\begin{description} \item[Environment variable DEBLICENSE not set, using Apache-2.0 by default] The environment variable \textit{DEBLICENSE} is not set, then the Apache-2.0 license is used by default. In the variable \textit{DEBLICENSE} the license for the files in \textit{debian/} is stored.  

% ToDo: Beschreiben, wo diese Umgebungsvariablen definiert werden. 
%(eventuell) vor der Ausführung abfragen.
\item[Checking that apt-file is installed and has been configured\dots {$[$ ok $]$}] Check if the \textit{apt-file} package is installed. This package is only marked as \emph{recommended}. 
\item[Checking that licensecheck is installed\dots {$[$ ok $]$}] Check if the \textit{licensecheck} package is installed. This package is also marked as \emph{recommended} only. 
\item[Solving dependencies for package <PaketName>] \item[Analysing pom.xml\dots] \item[Resolving com.jcabi:jcabi:pom:1.21 of scope runtime\dots]  

% ToDo: Angaben zum speziellen Paket verallgemeinern
\item[In pom.xml: The parent POM cannot be found in the Maven repository for Debian. 
Ignore it? com.jcabi:jcabi:pom:1.21 {$[$ Y/n $]$} \textgreater ]  

% ToDo: Angaben zum speziellen Paket verallgemeinern
That the dependency for the parent element is not found is the rule case. Therefore the question is answered in the affirmative that this can be ignored. This information is then written as \textit{--no-parent} in the file \textit{<packageName>.poms}.
 \item[Enter the upstream version for the package.] Here the version number of the upstream code to be built is requested and usually confirmed with \textit{Enter}. Otherwise the correct version number is entered
 \item[Version of com.jcabi:jcabi-aspects is 0.22.6]  

% ToDo: Angaben zum speziellen Paket verallgemeinern
The version number is displayed again.
 \item[Choose how the version will be transformed:] Now a selection is displayed how this version number should be converted.  

\begin{description} \item[0 - Replace all versions starting by 0. with 0.x] Ersetze alle Versionsbezeichnungen \item[(1) - Change the version to the symbolic 'debian' version] Die Standardangabe wird mit eckigen Klammern (Hier sind es aus satztechnischen Gründen runde Klammern) gekennzeichnet. Diese kann mit \textit{Enter} bestätigt werden. \item[2 - Keep the version] \item[3 - Custom rule] \end{description} 

Andernfalls wird nun die gewünschte Ziffer eingegeben. \item[com.jcabi:jcabi-aspects is a bundle. - Inform mh\_make that dependencies of type jar which may match this library should be transformed into bundles automatically? {$[$ Y/n $]$} \textgreater ] 

% ToDo: Angaben zum speziellen Paket verallgemeinern
When using mh\textit{\_}make<p0>\textit{\item, note that the environment in which mhmake} is started should have all dependencies of the package to be built. Otherwise, any entries in the relevant files (e.g. <i2>debian/control</i2>) must be made up manually. (Chapter <n0>, page <n1>)  

% ToDo: Angaben zum speziellen Paket verallgemeinern
\item[In pom.xml: This dependency cannot be found in the Debian Maven repository. Ignore this dependency? com.jcabi:jcabi-log:jar:0.17 {$[$ y/N $]$} \textgreater ] Diese Meldung kommt, wenn die benötigte Abhängigkeit nicht auf der Arbeitsmaschine installiert ist. 
\begin{verbatim} > dpkg --search /usr/share/maven-repo/com/jcabi/jcabi-log/*/* 
dpkg failed to execute successfully 
> apt-file search /usr/share/maven-repo/com/jcabi/jcabi-log 
Found /usr/share/maven-repo/com/jcabi/jcabi-log/0.18.1/jcabi-log-0.18.1.pom in libjcabi-log-java 
Found /usr/share/maven-repo/com/jcabi/jcabi-log/0.19.0/jcabi-log-0.19.0.pom in libjcabi-log-java 
Found /usr/share/maven-repo/com/jcabi/jcabi-log/debian/jcabi-log-debian.pom in libjcabi-log-java 
> dpkg --search /usr/share/java/jcabi-log.jar 
dpkg failed to execute successfully 
> apt-file search /usr/share/java/jcabi-log.jar 
Found libjcabi-log-java 
[error] Package libjcabi-log-java does not contain Maven dependency 
com.jcabi:jcabi-log:jar:0.17 but there seem to be a match 
If the package contains already Maven artifacts but the names don't match, 
try to enter a substitution rule of the form 
s/groupId/newGroupId/ s/artifactId/newArtifactId/ jar s/version/newVersion/ here: > \end{verbatim} 

After installing the missing package on the working machine, the search can be repeated.: 

\end{description} 

\nwenddocs{}\nwbegincode{37}\sublabel{NW4NcYAq-SN6sE-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-SN6sE-1}}}\moddef{MakeMaven5~{\nwtagstyle{}\subpageref{NW4NcYAq-SN6sE-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-gqeVW-1}}\nwenddeflinemarkup
    if [ -w debian/maven.rules ] 
    then 
        echo "#[groupId] [artefactId] [type] [version] [classifier] [scope]" \\ 
        >> debian/maven.rules 
    fi 

    ShowMaven 

    # Patch for mh_make bug 
    str4standardsversion="4.5.1" 
    cd $\{GitPath\}/debian/ 
    less --LINE-NUMBERS control 

    sed --in-place --expression=\\ 
    "s/Standards-Version: 4.4.1/Standards-Version: $\{str4standardsversion\}/" \\ 
    control 
    # 'a' means append. The string after the 'a' will be appended 
    # to the sting before the 'a'. 
    sed --in-place \\ 
    --expression="/Standards-Version: $\{str4standardsversion\}/ a Rules-Requires-Root: no" \\ 
    control 
    sed --in-place --expression=\\ 
    "s/debhelper-compat (=12)/debhelper-compat $\{str4versiondebhelpers\}/" \\ 
    control 

    cd $\{GitPath\} 
    whiptail --title "Check debian/control" \\ 
    --msgbox "Please check the control file another time!" 15 60
     less --LINE-NUMBERS $\{GitPath\}/debian/control
 \} 

\LA{}MavenPlugin~{\nwtagstyle{}\subpageref{NW4NcYAq-47i6FT-1}}\RA{} \nwused{\\{NW4NcYAq-gqeVW-1}}\nwendcode{}\nwbegindocs{38}\nwdocspar 

\section{Editing Maven files} \label{sec:MavenDateienBearbeiten} 

Packages built with \textit{Maven (mvn)} require additional files in the \textit{debian/} directory for this purpose. These are listed below. 

\nwenddocs{}\nwbegincode{39}\sublabel{NW4NcYAq-3IwFze-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-3IwFze-1}}}\moddef{ShowMaven~{\nwtagstyle{}\subpageref{NW4NcYAq-3IwFze-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-1X9Cb6-1}}\nwenddeflinemarkup 
function ShowMaven \{ 
    # Called by DisplayDebianFiles MakeMaven 

nano --linenumbers --mouse --softwrap debian/$\{PackName\}.poms 

\LA{}ShowMaven2~{\nwtagstyle{}\subpageref{NW4NcYAq-TDih7-1}}\RA{} \nwused{\\{NW4NcYAq-1X9Cb6-1}}\nwendcode{}\nwbegindocs{40}\nwdocspar 

\begin{itemize} \item{maven.cleanIgnoreRules} 
\item{maven.properties} 
\item{maven.rules} \item{maven.ignoreRules} \item{maven.publishedRules}
 \end{itemize} 

Now the file can still be edited  

\nwenddocs{}\nwbegincode{41}\sublabel{NW4NcYAq-TDih7-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-TDih7-1}}}\moddef{ShowMaven2~{\nwtagstyle{}\subpageref{NW4NcYAq-TDih7-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-3IwFze-1}}\nwenddeflinemarkup 
    mavenl=$(ls $\{GitPath\}/debian/ | grep 'maven') 
    for element in $\{mavenl[*]\} 
    do 
        nano --linenumbers --mouse --softwrap debian/$\{element\} 
    done 

    pomsl=$(ls $\{GitPath\}/debian/ | grep $\{PackName\}) 
    for element in $\{pomsl[*]\} 
    do 
        nano --linenumbers --mouse --softwrap debian/$\{element\} 
    done 
 \} 

\LA{}AskChrootPath~{\nwtagstyle{}\subpageref{NW4NcYAq-2yU147-1}}\RA{} \nwused{\\{NW4NcYAq-3IwFze-1}}\nwendcode{}\nwbegindocs{42}\nwdocspar 

\subsection{maven.rules} 

This file is constructed as follows: 

\nwenddocs{}\nwbegincode{43}\sublabel{NW4NcYAq-1qUWrs-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-1qUWrs-1}}}\moddef{maven-rules.header~{\nwtagstyle{}\subpageref{NW4NcYAq-1qUWrs-1}}}\endmoddef\nwstartdeflinemarkup\nwenddeflinemarkup 
#[groupID] [artifactID] [type] [version] [classifier] [scope] 
\nwnotused{maven-rules.header}\nwendcode{}\nwbegindocs{44}\nwdocspar 

\subsection{maven.ignoreRules} 

This file is constructed like the \textit{maven.rules} file. 

\nwenddocs{}\nwbegincode{45}\sublabel{NW4NcYAq-1pIKSs-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-1pIKSs-1}}}\moddef{maven-ignoreRules.header~{\nwtagstyle{}\subpageref{NW4NcYAq-1pIKSs-1}}}\endmoddef\nwstartdeflinemarkup\nwenddeflinemarkup 
#[groupID] [artifactID] [type] [version] [classifier] [scope] 
\nwnotused{maven-ignoreRules.header}\nwendcode{}\nwbegindocs{46}\nwdocspar 

Artifacts that are included in the \textit{maven.rules} file are to be deleted here if necessary. 

\subsection{maven.properties} 

The \textit{maven.properties} file can be used to override values of variables within the \textit{pom.xml} files. The most common use case is to disable or enable tests with \textit{maven.test.skip=true.} 

Other options are to change the source (\textit{maven.compiler.source=8}) or target level (\textit{maven.compiler.target=8}). Here the value (here: \textit{8}) refers to the java minimum version. This entry is especially needed if a message like the following is output during compilation: \textit{use -source 8 or higher to enable \dots}.
 

In addition, the file encoding used (\textit{project.build.sourceEncoding=UTF-8}) can be set here. 

\nwenddocs{}\nwbegincode{47}\sublabel{NW4NcYAq-2BLUST-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-2BLUST-1}}}\moddef{maven.properties~{\nwtagstyle{}\subpageref{NW4NcYAq-2BLUST-1}}}\endmoddef\nwstartdeflinemarkup\nwenddeflinemarkup 
# Include here properties to pass to Maven during the build. 
# For example: 
# maven.test.skip=true # project.build.sourceEncoding=UTF-8 
# maven.compiler.source=8 
# maven.compiler.target=8 
# To skip test - missing dependencies 
maven.test.skip=true 
\nwnotused{maven.properties}\nwendcode{}\nwbegindocs{48}\nwdocspar 

\subsection{PackageName.poms} 

In the file \textit{<package name>.poms} the options to the respective \textit{pom.xml} files are deposited. 

The file then contains 2 columns. The first column contains the pom.xml with the corresponding path and the second column contains the corresponding options, e.g. 

\begin{verbatim} # List of POM files for the package # Format of this file is: 
# <path to pom file> [option]* # where option can be: 
# --ignore: ignore this POM and its artifact if any 
# --ignore-pom: don't install the POM. To use on POM files that are 
# created temporarily for certain artifacts such as Javadoc jars. 
# [mh_install, mh_installpoms] 
# --no-parent: remove the <parent> tag from the POM 
# --package=<package>: an alternative package to use when installing 
# this POM and its artifact 
# --has-package-version: to indicate that the original version of the 
# POM is the same as the upstream part of the version for the package. 
# --keep-elements=<elem1,elem2>: a list of XML elements to keep in the 
# POM during a clean operation with mh_cleanpom or mh_installpom 
# --artifact=<path>: path to the build artifact associated with this 
# POM, it will be installed when using the command mh_install. [mh_install] 
# --java-lib: install the jar into /usr/share/java to comply with Debian 
# packaging guidelines 
# --usj-name=<name>: name to use when installing the library in /usr/share/java 
# --usj-version=<version>: version to use when installing the library in 
# /usr/share/java 
# --no-usj-versionless: don't install the versionless link in /usr/share/java 
# --dest-jar=<path>: the destination for the real jar. 
# It will be installed with mh_install. [mh_install] 
# --classifier=<classifier>: Optional, the classifier for the jar. 
# Empty by default. 
# --site-xml=<location>: Optional, the location for site.xml if it 
# needsto be installed. 
# Empty by default. [mh_install] 
# pom.xml --no-parent --has-package-version \end{verbatim} 

This means that the <parent> tag is removed from the POM when it is built. The \textit{--has-package-version} option specifies that the original version of the POM is the same as the upstream part of the package version. 

\subsection{README.source} \label{subsec:MavenReadmeSource} 

\begin{verbatim} 

Information about jcabi-aspects ------------------------------ 

This package was debianized using the mh_make command from the maven-debian-helper package. 

The build system uses Maven but prevents it from downloading anything from the Internet, making the build compliant with the Debian policy. \end{verbatim} 

\section{\textit{debian/rules} - additions for \texttt{Java} packages with \textit{Maven}} \label{sec:Rules4MavenDH} 

In the \textit{Rules4Maven} function, the build system specification is added to the \textit{debian/rules} file. 

\nwenddocs{}\nwbegincode{49}\sublabel{NW4NcYAq-1X9Cb6-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-1X9Cb6-1}}}\moddef{Rules4MavenDH~{\nwtagstyle{}\subpageref{NW4NcYAq-1X9Cb6-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-3bFwd5-1}}\nwenddeflinemarkup 
function Rules4MavenDH \{ 
    # Called by DebianRulesTemplates 

    sed --in-place \\ 
    --expression="s/dh $@/dh $@ --buildsystem=maven" \\ 
    $\{GitPath\}/debian/rules
 

\} \LA{}ShowMaven~{\nwtagstyle{}\subpageref{NW4NcYAq-3IwFze-1}}\RA{} \nwused{\\{NW4NcYAq-3bFwd5-1}}\nwendcode{}\nwbegindocs{50}\nwdocspar 

\chapter{Web-Extension-Plugin} \label{chap:WebextPlugin} 

The plugin shown below meets the special requirements of building \texttt{Mozilla} extensions as \texttt{Debian} packages (chapter \ref{chap:WebextBauen}, page \pageref{chap:WebextBauen}). 

\section{Header for Webext-Plugins} The header of the plugin contains information about the creators and the license.  

It also notes which \texttt{Debian} packages must be installed for the program script to run.  

\nwenddocs{}\nwbegincode{51}\sublabel{NW4NcYAq-B2EGb-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-B2EGb-1}}}\moddef{build-gbp-webext-plugin.sh~{\nwtagstyle{}\subpageref{NW4NcYAq-B2EGb-1}}}\endmoddef\nwstartdeflinemarkup\nwenddeflinemarkup
#!/usr/bin/bash 

# Copyright 2020-2023 Mechtilde and Michael Stehmann <mechtilde@debian.org>
# version 0.1.1  

# webext plugin for build-gbp.sh 

 # This program is free software; you can redistribute it and/or modify 
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 3 of the License, or 
 # (at your option) any later version.  

 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 # GNU General Public License for more details.  

 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 # MA 02110-1301, USA.  

\LA{}IdentifyWebextId~{\nwtagstyle{}\subpageref{NW4NcYAq-2j9FLK-1}}\RA{} \nwnotused{build-gbp-webext-plugin.sh}\nwendcode{}\nwbegindocs{52}\nwdocspar 

\section{Creating the \textit{webext*.*} files in \textit{debian/}} 

\subsection{Get the name of the \textit{*.xpi} file} 

The extension to be packaged must be stored under the name which is composed of the designation (id) in the file \textit{manifest.json} and the extension \textit{.xpi}. 

The designation is therefore determined as follows. 

\nwenddocs{}\nwbegincode{53}\sublabel{NW4NcYAq-2j9FLK-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-2j9FLK-1}}}\moddef{IdentifyWebextId~{\nwtagstyle{}\subpageref{NW4NcYAq-2j9FLK-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-B2EGb-1}}\nwenddeflinemarkup 
function IdentifyWebextId \{ 
    # Called by WebextRulesDH WebextInstall 

    if [ -z $\{webextID\} ] &&[ -f $\{GitPath\}/manifest.json ] 
    then 
        webextID=$(grep '"id":' $\{GitPath\}/manifest.json) 
        webextID=$(echo $\{webextID\} | sed --expression='s/^\\"id\\": \\"//') 
        webextID=$(echo $\{webextID\} | sed --expression='s/\\",\\s*//') 

        echo -e "Notice from Webext-Plugin: WebextID = "$\{webextID\} >> $\{log\} 
    fi 

    if [ -z $\{webextID\} ] 
    then 
        webextID="PLEASE_REPLACE_WITH_ID" 
        whiptail --title "ID not found" \\ 
        --msgbox "Didn't find ID or manifest.json in $\{GitPath\}" 15 60 
    fi
 \} 

\LA{}webext-rules~{\nwtagstyle{}\subpageref{NW4NcYAq-2o891Q-1}}\RA{} \nwused{\\{NW4NcYAq-B2EGb-1}}\nwendcode{}\nwbegindocs{54}\nwdocspar 

\subsection{\textit{debian/rules} - Additions for \texttt{Mozilla} AddOns} \label{subsec:webextrules} 

In the \textit{debian/rules} file for the web extension, it makes sense to list the directories or files to be installed there and assign them to a variable.This is done according to the pattern \textit{<Package>\_FILES = <List of files to include>.} 

The \textit{<package>\_FILES} list is created automatically by the plugin script. It must be checked for completeness and correctness. The files to be excluded are to be entered manually. 

Since the creation of the \textit{debian/rules} file is done once, when packaging new versions, the two lists must be carefully checked and adjusted if necessary. 

\nwenddocs{}\nwbegincode{55}\sublabel{NW4NcYAq-2o891Q-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-2o891Q-1}}}\moddef{webext-rules~{\nwtagstyle{}\subpageref{NW4NcYAq-2o891Q-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-2j9FLK-1}}\nwenddeflinemarkup 
function WebextRules \{ 
    # Called by DebianRulesTemplate 

    # These strings will be added to str4rules 

    Package=$(echo $\{SourceName\} | tr "a-z" "A-Z") 
    echo -e $\{Package\}"_FILES = \\\\" >> $\{GitPath\}/debian/rules 

    PackageL=$(ls $\{GitPath\}) 
    PackageA=($\{PackageL\}) 

    for element in $\{PackageA[*]\} 
    do 
        if [ "$\{element\}" != "debian" ] 
        then 
            echo -e $\{element\}" \\\\" >> $\{GitPath\}/debian/rules 
        fi 
    done 
    echo "\\$(NULL)" >> $\{GitPath\}/debian/rules
 

\LA{}webext-rules5~{\nwtagstyle{}\subpageref{NW4NcYAq-4KbJ5W-1}}\RA{} \nwused{\\{NW4NcYAq-2j9FLK-1}}\nwendcode{}\nwbegindocs{56}\nwdocspar 

\nwenddocs{}\nwbegincode{57}\sublabel{NW4NcYAq-4KbJ5W-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-4KbJ5W-1}}}\moddef{webext-rules5~{\nwtagstyle{}\subpageref{NW4NcYAq-4KbJ5W-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-2o891Q-1}}\nwenddeflinemarkup 
    echo -e "\\n Uncomment the following lines \\n" 
    echo "if there are files to exclude and add them." 
    echo -e "\\n# "$\{Package\}"_FILES_EXCLUDE = \\\\" \\ 
    >> $\{GitPath\}/debian/rules 
    echo -e "# \\$(NULL)\\n" >> $\{GitPath\}/debian/rules
 \} 

\LA{}webext-rules-dh~{\nwtagstyle{}\subpageref{NW4NcYAq-3X38Az-1}}\RA{} \nwused{\\{NW4NcYAq-2o891Q-1}}\nwendcode{}\nwbegindocs{58}\nwdocspar 

The following lines are added to the \textit{str4rulesdh} variable by the program script.. 

\nwenddocs{}\nwbegincode{59}\sublabel{NW4NcYAq-3X38Az-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-3X38Az-1}}}\moddef{webext-rules-dh~{\nwtagstyle{}\subpageref{NW4NcYAq-3X38Az-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-4KbJ5W-1}}\nwenddeflinemarkup 
function WebextRulesDH \{ 
    # Called by DebianRulesTemplate 

    IdentifyWebextId 

    DHCleanStr="override_dh_clean:\\n\\tdh_clean\\n\\trm -rf debian/build\\n" 

    DHAutoBuildIndepStr1="override_dh_auto_build-indep:" 
    DHAutoBuildIndepStr2="\\tmkdir \\$(CURDIR)/debian/build &&\\\\" 
    Str3B="\\tzip --recurse-paths " 
    DHAutoBuildIndepStr3=$\{Str3B\}"\\$(CURDIR)/debian/build/"$\{webextID\}".xpi \\\\" 
    DHAutoBuildIndepStr4="\\t \\$($\{Package\}_FILES) \\\\" 
    DHAutoBuildIndepStr5="# \\t --exclude \\$($\{Package\}_FILES_EXCLUDE)" 
    DHAutoBuildIndepStr6="\\tdh_auto_build\\n" 

    echo -e $\{DHCleanStr\} >> $\{GitPath\}/debian/rules 
    echo -e $\{DHAutoBuildIndepStr1\} >> $\{GitPath\}/debian/rules 
    echo -e $\{DHAutoBuildIndepStr2\} >> $\{GitPath\}/debian/rules 
    echo -e $\{DHAutoBuildIndepStr3\} >> $\{GitPath\}/debian/rules 
    echo -e "$\{DHAutoBuildIndepStr4\}" >> $\{GitPath\}/debian/rules 
    echo -e "$\{DHAutoBuildIndepStr5\}" >> $\{GitPath\}/debian/rules 
    echo -e $\{DHAutoBuildIndepStr6\} >> $\{GitPath\}/debian/rules
 \} 

\LA{}WebextControl~{\nwtagstyle{}\subpageref{NW4NcYAq-3uWAEF-1}}\RA{} \nwused{\\{NW4NcYAq-4KbJ5W-1}}\nwendcode{}\nwbegindocs{60}\nwdocspar 

\subsection{\textit{debian/control} - Additions for \texttt{Mozilla} AddOns} \label{subsec:WebextControl} 

\nwenddocs{}\nwbegincode{61}\sublabel{NW4NcYAq-3uWAEF-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-3uWAEF-1}}}\moddef{WebextControl~{\nwtagstyle{}\subpageref{NW4NcYAq-3uWAEF-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-3X38Az-1}}\nwenddeflinemarkup 
function WebextControl \{ 
    # Called by DebianControlTemplate 
    # TB specific, for FF 'web' sed --in-place \\ 
    --expression="s/Section: /Section: mail/" $\{GitPath\}/debian/control 

    # 'a' means append. The string after the 'a' will be appended 
    # to the sting before the 'a'. 
    # @X escapes the space at the beginning of the appended line. 
    # It will be removed later. 
    sed --in-place \\ 
    --expression="/Build-Depends: debhelper-compat $\{str4versiondebhelpers\}/ \\ 
    a @X , zip" \\ 
    $\{GitPath\}/debian/control 
    # TB specific, for FF 'firefox-esr (>= 91.4)' sed --in-place \\ 
    --expression="/Depends: \\$\{misc:Depends\}/ \\ 
    a @X , thunderbird (>= 1:91.4)" \\
     $\{GitPath\}/debian/control 
    sed --in-place --expression="s/^@X//g" $\{GitPath\}/debian/control
 \} 

\LA{}WebextInstall~{\nwtagstyle{}\subpageref{NW4NcYAq-ntEeG-1}}\RA{} \nwused{\\{NW4NcYAq-3X38Az-1}}\nwendcode{}\nwbegindocs{62}\nwdocspar 

\subsection{\textit{debian/webext-*.install}} \label{subsec:webext.install} 

For \texttt{Mozilla} extensions the following entry is mandatory: 

\begin{verbatim} debian/build/<manifest-id>.xpi /usr/share/webext \end{verbatim} 

\nwenddocs{}\nwbegincode{63}\sublabel{NW4NcYAq-ntEeG-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-ntEeG-1}}}\moddef{WebextInstall~{\nwtagstyle{}\subpageref{NW4NcYAq-ntEeG-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-3uWAEF-1}}\nwenddeflinemarkup 
function WebextInstall \{ 
    # Called by DisplayDebianFiles 
    IdentifyWebextId 
    InstallStr="debian/build/"$\{webextID\}".xpi\\tusr/share/webext" 
    echo -e $\{InstallStr\} >> $\{GitPath\}/debian/$\{PackName\}.install
 \} 

\LA{}WebextDocs~{\nwtagstyle{}\subpageref{NW4NcYAq-3O5mFU-1}}\RA{} \nwused{\\{NW4NcYAq-3uWAEF-1}}\nwendcode{}\nwbegindocs{64}\nwdocspar 

\subsection{\textit{debian/webext-*.docs}} \label{subsec:webext.docs} 

\nwenddocs{}\nwbegincode{65}\sublabel{NW4NcYAq-3O5mFU-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-3O5mFU-1}}}\moddef{WebextDocs~{\nwtagstyle{}\subpageref{NW4NcYAq-3O5mFU-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-ntEeG-1}}\nwenddeflinemarkup 
function WebextDocs \{ 
    # Called by echo "Still empty"
 \} 

\LA{}WebextLinks~{\nwtagstyle{}\subpageref{NW4NcYAq-3cFE1f-1}}\RA{} \nwused{\\{NW4NcYAq-ntEeG-1}}\nwendcode{}\nwbegindocs{66}\nwdocspar 

\subsection{\textit{debian/webext-links-tb}} \label{subsec:webext.links-tb} 

\scriptsize

\begin{verbatim} \# Source Target 
/usr/share/webext/<manifest.id>.xpi /usr/lib/thunderbird/extensions/<manifest.id>.xpi \end{verbatim} \normalsize

\nwenddocs{}\nwbegincode{67}\sublabel{NW4NcYAq-3cFE1f-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-3cFE1f-1}}}\moddef{WebextLinks~{\nwtagstyle{}\subpageref{NW4NcYAq-3cFE1f-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-3O5mFU-1}}\nwenddeflinemarkup 
function WebextLinksTB \{ 
    # Called by DisplayDebianFiles 
    IdentifyWebextId 
    SourceStr="/usr/share/webext/"$\{webextID\}".xpi\\t" 
    TargetStr="/usr/lib/thunderbird/extensions/"$\{webextID\}".xpi" 
    echo -e $\{SourceStr\}$\{TargetStr\} >> \\ 
    $\{GitPath\}/debian/$\{PackName\}.links
 \} 

\LA{}webext-plugin-end~{\nwtagstyle{}\subpageref{NW4NcYAq-44zweJ-1}}\RA{} \nwused{\\{NW4NcYAq-3O5mFU-1}}\nwendcode{}\nwbegindocs{68}\nwdocspar 

Now comes the conclusion of this Webext plugin. 

\nwenddocs{}\nwbegincode{69}\sublabel{NW4NcYAq-44zweJ-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-44zweJ-1}}}\moddef{webext-plugin-end~{\nwtagstyle{}\subpageref{NW4NcYAq-44zweJ-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-3cFE1f-1}}\nwenddeflinemarkup 
whiptail --title "webext plugin found" \\ 
--msgbox "build-gbp-webext-plugin.sh was loaded." 15 60 
# This is the end, my friend \nwused{\\{NW4NcYAq-3cFE1f-1}}\nwendcode{}\nwbegindocs{70}
\nwdocspar 

\chapter{\texttt{Python}-Plugin} \label{chap:PythonPlugin} 

The plugin shown below meets the special requirements of building \texttt{packages} written in the \texttt{Python} programming language. (Chapter \ref{chap:PythonBauen}, page \pageref{chap:PythonBauen}). 

\nwenddocs{}\nwbegincode{71}\sublabel{NW4NcYAq-3NlQ8l-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-3NlQ8l-1}}}\moddef{build-gbp-python-plugin.sh~{\nwtagstyle{}\subpageref{NW4NcYAq-3NlQ8l-1}}}\endmoddef\nwstartdeflinemarkup\nwenddeflinemarkup 
#!/usr/bin/bash 

# Copyright 2020-2022 Mechtilde and Michael Stehmann <mechtilde@debian.org>
# version 0.1.1  

# python plugin for build-gbp.sh 

 # This program is free software; you can redistribute it and/or modify 
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 3 of the License, or 
 # (at your option) any later version.  

 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 # GNU General Public License for more details.  

 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 # MA 02110-1301, USA.  

\LA{}python-rulesDH~{\nwtagstyle{}\subpageref{NW4NcYAq-2O9mNx-1}}\RA{} \nwnotused{build-gbp-python-plugin.sh}\nwendcode{}\nwbegindocs{72}\nwdocspar 

Next, the plugin announces that it has been loaded. 

\nwenddocs{}\nwbegincode{73}\sublabel{NW4NcYAq-394VUR-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-394VUR-1}}}\moddef{IdentifyPythonId~{\nwtagstyle{}\subpageref{NW4NcYAq-394VUR-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-Zy1bA-1}}\nwenddeflinemarkup 
whiptail –title "python plugin found" \\
–msgbox "build-gbp-python-plugin.sh was loaded." 15 60
 

echo "build-gbp-python-plugin.sh was loaded." >> $\{log\} 

\LA{}python-plugin-end~{\nwtagstyle{}\subpageref{NW4NcYAq-33SGli-1}}\RA{} \nwused{\\{NW4NcYAq-Zy1bA-1}}\nwendcode{}\nwbegindocs{74}\nwdocspar 

%\begin{figure}[!h]
%\centering
%\includegraphics[width=25em,height=30ex]{Pictures/InsertMavenChrootWorkspace.png} 
%\caption{Arbeitsverzeichnis in der Maven-Chroot angeben}
%\end{figure}
\section{Customizations for \texttt{Python} packages} \label{sec:PythonRules} 

Here, the specifics for \texttt{Python} packaging are mapped to the \textit{debian/rules} file. 

\nwenddocs{}\nwbegincode{75}\sublabel{NW4NcYAq-GUH79-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-GUH79-1}}}\moddef{python-rules~{\nwtagstyle{}\subpageref{NW4NcYAq-GUH79-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-2O9mNx-1}}\nwenddeflinemarkup 
function PythonRules \{ 
    # Called by DebianRulesTemplate 

    # These strings will be added to str4rules 
    echo -e "export PYBUILD_NAME="$\{SourceName\}"\\n" >> $\{GitPath\}/Debian/rules 
    echo -e "export PYBUILD_SYSTEM=distutils\\n" >> $\{GitPath\}/Debian/rules
 \} 

\LA{}python-control~{\nwtagstyle{}\subpageref{NW4NcYAq-4F4wdF-1}}\RA{} \nwused{\\{NW4NcYAq-2O9mNx-1}}\nwendcode{}\nwbegindocs{76}\nwdocspar 

\nwenddocs{}\nwbegincode{77}\sublabel{NW4NcYAq-2O9mNx-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-2O9mNx-1}}}\moddef{python-rulesDH~{\nwtagstyle{}\subpageref{NW4NcYAq-2O9mNx-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-3NlQ8l-1}}\nwenddeflinemarkup 
function PythonRulesDH \{ 
    # Called by DebianRulesTemplate 

    sed --in-place \\ 
    --expression="s/dh $@/dh $@ -with python3 --buildsystem=pybuild/" \\ 
    $\{GitPath\}/debian/rules 

\} \LA{}python-rules~{\nwtagstyle{}\subpageref{NW4NcYAq-GUH79-1}}\RA{} \nwused{\\{NW4NcYAq-3NlQ8l-1}}\nwendcode{}\nwbegindocs{78}\nwdocspar 

\section{\textit{debian/control} - Addition for \texttt{Python} packages} \label{sec:PythonControl} 

Here, the specifics for \texttt{Python} packaging are mapped to the \textit{debian/control} file. 

\nwenddocs{}\nwbegincode{79}\sublabel{NW4NcYAq-4F4wdF-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-4F4wdF-1}}}\moddef{python-control~{\nwtagstyle{}\subpageref{NW4NcYAq-4F4wdF-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-GUH79-1}}\nwenddeflinemarkup 
function PythonControl \{ 
    # Called by DebianControlTemplate 

    # Recent Python version 
    PythonVersion=$(py3versions --installed) 

    sed --in-place \\ 
    --expression="s/Section:/Section: python/" $\{GitPath\}/debian/control 

    sed --in-place \\ 
    --expression="/Build-Depends: debhelper-compat $\{str4versiondebhelpers\}/ \\ 
    a , dh-python@X , python3-all@X , python3-setuptools@X\\ 
    X-Python3-Version: >=$\{PythonVersion\}" $\{GitPath\}/debian/control 

    sed --in-place \\ 
    --expression=""
 

\LA{}python-control1~{\nwtagstyle{}\subpageref{NW4NcYAq-Zy1bA-1}}\RA{} \nwused{\\{NW4NcYAq-GUH79-1}}\nwendcode{}\nwbegindocs{80}\nwdocspar 

For testing, the \textit{python3-distutils} and \textit{python3-distutils-extra} packages are also required as build dependencies. 

\nwenddocs{}\nwbegincode{81}\sublabel{NW4NcYAq-Zy1bA-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-Zy1bA-1}}}\moddef{python-control1~{\nwtagstyle{}\subpageref{NW4NcYAq-Zy1bA-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-4F4wdF-1}}\nwenddeflinemarkup 

    sed --in-place \\ 
    --expression="/Depends: \\$\{misc:Depends\}/ \\ 
    a @X , \\$\{python3:Depends\}" \\ 
    $\{GitPath\}/debian/control 

    sed --in-place --expression="s/@X/\\n/g" $\{GitPath\}/debian/control
 \} 

\LA{}IdentifyPythonId~{\nwtagstyle{}\subpageref{NW4NcYAq-394VUR-1}}\RA{} \nwused{\\{NW4NcYAq-4F4wdF-1}}\nwendcode{}\nwbegindocs{82}\nwdocspar 

\nwenddocs{}\nwbegincode{83}\sublabel{NW4NcYAq-33SGli-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-33SGli-1}}}\moddef{python-plugin-end~{\nwtagstyle{}\subpageref{NW4NcYAq-33SGli-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-394VUR-1}}\nwenddeflinemarkup 

# This is the end, my friend \nwused{\\{NW4L0rMe-2uaRFM-1}}\nwendcode{}\nwbegindocs{84}\nwdocspar 

\chapter{Scripts} \section{Creation of a project within the Java team} \label{sec:CreateJavaTeam} 

Creating a project in the Java team, including obtaining an access token\index{Access tokens} to be assigned to the \textit{SALSA\_TOKEN} variable in the following script, is described in chapter \ref{subsec:JavaTeam} (page \pageref{subsec:JavaTeam}). 

\nwenddocs{}\nwbegincode{85}\sublabel{NW4NcYAq-1mpj3x-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-1mpj3x-1}}}\moddef{setup-salsa-repository~{\nwtagstyle{}\subpageref{NW4NcYAq-1mpj3x-1}}}\endmoddef\nwstartdeflinemarkup\nwenddeflinemarkup 
#!/usr/bin/bash 
# 
# Setup a new Git repository on Salsa 
# 
# This script uses the GitLab REST API and requires an access token. 
# The token is obtained from the GitLab profile page -> Access Tokens 
# (https://salsa.debian.org/profile/personal_access_tokens). 
# The token is in the environment variable SALSA_TOKEN 
# or has to be sourced from the ~/.salsarc file and assigned 
# to the SALSA_TOKEN variable: 
# 
# This is the Token for jollyday-java 
# SALSA_TOKEN="KyuZRyWTTxfddcGcyphN" # 

set -eu 
\LA{}setup-salsa-repository3~{\nwtagstyle{}\subpageref{NW4NcYAq-2DEwqI-1}}\RA{} \nwnotused{setup-salsa-repository}\nwendcode{}\nwbegindocs{86}\nwdocspar 

The \textit{jq} package must be installed on the local machine. 

\nwenddocs{}\nwbegincode{87}\sublabel{NW4NcYAq-2DEwqI-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-2DEwqI-1}}}\moddef{setup-salsa-repository3~{\nwtagstyle{}\subpageref{NW4NcYAq-2DEwqI-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-1mpj3x-1}}\nwenddeflinemarkup 

if ! which jq >/dev/null 
then 
    echo "You need to apt install jq" >&2
    exit 1 
fi 

\LA{}setup-salsa-repository5~{\nwtagstyle{}\subpageref{NW4NcYAq-19fbnO-1}}\RA{} \nwused{\\{NW4NcYAq-1mpj3x-1}}\nwendcode{}\nwbegindocs{88}\nwdocspar 

The call is made with the specification of the \textit{SourceName}. 

\nwenddocs{}\nwbegincode{89}\sublabel{NW4NcYAq-19fbnO-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-19fbnO-1}}}\moddef{setup-salsa-repository5~{\nwtagstyle{}\subpageref{NW4NcYAq-19fbnO-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-2DEwqI-1}}\nwenddeflinemarkup 
if [ -z "$1" ]; 
then 
    echo "Usage: ./setup-salsa-repository <packagename>" 
    exit 1; 
fi 

check_return_code() \{ 
    if [ $? -ne 0 ]; 
    then 
        echo 
        echo "Something went wrong!" 
        exit 1 
    fi
 \} 

test -n "$SALSA_TOKEN" || . ~/.salsarc 

PACKAGE=$1 

SALSA_URL="https://salsa.debian.org/api/v4" 
SALSA_GROUP=java-team 
SALSA_GROUP_ID=2588 

\LA{}setup-salsa-repository5~{\nwtagstyle{}\subpageref{NW4NcYAq-19fbnO-1}}\RA{} \nwused{\\{NW4NcYAq-1mpj3x-1}}\nwendcode{}\nwbegindocs{90}\nwdocspar 

Now the repository is created on \textit{salsa.debian.org}. 

\nwenddocs{}\nwbegincode{91}\sublabel{NW4NcYAq-4HgRCU-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-4HgRCU-1}}}\moddef{setup-salsa-repository8~{\nwtagstyle{}\subpageref{NW4NcYAq-4HgRCU-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-19fbnO-1}}\nwenddeflinemarkup 
# ---------------------------------------------------------------------- 

echo "Creating the $\{PACKAGE\} repository..." 

RESPONSE=$(curl -s "$SALSA_URL/projects?private_token=$SALSA_TOKEN" \\ 
  --data "path=$PACKAGE&namespace_id=\\ $SALSA_GROUP_ID&visibility=public&issues_enabled=false&snippets_enabled=false&wiki_enable\\ d=false&jobs_enabled=false&printing_merge_request_link_enabled=false") 

echo $RESPONSE | jq --exit-status .id > /dev/null 
check_return_code 

PROJECT_ID=$(echo $RESPONSE | jq '.id') 
\LA{}setup-salsa-repository10~{\nwtagstyle{}\subpageref{NW4NcYAq-2G7LRt-1}}\RA{} \nwused{\\{NW4NcYAq-19fbnO-1}}\nwendcode{}\nwbegindocs{92}\nwdocspar 

Now the pending BTS tag hook is configured. 

\nwenddocs{}\nwbegincode{93}\sublabel{NW4NcYAq-4HgRCU-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-4HgRCU-1}}}\moddef{setup-salsa-repository8~{\nwtagstyle{}\subpageref{NW4NcYAq-4HgRCU-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-19fbnO-1}}\nwenddeflinemarkup
# ---------------------------------------------------------------------- 

echo "Configuring the BTS tag pending hook..." 

TAGPENDING_URL="https://webhook.salsa.debian.org/tagpending/$PACKAGE" 
curl --silent --output /dev/null -XPOST --header "PRIVATE-TOKEN: $SALSA_TOKEN" \\ 
$SALSA_URL/projects/$PROJECT_ID/hooks \\ 
    --data "url=$TAGPENDING_URL&push_events=1&enable_ssl_verification=1" 
check_return_code 

# ---------------------------------------------------------------------- 

echo "Configuring the KGB hook..." 

KGB_URL="http://kgb.debian.net:9418/webhook/?channel=debian-java\\ 

%26network=oftc%26private=1%26use_color=1%26use_irc_notices=1%26squash_threshold=20"
curl --silent --output /dev/null -XPOST --header "PRIVATE-TOKEN: $SALSA_TOKEN" \\ 
$SALSA_URL/projects/$PROJECT_ID/hooks \\ 
    --data "url=\\ 
    $KGB_URL&push_events=yes&issues_events=yes&merge_requests_events=
    yes&tag_push_events=\\ yes&note_events=yes&job_events=yes&pipeline_events=yes&wiki_events=yes&enable_ssl_verification=1" 

check_return_code 

# ---------------------------------------------------------------------- 

echo "Configuring email notification on push..." 

curl --silent --output /dev/null -XPUT --header "PRIVATE-TOKEN: $SALSA_TOKEN" \\ 
$SALSA_URL/projects/$PROJECT_ID/services/emails-on-push \\ 
    --data "recipients=pkg-java-commits@lists.alioth.debian.org \\ 
    dispatch@tracker.debian.org" 
check_return_code 

# ---------------------------------------------------------------------- 

echo 
echo "Done! The repository is located at $\{SALSA_URL \nwused{\\{NW4NcYAq-4HgRCU-1}}\nwendcode{}\nwbegindocs{94}\nwdocspar 

%/api*\}/$SALSA_GROUP/$PACKAGE"
\section{Script for extracting the documentation in PDF and Epub format.} \label{sec:CreateBook} 

This script is used to create readable documents. 

\subsection{Dependencies} \label{subsec:BookDependencies} 

The following packages must be installed for the script to run. 

\begin{itemize} \item noweb 
\item texlive
\item texlive-latex-extra 
\item texlive-extra-utils 
\item texlive-binaries 
\item texlive-bibtex-extra 
\item biber 
\item texlive-lang-japanese 
\item tidy 
\item texlive-lang-german - for the German documentation 
\item texlive-lang-english - for the English transaltion 
\item texlive-lang-french - for the French translation \end{itemize} 

\subsection{Procedure} 

First, the script creates *.tex documents from the *.nw documents. 

The following script can be extracted with 

\begin{verbatim} notangle -Rcreate-book.sh Part6.nw > create-book.sh &&t=$(date + 
echo "#generated on $t" >> create-book.sh 
chmod ugo+x create-book.sh
 \end{verbatim} 

%c)
from the file \textit{Part6.nw}. 

\nwenddocs{}\nwbegincode{95}\sublabel{NW4NcYAq-m3SNi-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-m3SNi-1}}}\moddef{create-book.sh~{\nwtagstyle{}\subpageref{NW4NcYAq-m3SNi-1}}}\endmoddef\nwstartdeflinemarkup\nwenddeflinemarkup 
#!/usr/bin/bash 

#set -e 

BasePath=$(pwd) 

LANGS="en_US" 

noweave -index -delay BuildWithGBP.nw > BuildWithGBP.tex # contains preamble 
noweave -index -delay Title.nw > GBP-Title.tex 
noweave -index -delay Part1.nw > GBP-Part1.tex 
noweave -index -delay Part2.nw > GBP-Part2.tex 
noweave -index -delay Part3.nw > GBP-Part3.tex 
noweave -index -delay Part4.nw > GBP-Part4.tex 
noweave -index -delay Part5.nw > GBP-Part5.tex 
noweave -index -delay Part6.nw > GBP-Part6.tex 

#noweave -filter l2h -index -html BuildWithGBP.nw | htmltoc > BuildWithGBP.html 

\LA{}create-book.sh1~{\nwtagstyle{}\subpageref{NW4NcYAq-3Jnovu-1}}\RA{} \nwnotused{create-book.sh}\nwendcode{}\nwbegindocs{96}\nwdocspar 

This will then be converted to *.pdf and *.epub documents. The keyword directory must be created only once, after the first execution of \textit{pdflatex}. Multiple execution generates too high page numbers. 

\nwenddocs{}\nwbegincode{97}\sublabel{NW4NcYAq-3Jnovu-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-3Jnovu-1}}}\moddef{create-book.sh1~{\nwtagstyle{}\subpageref{NW4NcYAq-3Jnovu-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-m3SNi-1}}\nwenddeflinemarkup 
if [ -f BuildWithGBP.aux ] 
then 
    rm BuildWithGBP.aux 
fi 

for ((i=4; i>0; i--)) 
do 
    echo $i 
    pdflatex -shell-escape BuildWithGBP.tex 

    # Create Index only one time 
    # Otherwise you get wrong page numbers 
    if [ i=4 ] 
    then 
        makeindex BuildWithGBP 
    fi 

    # Create Bibliography 
    biber BuildWithGBP 
done
 

\LA{}create-book.sh5~{\nwtagstyle{}\subpageref{NW4NcYAq-2UQQOE-1}}\RA{} \nwused{\\{NW4NcYAq-m3SNi-1}}\nwendcode{}\nwbegindocs{98}\nwdocspar 

The EPUB format is a zipped XHTML enriched with metadata. 

\nwenddocs{}\nwbegincode{99}\sublabel{NW4NcYAq-2UQQOE-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-2UQQOE-1}}}\moddef{create-book.sh5~{\nwtagstyle{}\subpageref{NW4NcYAq-2UQQOE-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-3Jnovu-1}}\nwenddeflinemarkup 
# tex4ebook -f mobi BuildWithGBP.tex 
tex4ebook -f epub BuildWithGBP.tex ../ 

\LA{}create-book.sh6~{\nwtagstyle{}\subpageref{NW4NcYAq-8WbX4-1}}\RA{} \nwused{\\{NW4NcYAq-3Jnovu-1}}\nwendcode{}\nwbegindocs{100}\nwdocspar 

\nwenddocs{}\nwbegincode{101}\sublabel{NW4NcYAq-8WbX4-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-8WbX4-1}}}\moddef{create-book.sh6~{\nwtagstyle{}\subpageref{NW4NcYAq-8WbX4-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-2UQQOE-1}}\nwenddeflinemarkup 

# For the first translation 

for lang in $\{LANGS\} 
do 
    cd translation/$\{lang\}/target 
    for ((i=4; i>0; i--)) 
    do 
        pdflatex -shell-escape ./BuildWithGBP.tex 
        if [ i=4 ] 
        then 
            makeindex BuildWithGBP 
        fi 

        # Create Bibliography 
        biber BuildWithGBP 
    done 
    cd $\{BasePath\} 
done 

# Remove auxillary *.html files which are needed for epub 
if ls | grep --quiet '\\.html' 
then 
    rm *.html 
fi
 

\nwused{\\{NW4NcYAq-2UQQOE-1}}\nwendcode{}\nwbegindocs{102}\nwdocspar 

\section{Script for extracting the scripts.} \label{sec:CreateBuildscript} 

The following script can be extracted with 

\begin{verbatim} notangle -Rcreate-buildscript.sh Part6.nw > create-buildscript.sh &&t=$(date + 
echo "#generated on $t" >> create-buildscript.sh 
chmod ugo+x create-buildscript.sh \end{verbatim} 

%c)
from the file \textit{Part6.nw}. 

\nwenddocs{}\nwbegincode{103}\sublabel{NW4NcYAq-wYoEi-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-wYoEi-1}}}\moddef{build-script~{\nwtagstyle{}\subpageref{NW4NcYAq-wYoEi-1}}}\endmoddef\nwstartdeflinemarkup\nwenddeflinemarkup 
cat Title.nw Part1.nw Part2.nw Part3.nw Part4.nw Part5.nw Part6.nw > BuildWithGBPg.nw 
notangle -Rbuild-gbp.sh BuildWithGBPg.nw > build-gbp.sh &&t=$(date +\%c)
sed --in-place \\ 
--expression='s/This is the end, my friend[[:cntrl:]]*/This is the end, my friend/' \\ 
build-gbp.sh 
echo "#generated on $t" >> build-gbp.sh 
chmod ugo+x build-gbp.sh 

%c)
notangle -Rbuild-gbp-maven-plugin.sh BuildWithGBPg.nw > build-gbp-maven-plugin.sh &&t=$(date +\%c)
sed --in-place \\ 
--expression='s/This is the end, my friend[[:cntrl:]]*/This is the end, my friend/' \\ 
build-gbp-maven-plugin.sh 
echo "#generated on $t" >> build-gbp-maven-plugin.sh 
chmod ugo+x build-gbp-maven-plugin.sh 

%c)
notangle -Rbuild-gbp-webext-plugin.sh BuildWithGBPg.nw > \\ 
build-gbp-webext-plugin.sh &&t=$(date +\%c)
sed --in-place \\ 
--expression='s/This is the end, my friend[[:cntrl:]]*/This is the end, my friend/' \\ 
build-gbp-webext-plugin.sh 
echo "#generated on $t" >> build-gbp-webext-plugin.sh 
chmod ugo+x build-gbp-webext-plugin.sh 

%c)
# Remove auxillary file BuildWithGBPg.nw 
rm BuildWithGBPg.nw 

\nwnotused{build-script}\nwendcode{}\nwbegindocs{104}\nwdocspar 

By means of the command \textit{noweave}\index{noweave} the German language \textit{*.nw} files are converted into \textit{*.tex} files\index{TeX-Files}.
 

\nwenddocs{}\nwbegincode{105}\sublabel{NW4NcYAq-XCxZd-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-XCxZd-1}}}\moddef{CreateTexFromNW~{\nwtagstyle{}\subpageref{NW4NcYAq-XCxZd-1}}}\endmoddef\nwstartdeflinemarkup\nwenddeflinemarkup 
function CreateTexFromNW \{ 
    # Called by TaskSelect 
    # Create *.tex files from *.nw files 

    cd $\{SRCDIR\} 

    noweave -index -delay BuildWithGBP.nw > BuildWithGBP.tex # contains preamble 
    noweave -index -delay Title.nw > GBP-Title.tex 
    noweave -index -delay Part1.nw > GBP-Part1.tex 
    noweave -index -delay Part2.nw > GBP-Part2.tex 
    noweave -index -delay Part3.nw > GBP-Part3.tex 
    noweave -index -delay Part4.nw > GBP-Part4.tex 
    noweave -index -delay Part5.nw > GBP-Part5.tex 
    noweave -index -delay Part6.nw > GBP-Part6.tex 
\LA{}CreateTexFromNW1~{\nwtagstyle{}\subpageref{NW4NcYAq-erToq-1}}\RA{} \nwnotused{CreateTexFromNW}\nwendcode{}\nwbegindocs{106}\nwdocspar 

Any existing \textit{BuildWithGBP\_html.tex} file will be removed.. 

\nwenddocs{}\nwbegincode{107}\sublabel{NW4NcYAq-erToq-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-erToq-1}}}\moddef{CreateTexFromNW1~{\nwtagstyle{}\subpageref{NW4NcYAq-erToq-1}}}\endmoddef\nwstartdeflinemarkup\nwusesondefline{\\{NW4NcYAq-XCxZd-1}}\nwenddeflinemarkup 

if [ -f BuildWithGBP_html.tex ] then rm BuildWithGBP_html.tex fi \} \nwused{\\{NW4NcYAq-XCxZd-1}}\nwendcode{}\nwbegindocs{108}\nwdocspar 

\section{\textit{gitlab-ci.yml} für die Salsa-CI} \label{sec:gitlab-ci.yml} 

\nwenddocs{}\nwbegincode{109}\sublabel{NW4NcYAq-2VvVJL-1}\nwmargintag{{\nwtagstyle{}\subpageref{NW4NcYAq-2VvVJL-1}}}\moddef{gitlab-ci.yml~{\nwtagstyle{}\subpageref{NW4NcYAq-2VvVJL-1}}}\endmoddef\nwstartdeflinemarkup\nwenddeflinemarkup 
  variables: 
    DEPS: file make texlive noweb texlive-bibtex-extra texlive-lang-german 
          texlive-lang-japanese texlive-latex-extra texlive-binaries 
          texlive-extra-utils biber tidy texlive-lang-english 

  stages: 
    - build 
    - deploy 

  build: 
    stage: build 
    image: debian:sid 
    before_script: 
      - apt -y update 
      - apt -y install $DEPS 
    script: 
      - make 
    artifacts: 
      paths: 
        - '*.pdf' 
        - '*.epub' 
        - 'build-gbp-python-plugin.sh' 
        - 'build-gbp-maven-plugin.sh' 
        - 'build-gbp-webext-plugin.sh' 
        - 'build-gbp.sh' 
        - 'build-gbp-java-plugin.sh' 
        - 'translation/en_US/target/*.pdf' 

pages: 
  stage: deploy 
  image: debian:sid
  needs: 
    - build 
  script: 
    - mkdir -p public/de 
    - mkdir -p public/en_US 
    - cp *.pdf *.epub build-gbp*.sh public/
    - cp *.tex public/de/ 
    - cp translation/en_US/target/*.pdf public/en_US/ 

  artifacts: 
    paths: 
      - public 
  only: 
    - master 
\nwnotused{gitlab-ci.yml}\nwendcode{} 

\nwixlogsorted{c}{{AskChrootPath}{NW4NcYAq-2yU147-1}{\nwixd{NW4NcYAq-2yU147-1}\nwixu{NW4NcYAq-TDih7-1}}} \nwixlogsorted{c}{{AskChrootPath1}{NW4NcYAq-2HDZQq-1}{\nwixu{NW4NcYAq-2yU147-1}\nwixd{NW4NcYAq-2HDZQq-1}}} \nwixlogsorted{c}{{AskWorkspacePath}{NW4NcYAq-32GbAG-1}{\nwixu{NW4NcYAq-2HDZQq-1}\nwixd{NW4NcYAq-32GbAG-1}}} \nwixlogsorted{c}{{AskWorkspacePath2}{NW4NcYAq-2JSWnR-1}{\nwixu{NW4NcYAq-32GbAG-1}\nwixd{NW4NcYAq-2JSWnR-1}}} \nwixlogsorted{c}{{build-gbp-java-plugin}{NW4NcYAq-2UVuFb-1}{\nwixu{NW4NcYAq-15sQn8-1}\nwixd{NW4NcYAq-2UVuFb-1}}} \nwixlogsorted{c}{{build-gbp-java-plugin.sh}{NW4NcYAq-1Vt6yy-1}{\nwixd{NW4NcYAq-1Vt6yy-1}}} \nwixlogsorted{c}{{build-gbp-maven-plugin.sh}{NW4NcYAq-3bFwd5-1}{\nwixd{NW4NcYAq-3bFwd5-1}}} \nwixlogsorted{c}{{build-gbp-python-plugin.sh}{NW4NcYAq-3NlQ8l-1}{\nwixd{NW4NcYAq-3NlQ8l-1}}} \nwixlogsorted{c}{{build-gbp-webext-plugin.sh}{NW4NcYAq-B2EGb-1}{\nwixd{NW4NcYAq-B2EGb-1}}} \nwixlogsorted{c}{{build-script}{NW4NcYAq-wYoEi-1}{\nwixd{NW4NcYAq-wYoEi-1}}} \nwixlogsorted{c}{{create-book.sh}{NW4NcYAq-m3SNi-1}{\nwixd{NW4NcYAq-m3SNi-1}}} \nwixlogsorted{c}{{create-book.sh1}{NW4NcYAq-3Jnovu-1}{\nwixu{NW4NcYAq-m3SNi-1}\nwixd{NW4NcYAq-3Jnovu-1}}} \nwixlogsorted{c}{{create-book.sh5}{NW4NcYAq-2UQQOE-1}{\nwixu{NW4NcYAq-3Jnovu-1}\nwixd{NW4NcYAq-2UQQOE-1}}} \nwixlogsorted{c}{{create-book.sh6}{NW4NcYAq-8WbX4-1}{\nwixu{NW4NcYAq-2UQQOE-1}\nwixd{NW4NcYAq-8WbX4-1}}} \nwixlogsorted{c}{{CreateTexFromNW}{NW4NcYAq-XCxZd-1}{\nwixd{NW4NcYAq-XCxZd-1}}} \nwixlogsorted{c}{{CreateTexFromNW1}{NW4NcYAq-erToq-1}{\nwixu{NW4NcYAq-XCxZd-1}\nwixd{NW4NcYAq-erToq-1}}} \nwixlogsorted{c}{{gitlab-ci.yml}{NW4NcYAq-2VvVJL-1}{\nwixd{NW4NcYAq-2VvVJL-1}}} \nwixlogsorted{c}{{IdentifyMavenChrootPath}{NW4NcYAq-3UsGlp-1}{\nwixd{NW4NcYAq-3UsGlp-1}\nwixu{NW4NcYAq-2JSWnR-1}}} \nwixlogsorted{c}{{IdentifyMavenChrootPath1}{NW4NcYAq-wD95N-1}{\nwixu{NW4NcYAq-3UsGlp-1}\nwixd{NW4NcYAq-wD95N-1}}} \nwixlogsorted{c}{{IdentifyMavenChrootPath2}{NW4NcYAq-3SKWcr-1}{\nwixu{NW4NcYAq-wD95N-1}\nwixd{NW4NcYAq-3SKWcr-1}}} \nwixlogsorted{c}{{IdentifyMavenChrootPath3}{NW4NcYAq-1Ll2nB-1}{\nwixu{NW4NcYAq-3SKWcr-1}\nwixd{NW4NcYAq-1Ll2nB-1}}} \nwixlogsorted{c}{{IdentifyMavenChrootPath4}{NW4NcYAq-4b0e0v-1}{\nwixu{NW4NcYAq-1Ll2nB-1}\nwixd{NW4NcYAq-4b0e0v-1}}} \nwixlogsorted{c}{{IdentifyMavenChrootPath5}{NW4NcYAq-Fuuhl-1}{\nwixu{NW4NcYAq-4b0e0v-1}\nwixd{NW4NcYAq-Fuuhl-1}}} \nwixlogsorted{c}{{IdentifyMavenChrootPath7}{NW4NcYAq-28IS2D-1}{\nwixu{NW4NcYAq-Fuuhl-1}\nwixd{NW4NcYAq-28IS2D-1}}} \nwixlogsorted{c}{{IdentifyPythonId}{NW4NcYAq-394VUR-1}{\nwixd{NW4NcYAq-394VUR-1}\nwixu{NW4NcYAq-Zy1bA-1}}} \nwixlogsorted{c}{{IdentifyWebextId}{NW4NcYAq-2j9FLK-1}{\nwixu{NW4NcYAq-B2EGb-1}\nwixd{NW4NcYAq-2j9FLK-1}}} \nwixlogsorted{c}{{MakeMaven}{NW4NcYAq-ZOhlV-1}{\nwixd{NW4NcYAq-ZOhlV-1}\nwixu{NW4NcYAq-28IS2D-1}}} \nwixlogsorted{c}{{MakeMaven1}{NW4NcYAq-gqeVW-1}{\nwixu{NW4NcYAq-ZOhlV-1}\nwixd{NW4NcYAq-gqeVW-1}}} \nwixlogsorted{c}{{MakeMaven5}{NW4NcYAq-SN6sE-1}{\nwixu{NW4NcYAq-gqeVW-1}\nwixd{NW4NcYAq-SN6sE-1}}} \nwixlogsorted{c}{{maven-ignoreRules.header}{NW4NcYAq-1pIKSs-1}{\nwixd{NW4NcYAq-1pIKSs-1}}} \nwixlogsorted{c}{{maven-rules.header}{NW4NcYAq-1qUWrs-1}{\nwixd{NW4NcYAq-1qUWrs-1}}} \nwixlogsorted{c}{{maven.properties}{NW4NcYAq-2BLUST-1}{\nwixd{NW4NcYAq-2BLUST-1}}} \nwixlogsorted{c}{{MavenPlugin}{NW4NcYAq-47i6FT-1}{\nwixd{NW4NcYAq-47i6FT-1}\nwixu{NW4NcYAq-SN6sE-1}}} \nwixlogsorted{c}{{python-control}{NW4NcYAq-4F4wdF-1}{\nwixu{NW4NcYAq-GUH79-1}\nwixd{NW4NcYAq-4F4wdF-1}}} \nwixlogsorted{c}{{python-control1}{NW4NcYAq-Zy1bA-1}{\nwixu{NW4NcYAq-4F4wdF-1}\nwixd{NW4NcYAq-Zy1bA-1}}} \nwixlogsorted{c}{{python-plugin-end}{NW4NcYAq-33SGli-1}{\nwixu{NW4NcYAq-394VUR-1}\nwixd{NW4NcYAq-33SGli-1}}} \nwixlogsorted{c}{{python-rules}{NW4NcYAq-GUH79-1}{\nwixd{NW4NcYAq-GUH79-1}\nwixu{NW4NcYAq-2O9mNx-1}}} \nwixlogsorted{c}{{python-rulesDH}{NW4NcYAq-2O9mNx-1}{\nwixu{NW4NcYAq-3NlQ8l-1}\nwixd{NW4NcYAq-2O9mNx-1}}} \nwixlogsorted{c}{{Rules4Java}{NW4NcYAq-15sQn8-1}{\nwixu{NW4NcYAq-1Vt6yy-1}\nwixd{NW4NcYAq-15sQn8-1}}} \nwixlogsorted{c}{{Rules4MavenDH}{NW4NcYAq-1X9Cb6-1}{\nwixu{NW4NcYAq-3bFwd5-1}\nwixd{NW4NcYAq-1X9Cb6-1}}} \nwixlogsorted{c}{{setup-salsa-repository}{NW4NcYAq-1mpj3x-1}{\nwixd{NW4NcYAq-1mpj3x-1}}} \nwixlogsorted{c}{{setup-salsa-repository10}{NW4NcYAq-2G7LRt-1}{\nwixu{NW4NcYAq-4HgRCU-1}\nwixd{NW4NcYAq-2G7LRt-1}}} \nwixlogsorted{c}{{setup-salsa-repository3}{NW4NcYAq-2DEwqI-1}{\nwixu{NW4NcYAq-1mpj3x-1}\nwixd{NW4NcYAq-2DEwqI-1}}} \nwixlogsorted{c}{{setup-salsa-repository5}{NW4NcYAq-19fbnO-1}{\nwixu{NW4NcYAq-2DEwqI-1}\nwixd{NW4NcYAq-19fbnO-1}}} \nwixlogsorted{c}{{setup-salsa-repository8}{NW4NcYAq-4HgRCU-1}{\nwixu{NW4NcYAq-19fbnO-1}\nwixd{NW4NcYAq-4HgRCU-1}}} \nwixlogsorted{c}{{ShowMaven}{NW4NcYAq-3IwFze-1}{\nwixd{NW4NcYAq-3IwFze-1}\nwixu{NW4NcYAq-1X9Cb6-1}}} \nwixlogsorted{c}{{ShowMaven2}{NW4NcYAq-TDih7-1}{\nwixu{NW4NcYAq-3IwFze-1}\nwixd{NW4NcYAq-TDih7-1}}} \nwixlogsorted{c}{{webext-plugin-end}{NW4NcYAq-44zweJ-1}{\nwixu{NW4NcYAq-3cFE1f-1}\nwixd{NW4NcYAq-44zweJ-1}}} \nwixlogsorted{c}{{webext-rules}{NW4NcYAq-2o891Q-1}{\nwixu{NW4NcYAq-2j9FLK-1}\nwixd{NW4NcYAq-2o891Q-1}}} \nwixlogsorted{c}{{webext-rules-dh}{NW4NcYAq-3X38Az-1}{\nwixu{NW4NcYAq-4KbJ5W-1}\nwixd{NW4NcYAq-3X38Az-1}}} \nwixlogsorted{c}{{webext-rules5}{NW4NcYAq-4KbJ5W-1}{\nwixu{NW4NcYAq-2o891Q-1}\nwixd{NW4NcYAq-4KbJ5W-1}}} \nwixlogsorted{c}{{WebextControl}{NW4NcYAq-3uWAEF-1}{\nwixu{NW4NcYAq-3X38Az-1}\nwixd{NW4NcYAq-3uWAEF-1}}} \nwixlogsorted{c}{{WebextDocs}{NW4NcYAq-3O5mFU-1}{\nwixu{NW4NcYAq-ntEeG-1}\nwixd{NW4NcYAq-3O5mFU-1}}} \nwixlogsorted{c}{{WebextInstall}{NW4NcYAq-ntEeG-1}{\nwixu{NW4NcYAq-3uWAEF-1}\nwixd{NW4NcYAq-ntEeG-1}}} \nwixlogsorted{c}{{WebextLinks}{NW4NcYAq-3cFE1f-1}{\nwixu{NW4NcYAq-3O5mFU-1}\nwixd{NW4NcYAq-3cFE1f-1}}} \nwbegindocs{110}\nwdocspar \nwenddocs{} 