Skip to content

Commit 484d53c

Browse files
authored
Merge pull request #471 from PCMDI/458_switch_from_ossuuid_to_libuuid
458 switch from ossuuid to libuuid
2 parents 4520699 + 8f4d121 commit 484d53c

File tree

6 files changed

+24
-32
lines changed

6 files changed

+24
-32
lines changed

.circleci/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ aliases:
2222
conda config --set always_yes yes --set changeps1 no
2323
conda update -y -q conda
2424
conda config --set anaconda_upload no
25-
conda create -q -n py$PYTHON_VERSION -c cdat/label/nightly -c conda-forge -c cdat ossuuid udunits2 hdf5 libnetcdf numpy openssl lazy-object-proxy cdms2 python=$PYTHON_VERSION $CONDA_COMPILERS testsrunner
25+
conda create -q -n py$PYTHON_VERSION -c cdat/label/nightly -c conda-forge -c cdat libuuid udunits2 hdf5 libnetcdf numpy openssl lazy-object-proxy cdms2 python=$PYTHON_VERSION $CONDA_COMPILERS testsrunner
2626
2727
- &setup_cmor
2828
name: setup_cmor

.travis.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ before_install:
3131
- conda update -y -q conda
3232
- if [[ $TRAVIS_OS_NAME == "linux" ]]; then export CONDA_COMPILERS="gcc_linux-64 gfortran_linux-64"; fi
3333
- if [[ $TRAVIS_OS_NAME == "osx" ]]; then export CONDA_COMPILERS="clang_osx-64 gfortran_osx-64"; fi
34-
- if [[ $CMOR_PYTHON_VERSION == '2.7' ]]; then conda create -q -n py2.7 -c cdat/label/nightly -c conda-forge -c cdat ossuuid udunits2 hdf5 libnetcdf numpy openssl lazy-object-proxy cdms2 python=2.7 $CONDA_COMPILERS testsrunner; fi
35-
- if [[ $CMOR_PYTHON_VERSION == '3.6' ]]; then conda create -q -n py3.6 -c cdat/label/nightly -c conda-forge -c cdat ossuuid udunits2 hdf5 libnetcdf numpy openssl lazy-object-proxy cdms2 python=3.6 $CONDA_COMPILERS testsrunner; fi
36-
- if [[ $CMOR_PYTHON_VERSION == '3.7' ]]; then conda create -q -n py3.7 -c cdat/label/nightly -c conda-forge -c cdat ossuuid udunits2 hdf5 libnetcdf numpy openssl lazy-object-proxy cdms2 python=3.7 $CONDA_COMPILERS testsrunner; fi
34+
- if [[ $CMOR_PYTHON_VERSION == '2.7' ]]; then conda create -q -n py2.7 -c cdat/label/nightly -c conda-forge -c cdat libuuid udunits2 hdf5 libnetcdf numpy openssl lazy-object-proxy cdms2 python=2.7 $CONDA_COMPILERS testsrunner; fi
35+
- if [[ $CMOR_PYTHON_VERSION == '3.6' ]]; then conda create -q -n py3.6 -c cdat/label/nightly -c conda-forge -c cdat libuuid udunits2 hdf5 libnetcdf numpy openssl lazy-object-proxy cdms2 python=3.6 $CONDA_COMPILERS testsrunner; fi
36+
- if [[ $CMOR_PYTHON_VERSION == '3.7' ]]; then conda create -q -n py3.7 -c cdat/label/nightly -c conda-forge -c cdat libuuid udunits2 hdf5 libnetcdf numpy openssl lazy-object-proxy cdms2 python=3.7 $CONDA_COMPILERS testsrunner; fi
3737
- if [[ $CMOR_PYTHON_VERSION == '2.7' ]]; then source activate py2.7; fi
3838
- if [[ $CMOR_PYTHON_VERSION == '3.6' ]]; then source activate py3.6; fi
3939
- if [[ $CMOR_PYTHON_VERSION == '3.7' ]]; then source activate py3.7; fi

Src/cmor.c

+7-15
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include <stdio.h>
22
#include <stdlib.h>
33
#include <sys/stat.h>
4-
#include "uuid.h"
4+
#include <uuid/uuid.h>
55
#include <unistd.h>
66
#include <string.h>
77
#include "json.h"
@@ -3089,43 +3089,35 @@ int cmor_attNameCmp(const void *v1, const void *v2)
30893089
/************************************************************************/
30903090
void cmor_generate_uuid()
30913091
{
3092-
uuid_t *myuuid;
3093-
uuid_fmt_t fmt;
3094-
void *myuuid_str = NULL;
3095-
size_t uuidlen;
3092+
uuid_t myuuid;
3093+
char myuuid_str[37]; // 36 characters + '\0'
30963094
char value[CMOR_MAX_STRING];
30973095

30983096
cmor_add_traceback("cmor_generate_uuid");
30993097

31003098
/* -------------------------------------------------------------------- */
31013099
/* generates a new unique id */
31023100
/* -------------------------------------------------------------------- */
3103-
uuid_create(&myuuid);
3104-
uuid_make(myuuid, 4);
3105-
3106-
myuuid_str = NULL;
3107-
fmt = UUID_FMT_STR;
3101+
uuid_generate(myuuid);
31083102

31093103
/* -------------------------------------------------------------------- */
31103104
/* Write tracking_id and tracking_prefix */
31113105
/* -------------------------------------------------------------------- */
3112-
uuid_export(myuuid, fmt, &myuuid_str, &uuidlen);
3106+
uuid_unparse(myuuid, myuuid_str);
31133107

31143108
if (cmor_has_cur_dataset_attribute(GLOBAL_ATT_TRACKING_PREFIX) == 0) {
31153109
cmor_get_cur_dataset_attribute(GLOBAL_ATT_TRACKING_PREFIX, value);
31163110

31173111
strncpy(cmor_current_dataset.tracking_id, value, CMOR_MAX_STRING);
31183112
strcat(cmor_current_dataset.tracking_id, "/");
3119-
strcat(cmor_current_dataset.tracking_id, (char *)myuuid_str);
3113+
strcat(cmor_current_dataset.tracking_id, myuuid_str);
31203114
} else {
3121-
strncpy(cmor_current_dataset.tracking_id, (char *)myuuid_str,
3115+
strncpy(cmor_current_dataset.tracking_id, myuuid_str,
31223116
CMOR_MAX_STRING);
31233117
}
31243118
cmor_set_cur_dataset_attribute_internal(GLOBAL_ATT_TRACKING_ID,
31253119
cmor_current_dataset.tracking_id,
31263120
0);
3127-
free(myuuid_str);
3128-
uuid_destroy(myuuid);
31293121
cmor_pop_traceback();
31303122

31313123
}

configure

+10-10
Original file line numberDiff line numberDiff line change
@@ -4033,9 +4033,9 @@ else
40334033
UUIDFLAGS=""
40344034
fi
40354035

4036-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uuid_create in -luuid" >&5
4037-
$as_echo_n "checking for uuid_create in -luuid... " >&6; }
4038-
if ${ac_cv_lib_uuid_uuid_create+:} false; then :
4036+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for uuid_generate in -luuid" >&5
4037+
$as_echo_n "checking for uuid_generate in -luuid... " >&6; }
4038+
if ${ac_cv_lib_uuid_uuid_generate+:} false; then :
40394039
$as_echo_n "(cached) " >&6
40404040
else
40414041
ac_check_lib_save_LIBS=$LIBS
@@ -4049,27 +4049,27 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
40494049
#ifdef __cplusplus
40504050
extern "C"
40514051
#endif
4052-
char uuid_create ();
4052+
char uuid_generate ();
40534053
int
40544054
main ()
40554055
{
4056-
return uuid_create ();
4056+
return uuid_generate ();
40574057
;
40584058
return 0;
40594059
}
40604060
_ACEOF
40614061
if ac_fn_c_try_link "$LINENO"; then :
4062-
ac_cv_lib_uuid_uuid_create=yes
4062+
ac_cv_lib_uuid_uuid_generate=yes
40634063
else
4064-
ac_cv_lib_uuid_uuid_create=no
4064+
ac_cv_lib_uuid_uuid_generate=no
40654065
fi
40664066
rm -f core conftest.err conftest.$ac_objext \
40674067
conftest$ac_exeext conftest.$ac_ext
40684068
LIBS=$ac_check_lib_save_LIBS
40694069
fi
4070-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_uuid_uuid_create" >&5
4071-
$as_echo "$ac_cv_lib_uuid_uuid_create" >&6; }
4072-
if test "x$ac_cv_lib_uuid_uuid_create" = xyes; then :
4070+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_uuid_uuid_generate" >&5
4071+
$as_echo "$ac_cv_lib_uuid_uuid_generate" >&6; }
4072+
if test "x$ac_cv_lib_uuid_uuid_generate" = xyes; then :
40734073
cat >>confdefs.h <<_ACEOF
40744074
#define HAVE_LIBUUID 1
40754075
_ACEOF

configure.ac

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ else
185185
UUIDLDFLAGS="-luuid"
186186
UUIDFLAGS=""
187187
fi
188-
AC_CHECK_LIB([uuid],[uuid_create],[],[AC_ERROR([Could not get a working uuid])],[ ${UUIDFLAGS} ${UUIDLDFLAGS} ])
188+
AC_CHECK_LIB([uuid],[uuid_generate],[],[AC_ERROR([Could not get a working uuid])],[ ${UUIDFLAGS} ${UUIDLDFLAGS} ])
189189

190190
LIBS=""
191191
AC_ARG_WITH([udunits2],[AS_HELP_STRING([--with-udunits2],[enable support for udunits2 in none standard location])],[],[with_udunits2="no"])

recipes/cmor/meta.yaml.in

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ requirements:
2121
- {{ compiler("fortran") }}
2222
host:
2323
- python {{ python }}
24-
- ossuuid 1.6.2
24+
- libuuid
2525
- udunits2
2626
- six
2727
- hdf5
@@ -31,7 +31,7 @@ requirements:
3131
- cdms2
3232
run:
3333
- python {{ python }}
34-
- ossuuid 1.6.2
34+
- libuuid
3535
- udunits2
3636
- six
3737
- {{ pin_compatible('numpy') }}

0 commit comments

Comments
 (0)