Skip to content

Commit a6b10a4

Browse files
committed
lcov: Remove CVS artifacts
Replace CVS specifics in the build environment and tools source with Git mechanisms: * CONTRIBUTING and README file now refer to github for the primary source location * When run from a Git repository, the tools dynamically determine the Git version using 'git describe' * When installed into the file system, the version information is fixed with the current Git version * When preparing distribution files, the version at the time of preparing the files is written to file ".version" Also add a .gitignore file to filter out the most frequent temporary file types. Signed-off-by: Peter Oberparleiter <[email protected]>
1 parent fa2a991 commit a6b10a4

File tree

13 files changed

+153
-53
lines changed

13 files changed

+153
-53
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.version
2+
*.gcda
3+
*.gcno
4+
*.info
5+
*.tar.gz
6+
*.rpm

CONTRIBUTING

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,9 @@ following command line options:
6969
diff -Naurp
7070

7171
Please base your changes on the most current version of LCOV. You can use the
72-
following command line to obtain this version from the "utils" module of the
73-
LTP CVS repository (when asked for a password, simply press return):
72+
following command line to obtain this version from the lcov Git repository:
7473

75-
cvs -d:pserver:[email protected]:/cvsroot/ltp login
76-
cvs -z3 -d:pserver:[email protected]:/cvsroot/ltp co -P utils
77-
78-
You can find LCOV in sub-directory "utils/analysis/lcov".
74+
git clone https://github.com/linux-test-project/lcov.git
7975

8076
Add a meaningful description of the contribution to the top of the patch. The
8177
description should follow this format:

Makefile

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
# - clean: remove all generated files
1212
#
1313

14-
VERSION := 1.11
15-
RELEASE := 1
14+
VERSION := $(shell bin/get_version.sh --version)
15+
RELEASE := $(shell bin/get_version.sh --release)
1616

1717
CFG_DIR := $(PREFIX)/etc
1818
BIN_DIR := $(PREFIX)/usr/bin
@@ -49,6 +49,17 @@ install:
4949
bin/install.sh man/gendesc.1 $(MAN_DIR)/man1/gendesc.1 -m 644
5050
bin/install.sh man/lcovrc.5 $(MAN_DIR)/man5/lcovrc.5 -m 644
5151
bin/install.sh lcovrc $(CFG_DIR)/lcovrc -m 644
52+
bin/updateversion.pl $(BIN_DIR)/lcov $(VERSION) $(RELEASE)
53+
bin/updateversion.pl $(BIN_DIR)/genhtml $(VERSION) $(RELEASE)
54+
bin/updateversion.pl $(BIN_DIR)/geninfo $(VERSION) $(RELEASE)
55+
bin/updateversion.pl $(BIN_DIR)/genpng $(VERSION) $(RELEASE)
56+
bin/updateversion.pl $(BIN_DIR)/gendesc $(VERSION) $(RELEASE)
57+
bin/updateversion.pl $(MAN_DIR)/man1/lcov.1 $(VERSION) $(RELEASE)
58+
bin/updateversion.pl $(MAN_DIR)/man1/genhtml.1 $(VERSION) $(RELEASE)
59+
bin/updateversion.pl $(MAN_DIR)/man1/geninfo.1 $(VERSION) $(RELEASE)
60+
bin/updateversion.pl $(MAN_DIR)/man1/genpng.1 $(VERSION) $(RELEASE)
61+
bin/updateversion.pl $(MAN_DIR)/man1/gendesc.1 $(VERSION) $(RELEASE)
62+
bin/updateversion.pl $(MAN_DIR)/man5/lcovrc.5 $(VERSION) $(RELEASE)
5263

5364
uninstall:
5465
bin/install.sh --uninstall bin/lcov $(BIN_DIR)/lcov
@@ -71,7 +82,7 @@ lcov-$(VERSION).tar.gz: $(FILES)
7182
mkdir $(TMP_DIR)
7283
mkdir $(TMP_DIR)/lcov-$(VERSION)
7384
cp -r * $(TMP_DIR)/lcov-$(VERSION)
74-
find $(TMP_DIR)/lcov-$(VERSION) -name CVS -type d | xargs rm -rf
85+
bin/copy_dates.sh . $(TMP_DIR)/lcov-$(VERSION)
7586
make -C $(TMP_DIR)/lcov-$(VERSION) clean
7687
bin/updateversion.pl $(TMP_DIR)/lcov-$(VERSION) $(VERSION) $(RELEASE)
7788
cd $(TMP_DIR) ; \

README

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,11 @@ To install the tarball, unpack it to a directory and run:
6060

6161
make install
6262

63-
Use anonymous CVS for the most recent (but possibly unstable) version:
63+
Use Git for the most recent (but possibly unstable) version:
6464

65-
cvs -d:pserver:[email protected]:/cvsroot/ltp login
65+
git clone https://github.com/linux-test-project/lcov.git
6666

67-
(simply press the ENTER key when asked for a password)
68-
69-
cvs -z3 -d:pserver:[email protected]:/cvsroot/ltp export -D now utils
70-
71-
Change to the utils/analysis/lcov directory and type:
67+
Change to the ulting cov directory and type:
7268

7369
make install
7470

bin/copy_dates.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
#
3+
# Usage: copy_dates.sh SOURCE TARGET
4+
#
5+
# For each file found in SOURCE, set the modification time of the copy of that
6+
# file in TARGET to either the time of the latest Git commit (if SOURCE contains
7+
# a Git repository and the file was not modified after the last commit), or the
8+
# modification time of the original file.
9+
10+
SOURCE="$1"
11+
TARGET="$2"
12+
13+
if [ -z "$SOURCE" -o -z "$TARGET" ] ; then
14+
echo "Usage: $0 SOURCE TARGET" >&2
15+
exit 1
16+
fi
17+
18+
[ -d "$SOURCE/.git" ] ; NOGIT=$?
19+
20+
echo "Copying modification/commit times from $SOURCE to $TARGET"
21+
22+
cd "$SOURCE" || exit 1
23+
find * -type f | while read FILENAME ; do
24+
[ ! -e "$TARGET/$FILENAME" ] && continue
25+
26+
# Copy modification time
27+
touch -m "$TARGET/$FILENAME" -r "$FILENAME"
28+
29+
[ $NOGIT -eq 1 ] && continue # No Git
30+
git diff --quiet -- "$FILENAME" || continue # Modified
31+
git diff --quiet --cached -- "$FILENAME" || continue # Modified
32+
33+
# Apply modification time from Git commit time
34+
TIME=$(git log --pretty=format:%cd -n 1 --date=iso -- "$FILENAME")
35+
[ -n "$TIME" ] && touch -m "$TARGET/$FILENAME" --date "$TIME"
36+
done

bin/gendesc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,12 @@
3838
use strict;
3939
use File::Basename;
4040
use Getopt::Long;
41+
use Cwd qw/abs_path/;
4142

4243

4344
# Constants
44-
our $lcov_version = 'LCOV version 1.11';
45+
our $tool_dir = abs_path(dirname($0));
46+
our $lcov_version = 'LCOV version '.`$tool_dir/get_version.sh --version`;
4547
our $lcov_url = "http://ltp.sourceforge.net/coverage/lcov.php";
4648
our $tool_name = basename($0);
4749

@@ -67,9 +69,6 @@ our $input_filename;
6769
$SIG{__WARN__} = \&warn_handler;
6870
$SIG{__DIE__} = \&die_handler;
6971

70-
# Prettify version string
71-
$lcov_version =~ s/\$\s*Revision\s*:?\s*(\S+)\s*\$/$1/;
72-
7372
# Parse command line options
7473
if (!GetOptions("output-filename=s" => \$output_filename,
7574
"version" =>\$version,

bin/genhtml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,13 @@ use File::Basename;
6969
use File::Temp qw(tempfile);
7070
use Getopt::Long;
7171
use Digest::MD5 qw(md5_base64);
72+
use Cwd qw/abs_path/;
7273

7374

7475
# Global constants
7576
our $title = "LCOV - code coverage report";
76-
our $lcov_version = 'LCOV version 1.11';
77+
our $tool_dir = abs_path(dirname($0));
78+
our $lcov_version = 'LCOV version '.`$tool_dir/get_version.sh --version`;
7779
our $lcov_url = "http://ltp.sourceforge.net/coverage/lcov.php";
7880
our $tool_name = basename($0);
7981

@@ -305,7 +307,6 @@ our $rc_desc_html = 0; # lcovrc: genhtml_desc_html
305307

306308
our $cwd = `pwd`; # Current working directory
307309
chomp($cwd);
308-
our $tool_dir = dirname($0); # Directory where genhtml tool is installed
309310

310311

311312
#
@@ -315,15 +316,6 @@ our $tool_dir = dirname($0); # Directory where genhtml tool is installed
315316
$SIG{__WARN__} = \&warn_handler;
316317
$SIG{__DIE__} = \&die_handler;
317318

318-
# Prettify version string
319-
$lcov_version =~ s/\$\s*Revision\s*:?\s*(\S+)\s*\$/$1/;
320-
321-
# Add current working directory if $tool_dir is not already an absolute path
322-
if (! ($tool_dir =~ /^\/(.*)$/))
323-
{
324-
$tool_dir = "$cwd/$tool_dir";
325-
}
326-
327319
# Check command line for a configuration file name
328320
Getopt::Long::Configure("pass_through", "no_auto_abbrev");
329321
GetOptions("config-file=s" => \$opt_config_file,

bin/geninfo

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,15 @@ use File::Spec::Functions qw /abs2rel catdir file_name_is_absolute splitdir
5555
splitpath catpath/;
5656
use Getopt::Long;
5757
use Digest::MD5 qw(md5_base64);
58+
use Cwd qw/abs_path/;
5859
if( $^O eq "msys" )
5960
{
6061
require File::Spec::Win32;
6162
}
6263

6364
# Constants
64-
our $lcov_version = 'LCOV version 1.11';
65+
our $tool_dir = abs_path(dirname($0));
66+
our $lcov_version = 'LCOV version '.`$tool_dir/get_version.sh --version`;
6567
our $lcov_url = "http://ltp.sourceforge.net/coverage/lcov.php";
6668
our $gcov_tool = "gcov";
6769
our $tool_name = basename($0);
@@ -269,9 +271,6 @@ $SIG{"INT"} = \&int_handler;
269271
$SIG{__WARN__} = \&warn_handler;
270272
$SIG{__DIE__} = \&die_handler;
271273

272-
# Prettify version string
273-
$lcov_version =~ s/\$\s*Revision\s*:?\s*(\S+)\s*\$/$1/;
274-
275274
# Set LC_ALL so that gcov output will be in a unified format
276275
$ENV{"LC_ALL"} = "C";
277276

bin/genpng

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,12 @@
3232
use strict;
3333
use File::Basename;
3434
use Getopt::Long;
35+
use Cwd qw/abs_path/;
3536

3637

3738
# Constants
38-
our $lcov_version = 'LCOV version 1.11';
39+
our $tool_dir = abs_path(dirname($0));
40+
our $lcov_version = 'LCOV version '.`$tool_dir/get_version.sh --version`;
3941
our $lcov_url = "http://ltp.sourceforge.net/coverage/lcov.php";
4042
our $tool_name = basename($0);
4143

@@ -53,9 +55,6 @@ sub genpng_die_handler($);
5355
# Code entry point
5456
#
5557

56-
# Prettify version string
57-
$lcov_version =~ s/\$\s*Revision\s*:?\s*(\S+)\s*\$/$1/;
58-
5958
# Check whether required module GD.pm is installed
6059
if (check_and_load_module("GD"))
6160
{

bin/get_version.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
#
3+
# Usage: get_version.sh --version|--release
4+
#
5+
# Print lcov version or release information as provided by Git, .version
6+
# or a fallback.
7+
8+
TOOLDIR=$(cd $(dirname $0) ; pwd)
9+
GITVER=$(cd $TOOLDIR ; git describe --tags 2>/dev/null)
10+
11+
if [ -z "$GITVER" ] ; then
12+
# Get version information from file
13+
if [ -e "$TOOLDIR/../.version" ] ; then
14+
source "$TOOLDIR/../.version"
15+
fi
16+
else
17+
# Get version information from git
18+
VERSION=${GITVER%%-*}
19+
VERSION=${VERSION:1}
20+
if [ "${GITVER#*-}" != "$GITVER" ] ; then
21+
RELEASE=${GITVER#*-}
22+
fi
23+
fi
24+
25+
# Fallback
26+
[ -z "$VERSION" ] && VERSION=1.0
27+
[ -z "$RELEASE" ] && RELEASE=1
28+
29+
[ "$1" == "--version" ] && echo -n $VERSION
30+
[ "$1" == "--release" ] && echo -n $RELEASE

0 commit comments

Comments
 (0)