« May 2008
SunMonTueWedThuFriSat
    
1
2
3
4
5
6
7
8
9
10
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
       
Today
XML

Tom Haynes

loghyr.com
excfb.com

Blogs to Gander At

Navigation

Editing

AllMarks

Referers

Today's Page Hits: 50

Powered by Roller Weblogger.

statcounter.com

clustrmaps.com

Locations of visitors to this page

technorati.com

www.alesti.org

Add to Alesti RSS Reader

South Park as I was 10 years ago

South Park Fantasy

South Park today

South Park Reality

I have more hair and it isn't so grey. :->

10 years ago, really

Toon Tom

Today, literally

Tom Today

Site notes

This page validates as XHTML 1.0, and will look much better in a browser that supports web standards, but it is accessible to any browser or Internet device. It was created using techniques detailed at glish.com/css/.

« Exploring pulling... | Main | Finishing the spedeb... »
20080131 Thursday January 31, 2008
Getting a webrev generated for code review

I sponsor OpenSolaris contributions. I recently asked some contributers to provide a webrev on cr.opensolaris.org such that I could get a review done much in the same manner as we do internally. And I found there wasn't much usage documentation for it. And then the same subject just came up here: Shooting my mouth off.

I was wondering what it would take to generate a webrev. So I decided on a little experiment. Note, I chose to do this without Mercurial because at least one poster couldn't get to a repository. This should be easy enough to do with 'hg' as well.

First, lets get the ON source and install it in two locations:

[tdh@silver ~]> mkdir os
[tdh@silver ~]> cd os
[tdh@silver ~/os]> wget http://dlc.sun.com/osol/on/downloads/current/on-src.tar.bz2
...
[tdh@silver ~/os]> bzcat on-src.tar.bz2 | tar xf -
...
[tdh@silver ~/os]> ls -la
total 132535
drwxr-xr-x   3 tdh      staff          5 Jan 30 17:25 .
drwxr-xr-x  54 tdh      staff        101 Jan 31 11:12 ..
-rw-r--r--   1 tdh      staff    67779916 Jan 30 17:43 on-src.tar.bz2
-rw-r--r--   1 tdh      staff      10420 Jan 30 17:25 README.opensolaris
drwxr-xr-x   3 tdh      staff          3 Jan 30 17:24 usr
[tdh@silver ~/os]> mv usr README.opensolaris head/
[tdh@silver ~/os]> bzcat on-src.tar.bz2 | tar xf -
...
[tdh@silver ~/os]> mkdir tail
[tdh@silver ~/os]> mv usr README.opensolaris tail

And now set up our environment:

[tdh@silver ~/os]> cd tail/
[tdh@silver tail]> cp usr/src/tools/env/opensolaris.sh .
[tdh@silver tail]> chmod +w opensolaris.sh
[tdh@silver tail]> vi opensolaris.sh
[tdh@silver tail]> diff opensolaris.sh usr/src/tools/env/opensolaris.sh
43c43
< NIGHTLY_OPTIONS="-FNnaCDlmr";         export NIGHTLY_OPTIONS
---
> NIGHTLY_OPTIONS="-FNnaCDlmrt";                export NIGHTLY_OPTIONS
47c47
< GATE=tail;                    export GATE
---
> GATE=testws;                  export GATE
50c50
< CODEMGR_WS="/home/tdh/os/$GATE";                      export CODEMGR_WS
---
> CODEMGR_WS="/export/$GATE";                   export CODEMGR_WS
93c93
< STAFFER=tdh;                          export STAFFER
---
> STAFFER=nobody;                               export STAFFER

Note, I took out -t because I had earlier installed SUNWonbld:

[tdh@silver ~/os]> which webrev
/opt/onbld/bin/webrev

Okay, really get the environment:

[tdh@silver tail]> bldenv -d opensolaris.sh
Build type   is  DEBUG
RELEASE      is
VERSION      is  tail
RELEASE_DATE is

The top-level 'setup' target is available to build headers and tools.

Using /bin/tcsh as shell.

And a simple test (which shows why I should use 'hg' by the way - i.e., chmod is not an acceptable change tracking mechanism.):

[tdh@silver tail]> cd usr/src/prototypes/
[tdh@silver prototypes]> chmod +w prototype.c
[tdh@silver prototypes]> cp prototype.c xxx
[tdh@silver prototypes]> vi prototype.c
[tdh@silver prototypes]> diff prototype.c xxx
23c23
<  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
---
>  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
51,55d50
<
< /*
<  * Get up, stand up, stand up for your rights!
<  * Get up, stand up, don't give up your rights!
<  */

Yes, Bob Marley is playing in the background.

[tdh@silver prototypes]> cd ../../..
[tdh@silver ~/os]> pwd
/home/tdh/os/tail
[tdh@silver tail]> vi changes.txt
[tdh@silver tail]> more !$
more changes.txt
usr/src/prototypes/prototype.c

And this does not work:

[tdh@silver tail]> webrev -p ../head -i changes.txt
Unable to determine SCM type currently in use.
For teamware: webrev looks for $CODEMGR_WS either in
              the environment or in the file list.

And I'll try this:

[tdh@silver tail]> vi changes.txt
[tdh@silver tail]> cat changes.txt
CODEMGR_WS=/home/tdh/os/tail
CODEMGR_PARENT=/home/tdh/os/head
usr/src/prototypes/prototype.c
[tdh@silver tail]> webrev changes.txt
   SCM detected: teamware
 File list from: changes.txt
      Workspace: /home/tdh/os/tail
Compare against: /home/tdh/os/head
      Output to: /home/tdh/os/tail/webrev
   Output Files:
        usr/src/prototypes/prototype.c
                 patch cdiffs udiffs wdiffs sdiffs frames ps old new
 Generating PDF: Done.
     index.html: Done.

By the way, thanks to Frank Hoffman for a link to the man page, which is here:

[tdh@silver tail]> nroff -man usr/src/tools/scripts/webrev.1 | more

And we see we have output:

[tdh@silver tail]> ls -la webrev/
total 42
drwxr-xr-x   4 tdh      staff         11 Jan 31 11:35 .
drwxr-xr-x   4 tdh      staff          8 Jan 31 11:35 ..
-rw-r--r--   1 tdh      staff          2 Jan 31 11:35 TotalChangedLines
-rw-r--r--   1 tdh      staff       4983 Jan 31 11:35 ancnav.html
-rw-r--r--   1 tdh      staff       3053 Jan 31 11:35 ancnav.js
-rw-r--r--   1 tdh      staff         93 Jan 31 11:35 file.list
-rw-r--r--   1 tdh      staff       3760 Jan 31 11:35 index.html
drwxr-xr-x   4 tdh      staff          4 Jan 31 11:35 raw_files
-rw-r--r--   1 tdh      staff        489 Jan 31 11:35 tail.patch
-rw-r--r--   1 tdh      staff       2518 Jan 31 11:35 tail.pdf
drwxr-xr-x   3 tdh      staff          3 Jan 31 11:35 usr

At this point, you need to follow the instructions at cr.opensolaris.org to post your changes for review. Note that you could also tar and bzip the webrev to send out.

But I can finish this off with a simple example:

[tdh@silver tail]> scp -r webrev/ tdh@cr.opensolaris.org:example
The authenticity of host 'cr.opensolaris.org (72.5.123.19)' can't be established.
RSA key fingerprint is fa:ab:0c:a4:78:75:0b:bd:3d:eb:74:f1:b5:e1:98:a8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'cr.opensolaris.org,72.5.123.19' (RSA) to the list of known hosts.
Enter passphrase for key '/home/tdh/.ssh/id_dsa':
...

Which means that the following link should work: http://cr.opensolaris.org/~tdh/example


Originally posted on Kool Aid Served Daily
Copyright (C) 2008, Kool Aid Served Daily

Trackback URL: http://blogs.sun.com/tdh/entry/getting_a_webrev_generated_for
Comments:

It's *always* diff oldfile newfile. *Always*. See how your diffs say you changed the copyright year from 2008 to 2007? And how you *deleted* the Bob Marley comment ('51,55d50')?

Posted by Solaris on January 31, 2008 at 11:55 PM CST #

Post a Comment:

Name:
E-Mail:
URL:

Your Comment:

HTML Syntax: NOT allowed
Copyright (C) 2007, Kool Aid Served Daily