ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ozone/mgar/gar/bin/diffpkg
Revision: 1
Committed: Sat Jun 20 14:58:51 2026 UTC (4 weeks, 3 days ago) by operz
File size: 2022 byte(s)
Log Message:
Initial import of OZSW mgar build tree

File Contents

# Content
1 #!/bin/ksh
2 #
3 # $Id: diffpkg 431 2006-03-22 01:19:51Z comand $
4 #
5 # Copyright 2006 Cory Omand <comand@blastwave.org>
6 # All rights reserved. Use is subject to license terms.
7 #
8 # Redistribution and/or use, with or without modification, is
9 # permitted. This software is without warranty of any kind. The
10 # author(s) shall not be liable in the event that use of the
11 # software causes damage.
12 #
13 # diffpkg - compare the manifests of two packages (does not
14 # report file content or size changes).
15 #
16
17 F1=$1
18 F2=$2
19
20 if [ -z "$F2" ] || [ ! -f $F1 ] || [ ! -f $F2 ]; then
21 print "Usage: $0 <pkg1> <pkg2>"
22 exit 1
23 fi
24
25 # Create temp dir
26 TMPDIR=/tmp/compare.$$
27 mkdir -p $TMPDIR
28
29 # Process F1
30 TF1=$TMPDIR/`basename $F1`
31 cp $F1 $TMPDIR
32 gunzip $TF1 >/dev/null 2>&1
33 [ $? -eq 0 ] && TF1=$TMPDIR/`basename $TF1 .gz`
34
35 TF1NAME=`pkginfo -d $TF1 | cut -f2 -d' '`
36 TF1ROOT=$TMPDIR/${TF1NAME}-1
37 pkgadd -s $TMPDIR -d $TF1 $TF1NAME >/dev/null 2>&1
38 es=$?
39 if [ $es -ne 0 ]; then
40 echo "Failed to spool $F1: pkgadd returned exit code $es"
41 exit $es
42 fi
43 mv $TMPDIR/$TF1NAME $TF1ROOT
44 rm -f $TF1
45
46 # Process F2
47 TF2=$TMPDIR/`basename $F2`
48 cp $F2 $TMPDIR
49 gunzip $TF2 >/dev/null 2>&1
50 [ $? -eq 0 ] && TF2=$TMPDIR/`basename $TF2 .gz`
51
52 TF2NAME=`pkginfo -d $TF2 | cut -f2 -d' '`
53 TF2ROOT=$TMPDIR/${TF2NAME}-2
54 pkgadd -s $TMPDIR -d $TF2 $TF2NAME >/dev/null 2>&1
55 es=$?
56 if [ $es -ne 0 ]; then
57 echo "Failed to spool $F1: pkgadd returned exit code $es"
58 exit $es
59 fi
60 mv $TMPDIR/$TF2NAME $TF2ROOT
61 rm -f $TF2
62
63 if [ "$TF1NAME" != "$TF2NAME" ]; then
64 echo "Cannot compare packages $TF1NAME and $TF2NAME"
65 rm -rf $TMPDIR
66 exit 2
67 fi
68
69 # Sort manifests
70 nawk 'NF > 6 { print $4 }' $TF1ROOT/pkgmap | sort | uniq > $TF1ROOT/manifest
71 nawk 'NF > 6 { print $4 }' $TF2ROOT/pkgmap | sort | uniq > $TF2ROOT/manifest
72
73 # Compare manifests
74 diff -u $TF1ROOT/manifest $TF2ROOT/manifest > $TMPDIR/manifest.diff
75 if [ -s $TMPDIR/manifest.diff ]; then
76 cat $TMPDIR/manifest.diff
77 else
78 echo "Package lists are the same"
79 fi
80
81 # Clean up
82 rm -rf $TMPDIR
83 exit 0

Properties

Name Value
svn:executable *