I am trying to execute a bash script from ant exec task.
<target name="test" unless="${is.windows}">
<chmod file="./abc.sh" perm="a+x"/>
<exec dir="./" spawn="false" executable="bash" newenvironment="false">
<arg line="abc.sh ${some-argument}" />
</exec>
</target>
The bash script has shebang #!/bin/bash.
When I run the target, it gives me following output on our Jenkins machines where production code is built. It works fine on my local CentOS machines. Most of the lines are empty. On line 19, it has { (opening curly brace) -
[exec] abc.sh: line 2:
[exec] : command not foundabc.sh: line 7:
[exec] : command not foundabc.sh: line 8:
[exec] : command not foundabc.sh: line 12:
[exec] : command not foundabc.sh: line 14:
[exec] : command not foundabc.sh: line 17:
[exec] : command not foundabc.sh: line 19: syntax error near unexpected token `{
[exec] 'abc.sh: line 19: `{
[exec] '
[exec] Result: 2
It turns out that dos line endings was the problem. Setting svn eol property to native fixed the issue. As on our Jenkins server, the code is checked out for every build, the bash scripts being edited on Windows created line endings incompatible with centOS.
Related
I am trying to install Crypt::SSLeay that is required to launch PulledPork from Snort. I am working on a fresh Red Hat Linux Enterprise 7 Server (in VM) with Perl 5.16-3.
I am installing every Perl module from search.cpan.org and I need to get source code to compile myself.
At first, I wanted to install Crypt::SSLeay with
perl Makefile.PL
make
sudo make install
Then I got a bunch of dependencies to install first.
ExtUtils::CBuilder
ExtUtils::MakerMaker
Perl::OSType
IPC::Cmd
Params::Check
Locale::Maketext::Simple
Module::Load::Conditional
Module::Load
Test::More
ExtUtils::MM_Unix::tool_xsubpp
But now I am stuck with this.
Can't locate version.pm in #INC (#INC contains: /usr/local/lib64/perl5
/usr/local/share/perl5 /usr/lib64/perl5/vendor_perl
/usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at
/usr/local/share/perl5/Module/Load/Conditional.pm line 12. BEGIN
failed--compilation aborted at
/usr/local/share/perl5/Module/Load/Conditional.pm line 12. Compilation
failed in require at /usr/local/share/perl5/IPC/Cmd.pm line 60. BEGIN
failed--compilation aborted at /usr/local/share/perl5/IPC/Cmd.pm line
60. Compilation failed in require at /usr/local/share/perl5/ExtUtils/CBuilder/Base.pm line 10. BEGIN
failed--compilation aborted at
/usr/local/share/perl5/ExtUtils/CBuilder/Base.pm line 10. Compilation
failed in require at
/usr/local/share/perl5/ExtUtils/CBuilder/Platform/Unix.pm line 5.
BEGIN failed--compilation aborted at
/usr/local/share/perl5/ExtUtils/CBuilder/Platform/Unix.pm line 5.
Compilation failed in require at (eval 1) line 2. BEGIN
failed--compilation aborted at (eval 1) line 2. Compilation failed in
require at Makefile.PL line 5. BEGIN failed--compilation aborted at
Makefile.PL line 5.
I install version (http://search.cpan.org/~jpeacock/version-0.9917/lib/version.pod) but it told me :
ERROR from evaluation of
/home/pdavid/Downloads/version-0.9917/vutil/Makefile.PL:
ExtUtils::MM_Unix::tool_xsubpp : Can't find xsubpp at
/usr/local/share/perl5/ExtUtils/MM_Unix.pm line 3753.
Red Hat Enterprise Linux (and Fedora) ship a subset of Perl in the perl package; this is why you're missing version.pm although the software assumes it's there; that's why Sinan mentions it is in corelist.
The solution is to first install the perl-core package on your system, then your system will have all packages from core installed, and then you can install your software:
sudo yum install perl-core
By the way, you can also install Crypt::SSLeay via yum:
sudo yum install "perl(Crypt::SSLeay)"
In linux, I am able to run ldapdelete like this
sudo ldapdelete -x -w 1234 -D "cn=Manager,o=project1" -r "o=project1"
now I want to do this using ANT task:
<target name="ldap-delete">
<exec executable="ldapdelete" failonerror="false">
<arg value="-x"/>
<arg value="-w"/>
<arg value="${ldap.password}"/>
<arg value="-D"/>
<arg value=""${ldap.rootdn}""/>
<arg value="-r"/>
<arg value=""${ldap.entry}""/>
</exec>
</target>
but it failed when running ANT:
[exec] ldap_bind: Invalid DN syntax (34)
[exec] additional info: invalid DN
[exec] Result: 1
what is wrong with my ANT task script?
Thanks
according to martin clayton's comment, I removed quotes around the -D and -r arg values like this:
<arg value="-D"/>
<arg value="${ldap.rootdn}"/>
<arg value="-r"/>
<arg value="${ldap.entry}"/>
and run ant with verbose mode, I got the following error:
[echo] ldapdelete...
[exec] Current OS is Linux
[exec] Executing 'ldapdelete' with arguments:
[exec] '-x'
[exec] '-w'
[exec] '1234'
[exec] '-D'
[exec] 'cn=Manager,o=project1'
[exec] '-r'
[exec] 'o=project1'
[exec]
[exec] The ' characters around the executable and arguments are
[exec] not part of the command.
[exec] ldap_search: No such object (32)
[exec] ldap_delete: No such object (32)
[exec] Result: 32
ended up with a solution myself:
<target name="ldap-delete">
<exec executable="ldapdelete" failonerror="false">
<arg line="-x -w ${ldap.password} -D "${ldap.rootdn}" -r "${ldap.entry}""/>
</exec>
</target>
i am trying linphone for android . i have followed the steps
1) downloaded the linphone
2) installed ndk, sdk and cygwin and java jdk
3) set the PATH for sdk>platform-tools and sdk>tools and ndk.
./check_tools.sh: line 2: $'\r': command not found
./check_tools.sh: line 5: $'\r': command not found
./check_tools.sh: line 38: syntax error: unexpected end of file
Makefile:67: check_tools.mk: No such file or directory
make: *** No rule to make target 'check_tools.mk'. Stop.
i get the following errors
i dont know where i am getting wrong
I am trying to setup an ant build script for behat tests so I can run them from jenkins. When I run behat from the command line with bin/behat or ./bin/behat, the output works as expected. But when I use the following ant script
<project name="behat" basedir=".">
<exec dir="bin" executable="./behat">
</exec>
</project>
I get this error:
Buildfile: <mydir>/build.xml
[exec]
[exec]
[exec]
[exec] [RuntimeException]
[exec] Context class not found.
[exec] Maybe you have provided wrong or no `bootstrap` path in your behat.yml:
[exec] http://docs.behat.org/guides/7.config.html#paths
[exec]
[exec]
[exec]
[exec] behat [--init] [-f|--format="..."] [--out="..."] [--lang="..."] [--[no-]ansi] [--[no-]time] [--[no-]paths] [--[no-]snippets] [--[no-]snippets-paths] [--[no-]multiline] [--[no-]expand] [--story-syntax] [-d|--definitions="..."] [--name="..."] [--tags="..."] [--cache="..."] [--strict] [--dry-run] [--rerun="..."] [--append-snippets] [--append-to="..."] [features]
[exec]
[exec]
[exec] Result: 1
BUILD SUCCESSFUL
Total time: 0 seconds
You shouldn't be running behat from the bin directory. It won't find your behat.yml file.
You should either run it like this:
./bin/behat
or pass a path to the config file:
cd bin
./bin/behat --config ../behat.yml
I haven't tried the later. Your ant script might look something like:
<project name="behat" basedir=".">
<exec dir="${basedir}" executable="./bin/behat" />
</project>
I took ant out of the equation and just used jenkins to run the behat commands directly:
cd <mydir>
bin/behat
One thing I need to check is the build from jenkins returns failed, but it may be due to the behat tests are failing.
I am a student trying to use kdtree with libkdtree++ on linux 86*64. ./configure goes smooth, though sudo make install fails
cd . && /bin/sh /home/preetigupta25/kdtree-project/nvmd-libkdtree-7bb7e83/missing --run aclocal-1.10
/home/preetigupta25/kdtree-project/nvmd-libkdtree-7bb7e83/missing: line 54: aclocal-1.10: command not found
WARNING: `aclocal-1.10' is missing on your system.
/home/preetigupta25/kdtree-project/nvmd-libkdtree-7bb7e83/missing: line 54: automake-1.10: command not found
WARNING: `automake-1.10' is missing on your system.
cd . && /bin/sh /home/preetigupta25/kdtree-project/nvmd-libkdtree-7bb7e83/missing --run autoconf
configure.ac:10: error: possibly undefined macro: AM_INIT_AUTOMAKE
make: *** [configure] Error 1
but when I run it again it gives a different problem
[preetigupta25#dhalsim nvmd-libkdtree-7bb7e83]$ sudo make install
[sudo] password for preetigupta25:
/bin/sh ./config.status --recheck
running CONFIG_SHELL=/bin/sh /bin/sh ./configure --no-create --no-recursion
./configure: line 2082: syntax error near unexpected token `-Wall'
./configure: line 2082: `AM_INIT_AUTOMAKE(-Wall -Werror)'
make: *** [config.status] Error 2
Most likely you will have a more recent automake version - 1.11 I guess.
You will have to change that in configure:
am__api_version='1.11'
You have to do it before you invoke configure the first time.