Skip to content
This repository has been archived by the owner on Jun 7, 2021. It is now read-only.

[TRAFODION-2802] Prepare the build environment with one command #1353

Merged
merged 2 commits into from Jan 18, 2018

Conversation

sumory
Copy link
Contributor

@sumory sumory commented Dec 18, 2017

No description provided.

@Traf-Jenkins
Copy link

Can one of the admins verify this patch?

3 similar comments
@Traf-Jenkins
Copy link

Can one of the admins verify this patch?

@Traf-Jenkins
Copy link

Can one of the admins verify this patch?

@Traf-Jenkins
Copy link

Can one of the admins verify this patch?

@svarnau
Copy link
Contributor

svarnau commented Dec 18, 2017

Please do not open new pull-requests, when an existing pull-request exists for the same change/jira. It is better to just push new commits onto the same branch so that we can see previous commits & changes.

If it is absolutely necessary to do so, then it is good idea to put comment in the older one and close it.

@svarnau
Copy link
Contributor

svarnau commented Dec 18, 2017

jenkins, ok to test

@Traf-Jenkins
Copy link

Check Test Started: https://jenkins.esgyn.com/job/Check-PR-master/2271/

@Traf-Jenkins
Copy link

@sumory
Copy link
Contributor Author

sumory commented Dec 20, 2017

The old pull-request is already closed with related comment, thanks.

Copy link
Contributor

@zellerh zellerh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice idea to put all of these commands together into a script. Please see some detailed comments.

exit 1
fi

# check the based command
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe better to say "check some basic commands"

lsb_release)
(${MY_YUM} install redhat-lsb) >>${LOGFILE}2>&1
if [ "x$?" = "x0" ]; then
echo "ERROR: yum repo server has a error when run command [${MY_YUM} install redhat-lsb]."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: "has an error when running"

fi
;;
*)
echo "ERROR: command [${basecmd}] not exist. Make sure you have installed it, and have added it to the command path."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: "not exist" -> "does not exist"

exit 1
esac
fi
echo "INFO: command ${basecmd} exist"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: "exists"

echo "INFO: os distributor id is [${osdistributor}]"
;;
*)
echo "ERROR: The OS distribution is [${osdistributor}], but Trafodion only supports RedHat and CentOS presently."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I know we have also tried on the Oracle and Amazon distributions, which are similar to RedHat, and they may work as well (possibly with some small modifications). Many of the other Linux distros don't have yum, so they would have given an error above. Maybe you want to allow the user to proceed, at their own risk?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don‘t have the environment as you say, if the user has this environment, user can installed by modifying the environment variable MY_YUM

# must configure the yum repo right before execute this script.
# run this script with normal user, while must has sudo permission.

#default path
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This command needs a help text that should mention the following:

  • Who should use this script (people who want to set up a single node
    development system on a machine where they have sudo privileges)
  • What does the script do (e.g. yum install, build/setup tools).
  • A link to the Contributor guide wiki page that describes these steps
    (https://cwiki.apache.org/confluence/display/TRAFODION/Create+Build+Environment)
  • What environment variables must be set before calling this script
  • What optional environment variables can be set
  • What directories are created by the script, and how they can be customized

Once this PR is merged, we can also update the wiki page and mention this command.

MY_YUM=${MY_YUM-"${MY_SUDO} yum -y"}

# for setup tools
MY_LOCAL_SW_DIST=${MY_LOCAL_SW_DIST-${HOME}/local_software_tools}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's pretty common that the root directory of a server is small (at least on the OpenStack and Amazon VMs I have seen). Maybe add yet another variable like this one:

MY_SW_HOME=${MY_SW_HOME-${HOME}}

Then use $MY_SW_HOME instead of $HOME below.

echo "INFO: install dependent library finish"

# remove pdsh and qt-dev
echo "INFO: remove pdsh and qt-dev trafodion scripts get confused."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe say "INFO: remove pdsh and qt-dev commands to avoid problems with trafodion scripts"


javahome=`grep JAVA_HOME ~/.bashrc | wc -l`
if [ "x${javahome}" = "x0" ]; then
echo -en "export JAVA_HOME=${javapath}\n" >> $HOME/.bashrc
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When writing into the users .bashrc, I would recommend adding a comment that shows what tool wrote this. Something like:

# Lines added by traf_checkset_env.sh
exprt JAVA_HOME=...

if [ "x${javahome}" = "x0" ]; then
echo -en "export JAVA_HOME=${javapath}\n" >> $HOME/.bashrc
echo -en "export PATH=\$PATH:\$JAVA_HOME/bin\n" >> $HOME/.bashrc
fi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would probably be good to add a test here that runs

$JAVA_HOME/bin/java -version

and checks that we get an acceptable version.

@Traf-Jenkins
Copy link

New Check Test Started: https://jenkins.esgyn.com/job/Check-PR-master/2281/

@Traf-Jenkins
Copy link

@Traf-Jenkins
Copy link

Can one of the admins verify this patch?

2 similar comments
@Traf-Jenkins
Copy link

Can one of the admins verify this patch?

@Traf-Jenkins
Copy link

Can one of the admins verify this patch?

@Traf-Jenkins
Copy link

New Check Test Started: https://jenkins.esgyn.com/job/Check-PR-master/2283/

@Traf-Jenkins
Copy link

Can one of the admins verify this patch?

@Traf-Jenkins
Copy link

@DaveBirdsall
Copy link
Contributor

Is this ready to merge now? @zellerh, what do you think?

@zellerh
Copy link
Contributor

zellerh commented Jan 5, 2018

+1
Yes, looks good to me. Thank you for adding the help printout and sorry for taking a while to respond.

@DaveBirdsall
Copy link
Contributor

Thanks for this contribution. Sorry it's taken so long to merge.

@asfgit asfgit merged commit 9048853 into apache:master Jan 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
7 participants