[med-svn] [bcftools] 01/10: Set up code to install bcftools plugins

Afif Elghraoui afif-guest at moszumanska.debian.org
Tue Nov 10 07:45:45 UTC 2015


This is an automated email from the git hooks/post-receive script.

afif-guest pushed a commit to branch master
in repository bcftools.

commit 335db91652ecbb6c63d4d2fb2d8f504aa6cea86d
Author: Afif Elghraoui <afif at ghraoui.name>
Date:   Mon Nov 9 22:36:45 2015 -0800

    Set up code to install bcftools plugins
---
 debian/patches/destdir.patch                |   9 ++
 debian/patches/improve-plugin-support.patch | 212 ++++++++++++++++++++++++++++
 debian/patches/series                       |   1 +
 3 files changed, 222 insertions(+)

diff --git a/debian/patches/destdir.patch b/debian/patches/destdir.patch
index df5bc79..c50d542 100644
--- a/debian/patches/destdir.patch
+++ b/debian/patches/destdir.patch
@@ -4,6 +4,15 @@ Forwarded: not-needed
 Last-Update: 2015-11-03
 --- bcftools.orig/Makefile
 +++ bcftools/Makefile
+@@ -33,7 +33,7 @@
+ TABIX  = /usr/bin/tabix
+ 
+ CC       ?= gcc
+-CFLAGS   += -g -Wall -Wc++-compat -O2
++CFLAGS   += -g -Wall -Wc++-compat -O2 -DPLUGINPATH=\"$(pluginpath)\"
+ DFLAGS   =
+ OBJS     = main.o vcfindex.o tabix.o \
+            vcfstats.o vcfisec.o vcfmerge.o vcfquery.o vcffilter.o filter.o vcfsom.o \
 @@ -54,7 +54,7 @@
  
  LDLIBS += $(LDFLAGS)
diff --git a/debian/patches/improve-plugin-support.patch b/debian/patches/improve-plugin-support.patch
new file mode 100644
index 0000000..2123b29
--- /dev/null
+++ b/debian/patches/improve-plugin-support.patch
@@ -0,0 +1,212 @@
+From bea7d08f1947df750acf2577dbe827b1a43f549b Mon Sep 17 00:00:00 2001
+From: John Marshall <jm18 at sanger.ac.uk>
+Date: Fri, 20 Mar 2015 11:03:58 +0000
+Subject: [PATCH] Update $BCFTOOLS_PLUGINS handling
+
+An empty entry in the environment variable means to search $(pluginpath)
+directories at that point; no environment variable set means search just
+those system directories.  Document $BCFTOOLS_PLUGINS usage.
+
+Makefile installs plugins to $(plugindir), and allows both $(plugindir)
+and $(pluginpath) to be overridden if so desired.  Fixes #204.
+https://github.com/samtools/bcftools/issues/204
+---
+ Makefile          | 11 ++++++----
+ doc/bcftools.1    | 16 ++++++++------
+ doc/bcftools.html | 20 +++++++++++-------
+ doc/bcftools.txt  | 16 ++++++++++----
+ vcfplugin.c       | 62 +++++++++++++++++++++++++++++++++++--------------------
+ 5 files changed, 81 insertions(+), 44 deletions(-)
+
+--- bcftools.orig/doc/bcftools.1
++++ bcftools/doc/bcftools.1
+@@ -2,12 +2,12 @@
+ .\"     Title: bcftools
+ .\"    Author: [see the "AUTHORS" section]
+ .\" Generator: DocBook XSL Stylesheets v1.76.1 <http://docbook.sf.net/>
+-.\"      Date: 2015-01-21 15:01 GMT
++.\"      Date: 2015-03-20 11:57 GMT
+ .\"    Manual: \ \&
+ .\"    Source: \ \&
+ .\"  Language: English
+ .\"
+-.TH "BCFTOOLS" "1" "2015\-01\-21 15:01 GMT" "\ \&" "\ \&"
++.TH "BCFTOOLS" "1" "2015\-03\-20 11:57 GMT" "\ \&" "\ \&"
+ .\" -----------------------------------------------------------------
+ .\" * Define some portability stuff
+ .\" -----------------------------------------------------------------
+@@ -41,7 +41,7 @@
+ BCFtools is designed to work on a stream\&. It regards an input file "\-" as the standard input (stdin) and outputs to the standard output (stdout)\&. Several commands can thus be combined with Unix pipes\&.
+ .SS "VERSION"
+ .sp
+-This manual page was last updated \fB2015\-01\-21 15:01 GMT\fR and refers to bcftools git version \fB1\&.1\-140\-g9b0e7cc+\fR\&.
++This manual page was last updated \fB2015\-03\-20 11:57 GMT\fR and refers to bcftools git version \fB1\&.2\-6\-ga8d7fe9+\fR\&.
+ .SS "BCF1"
+ .sp
+ The BCF1 format output by versions of samtools <= 0\&.1\&.19 is \fBnot\fR compatible with this version of bcftools\&. To read BCF1 files one can use the view command from old versions of bcftools packaged with samtools versions <= 0\&.1\&.19 to convert to VCF, which can then be read by this version of bcftools\&.
+@@ -1918,9 +1918,13 @@
+ .PP
+ \fB\-l, \-\-list\-plugins\fR
+ .RS 4
+-List all available plugins\&. If not installed systemwide, set the environment variable LD_LIBRARY_PATH (linux) or DYLD_LIBRARY_PATH (Mac OS X) to include directory where
+-\fBlibhts\&.so\fR
+-is located\&. The BCFTOOLS_PLUGINS environment variable tells the program which directories to search\&.
++List all available plugins\&.
++.sp
++By default, appropriate system directories are searched for installed plugins\&. You can override this by setting the BCFTOOLS_PLUGINS environment variable to a colon\-separated list of directories to search\&. If BCFTOOLS_PLUGINS begins with a colon, ends with a colon, or contains adjacent colons, the system directories are also searched at that position in the list of directories\&.
++.sp
++If htslib is not installed systemwide, set the environment variable LD_LIBRARY_PATH (linux) or DYLD_LIBRARY_PATH (Mac OS X) to include the directory where
++\fBlibhts\&.so\&.1\fR
++is located\&.
+ .RE
+ .PP
+ \fB\-v, \-\-verbose\fR
+--- bcftools.orig/doc/bcftools.html
++++ bcftools/doc/bcftools.html
+@@ -1,13 +1,13 @@
+ <?xml version="1.0" encoding="UTF-8"?>
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+-<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>bcftools</title><link rel="stylesheet" type="text/css" href="docbook-xsl.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.76.1" /></head><body><div xml:lang="en" class="refentry" title="bcftools" lang="en"><a id="idp25137184"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>bcftools — utilities for variant calling and manip [...]
++<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>bcftools</title><link rel="stylesheet" type="text/css" href="docbook-xsl.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.76.1" /></head><body><div xml:lang="en" class="refentry" title="bcftools" lang="en"><a id="idp135936"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>bcftools — utilities for variant calling and manipul [...]
+ Call Format (VCF) and its binary counterpart BCF. All commands work
+ transparently with both VCFs and BCFs, both uncompressed and BGZF-compressed.</p><p>Most commands accept VCF, bgzipped VCF and BCF with filetype detected
+ automatically even when streaming from a pipe. Indexed VCF and BCF
+ will work in all situations. Un-indexed VCF and BCF and streams will
+ work in most, but not all situations.</p><p>BCFtools is designed to work on a stream. It regards an input file "-" as the
+ standard input (stdin) and outputs to the standard output (stdout). Several
+-commands can thus be  combined  with  Unix pipes.</p><div class="refsect2" title="VERSION"><a id="_version"></a><h3>VERSION</h3><p>This manual page was last updated <span class="strong"><strong>2015-01-21 15:01 GMT</strong></span> and refers to bcftools git version <span class="strong"><strong>1.1-140-g9b0e7cc+</strong></span>.</p></div><div class="refsect2" title="BCF1"><a id="_bcf1"></a><h3>BCF1</h3><p>The BCF1 format output by versions of samtools <= 0.1.19 is <span class="strong" [...]
++commands can thus be  combined  with  Unix pipes.</p><div class="refsect2" title="VERSION"><a id="_version"></a><h3>VERSION</h3><p>This manual page was last updated <span class="strong"><strong>2015-03-20 11:57 GMT</strong></span> and refers to bcftools git version <span class="strong"><strong>1.2-6-ga8d7fe9+</strong></span>.</p></div><div class="refsect2" title="BCF1"><a id="_bcf1"></a><h3>BCF1</h3><p>The BCF1 format output by versions of samtools <= 0.1.19 is <span class="strong">< [...]
+ compatible with this version of bcftools. To read BCF1 files one can use
+ the view command from old versions of bcftools packaged with samtools
+ versions <= 0.1.19 to convert to VCF, which can then be read by
+@@ -1059,12 +1059,16 @@
+     list plugin’s options
+ </dd><dt><span class="term">
+ <span class="strong"><strong>-l, --list-plugins</strong></span>
+-</span></dt><dd>
+-    List all available plugins. If not installed systemwide, set the environment
+-    variable LD_LIBRARY_PATH (linux) or DYLD_LIBRARY_PATH (Mac OS X) to include
+-    directory where <span class="strong"><strong>libhts.so</strong></span> is located.  The BCFTOOLS_PLUGINS
+-    environment variable tells the program which directories to search.
+-</dd><dt><span class="term">
++</span></dt><dd><p class="simpara">
++    List all available plugins.
++</p><p class="simpara">By default, appropriate system directories are searched for installed plugins.
++    You can override this by setting the BCFTOOLS_PLUGINS environment variable
++    to a colon-separated list of directories to search.
++    If BCFTOOLS_PLUGINS begins with a colon, ends with a colon, or contains
++    adjacent colons, the system directories are also searched at that position
++    in the list of directories.</p><p class="simpara">If htslib is not installed systemwide, set the environment variable
++    LD_LIBRARY_PATH (linux) or DYLD_LIBRARY_PATH (Mac OS X) to include the
++    directory where <span class="strong"><strong>libhts.so.1</strong></span> is located.</p></dd><dt><span class="term">
+ <span class="strong"><strong>-v, --verbose</strong></span>
+ </span></dt><dd>
+     print debugging information to debug plugin failure
+--- bcftools.orig/doc/bcftools.txt
++++ bcftools/doc/bcftools.txt
+@@ -1103,10 +1103,18 @@
+     list plugin's options
+ 
+ *-l, --list-plugins*::
+-    List all available plugins. If not installed systemwide, set the environment
+-    variable LD_LIBRARY_PATH (linux) or DYLD_LIBRARY_PATH (Mac OS X) to include
+-    directory where *libhts.so* is located.  The BCFTOOLS_PLUGINS
+-    environment variable tells the program which directories to search.
++    List all available plugins.
+++
++By default, appropriate system directories are searched for installed plugins.
++    You can override this by setting the BCFTOOLS_PLUGINS environment variable
++    to a colon-separated list of directories to search.
++    If BCFTOOLS_PLUGINS begins with a colon, ends with a colon, or contains
++    adjacent colons, the system directories are also searched at that position
++    in the list of directories.
+++
++If htslib is not installed systemwide, set the environment variable
++    LD_LIBRARY_PATH (linux) or DYLD_LIBRARY_PATH (Mac OS X) to include the
++    directory where *libhts.so.1* is located.
+ 
+ *-v, --verbose*::
+     print debugging information to debug plugin failure
+--- bcftools.orig/vcfplugin.c
++++ bcftools/vcfplugin.c
+@@ -146,30 +146,55 @@
+ 
+ char *msprintf(const char *fmt, ...);
+ 
+-static void init_plugin_paths(args_t *args)
++static void add_plugin_paths(args_t *args, const char *path)
+ {
+-    if ( args->nplugin_paths!=-1 ) return;
+-
+-    char *path = getenv("BCFTOOLS_PLUGINS");
+-    if ( path )
++    while (1)
+     {
+-        args->nplugin_paths = 1;
+-        args->plugin_paths  = (char**) malloc(sizeof(char*));
+-        char *ss = args->plugin_paths[0] = strdup(path);
+-        while ( *ss )
++        size_t len = strcspn(path, ":");
++
++	if ( len == 0 )
+         {
+-            if ( *ss==':' )
++#ifdef PLUGINPATH
++            add_plugin_paths(args, PLUGINPATH);
++#endif
++        }
++        else
++        {
++            char *dir = (char *) malloc(len + 1);
++            strncpy(dir, path, len);
++            dir[len] = '\0';
++
++            struct stat st;
++            if ( stat(dir, &st) == 0 )
+             {
+-                *ss = 0;
+                 args->plugin_paths = (char**) realloc(args->plugin_paths,sizeof(char*)*(args->nplugin_paths+1));
+-                args->plugin_paths[args->nplugin_paths] = ss+1;
++                args->plugin_paths[args->nplugin_paths] = dir;
+                 args->nplugin_paths++;
++                if ( args->verbose ) fprintf(stderr, "plugin directory %s .. ok\n", dir);
+             }
+-            ss++;
++            else
++            {
++                if ( args->verbose ) fprintf(stderr, "plugin directory %s .. %s\n", dir, strerror(errno));
++                free(dir);
++            }
++
+         }
++
++        path += len;
++        if ( *path == ':' ) path++;
++        else break;
+     }
+-    else
+-        args->nplugin_paths = 0;
++}
++
++static void init_plugin_paths(args_t *args)
++{
++    if ( args->nplugin_paths!=-1 ) return;
++
++    args->nplugin_paths = 0;
++    args->plugin_paths = NULL;
++
++    char *path = getenv("BCFTOOLS_PLUGINS");
++    add_plugin_paths(args, path ? path : "");
+ }
+ 
+ static void *dlopen_plugin(args_t *args, const char *fname)
+@@ -410,7 +435,8 @@
+     if ( args->hdr_out ) bcf_hdr_destroy(args->hdr_out);
+     if ( args->nplugin_paths>0 )
+     {
+-        free(args->plugin_paths[0]);
++        int i;
++        for (i=0; i<args->nplugin_paths; i++) free(args->plugin_paths[i]);
+         free(args->plugin_paths);
+     }
+     if ( args->filter )
diff --git a/debian/patches/series b/debian/patches/series
index 8cc41f9..a7a617c 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
+improve-plugin-support.patch
 external-libs.patch
 compiler-flags.patch
 destdir.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/bcftools.git



More information about the debian-med-commit mailing list