Bug#389061: devscripts: [new script] checkdiffs: Helpful wrapper around debdiff

2006-09-23 Thread James Westby
Package: devscripts
Version: 2.9.21
Severity: wishlist

Hi, 

I have written a new script that I think would be good for inclusion in
devscripts.

I'm not sure about the name, and perhaps it should be folded in to
debdiff itself, but this felt more natural.

It is a wrapper around debdiff that runs it for all binary packages
built from a source package, comparing the most recent version to the
previous. 

It attempts to get as much information as possible from files. It can be
run from an unpacked source dir, in which it read debian/control and
debian/changelog to get the packages and versions. The alternative is to
run it with a .changes file as an argument, in which case the old
version must be provided, as it is not in the file.

It first build a list of packages, and then downloads the packages it
needs using aptitude, then compares each in turn. If you already have
the binary packages on your system you can poit it to their location to
save that step.

I think it is worth including as it works out versions an packages from
the information that is already there. It also downloads any packages
that it needs, saving another manual step.

I use it after a pbuilder run, so I do

  $ pdebuild
  $ checkdiffs --new-dir /path/to/pbuilder/result/dir

making it very easy to use debdiff, and so try and eliminate mistakes
like files going missing between versions.

Please consider including it,

Thanks,

James
diff -Nru devscripts-2.9.21/checkdiffs.1 devscripts-2.9.22/checkdiffs.1
--- devscripts-2.9.21/checkdiffs.1  1970-01-01 01:00:00.0 +0100
+++ devscripts-2.9.22/checkdiffs.1  2006-09-23 17:25:19.0 +0100
@@ -0,0 +1,38 @@
+.TH USCAN 1 "Debian Utilities" "DEBIAN" \" -*- nroff -*-
+.SH NAME
+checkdiffs \- run debdiff for all binary packages built from the same source
+.SH SYNOPSIS
+\fBcheckdiffs\fR [\fI--new-dir path\fR] [\fI--old-dir path\fR] 
+   [\fI--old-version version\fR] [\fI--new-version version\fR]
+   [ .changes ]
+.SH DESCRIPTION
+\fBcheckdiffs\fR runs debdiff for each binary package built from a source 
+package, comparing the current version to the previous. It can either work
+from an unpacked source directory or from a .changes file. If a .changes file
+is used the --old-version option must be used, as the .changes file doesn't 
+contain this information.
+.PP
+If the directory options aren't given then aptitude will be used to retrieve
+the versions of the packages that are required.
+.SH OPTIONS
+.TP
+.B \-\-new\-version version
+The version number to use for the newer version to compare.
+.TP
+.B \-\-old\-version version
+The version number to use for the old version of the packages to compare.
+.TP
+.B \-\-new\-dir
+The directory where the .debs for the new versions of the package are. All the 
+required .debs should be in the root of this directory.
+.TP
+.B \-\-old\-dir
+Same as \-\-new\-dir but for the old versions of the packages.
+
+.SH SEE ALSO
+.BR aptitude (8),
+.BR debdiff (1),
+.SH AUTHOR
+Both checkdiffs and this manpage were written by James Westby. They are both
+(C) 2006 James Westby <[EMAIL PROTECTED]>, and are licensed under the
+GPL v2 or later.
diff -Nru devscripts-2.9.21/checkdiffs.pl devscripts-2.9.22/checkdiffs.pl
--- devscripts-2.9.21/checkdiffs.pl 1970-01-01 01:00:00.0 +0100
+++ devscripts-2.9.22/checkdiffs.pl 2006-09-23 17:15:51.0 +0100
@@ -0,0 +1,359 @@
+#!/usr/bin/perl -w
+# 
+# Copyright (C) 2006 James Westby <[EMAIL PROTECTED]>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+use strict;
+
+use File::Temp qw/ tempdir /;
+use Getopt::Long;
+use Cwd;
+
+#
+
+sub usage() {
+  
+  print < File::Spec->tmpdir());
+  die "Could not create temp dir" unless $temp_dir;
+  return $temp_dir;
+
+}
+
+sub test_dir() {
+
+  if (! -r "debian/control") {
+print STDERR "No debian/control, cannot find packages.\n";
+exit 1;
+  }
+
+}
+
+sub get_packages_changelog() {
+
+  open(CONTROL, '<', "debian/control");
+
+  my $package;
+  my (@archdep, @archindep);
+
+  while() {
+
+my $line = $_;
+
+chomp $line;
+
+if ( $line =~ m/Package: (.*)/ ) {
+  close CONTROL if $package;
+  die "Unable to parse debian/control" if $package;
+  $package = $1;
+}
+
+if ( $line =~ m/Architecture: (.*)/ ) {
+  

Bug#389061: devscripts: [new script] checkdiffs: Helpful wrapper around debdiff

2006-09-23 Thread martin f krafft
also sprach James Westby <[EMAIL PROTECTED]> [2006.09.23.1906 +0200]:
> I'm not sure about the name, and perhaps it should be folded in to
> debdiff itself, but this felt more natural.
> 
> It is a wrapper around debdiff that runs it for all binary packages
> built from a source package, comparing the most recent version to the
> previous. 

debdiff does not compare binary packages, it compares the source.

> It attempts to get as much information as possible from files. It can be
> run from an unpacked source dir, in which it read debian/control and
> debian/changelog to get the packages and versions. The alternative is to
> run it with a .changes file as an argument, in which case the old
> version must be provided, as it is not in the file.

The way I always use debdiff is:

  apt-get source foo
  cd foo-1.2
  dch -v1.2-1.1
  
  cd ../
  dpkg-source -b foo-1.2

Now, there will be two .dsc files, for -1 and -1.1, so you feed both
to debdiff.

I don't quite understand your use case.

> +.TH USCAN 1 "Debian Utilities" "DEBIAN" \" -*- nroff -*-

USCAN? :)

-- 
 .''`.   martin f. krafft <[EMAIL PROTECTED]>
: :'  :  proud Debian developer, author, administrator, and user
`. `'`   http://people.debian.org/~madduck - http://debiansystem.info
  `-  Debian - when you have better things to do than fixing systems


signature.asc
Description: Digital signature (GPG/PGP)


Bug#389061: devscripts: [new script] checkdiffs: Helpful wrapper around debdiff

2006-09-23 Thread Peter Samuelson

[martin f krafft]
> debdiff does not compare binary packages, it compares the source.

Have you tried it?  It certainly does compare binary packages.


signature.asc
Description: Digital signature


Bug#389061: devscripts: [new script] checkdiffs: Helpful wrapper around debdiff

2006-09-23 Thread martin f krafft
also sprach Peter Samuelson <[EMAIL PROTECTED]> [2006.09.24.0733 +0200]:
> [martin f krafft]
> > debdiff does not compare binary packages, it compares the source.
> 
> Have you tried it?  It certainly does compare binary packages.

It does. Sorry for jumping the gun.

-- 
 .''`. martin f. krafft <[EMAIL PROTECTED]>
: :'  :proud Debian developer, author, administrator, and user
`. `'` http://people.debian.org/~madduck http://debiansystem.info
  `-  Debian - when you have better things to do than fixing systems


signature.asc
Description: Digital signature (GPG/PGP)


Bug#389061: devscripts: [new script] checkdiffs: Helpful wrapper around debdiff

2006-10-22 Thread James Westby
Hi Martin,

sorry for the slow reply,

On (23/09/06 22:00), martin f krafft wrote:
> also sprach James Westby <[EMAIL PROTECTED]> [2006.09.23.1906 +0200]:
> > It attempts to get as much information as possible from files. It can be
> > run from an unpacked source dir, in which it read debian/control and
> > debian/changelog to get the packages and versions. The alternative is to
> > run it with a .changes file as an argument, in which case the old
> > version must be provided, as it is not in the file.
> 
> The way I always use debdiff is:
> 
>   apt-get source foo
>   cd foo-1.2
>   dch -v1.2-1.1
>   
>   cd ../
>   dpkg-source -b foo-1.2
> 
> Now, there will be two .dsc files, for -1 and -1.1, so you feed both
> to debdiff.
> 
> I don't quite understand your use case.

Yes this does work, I just wanted to expand it a little to make it
easier. As was noted debdiff also deals with binary packages, but in
your case you only have one set. This script finds all of the binary
packages that are built by looking in debian/control. It then downloads
these binary packages using aptitude for both versions (or uses ones on
the filesystem if you point it to them) and compares them.

So my workflow is 

apt-get source foo
cd foo-1.2
dch -v1.2-1.1

pdebuild (or similar)
checkdiffs --new-dir ../ (or wherever your build scripts leaves the packages)

It allows you to compare all binary packages without having to specify
them, and it removes the need to get the old versions if you don't have
them.

I noticed that there is a patch for half of this (the compare all binary
packages part) in the BTS already, so it would remove part of the need
for this script.

I am not that bothered about inclusion, but I wrote the thing and I
thought I would see if anyone else was interested. I had given it to one
person before, who was preparing the new upload of xfce (some 10 or so
source packages and many binary packages), and they liked it, as it
became automated to check all of their packages. 

At the moment it does not also compare the source packages (I was not
aware debdiff could) and would probably barf if udebs were being built.
I would be happy to extend it if it were considered for inclusion.

> 
> > +.TH USCAN 1 "Debian Utilities" "DEBIAN" \" -*- nroff -*-
> 
> USCAN? :)

oops, thanks for pointing this out. It should of course be checkdiffs.

James

-- 
  James Westby   --GPG Key ID: B577FE13-- http://jameswestby.net/
  seccure key - (3+)k7|M*edCX/.A:n*N!>|&7U.L#9E)Tu)T0>AM - secp256r1/nistp256



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#389061: devscripts: [new script] checkdiffs: Helpful wrapper around debdiff

2006-10-28 Thread martin f krafft
also sprach James Westby <[EMAIL PROTECTED]> [2006.10.22.1741 +0200]:
> sorry for the slow reply,

I am no better... :)

> I am not that bothered about inclusion, but I wrote the thing and
> I thought I would see if anyone else was interested. I had given
> it to one person before, who was preparing the new upload of xfce
> (some 10 or so source packages and many binary packages), and they
> liked it, as it became automated to check all of their packages. 

I am not at all opposed to it. Your script looks interesting and
actually seems like a step up from debdiff.

-- 
 .''`.   martin f. krafft <[EMAIL PROTECTED]>
: :'  :  proud Debian developer, author, administrator, and user
`. `'`   http://people.debian.org/~madduck - http://debiansystem.info
  `-  Debian - when you have better things to do than fixing systems


signature.asc
Description: Digital signature (GPG/PGP)


Bug#389061: devscripts: [new script] checkdiffs: Helpful wrapper around debdiff

2006-11-01 Thread James Westby
On (27/10/06 16:26), martin f krafft wrote:
> I am not at all opposed to it. Your script looks interesting and
> actually seems like a step up from debdiff.
> 

I was writing a page on some tools in the package already, and I found
out that dget can also do the same job as aptitude download, and so it
would seem sensible to use that instead.

The package keeps on getting more and more useful to me, just from
looking what it can already do.

I will then make a couple of tweaks to the script at some point, but I
have no idea when.

If anyone is interested in seeing this included I suggest you send a
mail to the bug, and copy me, and say so, then I will take that as a
prod to actually clean it up so it can be considered for inclusion.

-- 
  James Westby   --GPG Key ID: B577FE13-- http://jameswestby.net/
  seccure key - (3+)k7|M*edCX/.A:n*N!>|&7U.L#9E)Tu)T0>AM - secp256r1/nistp256



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]