I've asked a few times for some way to pkgdiff all the packages in two
repos, so I can see what's changed in one of our gate builds, and I've
filed/updated some RFE's for it, but keep finding needs for it now,
so instead of waiting for the pkg team to have cycles, I went ahead
and scratched my own itch.

This is obviously just a developer shortcut, not a production quality
tool, and most especially, it's *slow*, but it seems to meet what I
need for now, and maybe others can get some benefit as well, even if
it's just learning what a real tool should & should not do.

Comparing two X consolidation gate repos, stored on local disk,
with 302 packages in each, on my Ultra 27 (4 core, 3.0 Ghz nehalem)
took 11 minutes for the first run (exec'ing pkg contents 604 times),
and then 3 minutes for a subsequent run (using the cached manifests
from the previous run).

The obvious optimization would be to port from ksh93 to python,
using the pkg API to read the repo metadata once per run, not
once per pkg, and avoiding all those fork/execs of the python
interpreter, but that requires someone who has written at least
a couple lines of python before, unlike me.

The script currently takes these arguments:

 Usage: repodiff [-i attribute] [-o attribute] [-v name=value]
                 [-I attribute] [-T|-B] [-c dir] repo1 repo2

 -i, -o, & -v are passed to pkgdiff
 -I are package attributes to ignore (i.e. set name=<attribute>),
    for instance, -I info.repository-changeset
 -T strips timestamps off fmris in set values & depend fmri attributes
    before comparing
 -B strips branch versions & timestamps off fmris in set values & depend
    fmri attributes before comparing
 -c uses cached raw manifests from a previous run, assumes repos have not
    changed contents, but other flags may change

-I, -T & -B are implmented via pkgmogrify transformations applied
before pkgdiff'ing.

The current implementation is at:
https://cr.opensolaris.org/action/browse/x-cons/alanc/repodiff/repodiff/repodiff.sh

(x-cons since I don't have permission to post code reviews under pkg,
 and I am using this on the X-consolidation.)

Sample output from comparing x86 builds of the current xnv-gate (which has
Xorg-1.10 in) against the current Xorg-1.11 project gate (based on/synced
with current xnv-gate) is in:
https://cr.opensolaris.org/action/browse/x-cons/alanc/repodiff/repodiff/output.txt

That was run with:

./repodiff.sh -c /tmp/repodiff.Y6aOtX -B -I info.repository-changeset \
  /export/alanc/hg/xnv-fixes/proto/pkg_i386 \
  /export/alanc/hg/Xorg-1.11-merge/proto/pkg_i386

(since I'd previously run it without -c, and then realized I needed to
 tweak the comparison flags, but not redownload the data so could save
 time by using the cached copies)

That actually had some diffs I wasn't expecting, so is already giving
value in providing me things to investigate before I integrate the
project to our master gate.

One thing I have just noticed is that the output doesn't highlight it
only found diffs in 43 of the 302 packages, I suppose an option like
diff's -s to report those would be interesting in some cases.

--
        -Alan Coopersmith-        [email protected]
         Oracle Solaris Platform Engineering: X Window System

_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss

Reply via email to