Skip to content

Use ant -diagnostics instead of realpath to get ANT_HOME #28

@terryzuoty

Description

@terryzuoty

In the makefile of stf, this parts of code is trying to define the ANT_HOME

      ANT_BINDIR:=$(dir $(firstword $(shell $(WHICH) ant$(BAT) 2>$(NULL))))
      $(warning $(WHICH) ant$(BAT) 2>$(NULL) returned)
      $(warning $(ANT_BINDIR))
      ifneq (,$(ANT_BINDIR))
        ANT_BINDIR:=$(realpath $(ANT_BINDIR)$(D)ant$(BAT))
        ANT_HOME:=$(abspath $(ANT_BINDIR)$(D)..$(D)..)
        $(warning ANT_BINDIR set to $(ANT_BINDIR))
        $(warning ANT_HOME set to $(ANT_HOME))
        $(warning Found $(ANT_BINDIR), will start build with $(ANT_LAUNCHER).  Run make configure to install the required ant version 1.10.1 or follow the prereq install instructions in build$(D)build.md)

However, this part of code doesn't work as expected on RHEL7

RHEL7:

> makefile:174: ANT_HOME not set, looking in /tmp/svttemp/git/stf/../../systemtest_prereqs/apache-ant-1.10.1
> makefile:178: Cannot find /tmp/svttemp/git/stf/../../systemtest_prereqs/apache-ant-1.10.1/lib/ant-launcher.jar, looking for ant on the PATH
> makefile:194: which ant 2>/dev/null returned
> makefile:195: /usr/bin/
> makefile:199: ANT_BINDIR set to /usr/bin/ant
> makefile:200: ANT_HOME set to /usr
> makefile:201: Found /usr/bin/ant, will start build with /usr/lib/ant-launcher.jar.  Run make configure to install the required ant version 1.10.1 or follow the prereq install instructions in build/build.md


$ make -version
GNU Make 3.82
Built for x86_64-redhat-linux-gnu
Copyright (C) 2010  Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Ubuntu16:

> makefile:174: ANT_HOME not set, looking in /tmp/svttemp/git/stf/../../systemtest_prereqs/apache-ant-1.10.1
> makefile:178: Cannot find /tmp/svttemp/git/stf/../../systemtest_prereqs/apache-ant-1.10.1/lib/ant-launcher.jar, looking for ant on the PATH
> makefile:194: which ant 2>/dev/null returned
> makefile:195: /usr/bin/
> makefile:199: ANT_BINDIR set to /usr/share/ant/bin/ant
> makefile:200: ANT_HOME set to /usr/share/ant
> makefile:201: Found /usr/share/ant/bin/ant, will start build with /usr/share/ant/lib/ant-launcher.jar.  Run make configure to install the required ant version 1.10.1 or follow the prereq install instructions in build/build.md

GNU Make 4.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Instead of using realpath in the makefile, is using ant -diagnostics a proper approach to get the correct ant.home? For example

root@113fe7939c9b:~/systemtest_prereqs# ant -diagnostics | grep "ant.home" -m 1 --max-count=1 | cut -d ':' -f 2 
 /usr/share/ant
root@113fe7939c9b:~/systemtest_prereqs# 

There should be a same way on Windows to parse the ant -diagnostics result to get the real ant.home

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions