tech-pkg archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
pkgtools/pkgdiff: mkpatches, ignore time stamp for unchanged patches
Dear tech-pkg@, Thomas and Dieter,
I have implemented a small patch in order to ignore time stamps for
unchanged patches when doing "mkpatches -c".
To reproduce the problem please just take a package that has at least
one patch and then:
$ cd pkgsrc/foo/bar
$ make extract; make patch
$ mkpatches && mkpatches -c
...also if the patches are not really changed the time stamps in the
patches is updated and so also the "distinfo" should be updated as
well.
Please note that File::Compare and File::Copy are part of lang/perl (so
not additional dependencies are needed).
Thank you for your attention!
Ciao,
L.
Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/pkgtools/pkgdiff/Makefile,v
retrieving revision 1.86
diff -u -r1.86 Makefile
--- Makefile 3 Feb 2015 22:50:27 -0000 1.86
+++ Makefile 9 Jun 2015 10:40:10 -0000
@@ -1,6 +1,6 @@
# $NetBSD: Makefile,v 1.86 2015/02/03 22:50:27 abs Exp $
-PKGNAME= pkgdiff-1.6
+PKGNAME= pkgdiff-1.7
CATEGORIES= pkgtools devel
MAINTAINER= wiz%NetBSD.org@localhost
Index: files/mkpatches.pl
===================================================================
RCS file: /cvsroot/pkgsrc/pkgtools/pkgdiff/files/mkpatches.pl,v
retrieving revision 1.19
diff -u -r1.19 mkpatches.pl
--- files/mkpatches.pl 3 Feb 2015 22:50:27 -0000 1.19
+++ files/mkpatches.pl 9 Jun 2015 10:40:10 -0000
@@ -41,6 +41,8 @@
use Getopt::Std;
use Cwd;
+use File::Compare;
+use File::Copy;
use File::Spec;
my $patchdir;
@@ -123,6 +125,12 @@
open(HANDLE, "find ${patchdir} -type f -name \\\*.orig |");
foreach (<HANDLE>) {
chomp;
+ my $orig = $_;
+ my $new = $_;
+ $new =~ s/.orig$//;
+ if (File::Compare::compare_text($orig, $new, \&compare_patches) == 0) {
+ File::Copy::copy $orig, $new;
+ }
unlink $_;
}
exit 0;
@@ -223,6 +231,17 @@
close(HANDLE);
}
+sub
+compare_patches
+{
+ # Ignore the time stamp
+ if (($_[0] =~ /^---/) and ($_[1] =~ /^---/)) {
+ return 0;
+ }
+
+ return $_[0] ne $_[1];
+}
+
sub move_away_old_patches
{
open(HANDLE, "ls $patchdir/patch-* 2>/dev/null |");
Home |
Main Index |
Thread Index |
Old Index