[Pkg-lustre-svn-commit] updated: [6f9c04d] Redone the verson_tag.pl patch.
Patrick Winnertz
winnie at debian.org
Wed Aug 12 13:22:35 UTC 2009
The following commit has been merged in the master branch:
commit 6f9c04d38aa448a65ef505da79e8321069832f14
Author: Patrick Winnertz <winnie at debian.org>
Date: Wed Aug 12 15:18:47 2009 +0200
Redone the verson_tag.pl patch.
Signed-off-by: Patrick Winnertz <winnie at debian.org>
diff --git a/debian/patches/version_tag-pl-path.dpatch b/debian/patches/version_tag-pl-path.dpatch
index fffc2a8..7e36bc8 100755
--- a/debian/patches/version_tag-pl-path.dpatch
+++ b/debian/patches/version_tag-pl-path.dpatch
@@ -2,218 +2,47 @@
## autogen.dpatch by Patrick Winnertz <winnie at debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
-## DP: change path to version_tag.pl
+## DP: don't depend on utsrelease.h and version.h while building the modules
@DPATCH@
-diff -urNad lustre~/lustre/autoconf/lustre-core.m4 lustre/lustre/autoconf/lustre-core.m4
---- lustre~/lustre/autoconf/lustre-core.m4 2009-08-12 14:10:26.000000000 +0200
-+++ lustre/lustre/autoconf/lustre-core.m4 2009-08-12 14:10:27.000000000 +0200
-@@ -2452,6 +2452,7 @@
- lustre/tests/Makefile
- lustre/tests/mpi/Makefile
- lustre/utils/Makefile
-+lustre/scripts/version_tag.pl
- ])
- case $lb_target_os in
- darwin)
-diff -urNad lustre~/lustre/scripts/version_tag.pl.in lustre/lustre/scripts/version_tag.pl.in
---- lustre~/lustre/scripts/version_tag.pl.in 1970-01-01 01:00:00.000000000 +0100
-+++ lustre/lustre/scripts/version_tag.pl.in 2009-08-12 14:10:57.000000000 +0200
-@@ -0,0 +1,197 @@
-+#!/usr/bin/perl
-+# -*- Mode: perl; indent-tabs-mode: nil; cperl-indent-level: 4 -*-
-+
-+use strict;
-+use diagnostics;
-+use IO::File;
-+use Time::Local;
-+
-+my $pristine = 1;
-+my $kernver;
-+
-+# Use the CVS tag first otherwise use the portals version
-+sub get_tag()
-+{
-+ my $tag;
-+ my $line;
-+
-+ my $tagfile = new IO::File;
-+ if (!$tagfile->open("lustre/CVS/Tag")) {
-+ my $verfile = new IO::File;
-+ if (!$verfile->open("config.h")) {
-+ return "UNKNOWN";
-+ }
-+ while(defined($line = <$verfile>)) {
-+ $line =~ /\#define VERSION "(.*)"/;
-+ if ($1) {
-+ $tag = $1;
-+ last;
-+ }
-+ }
-+ $verfile->close();
-+ return $tag
-+ } else {
-+ my $tmp = <$tagfile>;
-+ $tagfile->close();
-+
-+ $tmp =~ m/T(.*)/;
-+ return $1;
-+ }
-+}
-+
-+sub get_latest_mtime()
-+{
-+ my %months=("Jan" => 0, "Feb" => 1, "Mar" => 2, "Apr" => 3, "May" => 4,
-+ "Jun" => 5, "Jul" => 6, "Aug" => 7, "Sep" => 8, "Oct" => 9,
-+ "Nov" => 10, "Dec" => 11);
-+
-+ my $last_mtime = 0;
-+ my @entries = `find . -name Entries`;
-+ my $entry_file;
-+ foreach $entry_file (@entries) {
-+ chomp($entry_file);
-+ my $entry = new IO::File;
-+ if (!$entry->open($entry_file)) {
-+ die "unable to open $entry_file: $!\n";
-+ }
-+ my $line;
-+ while (defined($line = <$entry>)) {
-+ chomp($line);
-+ #print "line: $line\n";
-+ my ($junk, $file, $version, $date) = split(/\//, $line);
-+
-+ #print "junk: $junk\nfile: $file\nver: $version\ndate: $date\n";
-+ #print "last_mtime: " . localtime($last_mtime) . "\n";
-+
-+ if ($junk eq "D" ||
-+ $file eq "lustre.spec.in" ||
-+ $file !~ m/\.(c|h|am|in)$/) {
-+ next;
-+ }
-+
-+ my $cur_dir = $entry_file;
-+ $cur_dir =~ s/\/CVS\/Entries$//;
-+ my @statbuf = stat("$cur_dir/$file");
-+ my $mtime = $statbuf[9];
-+ if (!defined($mtime)) {
-+ next;
-+ }
-+ my $local_date = gmtime($mtime);
-+ if ($local_date ne $date &&
-+ $file ne "lustre.spec.in") {
-+ #print "$file : " . localtime($mtime) . "\n";
-+ $pristine = 0;
-+ }
-+
-+ if ($mtime > $last_mtime) {
-+ $last_mtime = $mtime;
-+ }
-+
-+ if ($date) {
-+ my @t = split(/ +/, $date);
-+ if (int(@t) != 5) {
-+ #print "skipping: $date\n";
-+ next;
-+ }
-+ my ($hours, $min, $sec) = split(/:/, $t[3]);
-+ my ($mon, $mday, $year) = ($t[1], $t[2], $t[4]);
-+ my $secs = 0;
-+ $mon = $months{$mon};
-+ $secs = timelocal($sec, $min, $hours, $mday, $mon, $year);
-+ if ($secs > $last_mtime) {
-+ $last_mtime = $secs;
+diff -urNad lustre~/lustre/scripts/version_tag.pl lustre/lustre/scripts/version_tag.pl
+--- lustre~/lustre/scripts/version_tag.pl 2009-08-11 15:19:03.000000000 +0200
++++ lustre/lustre/scripts/version_tag.pl 2009-08-12 15:17:47.000000000 +0200
+@@ -163,16 +163,18 @@
+ !$ver->open("$objdir/include/linux/version.h") &&
+ !$ver->open("$dir/include/linux/utsrelease.h") &&
+ !$ver->open("$dir/include/linux/version.h")) {
+- die "Run make dep on $dir\n";
+- }
+- while(defined($line = <$ver>)) {
+- $line =~ /\#define UTS_RELEASE "(.*)"/;
+- if ($1) {
+- $kernver = $1;
+- last;
+- }
+- }
+- $ver->close();
++ #die "Run make dep on $dir\n";
++ $kernver = "UNKNOWN-KERNEL";
++ } else {
++ while(defined($line = <$ver>)) {
++ $line =~ /\#define UTS_RELEASE "(.*)"/;
++ if ($1) {
++ $kernver = $1;
++ last;
+ }
+ }
-+ }
-+ $entry->close();
-+ }
-+ return $last_mtime;
-+}
-+
-+sub get_linuxdir()
-+{
-+ my $config = new IO::File;
-+ my ($line, $dir);
-+ if (!$config->open("Makefile")) {
-+ die "Run ./configure first\n";
-+ }
-+ while (defined($line = <$config>)) {
-+ chomp($line);
-+ if ($line =~ /LINUX :?= (.*)/) {
-+ $dir = $1;
-+ last;
-+ }
-+ }
-+ $config->close();
-+ my $ver = new IO::File;
-+ if (!$ver->open("$dir/include/linux/version.h")) {
-+ die "Run make dep on $dir\n";
-+ }
-+ while(defined($line = <$ver>)) {
-+ $line =~ /\#define UTS_RELEASE "(.*)"/;
-+ if ($1) {
-+ $kernver = $1;
-+ last;
-+ }
-+ }
-+ $ver->close();
-+ chomp($kernver);
-+ $dir =~ s/\//\./g;
-+ return $dir;
-+}
-+
-+sub generate_ver($$$)
-+{
-+ my $tag = shift;
-+ my $mtime = shift;
-+ my $linuxdir = shift;
-+
-+ #print "localtime: " . localtime($mtime) . "\n";
-+
-+ my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) =
-+ localtime($mtime);
-+ $year += 1900;
-+ $mon++;
-+ my $show_last = sprintf("%04d%02d%02d%02d%02d%02d", $year, $mon, $mday,
-+ $hour, $min, $sec);
-+
-+ print "#define BUILD_VERSION \"";
-+
-+ my $lustre_vers = $ENV{LUSTRE_VERS};
-+
-+ if ($lustre_vers) {
-+ print "$tag-$lustre_vers\"\n";
-+ } elsif ($pristine) {
-+ print "$tag-$show_last-PRISTINE-$linuxdir-$kernver\"\n";
-+ } else {
-+ print "$tag-$show_last-CHANGED-$linuxdir-$kernver\"\n";
-+ }
-+}
-+chomp(my $cwd = `pwd`);
-+
-+# ARGV[0] = srcdir
-+# ARGV[1] = builddir
-+
-+# for get_latest_mtime and get_tag you need to be in srcdir
-+
-+if ($ARGV[0]) {
-+ chdir($ARGV[0]);
-+}
-+my $tag = get_tag();
-+my $mtime = get_latest_mtime();
-+
-+# for get_linuxdir you need to be in builddir
-+
-+#if ($ARGV[1]) {
-+# chdir($cwd);
-+# chdir($ARGV[1]);
-+#}
-+#my $linuxdir = get_linuxdir();
-+
-+my $linuxdir = '@LINUX@';
-+$linuxdir =~ s/\//\./g;
-+$kernver = '@LINUXRELEASE@';
-+
-+generate_ver($tag, $mtime, $linuxdir);
-+
-+exit(0);
++ $ver->close();
++ }
+ chomp($kernver);
+ $dir =~ s/\//\./g;
+ return $dir;
+@@ -243,6 +245,8 @@
+ if (!defined($ENV{LUSTRE_VERS}));
+
+ if ($progname eq "version_tag.pl") {
++ chdir($cwd);
++ chdir($ARGV[1]);
+ my $linuxdir = get_linuxdir();
+ $linuxdir =~ s/\//\./g;
+ generate_ver($tag, $mtime, $linuxdir);
--
Lustre Debian Packaging
More information about the Pkg-lustre-svn-commit
mailing list