[med-svn] [Git][med-team/libtabixpp][master] 3 commits: New upstream version 1.1.0

Michael R. Crusoe gitlab at salsa.debian.org
Sat Dec 14 14:30:38 GMT 2019



Michael R. Crusoe pushed to branch master at Debian Med / libtabixpp


Commits:
4b17a10f by Michael R. Crusoe at 2019-12-14T14:04:32Z
New upstream version 1.1.0
- - - - -
7c8c641d by Michael R. Crusoe at 2019-12-14T14:04:34Z
Update upstream source from tag 'upstream/1.1.0'

Update to upstream version '1.1.0'
with Debian dir ae89409b8a19befd41bf1d021ac04c56b1a664e5
- - - - -
534f433a by Michael R. Crusoe at 2019-12-14T14:29:33Z
1.1.0-1

- - - - -


9 changed files:

- Makefile
- debian/changelog
- debian/control
- debian/libtabixpp0.symbols
- debian/patches/build_shared_lib_with_debian_htslib.patch
- − debian/patches/hardening
- debian/patches/series
- tabix.cpp
- tabix.hpp


Changes:

=====================================
Makefile
=====================================
@@ -8,15 +8,19 @@ INCLUDES?=	-Ihtslib
 HTS_HEADERS?=	htslib/htslib/bgzf.h htslib/htslib/tbx.h
 HTS_LIB?=	htslib/libhts.a
 LIBPATH?=	-L. -Lhtslib
-
+LIBS?=	-lhts -lpthread -lm -lbz2 -llzma -lz
 DFLAGS=		-D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE
 PROG=		tabix++
 SUBDIRS=.
 
+ifeq ($(OS),Windows_NT)
+	LIBS += -lws2_32
+endif
+
 .SUFFIXES:.c .o
 
 .c.o:
-	$(CC) -c $(CXXFLAGS) $(DFLAGS) $(INCLUDES) $< -o $@
+	$(CC) $(CPPFLAGS) -c $(CXXFLAGS) $(DFLAGS) $(INCLUDES) $< -o $@
 
 all-recur lib-recur clean-recur cleanlocal-recur install-recur:
 	@target=`echo $@ | sed s/-recur//`; \
@@ -32,14 +36,13 @@ all-recur lib-recur clean-recur cleanlocal-recur install-recur:
 all:	$(PROG)
 
 tabix.o: $(HTS_HEADERS) tabix.cpp tabix.hpp
-	$(CXX) $(CXXFLAGS) -c tabix.cpp $(INCLUDES)
+	$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c tabix.cpp $(INCLUDES)
 
 htslib/libhts.a:
 	cd htslib && $(MAKE) lib-static
 
 tabix++: tabix.o main.cpp $(HTS_LIB)
-	$(CXX) $(CXXFLAGS) -o $@ main.cpp tabix.o $(INCLUDES) $(LIBPATH) \
-		-lhts -lpthread -lm -lz
+	$(CXX) $(LDFLAGS) $(CPPFLAGS) $(CXXFLAGS) -o $@ main.cpp tabix.o $(INCLUDES) $(LIBPATH) $(LIBS)
 
 cleanlocal:
 	rm -fr gmon.out *.o a.out *.dSYM $(PROG) *~ *.a tabix.aux tabix.log \


=====================================
debian/changelog
=====================================
@@ -1,3 +1,12 @@
+libtabixpp (1.1.0-1) UNRELEASED; urgency=medium
+
+  * Team upload.
+  * New upstream release.
+  * Freshen patches; hardening patch applied upstream
+    PENDING: libhts 1.10-2 with libhts3
+
+ -- Michael R. Crusoe <michael.crusoe at gmail.com>  Sat, 14 Dec 2019 15:04:39 +0100
+
 libtabixpp (1.0.0-5) unstable; urgency=medium
 
   * Team upload.


=====================================
debian/control
=====================================
@@ -7,6 +7,7 @@ Priority: optional
 Build-Depends: debhelper (>= 11~),
                libhts-dev,
                zlib1g-dev,
+               libbz2-dev,
                d-shlibs
 Standards-Version: 4.2.1
 Vcs-Browser: https://salsa.debian.org/med-team/libtabixpp


=====================================
debian/libtabixpp0.symbols
=====================================
@@ -1,5 +1,7 @@
 libtabixpp.so.0 libtabixpp0 #MINVER#
  _ZN5Tabix11getNextLineERNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE at Base 1.0.0
+ _ZN5Tabix13getKstringPtrEv at Base 1.1.0
+ _ZN5Tabix13getNextLineKSEv at Base 1.1.0
  _ZN5Tabix9getHeaderERNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE at Base 1.0.0
  _ZN5Tabix9setRegionERNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE at Base 1.0.0
  _ZN5TabixC1ERNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE at Base 1.0.0


=====================================
debian/patches/build_shared_lib_with_debian_htslib.patch
=====================================
@@ -4,25 +4,28 @@ Description: Build shared lib with Debian's htslib
  Debian's shared libhts from the archive.
  Also builds a shared library instead of a static one.
 Author: Sascha Steinbiss <sascha at steinbiss.name>
---- a/Makefile
-+++ b/Makefile
-@@ -3,11 +3,12 @@
+--- libtabixpp.orig/Makefile
++++ libtabixpp/Makefile
+@@ -3,7 +3,7 @@
  
  CC?=		gcc
  CXX?= 		g++
 -CXXFLAGS?=	-g -Wall -O2 -fPIC #-m64 #-arch ppc
-+CXXFLAGS+= -fPIC
++CXXFLAGS+=	-fPIC
  INCLUDES?=	-Ihtslib
  HTS_HEADERS?=	htslib/htslib/bgzf.h htslib/htslib/tbx.h
  HTS_LIB?=	htslib/libhts.a
- LIBPATH?=	-L. -Lhtslib
-+SONUMBER=0
- 
+@@ -12,6 +12,7 @@
  DFLAGS=		-D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE
  PROG=		tabix++
-@@ -18,32 +19,24 @@
+ SUBDIRS=.
++SONUMBER=0
+ 
+ ifeq ($(OS),Windows_NT)
+ 	LIBS += -lws2_32
+@@ -22,31 +23,22 @@
  .c.o:
- 	$(CC) -c $(CXXFLAGS) $(DFLAGS) $(INCLUDES) $< -o $@
+ 	$(CC) $(CPPFLAGS) -c $(CXXFLAGS) $(DFLAGS) $(INCLUDES) $< -o $@
  
 -all-recur lib-recur clean-recur cleanlocal-recur install-recur:
 -	@target=`echo $@ | sed s/-recur//`; \
@@ -34,13 +37,13 @@ Author: Sascha Steinbiss <sascha at steinbiss.name>
 -			|| exit 1; \
 -		cd $$wdir; \
 -	done;
-+all:	$(PROG) libtabixpp.so.$(SONUMBER) libtabixpp.a
++all:   $(PROG) libtabixpp.so.$(SONUMBER) libtabixpp.a
  
 -all:	$(PROG)
 -
 -tabix.o: $(HTS_HEADERS) tabix.cpp tabix.hpp
 +tabix.o: tabix.cpp tabix.hpp
- 	$(CXX) $(CXXFLAGS) -c tabix.cpp $(INCLUDES)
+ 	$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c tabix.cpp $(INCLUDES)
  
 -htslib/libhts.a:
 -	cd htslib && $(MAKE) lib-static
@@ -52,15 +55,13 @@ Author: Sascha Steinbiss <sascha at steinbiss.name>
  
 -tabix++: tabix.o main.cpp $(HTS_LIB)
 +tabix++: tabix.o main.cpp
- 	$(CXX) $(CXXFLAGS) -o $@ main.cpp tabix.o $(INCLUDES) $(LIBPATH) \
- 		-lhts -lpthread -lm -lz
+ 	$(CXX) $(LDFLAGS) $(CPPFLAGS) $(CXXFLAGS) -o $@ main.cpp tabix.o $(INCLUDES) $(LIBPATH) $(LIBS)
  
  cleanlocal:
  	rm -fr gmon.out *.o a.out *.dSYM $(PROG) *~ *.a tabix.aux tabix.log \
 -		tabix.pdf *.class libtabix.*.dylib libtabix.so*
 -	cd htslib && $(MAKE) clean
 +		tabix.pdf *.class libtabix*.dylib libtabix*so*
-+	#cd htslib && $(MAKE) clean
  
 -clean:cleanlocal-recur
 +clean: cleanlocal


=====================================
debian/patches/hardening deleted
=====================================
@@ -1,28 +0,0 @@
-Author: Michael R. Crusoe <michael.crusoe at gmail.com>
-Description: enable hardening flags passthrough
---- libtabixpp.orig/Makefile
-+++ libtabixpp/Makefile
-@@ -17,12 +17,12 @@
- .SUFFIXES:.c .o
- 
- .c.o:
--	$(CC) -c $(CXXFLAGS) $(DFLAGS) $(INCLUDES) $< -o $@
-+	$(CC) $(CPPFLAGS) -c $(CXXFLAGS) $(DFLAGS) $(INCLUDES) $< -o $@
- 
- all:	$(PROG) libtabixpp.so.$(SONUMBER) libtabixpp.a
- 
- tabix.o: tabix.cpp tabix.hpp
--	$(CXX) $(CXXFLAGS) -c tabix.cpp $(INCLUDES)
-+	$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c tabix.cpp $(INCLUDES)
- 
- libtabixpp.a: tabix.o
- 	ar rcs $@ $<
-@@ -31,7 +31,7 @@
- 	$(CXX) -shared -o $@ $< -fPIC -Wl,-soname,libtabixpp.so.$(SONUMBER) $(LDFLAGS) -lhts
- 
- tabix++: tabix.o main.cpp
--	$(CXX) $(CXXFLAGS) -o $@ main.cpp tabix.o $(INCLUDES) $(LIBPATH) \
-+	$(CXX) $(LDFLAGS) $(CPPFLAGS) $(CXXFLAGS) -o $@ main.cpp tabix.o $(INCLUDES) $(LIBPATH) \
- 		-lhts -lpthread -lm -lz
- 
- cleanlocal:


=====================================
debian/patches/series
=====================================
@@ -1,2 +1 @@
 build_shared_lib_with_debian_htslib.patch
-hardening


=====================================
tabix.cpp
=====================================
@@ -5,6 +5,9 @@ Tabix::Tabix(void) { }
 Tabix::Tabix(string& file) {
     has_jumped = false;
     filename = file;
+    str.l = 0;
+    str.m = 0;
+    str.s = NULL;
     const char* cfilename = file.c_str();
     struct stat stat_tbi,stat_vcf;
     char *fnidx = (char*) calloc(strlen(cfilename) + 5, 1);
@@ -47,18 +50,22 @@ Tabix::Tabix(string& file) {
 
     // set up the iterator, defaults to the beginning
     current_chrom = chroms.begin();
-    iter = tbx_itr_querys(tbx, current_chrom->c_str());
+    iter = tbx_itr_querys(tbx, (current_chrom != chroms.end() ? current_chrom->c_str() : ""));
 
 }
 
 Tabix::~Tabix(void) {
     tbx_itr_destroy(iter);
     tbx_destroy(tbx);
+    free(str.s);
+}
+
+const kstring_t * Tabix::getKstringPtr(){
+    return &str;
 }
 
 void Tabix::getHeader(string& header) {
     header.clear();
-    kstring_t str = {0,0,0};
     while ( hts_getline(fn, KS_SEP_LINE, &str) >= 0 ) {
         if ( !str.l || str.s[0]!=tbx->conf.meta_char ) {
             break;
@@ -70,7 +77,7 @@ void Tabix::getHeader(string& header) {
     // set back to start
     current_chrom = chroms.begin();
     if (iter) tbx_itr_destroy(iter);
-    iter = tbx_itr_querys(tbx, current_chrom->c_str());
+    iter = tbx_itr_querys(tbx, (current_chrom != chroms.end() ? current_chrom->c_str() : ""));
 }
 
 bool Tabix::setRegion(string& region) {
@@ -81,7 +88,6 @@ bool Tabix::setRegion(string& region) {
 }
 
 bool Tabix::getNextLine(string& line) {
-    kstring_t str = {0,0,0};
     if (has_jumped) {
         if (iter && tbx_itr_next(fn, tbx, iter, &str) >= 0) {
             line = string(str.s);
@@ -93,8 +99,8 @@ bool Tabix::getNextLine(string& line) {
             line = string(str.s);
             return true;
         } else {
-            ++current_chrom;
-            while (current_chrom != chroms.end()) {
+            // While we aren't at the end, advance. While we're still not at the end...
+            while (current_chrom != chroms.end() && ++current_chrom != chroms.end()) {
                 tbx_itr_destroy(iter);
                 iter = tbx_itr_querys(tbx, current_chrom->c_str());
                 if (iter && tbx_itr_next(fn, tbx, iter, &str) >= 0) {
@@ -108,3 +114,33 @@ bool Tabix::getNextLine(string& line) {
         }
     }
 }
+
+bool Tabix::getNextLineKS() {
+    if (has_jumped) {
+        if (iter && 
+	    tbx_itr_next(fn, tbx, iter, &str) >= 0) {
+            //line = &str;
+            return true;
+        } else 
+	    return false;
+    } else { // step through all sequences in the file
+        // we've never jumped, so read everything
+        if (iter && tbx_itr_next(fn, tbx, iter, &str) >= 0) {
+            //line = &str;
+            return true;
+        } else {
+            // While we aren't at the end, advance. While we're still not at the end...
+            while (current_chrom != chroms.end() && ++current_chrom != chroms.end()) {
+                tbx_itr_destroy(iter);
+                iter = tbx_itr_querys(tbx, current_chrom->c_str());
+                if (iter && tbx_itr_next(fn, tbx, iter, &str) >= 0) {
+                    //line = &str;
+                    return true;
+                } else {
+                    ++current_chrom;
+                }
+            }
+            return false;
+        }
+    }
+}


=====================================
tabix.hpp
=====================================
@@ -15,6 +15,7 @@ class Tabix {
 
     htsFile* fn;
     tbx_t* tbx;
+    kstring_t str;
     hts_itr_t* iter;
     const tbx_conf_t *idxconf;
     int tid, beg, end;
@@ -23,7 +24,6 @@ class Tabix {
     vector<string>::iterator current_chrom;
 
 public:
-
     string filename;
     vector<string> chroms;
 
@@ -31,8 +31,10 @@ public:
     Tabix(string& file);
     ~Tabix(void);
 
+    const kstring_t * getKstringPtr();
     void getHeader(string& header);
     bool setRegion(string& region);
     bool getNextLine(string& line);
+    bool getNextLineKS();
 
 };



View it on GitLab: https://salsa.debian.org/med-team/libtabixpp/compare/6f269a28e008a608320f8346f05da5cc5c101fc4...534f433aebb094d457f01e9bcb03a1a28c365a30

-- 
View it on GitLab: https://salsa.debian.org/med-team/libtabixpp/compare/6f269a28e008a608320f8346f05da5cc5c101fc4...534f433aebb094d457f01e9bcb03a1a28c365a30
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20191214/2e5d4fcb/attachment-0001.html>


More information about the debian-med-commit mailing list