diff --git a/debian/changelog b/debian/changelog index c199e1a..5450309 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +yorick-hdf5 (0.8.0-7) experimental; urgency=medium + + * Bug fix: "FTBFS against HDF5 v1.10", thanks to Gilles Filippini + (Closes: #842817). + * Check against Policy 3.9.8. + + -- Thibaut Paumard Wed, 02 Nov 2016 11:43:31 +0100 + yorick-hdf5 (0.8.0-6) experimental; urgency=high * Make yorick-hdf5 compile with HDF5 v1.10. The package is still broken diff --git a/debian/clean b/debian/clean new file mode 100644 index 0000000..cf370aa --- /dev/null +++ b/debian/clean @@ -0,0 +1 @@ +data.h5 diff --git a/debian/control b/debian/control index a1a2239..ff08155 100644 --- a/debian/control +++ b/debian/control @@ -2,12 +2,11 @@ Section: science Priority: extra Maintainer: Debian Science Maintainers -Uploaders: Thibaut Paumard -Build-Depends: debhelper (>= 9), yorick-dev (>= 2.1.05+dfsg-2~bpo40+1), libhdf5-dev (>= 1.10) -Standards-Version: 3.9.3 -DM-Upload-Allowed: yes -Vcs-Git: git://git.debian.org/git/debian-science/packages/yorick-hdf5.git -Vcs-Browser: http://git.debian.org/?p=debian-science/packages/yorick-hdf5.git +Uploaders: Thibaut Paumard +Build-Depends: debhelper (>= 9), yorick-dev (>= 2.1.05+dfsg-2~bpo40+1), libhdf5-dev (>= 1.10~) +Standards-Version: 3.9.8 +Vcs-Git: https://anonscm.debian.org/git/debian-science/packages/yorick-hdf5.git +Vcs-Browser: https://anonscm.debian.org/gitweb/?p=debian-science/packages/yorick-hdf5.git Package: yorick-hdf5 Architecture: any diff --git a/debian/patches/hid_t-64bit b/debian/patches/hid_t-64bit index 2546185..1ee1046 100644 --- a/debian/patches/hid_t-64bit +++ b/debian/patches/hid_t-64bit @@ -1,934 +1,1119 @@ -Description: hid_t is now 64bit - This is a temporary hack that really works only on 64-bit arches. - A better fix is under way. -Author: Thibaut Paumard +Description: wrap 64-bit long hid_t into Yorick's "long" type + HDF5 has changed hid_t to now be always 64bit. There is no + 64-bit-long type in Yorick on 32-bit architectures. On these + architectures, we keep a list of open ids and index them with the + 32-bit long "long" type. +Author: Thibaut Paumard Origin: vendor +Bug: https://github.com/frigaut/yorick-hdf5/issues/1 Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=842817 -Forwarded: not-needed -Last-Update: 2016-11-02 +Last-Update: 2016-11-03 --- This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ --- a/hdf5.c +++ b/hdf5.c -@@ -59,9 +59,9 @@ +@@ -34,8 +34,107 @@ + #include /* For EXIT_FAILURE, EXIT_SUCCESS */ + #include "hdf5.h" + #include "ydata.h" ++#include "yapi.h" + #include "pstdlib.h" + ++/* Make a new data type for hid_t */ ++// Y_WRAP_HID_T should be defined whenever sizeof(long) < sizeof(hid_t). ++// User may force wrapping. ++#ifndef Y_WRAP_HID_T ++# if H5_SIZEOF_LONG < H5_SIZEOF_HID_T ++# define Y_WRAP_HID_T ++# endif ++#endif ++ ++#ifndef Y_WRAP_HID_T ++// Y_WRAP_HID_T is not defined: hid_t can be represented immediately ++// as either int or long. ++# if H5_SIZEOF_HID_T <= H5_SIZEOF_INT ++# define ypush_hid_t ypush_int ++# define ygets_hid_t ygets_i ++# else ++# define ypush_hid_t ypush_long ++# define ygets_hid_t ygets_l ++# endif ++# define yfree_hid_t(hid) do {} while (0) ++ ++#else ++// Y_WRAP_HID_T is defined: wrap hid_t into long. We will maintain a ++// list of hid_t values, the interpreter will only see long integer ++// references to this list. ++ ++#define Y_H5_DEFAULT_SIZE 1024 ++static struct { ++ hid_t * ids; ++ size_t n_allocated; ++ long last; ++} y_hids = { ++ .ids = 0, ++ .n_allocated = 0, ++ .last = -1, ++} ; ++ ++void ypush_hid_t(hid_t hid) { ++ long yid=0; ++ if (hid <0) yid=-1; ++ else if (hid >0) { ++ if (y_hids.n_allocated == 0) { ++ y_hids.ids=malloc(Y_H5_DEFAULT_SIZE*sizeof(hid_t)); ++ if (!(y_hids.ids)) y_error("Failed to allocate list of hids"); ++ y_hids.n_allocated = Y_H5_DEFAULT_SIZE; ++ } ++ long cur; ++ long first_free=-1; ++ for (cur=0; cur<=y_hids.last; ++cur) { ++ if (y_hids.ids[cur] == hid) { ++ yid = cur+1; // because we map hid=0 to yid=0 ++ break; ++ } ++ if (y_hids.ids[cur]==-1 && first_free==-1) first_free=cur; ++ } ++ if (yid==0) { // did not find matching id ++ if (first_free != -1) cur=first_free; ++ yid=cur+1; ++ if (yid<0) { // long int overflow ++ y_error("Pushed to many hids, please close some"); ++ } ++ if (yid>y_hids.n_allocated) { // need to grow y_hids.ids ++ size_t n_allocated=2*y_hids.n_allocated; ++ hid_t * tmp=realloc(y_hids.ids, n_allocated*sizeof(hid_t)); ++ if (!tmp) y_error("Failed to grow list of hids"); ++ y_hids.ids=tmp; ++ y_hids.n_allocated=n_allocated; ++ } ++ y_hids.ids[cur]=hid; ++ if (cur > y_hids.last) y_hids.last=cur; ++ } ++ } ++ ypush_long(yid); ++} ++ ++hid_t ygets_hid_t(int iarg) { ++ // receive hid_t from Yorick. ++ long yid=ygets_l(iarg); ++ if (yid<=0) return yid; ++ long cur=yid-1; ++ if (cur>y_hids.last) y_error("No such id. Was it closed already?"); ++ return y_hids.ids[cur]; ++} ++ ++void yfree_hid_t(hid_t hid) { ++ long cur, i; ++ for (cur=0; cur<=y_hids.last; ++cur) { ++ if (y_hids.ids[cur] == hid) { ++ y_hids.ids[cur]=-1; ++ break; ++ } ++ } ++ while (y_hids.last>=0 && y_hids.ids[y_hids.last]==-1) --y_hids.last; ++} ++#endif ++ ++/* Done wrapping 64-bit hids into 32-bit yids */ ++ + void Y__H5Eon() { H5Eset_auto((H5E_auto_t)H5Eprint,stderr); } + void Y__H5Eoff() { H5Eset_auto(NULL,NULL); } + void Y__H5close() { H5close(); } +@@ -59,34 +158,35 @@ long mode = YGetInteger(sp-nArgs+2); long create_id = YGetInteger(sp-nArgs+3); long access_id = YGetInteger(sp-nArgs+4); - int status; - status=H5Fcreate(filename, (uint) mode, (hid_t) create_id, (hid_t) access_id); - PushIntValue(status); -+ hid_t fid; -+ fid=H5Fcreate(filename, (uint) mode, (hid_t) create_id, (hid_t) access_id); -+ PushLongValue(fid); ++ hid_t id; ++ id=H5Fcreate(filename, (uint) mode, (hid_t) create_id, (hid_t) access_id); ++ ypush_hid_t(id); } void Y__H5Fopen(int nArgs) -@@ -69,18 +69,18 @@ + { char *filename = YGetString(sp-nArgs+1); long flags = YGetInteger(sp-nArgs+2); - long access_id = YGetInteger(sp-nArgs+3); +- long access_id = YGetInteger(sp-nArgs+3); - int status; - status=H5Fopen(filename, (uint) flags, (hid_t) access_id); - PushIntValue(status); -+ hid_t fid; -+ fid=H5Fopen(filename, (uint) flags, (hid_t) access_id); -+ PushLongValue(fid); ++ hid_t access_id = ygets_hid_t(nArgs-3); ++ hid_t id; ++ id=H5Fopen(filename, (uint) flags, (hid_t) access_id); ++ ypush_hid_t(id); } void Y__H5Fclose(int nArgs) { - long file_id = YGetInteger(sp-nArgs+1); +- long file_id = YGetInteger(sp-nArgs+1); - int status; +- H5Fflush((hid_t) file_id, H5F_SCOPE_LOCAL); +- status=H5Fclose((hid_t) file_id); ++ hid_t file_id = ygets_hid_t(nArgs-1); + herr_t status; - H5Fflush((hid_t) file_id, H5F_SCOPE_LOCAL); - status=H5Fclose((hid_t) file_id); -- PushIntValue(status); -+ PushLongValue(status); - } - - -@@ -145,7 +145,7 @@ ++ H5Fflush(file_id, H5F_SCOPE_LOCAL); ++ status=H5Fclose(file_id); ++ yfree_hid_t(file_id); + PushIntValue(status); + } + + + void Y__H5Areads(int nArgs) + { +- long attid = YGetInteger(sp-nArgs+1); ++ hid_t attid = ygets_hid_t(nArgs-1); + Dimension *strdims = 0; + char **data= YGet_Q(sp-nArgs+2,0,&strdims); + long nelem = YGetInteger(sp-nArgs+3); +@@ -114,7 +214,7 @@ + + void Y__H5Dreads(int nArgs) + { +- long did = YGetInteger(sp-nArgs+1); ++ hid_t did = ygets_hid_t(nArgs-1); + Dimension *strdims = 0; + char **data= YGet_Q(sp-nArgs+2,0,&strdims); + long nelem = YGetInteger(sp-nArgs+3); +@@ -140,52 +240,54 @@ + + void Y__H5Gget_linkval(int nArgs) + { +- long loc_id = YGetInteger(sp-nArgs+1); ++ hid_t loc_id = ygets_hid_t(nArgs-1); + char *gname = YGetString(sp-nArgs+2); long size = YGetInteger(sp-nArgs+3); char *value = YGetString(sp-nArgs+4); - PushIntValue((long)H5Gget_linkval((hid_t) loc_id, gname, (size_t)size, value)); -+ PushLongValue((long)H5Gget_linkval((hid_t) loc_id, gname, (size_t)size, value)); - PopTo(sp-nArgs-1); - Drop(nArgs); - } -@@ -155,7 +155,7 @@ - long loc_id = YGetInteger(sp-nArgs+1); ++ PushIntValue((long)H5Gget_linkval(loc_id, gname, (size_t)size, value)); + PopTo(sp-nArgs-1); + Drop(nArgs); + } + + void Y__H5Gopen(nArgs) + { +- long loc_id = YGetInteger(sp-nArgs+1); ++ hid_t loc_id = ygets_hid_t(nArgs-1); char *gname = YGetString(sp-nArgs+2); - PushIntValue((long)H5Gopen((hid_t)loc_id, gname)); -+ PushLongValue((long)H5Gopen((hid_t)loc_id, gname)); - PopTo(sp-nArgs-1); - Drop(nArgs); - } -@@ -164,7 +164,7 @@ - { - long gid = YGetInteger(sp-nArgs+1); ++ ypush_hid_t(H5Gopen(loc_id, gname)); + PopTo(sp-nArgs-1); + Drop(nArgs); + } + + void Y__H5Gclose(nArgs) + { +- long gid = YGetInteger(sp-nArgs+1); ++ hid_t gid = ygets_hid_t(nArgs-1); - PushIntValue((long)H5Gclose((hid_t)gid)); -+ PushLongValue((long)H5Gclose((hid_t)gid)); - PopTo(sp-nArgs-1); - Drop(nArgs); - } -@@ -175,7 +175,7 @@ ++ PushIntValue((long)H5Gclose(gid)); ++ yfree_hid_t(gid); + PopTo(sp-nArgs-1); + Drop(nArgs); + } + + void Y__H5Gcreate(nArgs) + { +- long loc_id = YGetInteger(sp-nArgs+1); ++ hid_t loc_id = ygets_hid_t(nArgs-1); char *gname = YGetString(sp-nArgs+2); long size_hint = YGetInteger(sp-nArgs+3); ++ hid_t result=H5Gcreate(loc_id, gname, (size_t)size_hint); - PushIntValue((long)H5Gcreate((hid_t)loc_id, gname, (size_t)size_hint)); -+ PushLongValue((long)H5Gcreate((hid_t)loc_id, gname, (size_t)size_hint)); - PopTo(sp-nArgs-1); - Drop(nArgs); - } -@@ -186,7 +186,7 @@ ++ ypush_hid_t(result); + PopTo(sp-nArgs-1); + Drop(nArgs); + } + + void Y__H5Gget_num_objs(nArgs) + { +- long gid = YGetInteger(sp-nArgs+1); ++ hid_t gid = ygets_hid_t(nArgs-1); hsize_t num_obj=0; - H5Gget_num_objs((hid_t)gid, &num_obj); -- PushIntValue((long)num_obj); -+ PushLongValue((long)num_obj); - PopTo(sp-nArgs-1); - Drop(nArgs); - } -@@ -208,7 +208,7 @@ - long loc_id = YGetInteger(sp-nArgs+1); +- H5Gget_num_objs((hid_t)gid, &num_obj); ++ H5Gget_num_objs(gid, &num_obj); + PushIntValue((long)num_obj); + PopTo(sp-nArgs-1); + Drop(nArgs); +@@ -193,36 +295,36 @@ + + void Y__H5Gget_objname_by_idx(int nArgs) + { +- long loc_id = YGetInteger(sp-nArgs+1); ++ hid_t loc_id = ygets_hid_t(nArgs-1); long idx = YGetInteger(sp-nArgs+2); + char *name = YGetString(sp-nArgs+3); + long size = YGetInteger(sp-nArgs+4); + +- H5Gget_objname_by_idx((hid_t)loc_id, (hsize_t)idx,name,(size_t)size); ++ H5Gget_objname_by_idx(loc_id, (hsize_t)idx,name,(size_t)size); + Drop(nArgs); + } + + + void Y__H5Gget_objtype_by_idx(int nArgs) + { +- long loc_id = YGetInteger(sp-nArgs+1); ++ hid_t loc_id = ygets_hid_t(nArgs-1); + long idx = YGetInteger(sp-nArgs+2); - PushIntValue((long)H5Gget_objtype_by_idx((hid_t)loc_id, (hsize_t)idx)); -+ PushLongValue((long)H5Gget_objtype_by_idx((hid_t)loc_id, (hsize_t)idx)); - PopTo(sp-nArgs-1); - Drop(nArgs); - } -@@ -227,7 +227,7 @@ ++ PushIntValue((long)H5Gget_objtype_by_idx(loc_id, (hsize_t)idx)); + PopTo(sp-nArgs-1); + Drop(nArgs); + } + + void Y__H5Gget_objtype_by_name(int nArgs) + { +- long loc_id = YGetInteger(sp-nArgs+1); ++ hid_t loc_id = ygets_hid_t(nArgs-1); + char *name = YGetString(sp-nArgs+2); + Dimension *dims = 0; + long *objnum = YGet_L(sp-nArgs+3,0, &dims); + + H5G_stat_t statbuf; + hbool_t followlink=0; +- H5Gget_objinfo((hid_t)loc_id,name,followlink,&statbuf); ++ H5Gget_objinfo(loc_id,name,followlink,&statbuf); + objnum[0] = statbuf.objno[0]; objnum[1] = statbuf.objno[1]; - -- PushIntValue((long)statbuf.type); -+ PushLongValue((long)statbuf.type); - PopTo(sp-nArgs-1); - Drop(nArgs); - } -@@ -240,7 +240,7 @@ - long new_loc_id = YGetInteger(sp-nArgs+4); +@@ -234,14 +336,14 @@ + + void Y__H5Glink2(int nArgs) + { +- long curr_loc_id = YGetInteger(sp-nArgs+1); ++ hid_t curr_loc_id = ygets_hid_t(nArgs-1); + char *curname = YGetString(sp-nArgs+2); + long link_type = YGetInteger(sp-nArgs+3); +- long new_loc_id = YGetInteger(sp-nArgs+4); ++ hid_t new_loc_id = ygets_hid_t(nArgs-4); char *newname = YGetString(sp-nArgs+5); - PushIntValue((long)H5Glink2((hid_t)curr_loc_id, curname, -+ PushLongValue((long)H5Glink2((hid_t)curr_loc_id, curname, - (H5G_link_t)link_type, (hid_t)new_loc_id, +- (H5G_link_t)link_type, (hid_t)new_loc_id, ++ PushIntValue((long)H5Glink2(curr_loc_id, curname, ++ (H5G_link_t)link_type, new_loc_id, newname)); PopTo(sp-nArgs-1); -@@ -252,7 +252,7 @@ - long loc_id = YGetInteger(sp-nArgs+1); + Drop(nArgs); +@@ -249,29 +351,29 @@ + + void Y__H5Gunlink(int nArgs) + { +- long loc_id = YGetInteger(sp-nArgs+1); ++ hid_t loc_id = ygets_hid_t(nArgs-1); char *name = YGetString(sp-nArgs+2); - PushIntValue((long)H5Gunlink((hid_t)loc_id, name)); -+ PushLongValue((long)H5Gunlink((hid_t)loc_id, name)); - PopTo(sp-nArgs-1); - Drop(nArgs); - } -@@ -261,7 +261,7 @@ - { - long cls_id = YGetInteger(sp-nArgs+1); ++ PushIntValue((long)H5Gunlink(loc_id, name)); + PopTo(sp-nArgs-1); + Drop(nArgs); + } + + void Y__H5Pcreate(int nArgs) + { +- long cls_id = YGetInteger(sp-nArgs+1); ++ hid_t cls_id = ygets_hid_t(nArgs-1); - PushIntValue((long)H5Pcreate((hid_t)cls_id)); -+ PushLongValue((long)H5Pcreate((hid_t)cls_id)); - PopTo(sp-nArgs-1); - Drop(nArgs); - } -@@ -271,7 +271,7 @@ - long plist = YGetInteger(sp-nArgs+1); ++ ypush_hid_t(H5Pcreate(cls_id)); + PopTo(sp-nArgs-1); + Drop(nArgs); + } + + void Y__H5Pset_deflate(int nArgs) + { +- long plist = YGetInteger(sp-nArgs+1); ++ hid_t plist = ygets_hid_t(nArgs-1); long level = YGetInteger(sp-nArgs+2); - PushIntValue((long)H5Pset_deflate((hid_t)plist,(int)level)); -+ PushLongValue((long)H5Pset_deflate((hid_t)plist,(int)level)); - PopTo(sp-nArgs-1); - Drop(nArgs); - } -@@ -289,13 +289,14 @@ - - hsize_t hdim[5]; ++ PushIntValue((long)H5Pset_deflate(plist,(int)level)); + PopTo(sp-nArgs-1); + Drop(nArgs); + } +@@ -282,7 +384,7 @@ + + void Y__H5Pset_chunk(int nArgs) + { +- long plist=YGetInteger(sp-nArgs+1); ++ hid_t plist = ygets_hid_t(nArgs-1); + long ndims=YGetInteger(sp-nArgs+2); + Dimension *tmpdims = 0; + long *dim=YGet_L(sp-nArgs+3,0,&tmpdims); +@@ -293,7 +395,7 @@ + + for (i=0;i