treetools
Last edited by rjmb 1121 days ago.
oftentimes, i'll cvsup my src-all and ports-all 20 or 30 times before i think to upgrade. all the while, i'm thinking -- "i wonder how much the tree has actually changed? maybe i'm still somewhat-current.. do i need to rebuild?" yeah, well, that answer is now easily attainable.

another problem i've run into is when i find security announcements, but i'm not sure which version of a particular library c file i'm running. or one i may have run in the distant past.. how am i to know if i was vulnerable or not? huzzah. now you can.

i was busy learning ruby and i figured that if i had these problems, other people did too. i also asked around and nobody knew of a utility like this. (which seems kind of strange.. it seems basic to me. it has to be out there somewhere and i just don't know about it yet.)

usage

treescan.rb

first, cvsup your source.. then, if you're going to buildworld, do so. if you've built and installed, run treescan.rb -i .. if you haven't built or installed, just run treescan.rb. it will output the name of the file it just created.

dork@dorkwad:~> treescan.rb
+ scanning /usr/src
+ writing /home/rjmb/.treescan/12-11-2005-151948.scan
dork@dorkwad:~> 

treediff.rb

if you want to see the difference between the scan you just created and your last build, run treediff.rb with the path to the scanfile. if you want to see the individual file changes, use the -v flag. you can specify a specific historical scan to compare against (instead of the default last-install scan) by putting the path to the old scan after the current scan.

dork@dorkwad:~> treediff.rb /home/rjmb/.treescan/12-11-2005-151948.scan    ~
+ comparing using last installed scan: /home/rjmb/.treescan/12-10-2005-214657.scan
1 files modified, 0.00% of total files.
+1 lines in 1 modified files that gained lines.
0 lines in 0 modified files that lost lines.
total size change: +21 b (0.0000% change)
total line change: +1 (0.0000% change)
dork@dorkwad:~>

treehist.rb

just use treehist.rb with the full path to the file you want to see.

dork@dorkwad:~> treehist.rb /usr/src/usr.sbin/traceroute6/traceroute6.c    ~
 Sun Dec 11 15:22:06 PST 2005: 1.68
        mtime: Sun Jun 13 11:38:46 PDT 2004      size: 37.98 kb
        md5: eb353a7f9796cf2539dfe2caeb8177b8    lines: 1370
        ------
*Sat Dec 10 21:48:10 PST 2005: 1.67
        mtime: Sun Jun 11 10:00:00 PDT 2004      size: 37.92 kb
        md5: a787c93883ef93922919bb8881a883dd    lines: 1358
        ------
dork@dorkwad:~>            

most recent at the top.. the asterisk denotes an installed version. i faked the installed version for a more realistic example, but yeah, you get the idea.

download

http://magicferret.net/treetools-1.0.tar.gz

requirements

  • a source tree (usually in /usr/src)
  • ruby (a modern version of ruby, please)

    license

    it's the FreeBSD license. only with my name on it. by downloading the software, you agree to the terms of the license.

    copyright 2005 rj bertsche. all rights reserved.
    
    Redistribution and use in source and binary forms, with or without 
    modification, are permitted provided that the following conditions 
    are met:
    
       1. Redistributions of source code must retain the above copyright
    notice, this list of conditions and the following disclaimer.
       2. Redistributions in binary form must reproduce the above 
    copyright notice, this list of conditions and the following 
    disclaimer in the documentation and/or other materials provided 
    with the distribution.
    
    THIS SOFTWARE IS PROVIDED BY RJ BERTSCHE ``AS IS'' AND ANY 
    EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
    PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RJ BERTSCHE OR 
    CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
    EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
    PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
    PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 
    OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 
    USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 
    DAMAGE.
    

    disclaimer

    this is artless beginner code. also, since each scan is a 1.5meg compressed ruby marshal, it might be a bit slow the more scans you make. not much can be done about that, unless you want to get rid of a few of your scans.