Ignore:
Timestamp:
2022-12-12T13:55:38+13:00 (17 months ago)
Author:
anupama
Message:

New ant target unpack-cgimodule called during ant install command, that on a Unix system for perl >= 5.22 will unpack the common-src/cgi-bin/CGIModule.tar.gz into web/WEB-INF/cgi

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/build.xml

    r36879 r37020  
    11151115   
    11161116
    1117   <target name="install-runtime" depends="init,configure,configure-packages,configure-core,compile-web,compile-packages,compile-core,compile-classpath-jars"
     1117  <target name="install-runtime" depends="init,configure,configure-packages,configure-core,compile-web,compile-packages,compile-core,compile-classpath-jars,unpack-cgimodule"
    11181118    description="Install (configure, compile, install) the runtime system. Needs either common-src or collection-building to have been installed first." />
    11191119   
     
    19551955  <target name="update-web" depends="init,svnupdate-web,configure-web"
    19561956    description="update only the web stuff (config files)"/>
     1957
     1958
     1959  <!--
     1960      Newer versions of perl need CGI.pm placed in web/WEB-INF/cgi.
     1961      We have a CGIModule.tar.gz in common-src/cgi-bin, that we can use for linux (unix) systems.
     1962
     1963      - from perl5.22, CGI.pm is not included, but GS3 needs it:
     1964      https://stackoverflow.com/questions/45434990/why-does-this-code-have-issues-with-the-cgi-module
     1965      - bash line to get perl version: https://www.unix.com/shell-programming-and-scripting/18267-version-perl-installed-my-system.html
     1966      - run bash command using pipes with ant: https://stackoverflow.com/questions/1187402/ant-run-command-with-pipes
     1967      - single quotes in XML use &apos; https://stackoverflow.com/questions/7388695/how-can-i-escape-double-quotes-in-ant
     1968      - islessthan and isgreaterthan ant bool conditionals: https://stackoverflow.com/questions/7616159/apache-ant-less-than
     1969  --> 
     1970  <condition property="cgimodule.exists">
     1971    <and>
     1972      <available file="${web.home}/WEB-INF/cgi" type="dir"/> <!--Unavailable for custom web.home-->
     1973      <available file="${web.home}/WEB-INF/cgi/CGI.pm" type="file"/>
     1974      <available file="${web.home}/WEB-INF/cgi/Fh.pm" type="file"/>
     1975      <available file="${web.home}/WEB-INF/cgi/CGI" type="dir"/>
     1976    </and>
     1977  </condition>
     1978 
     1979  <target name="unpack-cgimodule" if="current.os.isunix" unless="cgimodule.exists">
     1980    <exec executable="bash" outputproperty="perl.major.version">
     1981      <arg value="-c"/>
     1982      <arg line='"perl -v | awk &apos;/This/ {print $4}&apos; | sed -e &apos;s/,//&apos;"'/>
     1983    </exec>
     1984    <echo>Got perl major version: ${perl.major.version}</echo>
     1985    <exec executable="bash" outputproperty="perl.min.version">
     1986      <arg value="-c"/>
     1987      <arg line='"perl -v | awk &apos;/This/ {print $6}&apos; | sed -e &apos;s/,//&apos;"'/>
     1988    </exec>
     1989    <echo>Got perl minor version: ${perl.min.version}</echo>
     1990
     1991    <if>
     1992      <bool>
     1993    <or>
     1994      <isgreaterthan arg1="${perl.major.version}" arg2="5"/>
     1995      <and>
     1996        <equals arg1="${perl.major.version}" arg2="5" trim="true"/>
     1997            <islessthan arg1="${perl.minor.version}" arg2="22"/>
     1998          </and>
     1999        </or>
     2000      </bool>   
     2001    <echo message="Unpacking the CGIModule needed for your perl version: ${perl.major.version}.${perl.min.version}" />
     2002
     2003    <untar compression="gzip"
     2004       src="${common.src.home}/cgi-bin/CGIModule.tar.gz"
     2005       dest="${web.home}/WEB-INF/cgi"/>
     2006    <move todir="${web.home}/WEB-INF/cgi" failonerror="false">
     2007      <!-- This fileset moves *contents* of directory CGIModule into destination dir web.home -->
     2008      <fileset dir="${web.home}/WEB-INF/cgi/CGIModule"/>
     2009    </move>
     2010    <delete dir="${web.home}/WEB-INF/cgi/CGIModule"/>
     2011   
     2012    </if>
     2013  </target>
    19572014
    19582015  <!-- ============ Targets concerned with https certification ================ -->
Note: See TracChangeset for help on using the changeset viewer.