diff --git a/AUTHORS b/AUTHORS index 9d55a3e01..3ff3338b6 100644 --- a/AUTHORS +++ b/AUTHORS @@ -87,6 +87,7 @@ The following submitted code, packages or analysis, and deserve special thanks: YBSAR Tullio Facchinetti Thomas Sullivan + Martin Natano Thanks to the following, who submitted detailed bug reports and excellent suggestions: @@ -177,4 +178,3 @@ suggestions: alparo Roy Zuo Friedrich Heusler - natano diff --git a/CMakeLists.txt b/CMakeLists.txt index b019b0a42..c1ab3b5e8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -94,29 +94,27 @@ check_struct_has_member ("struct stat" st_birthtime "sys/types.h;sys/stat.h" HAV message ("-- Looking for libuuid") if (DARWIN) # Apple includes the uuid functions in their libc, rather than libuuid - set (HAVE_UUID true) check_function_exists (uuid_unparse_lower HAVE_UUID_UNPARSE_LOWER) else (DARWIN) find_path (UUID_INCLUDE_DIR uuid/uuid.h) find_library (UUID_LIBRARY NAMES uuid) if (UUID_INCLUDE_DIR AND UUID_LIBRARY) - set (HAVE_UUID true) set (TASK_INCLUDE_DIRS ${TASK_INCLUDE_DIRS} ${UUID_INCLUDE_DIR}) set (TASK_LIBRARIES ${TASK_LIBRARIES} ${UUID_LIBRARY}) # Look for uuid_unparse_lower set (CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${UUID_INCLUDE_DIR}) set (CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${UUID_LIBRARY}) check_function_exists (uuid_unparse_lower HAVE_UUID_UNPARSE_LOWER) + else (UUID_INCLUDE_DIR AND UUID_LIBRARY) + message (FATAL_ERROR "-- libuuid not found.") endif (UUID_INCLUDE_DIR AND UUID_LIBRARY) endif (DARWIN) -if (HAVE_UUID AND HAVE_UUID_UNPARSE_LOWER) +if (HAVE_UUID_UNPARSE_LOWER) message ("-- Found libuuid") -elseif (HAVE_UUID AND NOT HAVE_UUID_UNPARSE_LOWER) +else (HAVE_UUID_UNPARSE_LOWER) message ("-- Found libuuid, using internal uuid_unparse_lower") -else (HAVE_UUID AND HAVE_UUID_UNPARSE_LOWER) - message ("-- libuuid not found, using internal uuid") -endif (HAVE_UUID AND HAVE_UUID_UNPARSE_LOWER) +endif (HAVE_UUID_UNPARSE_LOWER) # Set the package language. if (LANGUAGE) diff --git a/ChangeLog b/ChangeLog index 6cb6df701..2dff3c10d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -32,6 +32,7 @@ Features that are not yet modified. + ColPriority.cpp - Migration of column modification code out of Task.cpp and into the individual column object. + + Now requires libuuid (thanks to Martin Natano). Bugs + #1196 Now builds on Hurd (thanks to Jakub Wilk). diff --git a/NEWS b/NEWS index 7b6555cbd..ecc78d3ce 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,7 @@ New Features in taskwarrior 2.3.0 - The 'dateformat' settings now default to the ISO-8601 standard of 'Y-M-D'. - Italian translation. - UDA fields now allow default values. + - Now requires libuuid. New commands in taskwarrior 2.3.0 diff --git a/cmake.h.in b/cmake.h.in index e6188b84a..2d6dc7d8e 100644 --- a/cmake.h.in +++ b/cmake.h.in @@ -70,8 +70,7 @@ /* Found get_current_dir_name */ #cmakedefine HAVE_GET_CURRENT_DIR_NAME -/* Found the uuid library */ -#cmakedefine HAVE_UUID +/* Found uuid_unparse_lower in the uuid library */ #cmakedefine HAVE_UUID_UNPARSE_LOWER /* Undefine this to eliminate the execute command */ diff --git a/src/commands/CmdDiagnostics.cpp b/src/commands/CmdDiagnostics.cpp index ef33c2081..68a04b6c0 100644 --- a/src/commands/CmdDiagnostics.cpp +++ b/src/commands/CmdDiagnostics.cpp @@ -161,12 +161,6 @@ int CmdDiagnostics::execute (std::string& output) << " -random" #endif -#ifdef HAVE_UUID - << " +uuid" -#else - << " -uuid" -#endif - #ifdef HAVE_LIBGNUTLS << " +tls" #else @@ -175,12 +169,10 @@ int CmdDiagnostics::execute (std::string& output) << "\n"; out << " libuuid: " -#if defined (HAVE_UUID) and defined (HAVE_UUID_UNPARSE_LOWER) +#ifdef HAVE_UUID_UNPARSE_LOWER << "libuuid + uuid_unparse_lower" -#elif defined (HAVE_UUID) and !defined (HAVE_UUID_UNPARSE_LOWER) - << "libuuid, no uuid_unparse_lower" #else - << "n/a" + << "libuuid, no uuid_unparse_lower" #endif << "\n"; diff --git a/src/util.cpp b/src/util.cpp index f7b9fe073..a0b148c20 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -230,8 +230,6 @@ int autoComplete ( } //////////////////////////////////////////////////////////////////////////////// -#ifdef HAVE_UUID - #ifndef HAVE_UUID_UNPARSE_LOWER // Older versions of libuuid don't have uuid_unparse_lower(), only uuid_unparse() void uuid_unparse_lower (uuid_t uu, char *out) @@ -256,33 +254,6 @@ const std::string uuid () return std::string (buffer); } -//////////////////////////////////////////////////////////////////////////////// -#else - -#ifdef HAVE_RANDOM -#define rand() random() -#endif - -//////////////////////////////////////////////////////////////////////////////// -const std::string uuid () -{ - uint32_t time_low = ((rand () << 16) & 0xffff0000) | (rand () & 0xffff); - uint16_t time_mid = rand () & 0xffff; - uint16_t time_high_and_version = (rand () & 0x0fff) | 0x4000; - uint16_t clock_seq = (rand () & 0x3fff) | 0x8000; - uint8_t node [6]; - for (size_t i = 0; i < 6; i++) - node[i] = rand() & 0xff; - - char buffer[37]; - sprintf(buffer, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", - time_low, time_mid, time_high_and_version, clock_seq >> 8, clock_seq & 0xff, - node[0], node[1], node[2], node[3], node[4], node[5]); - - return std::string (buffer); -} -#endif - //////////////////////////////////////////////////////////////////////////////// // On Solaris no flock function exists. #ifdef SOLARIS diff --git a/src/util.h b/src/util.h index ac114feb0..fefd4e794 100644 --- a/src/util.h +++ b/src/util.h @@ -34,9 +34,7 @@ #include #include -#ifdef HAVE_UUID #include -#endif // util.cpp bool confirm (const std::string&); @@ -46,7 +44,7 @@ void delay (float); std::string formatBytes (size_t); int autoComplete (const std::string&, const std::vector&, std::vector&, int minimum = 1); -#if defined(HAVE_UUID) && !defined(HAVE_UUID_UNPARSE_LOWER) +#ifndef HAVE_UUID_UNPARSE_LOWER void uuid_unparse_lower (uuid_t uu, char *out); #endif const std::string uuid ();