[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[SCM] Debian package checker branch, master, updated. 2.5.14-5-ge05f55b



The following commit has been merged in the master branch:
commit e05f55b863965ad693c8fbc44278919a0c3a9c1a
Author: Niels Thykier <niels@thykier.net>
Date:   Sat Jun 29 22:20:58 2013 +0200

    Install auto-generated API documentation into usr/share/doc
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/debian/changelog b/debian/changelog
index 15bc0b2..e32f1ab 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,10 @@ lintian (2.5.15) UNRELEASED; urgency=low
 
   * debian/dirs:
     + [NT] Remove /var/lib/lintian, we no longer use it.
+  * debian/docs:
+    + [NT] Add auto-generated API documentation.
+  * debian/rules:
+    + [NT] Generate API documentation during build.
 
  -- Niels Thykier <niels@thykier.net>  Sat, 29 Jun 2013 21:11:09 +0200
 
diff --git a/debian/docs b/debian/docs
index 48b9796..9de2e65 100644
--- a/debian/docs
+++ b/debian/docs
@@ -1,3 +1,4 @@
+doc/api.html
 doc/lintian.html
 doc/CREDITS
 doc/README
diff --git a/debian/rules b/debian/rules
index 18f8014..5ab7db9 100755
--- a/debian/rules
+++ b/debian/rules
@@ -38,7 +38,7 @@ $(profiles): $(allchecks) $(autoreject_data) private/generate-profiles.pl
 	private/generate-profiles.pl
 
 api-doc:
-	private/generate-html-docs ./lib ./doc/tutorial doc/api.html $(VER)
+	private/generate-html-docs
 
 runtests: $(neededfiles) $(allchecks) $(allcollect) $(tagfiles) $(testfiles)
 	@echo .... running tests ....
@@ -73,6 +73,7 @@ build-stamp: $(neededfiles) $(docsource) $(testtarget)
 	pod2man --section=1 man/lintian-info.pod > man/man1/lintian-info.1
 	LINTIAN_ROOT="" ./frontend/lintian --help \
 		| tail -n +3 | $(PERL) -n -e 'print "  $$_"' >doc/help.tmp
+	private/generate-html-docs > /dev/null
 	$(PERL) -p -e 'BEGIN { open HELP, "<", "doc/help.tmp" or die; local $$/ = undef; $$h = <HELP> }; s/%LINTIAN_HELP%/$$h/' doc/README.in >doc/README
 
 	# check that the static data about perl core modules is up to date
diff --git a/private/generate-html-docs b/private/generate-html-docs
index 8d3efac..a333a4c 100755
--- a/private/generate-html-docs
+++ b/private/generate-html-docs
@@ -2,6 +2,7 @@
 
 use strict;
 use warnings;
+use autodie;
 
 use Pod::Simple::HTMLBatch;
 use Pod::Simple::HTML;
@@ -14,7 +15,7 @@ $output = pop @ARGV;
 
 push @input, './lib', './doc/tutorial' unless @input;
 $output //= './doc/api.html';
-$version //= '<version>';
+$version = guess_version();
 
 if ( ! -d $output) {
     mkdir $output or die "could not create directory: $!";
@@ -37,5 +38,33 @@ sub header {
 <head><title>Lintian (v$version) API doc</title></head>
 <body class='contentspage'>
 <h1>Lintian (v$version) API doc</h1>
+<p><em>Note: </em>This API is not stable between releases.</p>
 EOF
 }
+
+sub guess_version {
+    my $version;
+    my $dist;
+    open(my $fd, '-|', 'dpkg-parsechangelog', '-c0');
+    while (my $line = <$fd>) {
+        $version = $1 if $line =~ m{\A Version: \s*+ (\S++) \s* \Z}xsm;
+        $dist = $1 if $line =~ m{\A Distribution: \s*+ (\S++) \s* \Z}xsm;
+    }
+    close($fd);
+    if ( (! defined($dist) or $dist eq 'UNRELEASED') and -d '.git') {
+        # For unreleased versions, git describe is probably a better
+        # choice when available.
+        my $guess;
+        require IPC::Run;
+        delete $ENV{'GITDIR'};
+        eval {
+            # Ignore git being missing (or even failing to work)
+            # - the version being incorrect for non-release cases is
+            #   not a major issue.
+            IPC::Run::run(['git', 'describe'], \undef, \$guess);
+            chomp $guess;
+            $version = $guess if $guess ne '' && $guess =~ m{\A \d+\. }xsm;
+        };
+    }
+    return $version;
+}

-- 
Debian package checker


Reply to: