Author: smr Date: 2012-02-20 21:04:34 +0000 (Mon, 20 Feb 2012) New Revision: 9732
Added: trunk/packages/minc/trunk/debian/patches/read_file_names-refactor.patch Removed: trunk/packages/minc/trunk/debian/patches/mincaverage-pathmax.patch Modified: trunk/packages/minc/trunk/debian/changelog trunk/packages/minc/trunk/debian/control trunk/packages/minc/trunk/debian/patches/series trunk/packages/minc/trunk/debian/rules Log: Refactor common PATH_MAX-using code, apply fix for case PATH_MAX is not defined. Modified: trunk/packages/minc/trunk/debian/changelog =================================================================== --- trunk/packages/minc/trunk/debian/changelog 2012-02-20 20:42:07 UTC (rev 9731) +++ trunk/packages/minc/trunk/debian/changelog 2012-02-20 21:04:34 UTC (rev 9732) @@ -1,3 +1,12 @@ +minc (2.1.00-5) unstable; urgency=low + + * patches/mincaverage-pathmax.patch: Remove. + * patches/read_file_names-refactor.patch: New. Refactored duplicated + PATH_MAX-using code into library. Need to run autoreconf because + Makefile.am changed. + + -- Steve M. Robbins <[email protected]> Mon, 20 Feb 2012 15:00:32 -0600 + minc (2.1.00-4) unstable; urgency=low * source/format: Set to 3.0 (quilt), so that patches are applied. Modified: trunk/packages/minc/trunk/debian/control =================================================================== --- trunk/packages/minc/trunk/debian/control 2012-02-20 20:42:07 UTC (rev 9731) +++ trunk/packages/minc/trunk/debian/control 2012-02-20 21:04:34 UTC (rev 9732) @@ -4,7 +4,7 @@ Priority: optional Maintainer: Debian Med Packaging Team <[email protected]> Uploaders: Steve M. Robbins <[email protected]> -Build-Depends: debhelper (>= 9), autotools-dev, csh, +Build-Depends: debhelper (>= 9), autotools-dev, dh-autoreconf, csh, libnetcdf-dev, zlib1g-dev, texlive-latex-base, libhdf5-dev Standards-Version: 3.9.2 Vcs-Svn: svn://svn.debian.org/svn/debian-med/trunk/packages/minc/trunk/ Deleted: trunk/packages/minc/trunk/debian/patches/mincaverage-pathmax.patch =================================================================== --- trunk/packages/minc/trunk/debian/patches/mincaverage-pathmax.patch 2012-02-20 20:42:07 UTC (rev 9731) +++ trunk/packages/minc/trunk/debian/patches/mincaverage-pathmax.patch 2012-02-20 21:04:34 UTC (rev 9732) @@ -1,19 +0,0 @@ -Description: Work around missing PATH_MAX definition -Author: Steve Robbins <[email protected]> -Bug: n/a -Forwarded: no - - ---- a/progs/mincaverage/mincaverage.c 2008-01-16 20:33:02.000000000 -0600 -+++ b/progs/mincaverage/mincaverage.c 2012-02-19 21:40:56.634227217 -0600 -@@ -1029,6 +1029,10 @@ - static char **read_file_names(char *filelist, int *num_files) - { - #define FILE_NAME_ALLOC_SIZE 10 -+#ifndef PATH_MAX -+# define PATH_MAX 1024 -+#endif -+ - char **files; - int array_size; - int nfiles; Added: trunk/packages/minc/trunk/debian/patches/read_file_names-refactor.patch =================================================================== --- trunk/packages/minc/trunk/debian/patches/read_file_names-refactor.patch (rev 0) +++ trunk/packages/minc/trunk/debian/patches/read_file_names-refactor.patch 2012-02-20 21:04:34 UTC (rev 9732) @@ -0,0 +1,593 @@ +Description: Work around missing PATH_MAX definition +Author: Steve Robbins <[email protected]> +Bug: n/a +Forwarded: no + +--- minc-2.1.00.orig/Makefile.am ++++ minc-2.1.00/Makefile.am +@@ -67,6 +67,7 @@ + # not part of the installation. + # + noinst_HEADERS = \ ++ libsrc/read_file_names.h \ + libsrc/minc_basic.h \ + libsrc/minc_config.h \ + libsrc/minc_error.h \ +@@ -425,6 +426,7 @@ + libminc2_la_LDFLAGS = -version-info 2:3:1 + libminc2_la_SOURCES = \ + libsrc/ParseArgv.c \ ++ libsrc/read_file_names.c \ + libsrc/dim_conversion.c \ + libsrc/image_conversion.c \ + libsrc/minc_convenience.c \ +--- /dev/null ++++ minc-2.1.00/libsrc/read_file_names.c +@@ -0,0 +1,104 @@ ++#if HAVE_CONFIG_H ++#include "config.h" ++#endif ++ ++#include <stdio.h> ++#include <stdlib.h> ++#include <string.h> ++#include "read_file_names.h" ++ ++#define FILE_NAME_ALLOC_SIZE 10 ++ ++#if defined(PATH_MAX) ++# define FILE_PATH_MAX PATH_MAX ++#else ++# define FILE_PATH_MAX 2046 ++#endif ++ ++ ++ ++/* ----------------------------- MNI Header ----------------------------------- ++@NAME : read_file_names ++@INPUT : filelist - name of file from which to read names ++@OUTPUT : num_files - number of files read in ++@RETURNS : Pointer to a NULL-terminated array of file names ++@DESCRIPTION: Reads in a list of file names from file filelist or stdin if ++ "-" is specified. Returns NULL if an error occurs. If ++ no error occurs, then a pointer to an empty array is ++ returned and num_files is zero. ++@METHOD : ++@GLOBALS : ++@CALLS : ++@CREATED : March 8, 1995 (Peter Neelin) ++@MODIFIED : ++---------------------------------------------------------------------------- */ ++char **read_file_names(char *filelist, int *num_files) ++{ ++ char **files; ++ int array_size; ++ int nfiles; ++ FILE *fp; ++ char line[FILE_PATH_MAX+1]; ++ int length; ++ ++ /* Open the file */ ++ if (strcmp(filelist, "-") == 0) { ++ fp = stdin; ++ } ++ else { ++ fp = fopen(filelist, "r"); ++ if (fp == NULL) { ++ (void) fprintf(stderr, "Error opening file \"%s\"\n", filelist); ++ return NULL; ++ } ++ } ++ ++ /* Allocate an initial array and NULL-terminate it */ ++ array_size = FILE_NAME_ALLOC_SIZE; ++ files = malloc(sizeof(*files) * array_size); ++ if (files == NULL) { ++ (void) fprintf(stderr, "Error allocating memory\n"); ++ return NULL; ++ } ++ nfiles = 0; ++ files[nfiles] = NULL; ++ ++ /* Read in file names */ ++ while (fgets(line, sizeof(line)/sizeof(line[0]), fp) != NULL) { ++ ++ /* Remove a trailing newline and check that there is a name */ ++ length = strlen(line); ++ if ((length > 0) && (line[length-1] == '\n')) { ++ line[length-1] = '\0'; ++ length--; ++ } ++ if (length == 0) continue; ++ ++ /* Make room for names if needed */ ++ while (nfiles >= array_size-1) { ++ array_size += FILE_NAME_ALLOC_SIZE; ++ files = realloc(files, sizeof(*files) * array_size); ++ if (files == NULL) { ++ (void) fprintf(stderr, "Error allocating memory\n"); ++ return NULL; ++ } ++ } ++ ++ /* Save the name, making sure that the list is NULL-terminated */ ++ files[nfiles] = strdup(line); ++ if (files[nfiles] == NULL) { ++ (void) fprintf(stderr, "Error allocating memory\n"); ++ return NULL; ++ } ++ nfiles++; ++ files[nfiles] = NULL; ++ } ++ ++ /* Close the file */ ++ (void) fclose(fp); ++ ++ /* Return the number of files */ ++ *num_files = nfiles; ++ ++ return files; ++} +--- /dev/null ++++ minc-2.1.00/libsrc/read_file_names.h +@@ -0,0 +1,18 @@ ++ ++ ++/* ----------------------------- MNI Header ----------------------------------- ++@NAME : read_file_names ++@INPUT : filelist - name of file from which to read names ++@OUTPUT : num_files - number of files read in ++@RETURNS : Pointer to a NULL-terminated array of file names ++@DESCRIPTION: Reads in a list of file names from file filelist or stdin if ++ "-" is specified. Returns NULL if an error occurs. If ++ no error occurs, then a pointer to an empty array is ++ returned and num_files is zero. ++@METHOD : ++@GLOBALS : ++@CALLS : ++@CREATED : March 8, 1995 (Peter Neelin) ++@MODIFIED : ++---------------------------------------------------------------------------- */ ++char **read_file_names(char *filelist, int *num_files); +--- minc-2.1.00.orig/progs/minccalc/minccalc.c ++++ minc-2.1.00/progs/minccalc/minccalc.c +@@ -121,6 +121,7 @@ + #include <voxel_loop.h> + #include <time_stamp.h> + #include "node.h" ++#include "read_file_names.h" + + /* Constants */ + +@@ -143,7 +144,6 @@ + int input_vector_length, double *input_data[], + int output_num_buffers, int output_vector_length, + double *output_data[], Loop_Info *loop_info); +-static char **read_file_names(char *filelist, int *num_files); + static char *read_expression_file(char *filename); + static int get_list_option(char *dst, char *key, int argc, char **argv); + +@@ -516,93 +516,6 @@ + } + + /* ----------------------------- MNI Header ----------------------------------- +-@NAME : read_file_names +-@INPUT : filelist - name of file from which to read names +-@OUTPUT : num_files - number of files read in +-@RETURNS : Pointer to a NULL-terminated array of file names +-@DESCRIPTION: Reads in a list of file names from file filelist or stdin if +- "-" is specified. Returns NULL if an error occurs. If +- no error occurs, then a pointer to an empty array is +- returned and num_files is zero. +-@METHOD : +-@GLOBALS : +-@CALLS : +-@CREATED : March 8, 1995 (Peter Neelin) +-@MODIFIED : +----------------------------------------------------------------------------- */ +-static char **read_file_names(char *filelist, int *num_files) +-{ +-#define FILE_NAME_ALLOC_SIZE 10 +- char **files; +- int array_size; +- int nfiles; +- FILE *fp; +- char line[PATH_MAX+1]; +- int length; +- +- /* Open the file */ +- if (strcmp(filelist, "-") == 0) { +- fp = stdin; +- } +- else { +- fp = fopen(filelist, "r"); +- if (fp == NULL) { +- (void) fprintf(stderr, "Error opening file \"%s\"\n", filelist); +- return NULL; +- } +- } +- +- /* Allocate an initial array and NULL-terminate it */ +- array_size = FILE_NAME_ALLOC_SIZE; +- files = malloc(sizeof(*files) * array_size); +- if (files == NULL) { +- (void) fprintf(stderr, "Error allocating memory\n"); +- return NULL; +- } +- nfiles = 0; +- files[nfiles] = NULL; +- +- /* Read in file names */ +- while (fgets(line, sizeof(line)/sizeof(line[0]), fp) != NULL) { +- +- /* Remove a trailing newline and check that there is a name */ +- length = strlen(line); +- if ((length > 0) && (line[length-1] == '\n')) { +- line[length-1] = '\0'; +- length--; +- } +- if (length == 0) continue; +- +- /* Make room for names if needed */ +- while (nfiles >= array_size-1) { +- array_size += FILE_NAME_ALLOC_SIZE; +- files = realloc(files, sizeof(*files) * array_size); +- if (files == NULL) { +- (void) fprintf(stderr, "Error allocating memory\n"); +- return NULL; +- } +- } +- +- /* Save the name, making sure that the list is NULL-terminated */ +- files[nfiles] = strdup(line); +- if (files[nfiles] == NULL) { +- (void) fprintf(stderr, "Error allocating memory\n"); +- return NULL; +- } +- nfiles++; +- files[nfiles] = NULL; +- } +- +- /* Close the file */ +- (void) fclose(fp); +- +- /* Return the number of files */ +- *num_files = nfiles; +- +- return files; +-} +- +-/* ----------------------------- MNI Header ----------------------------------- + @NAME : read_expression_file + @INPUT : filename - Name of file from which to read expression + @OUTPUT : (none) +--- minc-2.1.00.orig/progs/mincaverage/mincaverage.c ++++ minc-2.1.00/progs/mincaverage/mincaverage.c +@@ -105,6 +105,7 @@ + #include <ParseArgv.h> + #include <time_stamp.h> + #include <voxel_loop.h> ++#include "read_file_names.h" + + /* Constants */ + +@@ -165,7 +166,6 @@ + double *output_data[], + Loop_Info *loop_info); + static int get_double_list(char *dst, char *key, char *nextarg); +-static char **read_file_names(char *filelist, int *num_files); + + /* Argument variables */ + static int clobber = FALSE; +@@ -1010,91 +1010,3 @@ + + return TRUE; + } +- +-/* ----------------------------- MNI Header ----------------------------------- +-@NAME : read_file_names +-@INPUT : filelist - name of file from which to read names +-@OUTPUT : num_files - number of files read in +-@RETURNS : Pointer to a NULL-terminated array of file names +-@DESCRIPTION: Reads in a list of file names from file filelist or stdin if +- "-" is specified. Returns NULL if an error occurs. If +- no error occurs, then a pointer to an empty array is +- returned and num_files is zero. +-@METHOD : +-@GLOBALS : +-@CALLS : +-@CREATED : March 8, 1995 (Peter Neelin) +-@MODIFIED : +----------------------------------------------------------------------------- */ +-static char **read_file_names(char *filelist, int *num_files) +-{ +-#define FILE_NAME_ALLOC_SIZE 10 +- char **files; +- int array_size; +- int nfiles; +- FILE *fp; +- char line[PATH_MAX+1]; +- int length; +- +- /* Open the file */ +- if (strcmp(filelist, "-") == 0) { +- fp = stdin; +- } +- else { +- fp = fopen(filelist, "r"); +- if (fp == NULL) { +- (void) fprintf(stderr, "Error opening file \"%s\"\n", filelist); +- return NULL; +- } +- } +- +- /* Allocate an initial array and NULL-terminate it */ +- array_size = FILE_NAME_ALLOC_SIZE; +- files = malloc(sizeof(*files) * array_size); +- if (files == NULL) { +- (void) fprintf(stderr, "Error allocating memory\n"); +- return NULL; +- } +- nfiles = 0; +- files[nfiles] = NULL; +- +- /* Read in file names */ +- while (fgets(line, sizeof(line)/sizeof(line[0]), fp) != NULL) { +- +- /* Remove a trailing newline and check that there is a name */ +- length = strlen(line); +- if ((length > 0) && (line[length-1] == '\n')) { +- line[length-1] = '\0'; +- length--; +- } +- if (length == 0) continue; +- +- /* Make room for names if needed */ +- while (nfiles >= array_size-1) { +- array_size += FILE_NAME_ALLOC_SIZE; +- files = realloc(files, sizeof(*files) * array_size); +- if (files == NULL) { +- (void) fprintf(stderr, "Error allocating memory\n"); +- return NULL; +- } +- } +- +- /* Save the name, making sure that the list is NULL-terminated */ +- files[nfiles] = strdup(line); +- if (files[nfiles] == NULL) { +- (void) fprintf(stderr, "Error allocating memory\n"); +- return NULL; +- } +- nfiles++; +- files[nfiles] = NULL; +- } +- +- /* Close the file */ +- (void) fclose(fp); +- +- /* Return the number of files */ +- *num_files = nfiles; +- +- return files; +-} +- +--- minc-2.1.00.orig/progs/mincconcat/mincconcat.c ++++ minc-2.1.00/progs/mincconcat/mincconcat.c +@@ -129,6 +129,7 @@ + #include <ParseArgv.h> + #include <time_stamp.h> + #include <voxel_loop.h> ++#include "read_file_names.h" + + /* Constants */ + #ifndef TRUE +@@ -213,7 +214,6 @@ + static int sort_function(const void *value1, const void *value2); + static void create_concat_file(int inmincid, Concat_Info *concat_info); + static void update_history(int mincid, char *arg_string); +-static char **read_file_names(char *filelist, int *num_files); + + /* Globals */ + static int Sort_ascending = TRUE; +@@ -1457,91 +1457,3 @@ + free(string); + + } +- +-/* ----------------------------- MNI Header ----------------------------------- +-@NAME : read_file_names +-@INPUT : filelist - name of file from which to read names +-@OUTPUT : num_files - number of files read in +-@RETURNS : Pointer to a NULL-terminated array of file names +-@DESCRIPTION: Reads in a list of file names from file filelist or stdin if +- "-" is specified. Returns NULL if an error occurs. If +- no error occurs, then a pointer to an empty array is +- returned and num_files is zero. +-@METHOD : +-@GLOBALS : +-@CALLS : +-@CREATED : March 8, 1995 (Peter Neelin) +-@MODIFIED : +----------------------------------------------------------------------------- */ +-static char **read_file_names(char *filelist, int *num_files) +-{ +-#define FILE_NAME_ALLOC_SIZE 10 +- char **files; +- int array_size; +- int nfiles; +- FILE *fp; +- char line[PATH_MAX+1]; +- int length; +- +- /* Open the file */ +- if (strcmp(filelist, "-") == 0) { +- fp = stdin; +- } +- else { +- fp = fopen(filelist, "r"); +- if (fp == NULL) { +- (void) fprintf(stderr, "Error opening file \"%s\"\n", filelist); +- return NULL; +- } +- } +- +- /* Allocate an initial array and NULL-terminate it */ +- array_size = FILE_NAME_ALLOC_SIZE; +- files = malloc(sizeof(*files) * array_size); +- if (files == NULL) { +- (void) fprintf(stderr, "Error allocating memory\n"); +- return NULL; +- } +- nfiles = 0; +- files[nfiles] = NULL; +- +- /* Read in file names */ +- while (fgets(line, sizeof(line)/sizeof(line[0]), fp) != NULL) { +- +- /* Remove a trailing newline and check that there is a name */ +- length = strlen(line); +- if ((length > 0) && (line[length-1] == '\n')) { +- line[length-1] = '\0'; +- length--; +- } +- if (length == 0) continue; +- +- /* Make room for names if needed */ +- while (nfiles >= array_size-1) { +- array_size += FILE_NAME_ALLOC_SIZE; +- files = realloc(files, sizeof(*files) * array_size); +- if (files == NULL) { +- (void) fprintf(stderr, "Error allocating memory\n"); +- return NULL; +- } +- } +- +- /* Save the name, making sure that the list is NULL-terminated */ +- files[nfiles] = strdup(line); +- if (files[nfiles] == NULL) { +- (void) fprintf(stderr, "Error allocating memory\n"); +- return NULL; +- } +- nfiles++; +- files[nfiles] = NULL; +- } +- +- /* Close the file */ +- (void) fclose(fp); +- +- /* Return the number of files */ +- *num_files = nfiles; +- +- return files; +-} +- +--- minc-2.1.00.orig/progs/mincmath/mincmath.c ++++ minc-2.1.00/progs/mincmath/mincmath.c +@@ -123,6 +123,7 @@ + #include <ParseArgv.h> + #include <time_stamp.h> + #include <voxel_loop.h> ++#include "read_file_names.h" + + /* Constants */ + +@@ -219,7 +220,6 @@ + int output_num_buffers, int output_vector_length, + double *output_data[], + Loop_Info *loop_info); +-static char **read_file_names(char *filelist, int *num_files); + + /* Argument variables */ + static int clobber = FALSE; +@@ -929,91 +929,3 @@ + + return; + } +- +-/* ----------------------------- MNI Header ----------------------------------- +-@NAME : read_file_names +-@INPUT : filelist - name of file from which to read names +-@OUTPUT : num_files - number of files read in +-@RETURNS : Pointer to a NULL-terminated array of file names +-@DESCRIPTION: Reads in a list of file names from file filelist or stdin if +- "-" is specified. Returns NULL if an error occurs. If +- no error occurs, then a pointer to an empty array is +- returned and num_files is zero. +-@METHOD : +-@GLOBALS : +-@CALLS : +-@CREATED : March 8, 1995 (Peter Neelin) +-@MODIFIED : +----------------------------------------------------------------------------- */ +-static char **read_file_names(char *filelist, int *num_files) +-{ +-#define FILE_NAME_ALLOC_SIZE 10 +- char **files; +- int array_size; +- int nfiles; +- FILE *fp; +- char line[PATH_MAX+1]; +- int length; +- +- /* Open the file */ +- if (strcmp(filelist, "-") == 0) { +- fp = stdin; +- } +- else { +- fp = fopen(filelist, "r"); +- if (fp == NULL) { +- (void) fprintf(stderr, "Error opening file \"%s\"\n", filelist); +- return NULL; +- } +- } +- +- /* Allocate an initial array and NULL-terminate it */ +- array_size = FILE_NAME_ALLOC_SIZE; +- files = malloc(sizeof(*files) * array_size); +- if (files == NULL) { +- (void) fprintf(stderr, "Error allocating memory\n"); +- return NULL; +- } +- nfiles = 0; +- files[nfiles] = NULL; +- +- /* Read in file names */ +- while (fgets(line, sizeof(line)/sizeof(line[0]), fp) != NULL) { +- +- /* Remove a trailing newline and check that there is a name */ +- length = strlen(line); +- if ((length > 0) && (line[length-1] == '\n')) { +- line[length-1] = '\0'; +- length--; +- } +- if (length == 0) continue; +- +- /* Make room for names if needed */ +- while (nfiles >= array_size-1) { +- array_size += FILE_NAME_ALLOC_SIZE; +- files = realloc(files, sizeof(*files) * array_size); +- if (files == NULL) { +- (void) fprintf(stderr, "Error allocating memory\n"); +- return NULL; +- } +- } +- +- /* Save the name, making sure that the list is NULL-terminated */ +- files[nfiles] = strdup(line); +- if (files[nfiles] == NULL) { +- (void) fprintf(stderr, "Error allocating memory\n"); +- return NULL; +- } +- nfiles++; +- files[nfiles] = NULL; +- } +- +- /* Close the file */ +- (void) fclose(fp); +- +- /* Return the number of files */ +- *num_files = nfiles; +- +- return files; +-} +- Modified: trunk/packages/minc/trunk/debian/patches/series =================================================================== --- trunk/packages/minc/trunk/debian/patches/series 2012-02-20 20:42:07 UTC (rev 9731) +++ trunk/packages/minc/trunk/debian/patches/series 2012-02-20 21:04:34 UTC (rev 9732) @@ -1,4 +1,4 @@ 01_mincedit-sensible-viewer.diff 03_mincview.diff decompress-whole-file.diff -mincaverage-pathmax.patch +read_file_names-refactor.patch Modified: trunk/packages/minc/trunk/debian/rules =================================================================== --- trunk/packages/minc/trunk/debian/rules 2012-02-20 20:42:07 UTC (rev 9731) +++ trunk/packages/minc/trunk/debian/rules 2012-02-20 21:04:34 UTC (rev 9732) @@ -21,8 +21,13 @@ override_dh_auto_configure: + dh_autoreconf dh_auto_configure -- $(DEB_CONFIGURE_EXTRA_FLAGS) +override_dh_auto_clean: + dh_autoreconf_clean + dh_auto_clean + ps_docs = doc/prog_ref.ps doc/prog_guide.ps volume_io/Documentation/volume_io.ps doc/prog_ref.ps doc/prog_guide.ps: _______________________________________________ debian-med-commit mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-med-commit
