[med-svn] [libvcflib] 02/02: Somehow the patch approach does not work - probably include dir is cleaned up at some point in time. Just provide a copy and use this inside Makefile
Andreas Tille
tille at debian.org
Thu Jun 23 16:04:14 UTC 2016
This is an automated email from the git hooks/post-receive script.
tille pushed a commit to branch master
in repository libvcflib.
commit e819271ec8dbbbaf8fe22113e225e0ff701cc807
Author: Andreas Tille <tille at debian.org>
Date: Thu Jun 23 18:02:21 2016 +0200
Somehow the patch approach does not work - probably include dir is cleaned up at some point in time. Just provide a copy and use this inside Makefile
---
debian/README.source | 3 +
debian/patches/IntervalTree.h.patch | 219 ------------------------------------
debian/patches/intervaltree.patch | 10 ++
debian/patches/series | 2 +-
4 files changed, 14 insertions(+), 220 deletions(-)
diff --git a/debian/README.source b/debian/README.source
new file mode 100644
index 0000000..76781c9
--- /dev/null
+++ b/debian/README.source
@@ -0,0 +1,3 @@
+The header file debian/include/IntervalTree.h was obtained from
+ https://github.com/ekg/intervaltree
+
diff --git a/debian/patches/IntervalTree.h.patch b/debian/patches/IntervalTree.h.patch
deleted file mode 100644
index fd8ee3d..0000000
--- a/debian/patches/IntervalTree.h.patch
+++ /dev/null
@@ -1,219 +0,0 @@
-uthor: Andreas Tille <tille at debian.org>
-Last-Update: Thu, 23 Jun 2016 09:10:54 +0200
-Origin: https://github.com/ekg/intervaltree
-Description: Inject header file via quilt patch
-
---- /dev/null
-+++ b/include/IntervalTree.h
-@@ -0,0 +1,211 @@
-+#ifndef __INTERVAL_TREE_H
-+#define __INTERVAL_TREE_H
-+
-+#include <vector>
-+#include <algorithm>
-+#include <iostream>
-+#include <memory>
-+
-+template <class T, typename K = std::size_t>
-+class Interval {
-+public:
-+ K start;
-+ K stop;
-+ T value;
-+ Interval(K s, K e, const T& v)
-+ : start(s)
-+ , stop(e)
-+ , value(v)
-+ { }
-+};
-+
-+template <class T, typename K>
-+K intervalStart(const Interval<T,K>& i) {
-+ return i.start;
-+}
-+
-+template <class T, typename K>
-+K intervalStop(const Interval<T,K>& i) {
-+ return i.stop;
-+}
-+
-+template <class T, typename K>
-+ std::ostream& operator<<(std::ostream& out, Interval<T,K>& i) {
-+ out << "Interval(" << i.start << ", " << i.stop << "): " << i.value;
-+ return out;
-+}
-+
-+template <class T, typename K = std::size_t>
-+class IntervalStartSorter {
-+public:
-+ bool operator() (const Interval<T,K>& a, const Interval<T,K>& b) {
-+ return a.start < b.start;
-+ }
-+};
-+
-+template <class T, typename K = std::size_t>
-+class IntervalTree {
-+
-+public:
-+ typedef Interval<T,K> interval;
-+ typedef std::vector<interval> intervalVector;
-+ typedef IntervalTree<T,K> intervalTree;
-+
-+ intervalVector intervals;
-+ std::unique_ptr<intervalTree> left;
-+ std::unique_ptr<intervalTree> right;
-+ K center;
-+
-+ IntervalTree<T,K>(void)
-+ : left(nullptr)
-+ , right(nullptr)
-+ , center(0)
-+ { }
-+
-+private:
-+ std::unique_ptr<intervalTree> copyTree(const intervalTree& orig){
-+ return std::unique_ptr<intervalTree>(new intervalTree(orig));
-+ }
-+public:
-+
-+ IntervalTree<T,K>(const intervalTree& other)
-+ : intervals(other.intervals),
-+ left(other.left ? copyTree(*other.left) : nullptr),
-+ right(other.right ? copyTree(*other.right) : nullptr),
-+ center(other.center)
-+ {
-+ }
-+
-+public:
-+
-+ IntervalTree<T,K>& operator=(const intervalTree& other) {
-+ center = other.center;
-+ intervals = other.intervals;
-+ left = other.left ? copyTree(*other.left) : nullptr;
-+ right = other.right ? copyTree(*other.right) : nullptr;
-+ return *this;
-+ }
-+
-+ // Note: changes the order of ivals
-+ IntervalTree<T,K>(
-+ intervalVector& ivals,
-+ std::size_t depth = 16,
-+ std::size_t minbucket = 64,
-+ K leftextent = 0,
-+ K rightextent = 0,
-+ std::size_t maxbucket = 512
-+ )
-+ : left(nullptr)
-+ , right(nullptr)
-+ {
-+
-+ --depth;
-+ IntervalStartSorter<T,K> intervalStartSorter;
-+ if (depth == 0 || (ivals.size() < minbucket && ivals.size() < maxbucket)) {
-+ std::sort(ivals.begin(), ivals.end(), intervalStartSorter);
-+ intervals = ivals;
-+ } else {
-+ if (leftextent == 0 && rightextent == 0) {
-+ // sort intervals by start
-+ std::sort(ivals.begin(), ivals.end(), intervalStartSorter);
-+ }
-+
-+ K leftp = 0;
-+ K rightp = 0;
-+ K centerp = 0;
-+
-+ if (leftextent || rightextent) {
-+ leftp = leftextent;
-+ rightp = rightextent;
-+ } else {
-+ leftp = ivals.front().start;
-+ std::vector<K> stops;
-+ stops.resize(ivals.size());
-+ transform(ivals.begin(), ivals.end(), stops.begin(), intervalStop<T,K>);
-+ rightp = *max_element(stops.begin(), stops.end());
-+ }
-+
-+ //centerp = ( leftp + rightp ) / 2;
-+ centerp = ivals.at(ivals.size() / 2).start;
-+ center = centerp;
-+
-+ intervalVector lefts;
-+ intervalVector rights;
-+
-+ for (typename intervalVector::const_iterator i = ivals.begin(); i != ivals.end(); ++i) {
-+ const interval& interval = *i;
-+ if (interval.stop < center) {
-+ lefts.push_back(interval);
-+ } else if (interval.start > center) {
-+ rights.push_back(interval);
-+ } else {
-+ intervals.push_back(interval);
-+ }
-+ }
-+
-+ if (!lefts.empty()) {
-+ left = std::unique_ptr<intervalTree>(new intervalTree(lefts, depth, minbucket, leftp, centerp));
-+ }
-+ if (!rights.empty()) {
-+ right = std::unique_ptr<intervalTree>(new intervalTree(rights, depth, minbucket, centerp, rightp));
-+ }
-+ }
-+ }
-+
-+ intervalVector findOverlapping(K start, K stop) const {
-+ intervalVector ov;
-+ this->findOverlapping(start, stop, ov);
-+ return ov;
-+ }
-+
-+ void findOverlapping(K start, K stop, intervalVector& overlapping) const {
-+ if (!intervals.empty() && ! (stop < intervals.front().start)) {
-+ for (typename intervalVector::const_iterator i = intervals.begin(); i != intervals.end(); ++i) {
-+ const interval& interval = *i;
-+ if (interval.stop >= start && interval.start <= stop) {
-+ overlapping.push_back(interval);
-+ }
-+ }
-+ }
-+
-+ if (left && start <= center) {
-+ left->findOverlapping(start, stop, overlapping);
-+ }
-+
-+ if (right && stop >= center) {
-+ right->findOverlapping(start, stop, overlapping);
-+ }
-+
-+ }
-+
-+ intervalVector findContained(K start, K stop) const {
-+ intervalVector contained;
-+ this->findContained(start, stop, contained);
-+ return contained;
-+ }
-+
-+ void findContained(K start, K stop, intervalVector& contained) const {
-+ if (!intervals.empty() && ! (stop < intervals.front().start)) {
-+ for (typename intervalVector::const_iterator i = intervals.begin(); i != intervals.end(); ++i) {
-+ const interval& interval = *i;
-+ if (interval.start >= start && interval.stop <= stop) {
-+ contained.push_back(interval);
-+ }
-+ }
-+ }
-+
-+ if (left && start <= center) {
-+ left->findContained(start, stop, contained);
-+ }
-+
-+ if (right && stop >= center) {
-+ right->findContained(start, stop, contained);
-+ }
-+
-+ }
-+
-+ ~IntervalTree(void) = default;
-+
-+};
-+
-+#endif
diff --git a/debian/patches/intervaltree.patch b/debian/patches/intervaltree.patch
new file mode 100644
index 0000000..ff9093f
--- /dev/null
+++ b/debian/patches/intervaltree.patch
@@ -0,0 +1,10 @@
+--- a/Makefile
++++ b/Makefile
+@@ -160,6 +160,7 @@ multichoose: pre
+ intervaltree: pre
+ echo "Source does not contain dir intervaltree"
+ # cd intervaltree && $(MAKE) && cp *.h* $(VCF_LIB_LOCAL)/$(INC_DIR)/
++ mkdir -p $(VCF_LIB_LOCAL)/$(INC_DIR)/ && cp -a debian/include/* $(VCF_LIB_LOCAL)/$(INC_DIR)/
+
+ $(TABIX): pre
+ echo "No need to create separately packaged tabixpp"
diff --git a/debian/patches/series b/debian/patches/series
index c5dc43e..ec7bf95 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,4 +3,4 @@ use_debian_packaged_smithwaterman.patch
multichoose.h.patch
filevercmp.h.patch
use_debian_packaged_fastahack.patch
-IntervalTree.h.patch
+intervaltree.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/libvcflib.git
More information about the debian-med-commit
mailing list