The Need to Pull

Even when you do not want to trust the SAC master source host to install system programs directly on your hosts you may still want to have access to the latest versions of those tools.

This document explains how to use the rsync utility to pull the recent master copy of a SAC tool to your platform source (or your master source) for you to install or inspect.

Getting started

You need the source (or a binary for your platform) to rsync: SAC caches a copy of the recommended release at: ftp://ftp.sac.fedex.com/pub/gnu/rsync-2.3.1.tar.gz. Note version 2.3.2 has been released, but we have not upgraded due to peak freeze.

Down-load the source to rsync and install it someplace in your search path. We install it in /usr/local/bin/rsync on our hosts.

To test this application run:

rsync rsync://msrc.sac.fedex.com/
Which should output a table, like:
ftp SA+C ftp spool
msrc the SA+C master source tree
Admin the SA+C master source admin tools

Getting setup

You need two toplevel directories to use the pull system. One to hold the pull code and one that caches the source you pull down. We are going to call these Admin and src. They can be placed in any directory you can write.

These are the steps to initialize these directories:

  1. Make the Admin directory, I used /tftp/Admin in my example below (only becaue /tftp had a lot of space).
    export TOP=some-directory
    cd $TOP
    mkdir Admin Pkgs msrc

  2. Build a .rsrc file to tell the rsrc script where to pull sources from. Later we will install other rsrc control files to pull different products from different master source hosts.
    echo RSRC_ROOT=\"${PWD}/\" > .rsrc
    echo RSRC_MSRC=\"rsync://msrc.sac.fedex.com\" >> .rsrc
    The FQDN of the master source host might have to be changed to a local server if you are not on the FedEx Corporate network.

  3. To provide the rsrc and makeme programs that we'll use to pull down the rest of the master source we install the bin directory from the master source with rsync, and install it in our PATH.
    rsync -ra rsync://msrc.sac.fedex.com/Admin/bin/ Admin/bin
    PATH=$TOP/Admin/bin:$PATH

  4. Test the configuration of the bin/rsrc program:
    rsrc -version
    Should output something like:
    rsrc: a revision token from RCS
    Control file basename: .rsrc
    Read control files:  $TOP/.rsrc
    
    Local directory $TOP/, with
    shell preferences from /usr/local/lib/distrib/local.defs
    This host w01.sac.fedex.com should be listed in
    /usr/local/lib/distrib/distrib.cf:
    /home/ksb/Admin/bin/rsrc[120]: distrib:  not found
    
    Remote master source pool is: rsync://msrc.sac.fedex.com
    Copied with: rsync --exclude=.rsrc -r $URL/ .
    
    This directory: $TOP/Admin
    is made from the URL: rsync://msrc.sac.fedex.com
    

    If that looks like what you want you can go on, else read the comments in the bin/rsrc script about building shell variables to modify the run-time behavior of the program to get sources from your favorite site.

  5. Pull down a test file with rsrc.
    cd Admin
    rsrc -get README Targets Macros Levers

    View some of those files to be sure they look sane. If the rsrc scrip fails run it with ksb -x to see what looks wrong.

  6. You might have to build a local.defs file someplace and set the path to it. You can use something like:
    PATH=/usr/local/bin:/usr/local/etc:$PATH:/usr/ccs/bin
    export PATH
    umask 022
    
    To get you going on a Sun. It must set a PATH to find the C compiler and local tools. It should set a umask.

  7. Stop to build the product side of the system at this point (come back later to fill in the Admin script and templates if you are going to create your own master source pool). You need a top level master source cache. I would put it next to the Admin cache (not under it). Check the -version output carefully.
    cd $TOP/msrc
    rsrc -get RBOOT
    (Once again change the master source hostname if you must.)

  8. If you don't have mkcmd installed you can use the RBOOT script to install the minimal ksb tools. You must have rsrc and makeme in you search path. Run it with:
    ksh -x ./RBOOT

    Note that it trys to install the tools under /usr/local: if you don't have permission to install there you'll have to build with:

    ksh ./RBOOT DESTDIR=/tmp/myroot

    Which builds a version of the basic stuff in /tmp/myroot.

  9. Now pull down any package you like and use makeme to build it locally, or configure distrib to know about the local platforms and build as I do.

    1. Change directory to the location where the source should be. If the directory structure is not there mkdir -p down to the product (for example sbp).
      mkdir -p local/etc
      cd local/etc

    2. Use rsrc to get the product, and move into the product's source.
      rsrc -get sbp
      cd sbp

    3. Use either makeme or make to build it locally or across many hosts.
      makeme install
      or
      make HOSTS=-mnostromo,sulaco,yaruro install

    4. Cleanup and cruft: either remove the whole shadow copy, or make clean.

Thoughts

This really doesn't fix the issue that so many people complained about: we are still trusting the master source host to hold "pure and clean" source. If they put a nasty bit of code in the repositoy we are going to pull it down and run it.

The only difference is when. We'll do it when we choose. That might be a bigger problem, because the keeper of the source might be in the middle of a change.

I still prefer the push model.

Known Bugs

There are some problems with the pull version of the master source! Almost all of these are problems with "makeme", if you don't use that script more than from "RBOOT" you'll be happy.
mkcmd's lib
The hosttype.m file is processed via distrib on the way over and doesn't work correcly from an rsrc boot. I know how to fix it.

You should edit it by hand, or run m4 over it by hand.

vi /usr/local/lib/mkcmd/type/hosttype.m
rdist'd bin
The hack.ed file suffers from the same issue as above.

Don't build rdist with makeme.

mk's lib
Is broken by the rsrc spell for an even larger reason.

Don't build this withe makeme

The next steps

We can pull code from different sources with the pull system. In any product or package directory you can build a .rsrc control file to force that product's source to come from a different rsync server (or ftp for that matter).

Let's look at the shell code in Admin/bin/rsrc. It reads the .rsrc control file in your home directory, and the first one it finds on the way up to slash. We put on at the top of the Admin and msrc directories when we build the caches.

These control files are shell scrips. They set variables like: RSRC_LOCAL_DEFSRSRC_MSRC RSRC_LIST SRC_MAKEME VIA_RSYNC VIA_FTP RSRC_DISTRIBS