YaM
From DGC Wiki
|
YaM is a software development framework with tools for facilitating the rapid development of software in a concurrent software development environment [1]. Team Caltech uses YaM to implement its configuration management process. This page collects the essential information that you need to know in order to make use of YaM.
More info:
- YAM- A Framework for Rapid Software Development, A. Jain and J. Biesiadecki, Second Int'l Conf on Space Mission Challenges for Information Technology (SMC-IT), 2006.
- YaM wiki
- YaM releases for DGC project
Getting started
This section contains a quick guide to using YaM. It makes use of the play project, which has been set up for testing. Within this project there is a copy of the "follow" package, which allows you to run a controller on Alice (either in hardware or in simulation). If any of the commands listed here don't work, please send e-mail to Richard Murray or fix the wiki page once you figure out what is wrong.
In this tutorial, we will create a new module that prints your name on the screen and then integrate this new module into the "follow" package. We will then generate a new release of the package. The process that we use for this is consistent with the Team Caltech configuration management process, with the role of the developer and the build manager both being done by a single person.
Setting up your environment
YaM makes use of several environment variables to keep track of the project you are working on. You should set up the following environment variables in your shell initialization script (.cshrc, .bash.rc, etc):
- export YAM_PROJECT=play
- export YAM_PROJECT_CONFIG_DIR=/dgc/yam/play
- export YAM_SITE=lab (assuming you working on this on gclab)
Creating a bug/task request
The first step in the configuration management process is to create a request for a change. This is not strictly part of YaM, but is an important part of the way we keep track of software development. To create a change request, you should do the following:
- Log in to the bugzilla system
- Create a new bug with a summary that reads "Add user <your name> to follow display". Enter a short indicating that you are working through the YaM tutorial
- Assign the bug to yourself and accept it, so that we know you are working on it
- Set the "Status" flag to "In Progress" (not yet implemented)
Checking out a "sandbox"
stefano : Move this line at the beginning of the section. Everybody is realizing this too late!!
You might have to type your password a lot if you have not set up .ssh so that it knows which machines you can log in from automatically. To do this:
- run the command 'ssh-keygen -t dsa' on gclab and hit enter at the prompts.
- This will create a file '~/.ssh/id_dsa.pub' which you append to the file '~/.ssh/authorized_keys'- eg, run 'cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys'
- make sure that the permissions mode of the authorized_keys file is -rw-r--r-- (644)
- copy your .ssh folder to gcfield
You'll know this worked if you can ssh to any machine in the lab or alice from another machine in the lab or alice without typing your password. See ssh-keygen(1) for more info.
Source code development is done in a YaM sandbox. This is basically a copy of the code that you can use for adding new functionality to a package. We start by checking out a copy of the "follow-test" package, which consists of the modules that make up the follow package. To check out a sandbox, you should do the following:
- Check out the follow-test package using YaM
yam setup follow-test
- An editor window will pop up with the file config.yam opened up. This file should list the modules that are part of the package (including skynet, sparrow, adrive, etc) as well as the revisions (branches) of each module. You can exit the editor without making any changes.
This will create a subdirectory of the current directory with the name "follow-test" which has the code for the "follow-test package". If you cd into the 'src' subdirectory, you will see the code that is included in the package, which should consist of each of the modules listed above.
Once you have checked out the sandbox, it is good idea to document this in bugzilla so that we can keep track of where changes were implemented:
- Log in to the bugzilla system and find the bug you created
- Enter a comment saying that you have created "Rx-yy-user" to work on this feature.
Making your changes
The current version of "follow-test" does not have the Makefiles set up yet, so you will need to manually make and install the modules. Do this by going into each subdirectory in the 'src' directory and typing "make install". You may need to install some modules before others to get the dependencies right (YaM makefiles will do this correctly once they are working). The following should work:
# make -C src/sparrow install # make -C src/skynet install # make -C src/adrive install # make -C src/asim
If you cd to the 'src/asim' directly, you should be able to run asim (simulator) and see a sparrow display come up. If you ge tan error about libserial, you may need to set up the load library path:
export LD_LIBRARY_PATH=usr/local/lib # for bash setenv LD_LIBRARY_PATH /usr/local/lib # for tcsh
At this point, you are ready to make modifications to the code. Pick some module and make a change that is visible (change a startup message or perhaps modify the sparrow display on asim or follow).
Once you have completed your changes, commit them to the respository using 'svn commit' as usual. When you are ready to create a new revision of your code (meaning that you want to release it to the build manager), use the command
yam save <module>
where 'module' is one of 'asim', 'skynet', etc. This will create a new release of the module, incrementing the module number. It will also remove the source code from your sandbox, unless you recheck it out (by moving the module from a 'link' module back to a 'work' module. You should update your bugzilla bug, indicating that you have made the appropriate change and are done with your testing.
Releasing a new package
stefano : This is not clear
For this section, you are operating as the build manager for the package. You should pretend that someone else committed the module changes and that you are now going to check those changes to make sure they are OK.
Start by checking out a fresh copy of the package from the repository. Make sure that you either explicitly specify the release numbers for the modules that you want to use. Once you have the package checked out, compile and test the code to make sure that it works. When you are done, use the command
yam pkgnewrelease
to create a new release for the package.
Using the DGC project
Once you have successfully committed a module and package release under the 'play' project, you are ready to switch to the 'dgc' project. You do this by changing the YAM_* environment variables. Under bash, put the following lines in your .bashrc file:
export YAM_PROJECT=dgc export YAM_PROJECT_CONFIG_DIR=/dgc/yam/dgc export YAM_SITE=lab # gclab # export YAM_SITE=alice # gcfield
You now need to decide what package you want to check out. Here are some possibilities:
- 'yam setup simulation' - this will check out the modules required to build 'asim'. Good for testing that everything is working
- 'yam setup --currentmodules' - check out a sandbox with all non-obsolete modules (roughly trunk)
- List of all defined packages
At the current time the makefiles for building an entire package haven't been setup, so you will need to individually build the modules that are part of a given package. You do this by typing the following command from within the top level sandbox directory:
make -C src/<module> -f Makefile.yam all
Customizing YaM
Here are some links to notes for customizing YaM
Where to put data files
We need to figure out where to put data files within YaM.
Principles
- All data required for unit tests and field testing must go in YaM (so that we can have it defined as part of a stable alice-{hardware,software} release
- We should avoid a structure that avoids checking out large amounts of data that aren't needed
- We should allow for having logged data outside of YaM (eg, use DGC_* environment variable)
Proposed solution
- Routes: these will go in modules with the names 'routes-<location>', where location is 'stluke', 'missionblvd', etc. A 'unittests' location will be used for all routes that are part of standard unit tests
- Logged data for unit tests: separate modules will be used for logged data that is part of a unit . The format of the modules should be '<package>-testdata', with the module containing all data files required for testing the given package.
- It is not required to have the test data modules be part of the standard checkout for a package. So, for example, the 'sensing' package might not include the large test files. Instead, the 'sensing-testdata' package might have the 'sensing' package + the required test data
File names
- Within the modules, the files should be have as '<loc>_<test>_<component>.type' where
- <loc> is the location of the test: stluke, missionblvd, darpa
- <test> is the description of the test/situation: simplelane, intersection, twowaytraf, etc
- <component> is the name of the component being used
- For MDF files, we can use this field to capture the different individual tests
- <type> is the file type: 'rndf', 'mdf', etc. Each log should have a specific type
- Between the different modules, the <loc> and <test> components should be the same when the data is the same. So 'stluke_sinewave_*.*' should all be for the same exact case, regardless of which module that file is in.
- All data files should have an RNDF defined in one of the routes-* modules, so this will define the names that are used.
Updating link modules
There is often a need to bump up a sandbox's link module configuration to latest releases of the link modules. This is especially needed when trying to release a module from a sandbox. While some of you may already be aware of this, the "yam config" command is a handy way to accomplish this. From the top-level of your sandbox you can run
yam config -update-links -o newconfig
This command will read in your existing YAM.config, will update all the link modules to their latest versions and will create the 'newconfig' file with the updated contents. Typically you can replace the existing YAM.config with 'newconfig' and relink the sandbox. That is, run
mv newconfig YAM.config
yam relink
These steps will bump up your sandbox so all the link modules are pointing to the latest link modules. After testing your work modules, you should be able to release them.
yam-config has other options for transforming YAM.config files (or for creating them from scratch). You can learn about them using the -h option. Since this command does not make any changes to a sandbox, its harmless to experiment with.
Project Setup
This section describes how to set up a new project. This is intended as documentation for YaM administrators, since for developers the projects you need should already be set up. The directions here are pretty much directly from the YaM wiki.
Set up the MySQL database
- Create a new MySQL database for YaM
gc$ mysqladmin -u root -p create yamplay
The convention is to prefix the project name with 'yam' so that we can tell that is what the database is used for. - Create the database structure needed by YaM
gc$ mysql -u root -p yamplay < /mnt/dgc-lab/software/yam/YaM-xxx/sql/create-yyy.sql
(replace xxx and yyy with the latest version information)
- Give the YaM user access to the database
gc$ mysql -u root -p mysql> GRANT SELECT,INSERT,UPDATE,ALTER ON yamplay.* TO 'yam@%' IDENTIFIED BY 'yamPassword'; mysql> flush privileges; mysql> quit;
You should replace yamPassword with the desired password for the database. The '%' is a wildcard that will allow access from any host that can talk to the mysql server (on gc, this is restricted to internal hosts by our filewall rules).
Set up the YaM project
- Create the directories where your YaM configuration will exist and set the permissions to allow group setgid and write access. This must be done on gclab since that is where the files live.
gclab$ sudo mkdir /dgc/yam/play gclab$ sudo mkdir /dgc/yam/tmp gclab$ sudo chmod g+sw /dgc/yam/play gclab$ sudo chmod g+sw /dgc/yam/tmp
- Create a configuration file 'play.config' using the YaM gui. See instructions in config files for a list of what to create, or look at an existing configuration file
gc$ yam -admin gui -init
(Note: the gui will open up an X11 window on your computer. Make sure that X11 forwarding is turned on (ssh -Y) if you are setting things up remotely.) Make sure that your configuration file is saved as 'play.config' and that the project directory is set to '/dgc/yam/play'. You should initially set the svn repository to be of the form 'file:///' since this is required for yam initialization (you can change it back later to be 'svn+ssh://host/'. - Test the configuration to make sure that everything is set up properly
gc$ yam -testdb
Note that you need to have the YAM_PROJECT and YAM_PROJECT_CONFIG_DIR environment variables set up properly in order for this command to complete successfully.
- Initialize the YaM project
yam -admin project -init
Notes
- On gc, yamSVN.pm was modified to use database type 'fsfs', which is apparently not the default. Need to use this to get the group permissions right.
- After this command runs, you should check the permissions on the subversion database and make sure they are properly initialized for group access.
- You can now reset the subversion repository to be of type 'svn+ssh://host/' using the gui.
Set up the initial release
- Create the new modules in your project
yam mkmodule moduleName
- Create a package that includes a set of modules and/or subpackages:
yam mkpackage -mods "module1 module2 subpkg1 subpkg2" packageName
- Create a sandbox and populate the modules with the files you have
Setup notes
In order to get everything working when I set this up, I had to do a number of additional steps (with help from Abhi Jain):
- Change permissions of executables in src/SiteDefs/mkHome/shared and set svn:executable property
chmod +x *.sh *.pl killprocs yamroot
This appears to be fixed in R1-72i.
- Copy 'makefile-yam-tail.mk' to src/SiteDefs. This defines all of the default rules that YaM wants in Makefile.yam. This appears to be fixed in R1-72i.
- Set up src/SiteDenfs/mkHome/shared/yamNative.sh to recognize the OS that I was using.
- Modified this on gc to detect RHEL4 and gentoo
Installation notes
- Current source is in gc:/usr/local/src/YaM*. We are currently running release R1-72d (30 Oct 06).
- Installation is done using the instructions on the wiki. This took a while to get right but now appears to be working
- Installation instructions are in doc/README.customize
- These appear to be out of date - refer to yamInstall script that is currently in the obsolete directory
Release 72a installation
- Followed instructions on YaM wiki (login as TeamCaltech)
- Set up test project in /dgc/yam/play
-
Had to run database test routine from that directory in order to find 'releasemap' file(see next line) -
Had to create releasemap file; not sure what goes in it. For now just suing "a=b" as a test.(don't put this in configuration file)
Installation under Mac OSX
Warning: These notes are written assuming you know something about how to configure YaM on a linux client. Probably too terse at this point to be generally useful. If you try these out, make sure you get things working on the play account before you do something to the DGC repository.
Install Fink:
- Install the fink package from http://www.finkproject.org/
- Enable unstable packages, as described here: http://www.finkproject.org/faq/usage-fink.php?phpLang=en#unstable
Install YaM:
- Copy gclab:/dgc/software/yam/src/YaM-R1-72v to someplace on your local machine. This will fail because "yam" (the executable) will conflict with "YaM" the directory on the Mac filesystem (non-case sensitive). To fix, manually copy over the "yam" executable and rename as "yam-bin".
- Create a symbolic link from YaM-R1-72v/yam-bin to ~/bin/yam (or some other directory in your path).
Install the following perl modules:
- Using fink: carp-assert-pm, text-wrapper-pm text-template-pm, time-modules-pm, svn-swig-pm586, algorithm-diff-pm, gtk2-pm586, dbi-pm586, dbd-mysql-pm586
- Using CPAN: array-printcols (wasn't available directly through fink)
- (To figure out what you need, type 'yam' and look at the error message, then chase down the package using google)
Verify YaM is working:
- yam -help
- yam -testperl
Configure YaM
- Run 'yam -admin gui -init' to set up a config file. You might want to start with the file gclab:/dgc/yam/play/play.config as an example. You need to change the database host to '127.0.0.1' and also set the paths /dgc/yam to something that makes sense on your local machine.
- Use the command 'ssh -L 3306:gc.caltech.edu:3306 gc.caltech.edu' to set up port fowarding to gc.
- Run 'yam -testdb' to make sure you can access the database
- Create the directories 'Module-Releases' and 'Package-Releases' in the project configuration directory (set in the config file).
That should be it. At this point you can run yam just like on gclab.
Troubleshooting:
- "Make - out of virtual memory - Ther version of make installed on "OS X" is 3.80 and there is a known bug when you have long evaluations (which YaM does). I fixed this by installing make v 3.81 in /usr/local/bin and putting this in my path ahead of the standard make
Required Third Party Software
- a fast way to install the required perl and MySql stuff is to use Yum
- yum install mysql mysql-server perl-DBI perl-DBD-MySQL perl-File-NCopy perl-MailTools perl-Text-Wrapper perl-Text-Template perl-Carp-Assert perl-Array-PrintCols perl-HTML-Table perl-Gtk2 perl-Algoritm-Diff
- Perl required on all machines, including following extension modules:
- Algorithm::Diff
- Array::PrintCols
- Carp::Assert
- DBI (be sure to test before installing)
- DBD::mysql (check README to install, needs mysqlclient, MUST test before installing)
- ExtUtils::Depends (needed to install Glib)
- ExtUtils::PkgConfig (needed to install Glib)
- File::NCopy
- Glib
- Gtk2
- HTML::Table
- Mail::Mailer
- Switch
- Text::Template
- Text::Wrapper
- Time::CTime
- These extensions should be installed to the local filesystem, and the path should be added to the PERL5LIB environment variable when using YaM
- run yam -testperl to verify all required packages are present. If it runs silently, then all is well
- CVS (v. 1.11.1 or later)installed on every machine
- MySQL (v. 4.0 or later) istalled on single MySQL server machine.
- GNU make (v. 3.80 or later) on all machines
- phpMyAdmin allows for much better managing of the YaM MySQL database
Troubleshooting
- Before running 'yam rebuild', you may have to delete your src/ directory because YaM does not like to overwrite code
If you have a problem
Please enter a bug report. [2] -> Product: Implement -> Component: YaM
Make sure you attach the log file to this bug report.
![[Main Page]](../../../../upload/alice.jpg)