From: Christopher J. Morrone Date: Wed, 27 Nov 2013 23:49:29 +0000 (-0800) Subject: LU-4321 build: Remove make_META.pl X-Git-Tag: 2.5.53~25 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=83b8634e60a26012d1cfedaea42595a7af02e570 LU-4321 build: Remove make_META.pl This patch is a first pass at cleaning up version_tag.pl. Primarily, it removes the strange "make_META.pl" symlink behavior. It is not at all clear to me why the symlink was being generated on the fly, and then version_tag.pl changed its behavior based on its name. Odd. Instead version_tag.pl now take "--make_META" as the first option on its command line. Further, we haven't use CVS in a long time, so this patch removes the cvs-related file and checks. The is_git and is_cvs variables weren't even used, so those are removed as well. Change-Id: I651234bdf1d2d32db16151f332f2b3785ee123a0 Signed-off-by: Christopher J. Morrone Reviewed-on: http://review.whamcloud.com/8427 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Dmitry Eremin Reviewed-by: Minh Diep Reviewed-by: Bob Glossman Reviewed-by: Oleg Drokin --- diff --git a/autoMakefile.am b/autoMakefile.am index 8dab812..ae9f30a 100644 --- a/autoMakefile.am +++ b/autoMakefile.am @@ -256,8 +256,8 @@ checkstack-clean: rm -f ${CSTK} ${CSTKO} module-dist-hook: - if [ -d CVS -o -d .git ]; then \ - perl lustre/scripts/make_META.pl > $(distdir)/META; \ + if [ -d .git ]; then \ + perl lustre/scripts/version_tag.pl --make_META > $(distdir)/META; \ elif [ -f META ]; then \ cp META $(distdir)/META; \ else \ diff --git a/lustre/scripts/Makefile.am b/lustre/scripts/Makefile.am index 3d84d79..9269050 100644 --- a/lustre/scripts/Makefile.am +++ b/lustre/scripts/Makefile.am @@ -51,9 +51,9 @@ sbin_SCRIPTS = $(genscripts) $(sbinscripts) bin_SCRIPTS = lustre_req_history lfs_migrate EXTRA_DIST = license-status version_tag.pl version_tag-git.pl \ - version_tag-cvs.pl version_tag-none.pl lc_common \ + version_tag-none.pl lc_common \ $(addsuffix .in,$(genscripts)) lc_mon $(sbinscripts) \ - $(bin_SCRIPTS) make_META.pl lustre lnet lhbadm \ + $(bin_SCRIPTS) lustre lnet lhbadm \ haconfig ldev Lustre.ha_v2 scriptlibdir = @libexecdir@/@PACKAGE@ @@ -65,6 +65,3 @@ CLEANFILES = $(genscripts) $(genscripts): %: %.in sed -e 's#@scriptlibdir@#$(scriptlibdir)#' < $< > $@ chmod +x $@ - -make_META.pl: version_tag.pl - ln -f $< $@ diff --git a/lustre/scripts/version_tag-cvs.pl b/lustre/scripts/version_tag-cvs.pl deleted file mode 100644 index 59d0e07..0000000 --- a/lustre/scripts/version_tag-cvs.pl +++ /dev/null @@ -1,147 +0,0 @@ -use Time::Local; - -my ($last_mtime, $pristine); - -# for CVS, the buildid is that old "latest mtime" process -sub get_buildid() -{ - - return mtime2date($last_mtime); - -} - -# 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/[TN](.*)/; - 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 $pristine = 1; - - # if we got here, we are operating in a CVS checkout - 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") { - # also used to skip: "$file !~ m/\.(c|h|am|in)$/" but I see - # no good reason why only the above file patterns should - # count towards pristine/changed. it should be any file, - # surely. - next; - } - - my $cur_dir = $entry_file; - $cur_dir =~ s/\/CVS\/Entries$//; - my @statbuf = stat("$cur_dir/$file"); - my $mtime = $statbuf[9]; - if (!defined($mtime)) { - die "unable to get mtime of $cur_dir/$file: $!\n"; - } - 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; - } - } - } - $entry->close(); - } - return $last_mtime, $pristine; - -} - -sub mtime2date($) -{ - - my $mtime = shift; - - 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); - - return $show_last; - -} - -sub is_pristine() -{ - - return $pristine; - -} - -($last_mtime, $pristine) = get_latest_mtime(); - -1; diff --git a/lustre/scripts/version_tag.pl b/lustre/scripts/version_tag.pl index 4d2bb4a..c464ef6 100644 --- a/lustre/scripts/version_tag.pl +++ b/lustre/scripts/version_tag.pl @@ -114,8 +114,12 @@ my $path = $0; $path =~ s/(.+)\/.*/\1/; push(@INC, $cwd . "/" . $path); -my $is_git = 0; -my $is_cvs = 0; +# The _first_ argument on the command line may be --make_META +# Remove it from ARGV if found +if ($ARGV[0] eq "--make_META") { + shift @ARGV; + $make_meta = 1; +} # ARGV[0] = srcdir # ARGV[1] = builddir @@ -126,14 +130,10 @@ if ($ARGV[0]) { } if (-d ".git") { - $is_git = 1; require "version_tag-git.pl"; -} elsif (-d "CVS") { - $is_cvs = 1; - require "version_tag-cvs.pl"; } else { die("a tree status can only be determined in an source code control system checkout\n") - if ($progname eq "make_META.pl"); + if ($make_meta); require "version_tag-none.pl"; } @@ -144,7 +144,7 @@ my $tag = get_tag(); my $pristine = is_pristine(); my $buildid = get_buildid(); -if ($progname eq "version_tag.pl") { +if (!$make_meta) { my $kernver = ""; $kernver = get_kernver($am_linuxdir, $am_linuxobjdir) if ($am_linuxdir ne ""); @@ -152,7 +152,7 @@ if ($progname eq "version_tag.pl") { my $linuxdir =~ s/\//\./g; generate_ver($tag, $local_version, $buildid, $linuxdir, $pristine, $kernver, $ENV{LUSTRE_VERS}); -} elsif ($progname eq "make_META.pl") { +} else { print "TAG = $tag\n"; print "VERSION = $am_version\n"; print "BUILDID = $buildid\n";