pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/pkgtools/pkgdiff Update to 1.0.
details: https://anonhg.NetBSD.org/pkgsrc/rev/f71163ee8632
branches: trunk
changeset: 584893:f71163ee8632
user: wiz <wiz%pkgsrc.org@localhost>
date: Wed Feb 02 10:23:02 2011 +0000
description:
Update to 1.0.
Smarter pkgdiff, doesn't create chunks that are added automatically
by the pkgsrc infrastructure (configure:exit instead of regenerate,
Makefile: localedir).
mkpatches: patch file names now contain the path to the file and its name
per discussion on tech-pkg June 2010.
Also, the files are created directly in the patches/ directory; backups
are saved as patches/patch-foo.orig.
patchdiff: now compares patches/patch-foo with patches/patch-foo.orig;
if they only differ in non-essential parts, patchdiff reinstates the
original patch to keep commits less noisy.
diffstat:
pkgtools/pkgdiff/Makefile | 6 +-
pkgtools/pkgdiff/files/feedback-patches.0 | 4 +-
pkgtools/pkgdiff/files/mkpatches.0 | 26 ++++-
pkgtools/pkgdiff/files/mkpatches.1 | 36 ++++++--
pkgtools/pkgdiff/files/mkpatches.pl | 121 ++++++++++++++++++++---------
pkgtools/pkgdiff/files/patchdiff.0 | 13 +-
pkgtools/pkgdiff/files/patchdiff.1 | 19 +--
pkgtools/pkgdiff/files/patchdiff.pl | 80 ++++++++----------
pkgtools/pkgdiff/files/pkgdiff | 8 +-
pkgtools/pkgdiff/files/pkgdiff.0 | 4 +-
pkgtools/pkgdiff/files/pkgvi.0 | 2 +-
11 files changed, 193 insertions(+), 126 deletions(-)
diffs (truncated from 633 to 300 lines):
diff -r bdfc7bd8387e -r f71163ee8632 pkgtools/pkgdiff/Makefile
--- a/pkgtools/pkgdiff/Makefile Wed Feb 02 09:04:03 2011 +0000
+++ b/pkgtools/pkgdiff/Makefile Wed Feb 02 10:23:02 2011 +0000
@@ -1,14 +1,14 @@
-# $NetBSD: Makefile,v 1.70 2010/07/04 22:20:04 sbd Exp $
+# $NetBSD: Makefile,v 1.71 2011/02/02 10:23:02 wiz Exp $
#
-DISTNAME= pkgdiff-0.123
+DISTNAME= pkgdiff-1.0
CATEGORIES= pkgtools devel
MASTER_SITES= # empty
DISTFILES= # empty
MAINTAINER= wiz%NetBSD.org@localhost
HOMEPAGE= ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/doc/pkgsrc.html
-COMMENT= Tools to create, maintain and send back patches for pkgsrc
+COMMENT= Tools to create, maintain, and send back patches for pkgsrc
PKG_INSTALLATION_TYPES= overwrite pkgviews
PKG_DESTDIR_SUPPORT= user-destdir
diff -r bdfc7bd8387e -r f71163ee8632 pkgtools/pkgdiff/files/feedback-patches.0
--- a/pkgtools/pkgdiff/files/feedback-patches.0 Wed Feb 02 09:04:03 2011 +0000
+++ b/pkgtools/pkgdiff/files/feedback-patches.0 Wed Feb 02 10:23:02 2011 +0000
@@ -1,7 +1,7 @@
FEEDBACK-PATCHES(1) NetBSD General Commands Manual FEEDBACK-PATCHES(1)
NNAAMMEE
- ffeeeeddbbaacckk--ppaattcchheess - help sending pkgsrc patches back
+ ffeeeeddbbaacckk--ppaattcchheess -- help sending pkgsrc patches back
SSYYNNOOPPSSIISS
ffeeeeddbbaacckk--ppaattcchheess _c_a_t_e_g_o_r_y_/_p_k_g [maintainer%software.org@localhost]
@@ -56,4 +56,4 @@
BBUUGGSS
Currently the pkgsrc base directory is hardcoded to _/_u_s_r_/_p_k_g_s_r_c.
-NetBSD 2.0_BETA Sep 29, 2003 NetBSD 2.0_BETA
+NetBSD 5.0 Sep 29, 2003 NetBSD 5.0
diff -r bdfc7bd8387e -r f71163ee8632 pkgtools/pkgdiff/files/mkpatches.0
--- a/pkgtools/pkgdiff/files/mkpatches.0 Wed Feb 02 09:04:03 2011 +0000
+++ b/pkgtools/pkgdiff/files/mkpatches.0 Wed Feb 02 10:23:02 2011 +0000
@@ -1,10 +1,10 @@
MKPATCHES(1) NetBSD General Commands Manual MKPATCHES(1)
NNAAMMEE
- mmkkppaattcchheess - create patch files appropriate for pkgsrc
+ mmkkppaattcchheess -- create patch files appropriate for pkgsrc
SSYYNNOOPPSSIISS
- mmkkppaattcchheess [--dd _o_u_t_p_u_t_-_d_i_r_e_c_t_o_r_y]
+ mmkkppaattcchheess [--cc | --rr] [--hhvv]
DDEESSCCRRIIPPTTIIOONN
mmkkppaattcchheess is a perl script that simplifies creating patches from a
@@ -17,11 +17,23 @@
changed file of the same name (with no ``.orig'' extension) using
pkgdiff(1).
- The resulting patches are saved in the directory _$_{_W_R_K_D_I_R_}_/_._n_e_w_p_a_t_c_h_e_s or
- the directory specified after --dd, and can be easily compared to the cur-
- rently existing set using patchdiff(1).
+ The resulting patches are saved in the package's patches directory (usu-
+ ally _p_a_t_c_h_e_s_/) and can be easily compared to the currently existing set
+ using patchdiff(1) or ccvvss ddiiffff.
+
+ Supported options are:
+
+ --cc Clean up backup patches of previous runs. Use this after you're
+ finished working on the patch set and committed it.
+
+ --hh Show a short usage.
+
+ --rr Revert the changes. Removes the new patches and puts the original
+ patches back.
+
+ --vv More verbose output.
SSEEEE AALLSSOO
- patchdiff(1), pkgdiff(1)
+ cvs(1), patchdiff(1), pkgdiff(1)
-NetBSD 1.6 June 25, 2000 NetBSD 1.6
+NetBSD 5.0 January 31, 2011 NetBSD 5.0
diff -r bdfc7bd8387e -r f71163ee8632 pkgtools/pkgdiff/files/mkpatches.1
--- a/pkgtools/pkgdiff/files/mkpatches.1 Wed Feb 02 09:04:03 2011 +0000
+++ b/pkgtools/pkgdiff/files/mkpatches.1 Wed Feb 02 10:23:02 2011 +0000
@@ -1,9 +1,9 @@
-.\" $NetBSD: mkpatches.1,v 1.3 2005/12/13 12:05:08 wiz Exp $
+.\" $NetBSD: mkpatches.1,v 1.4 2011/02/02 10:23:02 wiz Exp $
.\"
-.\" Copyright (c) 2000 by Thomas Klausner <wiz%NetBSD.org@localhost>
+.\" Copyright (c) 2000-2011 by Thomas Klausner <wiz%NetBSD.org@localhost>
.\" All Rights Reserved. Absolutely no warranty.
.\"
-.Dd June 25, 2000
+.Dd January 31, 2011
.Dt MKPATCHES 1
.Os
.Sh NAME
@@ -11,7 +11,8 @@
.Nd create patch files appropriate for pkgsrc
.Sh SYNOPSIS
.Nm
-.Op Fl d Ar output-directory
+.Oo Fl c | Fl r Oc
+.Op Fl hv
.Sh DESCRIPTION
.Nm
is a perl script that simplifies creating patches from a changed work
@@ -31,12 +32,29 @@
extension) using
.Xr pkgdiff 1 .
.Pp
-The resulting patches are saved in the directory
-.Pa ${WRKDIR}/.newpatches
-or the directory specified after
-.Fl d ,
+The resulting patches are saved in the package's patches directory
+(usually
+.Pa patches/ )
and can be easily compared to the currently existing set using
-.Xr patchdiff 1 .
+.Xr patchdiff 1
+or
+.Ic "cvs diff" .
+.Pp
+Supported options are:
+.Bl -tag -width 3n
+.It Fl c
+Clean up backup patches of previous runs.
+Use this after you're finished working on the patch set and committed
+it.
+.It Fl h
+Show a short usage.
+.It Fl r
+Revert the changes.
+Removes the new patches and puts the original patches back.
+.It Fl v
+More verbose output.
+.El
.Sh SEE ALSO
+.Xr cvs 1 ,
.Xr patchdiff 1 ,
.Xr pkgdiff 1
diff -r bdfc7bd8387e -r f71163ee8632 pkgtools/pkgdiff/files/mkpatches.pl
--- a/pkgtools/pkgdiff/files/mkpatches.pl Wed Feb 02 09:04:03 2011 +0000
+++ b/pkgtools/pkgdiff/files/mkpatches.pl Wed Feb 02 10:23:02 2011 +0000
@@ -1,6 +1,6 @@
#!@PERL5@
#
-# $NetBSD: mkpatches.pl,v 1.13 2008/02/16 22:21:35 apb Exp $
+# $NetBSD: mkpatches.pl,v 1.14 2011/02/02 10:23:02 wiz Exp $
#
# mkpatches: creates a set of patches patch-aa, patch-ab, ...
# in work/.newpatches by looking for *.orig files in and below
@@ -13,7 +13,7 @@
# It retains the naming and header (RCS Id and comment) from the
# patches directory.
#
-# Copyright (c) 2000 by Thomas Klausner <wiz%NetBSD.org@localhost>
+# Copyright (c) 2000, 2011 by Thomas Klausner <wiz%NetBSD.org@localhost>
# 2004 by Dieter Baron <dillo%NetBSD.org@localhost>
# All Rights Reserved. Absolutely no warranty.
#
@@ -31,27 +31,27 @@
# create patchdir, or empty it if already existing
sub create_patchdir {
- if ( -d $patchdir ) {
- unlink "$patchdir/*";
- } else {
+ if (! -d $patchdir) {
mkdir($patchdir, 0755);
}
}
# read command line arguments
-undef($opt_d);
+undef($opt_c);
undef($opt_h);
+undef($opt_r);
undef($opt_v);
-getopts('d:hv');
+getopts('chrv');
if ($opt_h) {
($prog) = ($0 =~ /([^\/]+)$/);
print STDERR <<EOF;
-usage: $prog [-d output-directory]
- -d dirname directory to put the resulting patches into;
- defaults to \$WRKDIR/.newpatches
+usage: $prog [-chv]
+ -c commit -- clean up old patches backups
+ -h show this help
+ -r revert -- remove new patches, put old patches back
-v verbose - list .orig files as processed
EOF
exit 0;
@@ -62,15 +62,32 @@
$wrkdir=`@MAKE@ show-var VARNAME=WRKDIR` or
die ("can't find WRKDIR -- wrong dir?");
chomp($wrkdir);
-$old_patchdir=`@MAKE@ show-var VARNAME=PATCHDIR` or
+$patchdir=`@MAKE@ show-var VARNAME=PATCHDIR` or
die ("can't find PATCHDIR -- wrong dir?");
-chomp($old_patchdir);
+chomp($patchdir);
+
+if ($opt_c) {
+ open(HANDLE, "find ${patchdir} -type f -name \\\*.orig |");
+ foreach (<HANDLE>) {
+ chomp;
+ unlink $_;
+ }
+ exit 0;
+}
-if ($opt_d) {
- $patchdir = cwd()."/$opt_d";
-}
-else {
- $patchdir="$wrkdir"."/.newpatches";
+if ($opt_r) {
+ open(HANDLE, "find ${patchdir} -type f -name \\\*.orig |");
+ foreach (<HANDLE>) {
+ chomp;
+ my $orig = $_;
+ my $new = $_;
+ $new =~ s/.orig$//;
+ rename $orig, $new;
+ if (! -s $new) {
+ unlink $new;
+ }
+ }
+ exit 0;
}
create_patchdir();
@@ -81,6 +98,8 @@
die ("can't find WRKSRC -- wrong dir?");
chomp($wrksrc);
+move_away_old_patches();
+
analyze_old_patches();
chdir $wrksrc or die ("can't cd to WRKSRC ($wrksrc)");
@@ -98,22 +117,18 @@
$path = $_;
$complete = $path;
$complete =~ s/.orig$//;
- $new = File::Spec->abs2rel( $complete, $wrksrc );
- $old = File::Spec->abs2rel( $path, $wrksrc );
- if ( -f $complete ) {
+ $new = File::Spec->abs2rel($complete, $wrksrc);
+ $old = File::Spec->abs2rel($path, $wrksrc);
+ if (-f $complete) {
$patchfile = patch_name($new);
if ($opt_v) {
print "$patchfile -> $complete\n";
}
- $diff=`pkgdiff $old $new`;
- if ( $? ) {
+ $diff=`pkgdiff $old $new 2>&1`;
+ if ($?) {
print "$old: $diff";
}
- if ( "$diff" eq "" ) {
- print ("$new and $old don't differ\n");
- } else {
- make_patch($old, $new, $patchfile, $diff);
- }
+ make_patch($old, $new, $patchfile, $diff);
} else {
print ("$new doesn't exist, though $old does\n");
}
@@ -122,19 +137,28 @@
sub analyze_old_patches
{
my $filename;
+ my $origfilename;
my $patch;
my $name;
+ my $checkname;
%old_header = ();
%old_filename = ();
- open(HANDLE, "ls $old_patchdir/patch-* 2>/dev/null |");
+ open(HANDLE, "ls $patchdir/patch-* 2>/dev/null |");
- while ($filename = <HANDLE>) {
- chomp $filename;
- $patch = `sed '/^\+\+\+/ q' $filename`;
+ while ($origfilename = <HANDLE>) {
+ chomp $origfilename;
+ next if not $origfilename =~ m/.orig$/;
Home |
Main Index |
Thread Index |
Old Index