]> git.ipfire.org Git - thirdparty/pciutils.git/commitdiff
New release system
authorMartin Mares <mj@ucw.cz>
Sat, 27 Dec 2003 13:28:42 +0000 (13:28 +0000)
committerMartin Mares <mj@ucw.cz>
Fri, 5 May 2006 12:18:14 +0000 (14:18 +0200)
Integrated a new system for making release.
Really applied the fbsd-device patch this time.
Released as 2.1.99-test2.
git-archimport-id: mj@ucw.cz--public/pciutils--main--2.2--patch-29

ChangeLog
Makefile
README
lib/fbsd-device.c
maint/release [new file with mode: 0755]
maint/release.pm [new file with mode: 0644]
maint/upload [deleted file]
pciutils.lsm
pciutils.spec

index 767e7ce8ef36b7a930beda2aa78405431a3a48e6..aa3ca88627cbb033daafa5ecb5d6ffebd18dc797 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2003-12-27  Martin Mares  <mj@ucw.cz>
+
+       * Released as 2.1.99-test2.
+
+       * README, pciutils.lsm, pciutils.spec: Use @VERSION@ to make the
+       release scripts insert the current version. "make release" is gone.
+
+       * maint/release, maint/release.pm: Added a new system of scripts for
+       making releases including inter-version diffs etc.
+
+       * Makefile: Cleaned up.
+
+       * lib/fbsd-device.c: I patched another copy of this file by mistake,
+       this time the version checks should be right.
+
 2003-12-27  Martin Mares  <mj@ucw.cz>
 
        * Released as 2.1.99-test1.
index dd1973c6e1da443ed87b409e145230b6efd68d56..4d0c215e6db186304fb84426fd1c8dd12e6a668a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@
 OPT=-O2 -fomit-frame-pointer
 CFLAGS=$(OPT) -Wall -W -Wno-parentheses -Wstrict-prototypes -Wmissing-prototypes -Winline
 
-VERSION=2.1.99-test1
+VERSION=2.1.99-test2
 DATE=2003-12-27
 
 PREFIX=/usr/local
@@ -53,6 +53,9 @@ update-pciids: update-pciids.sh
 clean:
        rm -f `find . -name "*~" -o -name "*.[oa]" -o -name "\#*\#" -o -name TAGS -o -name core`
        rm -f update-pciids lspci setpci lib/config.* *.8 pci.ids.*
+       rm -rf maint/dist
+
+distclean: clean
 
 install: all
 # -c is ignored on Linux, but required on FreeBSD
@@ -70,29 +73,4 @@ uninstall: all
 get-ids:
        cp ~/tree/pciids/pci.ids pci.ids
 
-pci.ids:
-       @ [ -f pci.ids ] || echo >&2 "The pci.ids file is no longer part of the CVS. Please do run update-ids.sh to download them." && false
-
-release:
-       sed "s/^\\(Version:[    ]*\\).*/\\1$(VERSION)/;s/^\\(Entered-date:[     ]*\\)[0-9]*/\\1`date -d$(DATE) '+%y%m%d'`/;s/\\(pciutils-\\)[0-9.]*/\\1$(VERSION)\\./" <pciutils.lsm >pciutils.lsm.new
-       sed "s/^\\(Version:[    ]*\\).*/\\1$(VERSION)/" <pciutils.spec >pciutils.spec.new
-       sed "s/\\(, version \\).*\./\\1$(VERSION)./" <README >README.new
-       mv pciutils.lsm.new pciutils.lsm
-       mv pciutils.spec.new pciutils.spec
-       mv README.new README
-
-REL=pciutils-$(VERSION)
-DISTTMP=/tmp/pciutils-dist
-
-dist: clean pci.ids
-       rm -rf $(DISTTMP)
-       mkdir $(DISTTMP)
-       cp -a . $(DISTTMP)/$(REL)
-       rm -rf `find $(DISTTMP)/$(REL) -name .arch-ids -o -name "{arch}" -o -name CVS -o -name tmp -o -name maint`
-       cd $(DISTTMP) ; tar czvvf /tmp/$(REL).tar.gz $(REL)
-       rm -rf $(DISTTMP)
-
-upload: dist
-       maint/upload $(REL)
-
-.PHONY: all lib clean install uninstall dist man release upload get-ids
+.PHONY: all clean distclean install uninstall get-ids
diff --git a/README b/README
index 056d3e3926478acc520fc866fec1303899193b5e..d784b8608cf70de2c7d5b099ff6167b54c923845 100644 (file)
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-This package contains the PCI Utilities, version 2.1.99-test1.
+This package contains the PCI Utilities, version @VERSION@.
 
 Copyright (c) 1997--2003 Martin Mares <mj@ucw.cz>
 
index 13dc91a47cef88ae799c826195f2a60b0d7cc9e6..09041e370b740564b59b8d2da37f396407bbe9f4 100644 (file)
@@ -2,21 +2,27 @@
  *     The PCI Library -- FreeBSD /dev/pci access
  *
  *     Copyright (c) 1999 Jari Kirma <kirma@cs.hut.fi>
+ *     Updated in 2003 by Samy Al Bahra <samy@kerneled.com>
  *
  *     Can be freely distributed and used under the terms of the GNU GPL.
  */
 
-/*
- *      Read functionality of this driver is briefly tested, and seems
- *      to supply basic information correctly, but I promise no more.
- */
-
 #include <fcntl.h>
 #include <string.h>
 #include <unistd.h>
-
-#include <pci/pcivar.h>
-#include <pci/pci_ioctl.h>
+#include <osreldate.h>
+
+#if __FreeBSD_version < 500000
+#  include <pci/pcivar.h>
+#else
+#  include <dev/pci/pcivar.h>
+#endif
+
+#if __FreeBSD_version < 430000
+#  include <pci/pci_ioctl.h>
+#else
+#  include <sys/pciio.h>
+#endif
 
 #include "internal.h"
 
diff --git a/maint/release b/maint/release
new file mode 100755 (executable)
index 0000000..67dd369
--- /dev/null
@@ -0,0 +1,38 @@
+#!/usr/bin/perl
+# A simple script for making releases of the pciutils
+# (c) 2003 Martin Mares <mj@ucw.cz>
+
+use strict;
+use warnings;
+require "maint/release.pm";
+
+my $r = new UCW::Release("pciutils");
+my $ver = $r->GetVersionFromFile("Makefile", "VERSION=(.*)");
+$r->GetVersionsFromChangelog("ChangeLog", "Released as (.*)\.");
+if ($ver =~ /-/) {
+       $r->{"ALPHADIR"} = "alpha/";
+       $r->{"conditions"}->{"ALPHA_VERSION"} = 1;
+} else {
+       $r->{"ALPHADIR"} = "";
+       $r->{"conditions"}->{"ALPHA_VERSION"} = -1;
+}
+push @{$r->{"uploads"}}, {
+       "url" => "scp://atrey.karlin.mff.cuni.cz/~ftp/pub/linux/pci/" . $r->{"ALPHADIR"}
+       },{
+       "url" => "scp://master.kernel.org/~ftp/pub/software/utils/pciutils/" . $r->{"ALPHADIR"}
+       };
+push @{$r->{"uploads"}}, {
+       "url" => "ftp://metalab.unc.edu/incoming/linux/",
+       "filter" => '(\.tar\.gz|\.lsm)$'
+       } if !defined $r->{"ALPHADIR"};
+$r->ParseOptions;
+$r->InitDist("maint/dist");
+my $reldir = $r->GenPackage;
+$r->GenFile("README");
+$r->GenFile("pciutils.lsm");
+$r->Dispatch;
+if ($r->{"do_upload"}) {
+       print "Uploading pci.ids to Jabberwock\n";
+       `scp pci.ids pciids@jabberwock.ucw.cz:05-pciutils.new`; die if $?;
+       `ssh pciids@jabberwock.ucw.cz mv 05-pciutils.new origs/05-pciutils`; die if $?;
+}
diff --git a/maint/release.pm b/maint/release.pm
new file mode 100644 (file)
index 0000000..a3c88ec
--- /dev/null
@@ -0,0 +1,305 @@
+#!/usr/bin/perl
+# A simple system for making software releases
+# (c) 2003 Martin Mares <mj@ucw.cz>
+
+package UCW::Release;
+use strict;
+use warnings;
+use Getopt::Long;
+
+our $verbose = 0;
+
+sub new($$) {
+       my ($class,$basename) = @_;
+       my $s = {
+               "PACKAGE" => $basename,
+               "rules" => [
+                       # p=preprocess, s=subst, -=discard
+                       '(^|/)(CVS|\.arch-ids|{arch}|tmp)/' => '-',
+                       '\.(lsm|spec)$' => 'ps',
+                       '(^|/)README$' => 's'
+                       ],
+               "conditions" => {
+                       },
+               "DATE" => `date '+%Y-%m-%d' | tr -d '\n'`,
+               "LSMDATE" => `date '+%y%m%d' | tr -d '\n'`,
+               "distfiles" => [
+                       ],
+               "archivedir" => "/home/mj/tmp/archives/$basename",
+               "uploads" => [
+                       ],
+               # Options
+               "do_test" => 1,
+               "do_patch" => 1,
+               "diff_against" => "",
+               "do_upload" => 1
+       };
+       bless $s;
+       return $s;
+}
+
+sub GetVersionFromFile($) {
+       my ($s,$file,$rx) = @_;
+       open F, $file or die "Unable to open $file for version autodetection";
+       while (<F>) {
+               chomp;
+               if (/$rx/) {
+                       $s->{"VERSION"} = $1;
+                       print "Detected version $1 from $file\n" if $verbose;
+                       last;
+               }
+       }
+       close F;
+       if (!defined $s->{"VERSION"}) { die "Failed to auto-detect version"; }
+       return $s->{"VERSION"};
+}
+
+sub GetVersionsFromChangelog($) {
+       my ($s,$file,$rx) = @_;
+       open F, $file or die "Unable to open $file for version autodetection";
+       while (<F>) {
+               chomp;
+               if (/$rx/) {
+                       if (!defined $s->{"VERSION"}) {
+                               $s->{"VERSION"} = $1;
+                               print "Detected version $1 from $file\n" if $verbose;
+                       } elsif ($s->{"VERSION"} eq $1) {
+                               # do nothing
+                       } else {
+                               $s->{"OLDVERSION"} = $1;
+                               print "Detected previous version $1 from $file\n" if $verbose;
+                               last;
+                       }
+               }
+       }
+       close F;
+       if (!defined $s->{"VERSION"}) { die "Failed to auto-detect version"; }
+       return $s->{"VERSION"};
+}
+
+sub InitDist($) {
+       my ($s,$dd) = @_;
+       $s->{"DISTDIR"} = $dd;
+       print "Initializing dist directory $dd\n" if $verbose;
+       `rm -rf $dd`; die if $?;
+       `mkdir -p $dd`; die if $?;
+}
+
+sub ExpandVar($$) {
+       my ($s,$v) = @_;
+       if (defined $s->{$v}) {
+               return $s->{$v};
+       } else {
+               die "Reference to unknown variable $v";
+       }
+}
+
+sub CopyFile($$$$) {
+       my ($s,$f,$dir,$action) = @_;
+
+       (my $d = $f) =~ s@(^|/)[^/]*$@@;
+       $d = "$dir/$d";
+       -d $d || `mkdir -p $d`; die if $?;
+
+       my $preprocess = ($action =~ /p/);
+       my $subst = ($action =~ /s/);
+       if ($preprocess || $subst) {
+               open I, "$f" or die "open($f): $?";
+               open O, ">$dir/$f" or die "open($dir/$f): $!";
+               my @ifs = ();   # stack of conditions, 1=satisfied
+               my $empty = 0;  # last line was empty
+               my $is_makefile = ($f =~ /(Makefile|.mk)$/);
+               while (<I>) {
+                       if ($subst) {
+                               s/@([0-9A-Za-z_]+)@/$s->ExpandVar($1)/ge;
+                       }
+                       if ($preprocess) {
+                               if (/^#/ || $is_makefile) {
+                                       if (/^#?ifdef\s+(\w+)/) {
+                                               if (defined ${$s->{"conditions"}}{$1}) {
+                                                       push @ifs, ${$s->{"conditions"}}{$1};
+                                                       next;
+                                               }
+                                               push @ifs, 0;
+                                       } elsif (/^#ifndef\s+(\w+)/) {
+                                               if (defined ${$s->{"conditions"}}{$1}) {
+                                                       push @ifs, -${$s->{"conditions"}}{$1};
+                                                       next;
+                                               }
+                                               push @ifs, 0;
+                                       } elsif (/^#if\s+/) {
+                                               push @ifs, 0;
+                                       } elsif (/^#?endif/) {
+                                               my $x = pop @ifs;
+                                               defined $x or die "Improper nesting of conditionals";
+                                               $x && next;
+                                       } elsif (/^#?else/) {
+                                               my $x = pop @ifs;
+                                               defined $x or die "Improper nesting of conditionals";
+                                               push @ifs, -$x;
+                                               $x && next;
+                                       }
+                               }
+                               @ifs && $ifs[$#ifs] < 0 && next;
+                               if (/^$/) {
+                                       $empty && next;
+                                       $empty = 1;
+                               } else { $empty = 0; }
+                       }               
+                       print O;
+               }
+               close O;
+               close I;
+               ! -x $f or chmod(0755, "$dir/$f") or die "chmod($dir/$f): $!";
+       } else {
+               `cp -a $f $dir/$f`; die if $?;
+       }
+}
+
+sub GenPackage($) {
+       my ($s) = @_;
+       $s->{"PKG"} = $s->{"PACKAGE"} . "-" . $s->{"VERSION"};
+       my $dir = $s->{"DISTDIR"} . "/" . $s->{"PKG"};
+       print "Generating $dir\n";
+
+       FILES: foreach my $f (`find . -type f`) {
+               chomp $f;
+               $f =~ s/^\.\///;
+               my $action = "";
+               my @rules = @{$s->{"rules"}};
+               while (@rules) {
+                       my $rule = shift @rules;
+                       my $act = shift @rules;
+                       if ($f =~ $rule) {
+                               $action = $act;
+                               last;
+                       }
+               }
+               ($action =~ /-/) && next FILES;
+               print "$f ($action)\n" if $verbose;
+               $s->CopyFile($f, $dir, $action);
+       }
+
+       if (-f "$dir/Makefile") {
+               print "Cleaning up\n";
+               `cd $dir && make distclean >&2`; die if $?;
+       }
+
+       my $arch = "$dir.tar.gz";
+       print "Creating $arch\n";
+       my $tarvv = $verbose ? "vv" : "";
+       `tar cz${tarvv}f $arch $dir >&2`; die if $?;
+       push @{$s->{"distfiles"}}, $arch;
+
+       my $adir = $s->{"archivedir"};
+       my $afile = $adir . "/" . $s->{"PKG"} . ".tar.gz";
+       print "Archiving $arch in $afile\n";
+       -d $adir or `mkdir -p $adir`;
+       `cp $arch $afile`; die if $?;
+
+       return $dir;
+}
+
+sub GenFile($$) {
+       my ($s,$f) = @_;
+       my $sf = $s->{"DISTDIR"} . "/" . $s->{"PKG"} . "/$f";
+       my $df = $s->{"DISTDIR"} . "/$f";
+       print "Generating $df\n";
+       `cp $sf $df`; die if $?;
+       push @{$s->{"distfiles"}}, $df;
+}
+
+sub ParseOptions($) {
+       my ($s) = @_;
+       GetOptions(
+               "verbose!" => \$verbose,
+               "test!" => \$s->{"do_test"},
+               "patch!" => \$s->{"do_patch"},
+               "diff-against=s" => \$s->{"diff_against"},
+               "upload!" => \$s->{"do_upload"}
+       ) || die "Syntax: release [--verbose] [--test] [--nopatch] [--diff-against=<version>] [--noupload]";
+}
+
+sub Test($) {
+       my ($s) = @_;
+       my $dd = $s->{"DISTDIR"};
+       my $pkg = $s->{"PKG"};
+       my $log = "$dd/$pkg.log";
+       print "Doing a test compilation\n";
+       `( cd $dd/$pkg && make ) >$log 2>&1`;
+       die "There were errors. Please inspect $log" if $?;
+       `grep -q [Ww]arning $log`;
+       $? or print "There were warnings! Please inspect $log.\n";
+       print "Cleaning up\n";
+       `cd $dd/$pkg && make distclean`; die if $?;
+}
+
+sub MakePatch($) {
+       my ($s) = @_;
+       my $dd = $s->{"DISTDIR"};
+       my $pkg1 = $s->{"PKG"};
+       my $oldver;
+       if ($s->{"diff_against"} ne "") {
+               $oldver = $s->{"diff_against"};
+       } elsif (defined $s->{"OLDVERSION"}) {
+               $oldver = $s->{"OLDVERSION"};
+       } else {
+               die "MakePatch: Don't know which is the previous version";
+       }
+       my $pkg0 = $s->{"PACKAGE"} . "-" . $oldver;
+
+       my $oldarch = $s->{"archivedir"} . "/" . $pkg0 . ".tar.gz";
+       -f $oldarch or die "MakePatch: $oldarch not found";
+       print "Unpacking $pkg0 from $oldarch\n";
+       `cd $dd && tar xzf $oldarch`; die if $?;
+
+       my $diff = $s->{"PACKAGE"} . "-" . $oldver . "-" . $s->{"VERSION"} . ".diff.gz";
+       print "Creating a patch from $pkg0 to $pkg1: $diff\n";
+       `cd $dd && diff -ruN $pkg0 $pkg1 | gzip >$diff`; die if $?;
+       push @{$s->{"distfiles"}}, "$dd/$diff";
+}
+
+sub Upload($) {
+       my ($s) = @_;
+       foreach my $u (@{$s->{"uploads"}}) {
+               my $url = $u->{"url"};
+               print "Upload to $url :\n";
+               my @files = ();
+               my $filter = $u->{"filter"} || ".*";
+               foreach my $f (@{$s->{"distfiles"}}) {
+                       if ($f =~ $filter) {
+                               print "\t$f\n";
+                               push @files, $f;
+                       }
+               }
+               print "<confirm> "; <STDIN>;
+               if ($url =~ m@^scp://([^/]+)(.*)@) {
+                       $, = " ";
+                       my $cmd = "scp @files $1:$2\n";
+                       `$cmd`; die if $?;
+               } elsif ($url =~ m@ftp://([^/]+)(.*)@) {
+                       my $host = $1;
+                       my $dir = $2;
+                       open FTP, "|ftp -v $host" or die;
+                       print FTP "cd $dir\n";
+                       foreach my $f (@files) {
+                               (my $ff = $f) =~ s@.*\/([^/].*)@$1@;
+                               print FTP "put $f $ff\n";
+                       }
+                       print FTP "bye\n";
+                       close FTP;
+                       die if $?;
+               } else {
+                       die "Don't know how to handle this URL scheme";
+               }
+       }
+}
+
+sub Dispatch($) {
+       my ($s) = @_;
+       $s->Test if $s->{"do_test"};
+       $s->MakePatch if $s->{"do_patch"};
+       $s->Upload if $s->{"do_upload"};
+}
+
+1;
diff --git a/maint/upload b/maint/upload
deleted file mode 100755 (executable)
index 679b6f8..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/sh
-rel=$1.tar.gz
-rf=/tmp/$rel
-if echo $rel | grep -q - ; then
-       echo "Uploading $rel (ALPHA)"
-       alpha=alpha/
-else
-       echo "Uploading $rel"
-       alpha=
-fi
-echo "atrey"
-scp $rf README pciutils.lsm atrey:~ftp/pub/linux/pci/$alpha
-echo "kernel.org"
-scp $rf README pciutils.lsm master.kernel.org:~ftp/pub/software/utils/pciutils/$alpha
-if [ -z "$alpha" ] ; then
-       echo "metalab"
-       ftp -v metalab.unc.edu <<EOF
-cd incoming/Linux
-put $rf $rel
-put pciutils.lsm
-quit
-EOF
-       fi
-echo "jabberwock"
-scp -C pci.ids pciids@jabberwock.ucw.cz:origs/05-$1
index 2c12a0f74401c8c891e4ef042cdf021dcfe8da8e..e97c148560600171f9607e366fe31ca7eca281d2 100644 (file)
@@ -1,14 +1,16 @@
 Begin3
 Title:          Linux PCI Utilities
-Version:        2.1.99-test1
-Entered-date:   031227
+Version:        @VERSION@
+Entered-date:   @LSMDATE@
 Description:    This package contains various utilities for inspecting and
                setting of devices connected to the PCI bus.
 Keywords:       kernel, pci, lspci, setpci, libpci
 Author:         mj@ucw.cz (Martin Mares)
 Maintained-by:  mj@ucw.cz (Martin Mares)
-Primary-site:   atrey.karlin.mff.cuni.cz pub/linux/pci/pciutils-2.1.99-test1.tar.gz
-Alternate-site: ftp.kernel.org pub/software/utils/pciutils/pciutils-2.1.99-test1.tar.gz
-Alternate-site: metalab.unc.edu pub/Linux/hardware/pciutils-2.1.99-test1.tar.gz
+Primary-site:   atrey.karlin.mff.cuni.cz pub/linux/pci/@ALPHADIR@pciutils-@VERSION@.tar.gz
+Alternate-site: ftp.kernel.org pub/software/utils/pciutils/@ALPHADIR@pciutils-@VERSION@.tar.gz
+#ifndef ALPHA_VERSION
+Alternate-site: metalab.unc.edu pub/Linux/hardware/pciutils-@VERSION@.tar.gz
+#endif
 Copying-policy: GPL
 End
index a983b74067de57c84c856a33f9211ff54340a268..643f312f40ff50f406b5419bee4eb28fcbdda341 100644 (file)
@@ -1,5 +1,5 @@
 Name:          pciutils
-Version:       2.1.99-test1
+Version:       @VERSION@
 Release:       1
 Source:                ftp://atrey.karlin.mff.cuni.cz/pub/linux/pci/%{name}-%{version}.tar.gz
 Copyright:     GNU GPL