mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
require libuuid
- require libuuid at build time and remove insufficiently seeded replacement for uuid()
This commit is contained in:
parent
779e32540a
commit
fcfd50bd25
8 changed files with 12 additions and 52 deletions
2
AUTHORS
2
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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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).
|
||||
|
|
1
NEWS
1
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
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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";
|
||||
|
||||
|
|
29
src/util.cpp
29
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
|
||||
|
|
|
@ -34,9 +34,7 @@
|
|||
#include <sys/types.h>
|
||||
#include <Task.h>
|
||||
|
||||
#ifdef HAVE_UUID
|
||||
#include <uuid/uuid.h>
|
||||
#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::string>&, std::vector<std::string>&, 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 ();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue