mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-24 08:56:43 +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
|
YBSAR
|
||||||
Tullio Facchinetti
|
Tullio Facchinetti
|
||||||
Thomas Sullivan
|
Thomas Sullivan
|
||||||
|
Martin Natano
|
||||||
|
|
||||||
Thanks to the following, who submitted detailed bug reports and excellent
|
Thanks to the following, who submitted detailed bug reports and excellent
|
||||||
suggestions:
|
suggestions:
|
||||||
|
@ -177,4 +178,3 @@ suggestions:
|
||||||
alparo
|
alparo
|
||||||
Roy Zuo
|
Roy Zuo
|
||||||
Friedrich Heusler
|
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")
|
message ("-- Looking for libuuid")
|
||||||
if (DARWIN)
|
if (DARWIN)
|
||||||
# Apple includes the uuid functions in their libc, rather than libuuid
|
# 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)
|
check_function_exists (uuid_unparse_lower HAVE_UUID_UNPARSE_LOWER)
|
||||||
else (DARWIN)
|
else (DARWIN)
|
||||||
find_path (UUID_INCLUDE_DIR uuid/uuid.h)
|
find_path (UUID_INCLUDE_DIR uuid/uuid.h)
|
||||||
find_library (UUID_LIBRARY NAMES uuid)
|
find_library (UUID_LIBRARY NAMES uuid)
|
||||||
if (UUID_INCLUDE_DIR AND UUID_LIBRARY)
|
if (UUID_INCLUDE_DIR AND UUID_LIBRARY)
|
||||||
set (HAVE_UUID true)
|
|
||||||
set (TASK_INCLUDE_DIRS ${TASK_INCLUDE_DIRS} ${UUID_INCLUDE_DIR})
|
set (TASK_INCLUDE_DIRS ${TASK_INCLUDE_DIRS} ${UUID_INCLUDE_DIR})
|
||||||
set (TASK_LIBRARIES ${TASK_LIBRARIES} ${UUID_LIBRARY})
|
set (TASK_LIBRARIES ${TASK_LIBRARIES} ${UUID_LIBRARY})
|
||||||
# Look for uuid_unparse_lower
|
# Look for uuid_unparse_lower
|
||||||
set (CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${UUID_INCLUDE_DIR})
|
set (CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${UUID_INCLUDE_DIR})
|
||||||
set (CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${UUID_LIBRARY})
|
set (CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${UUID_LIBRARY})
|
||||||
check_function_exists (uuid_unparse_lower HAVE_UUID_UNPARSE_LOWER)
|
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 (UUID_INCLUDE_DIR AND UUID_LIBRARY)
|
||||||
endif (DARWIN)
|
endif (DARWIN)
|
||||||
|
|
||||||
if (HAVE_UUID AND HAVE_UUID_UNPARSE_LOWER)
|
if (HAVE_UUID_UNPARSE_LOWER)
|
||||||
message ("-- Found libuuid")
|
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")
|
message ("-- Found libuuid, using internal uuid_unparse_lower")
|
||||||
else (HAVE_UUID AND HAVE_UUID_UNPARSE_LOWER)
|
endif (HAVE_UUID_UNPARSE_LOWER)
|
||||||
message ("-- libuuid not found, using internal uuid")
|
|
||||||
endif (HAVE_UUID AND HAVE_UUID_UNPARSE_LOWER)
|
|
||||||
|
|
||||||
# Set the package language.
|
# Set the package language.
|
||||||
if (LANGUAGE)
|
if (LANGUAGE)
|
||||||
|
|
|
@ -32,6 +32,7 @@ Features
|
||||||
that are not yet modified.
|
that are not yet modified.
|
||||||
+ ColPriority.cpp - Migration of column modification code out of Task.cpp and
|
+ ColPriority.cpp - Migration of column modification code out of Task.cpp and
|
||||||
into the individual column object.
|
into the individual column object.
|
||||||
|
+ Now requires libuuid (thanks to Martin Natano).
|
||||||
|
|
||||||
Bugs
|
Bugs
|
||||||
+ #1196 Now builds on Hurd (thanks to Jakub Wilk).
|
+ #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'.
|
- The 'dateformat' settings now default to the ISO-8601 standard of 'Y-M-D'.
|
||||||
- Italian translation.
|
- Italian translation.
|
||||||
- UDA fields now allow default values.
|
- UDA fields now allow default values.
|
||||||
|
- Now requires libuuid.
|
||||||
|
|
||||||
New commands in taskwarrior 2.3.0
|
New commands in taskwarrior 2.3.0
|
||||||
|
|
||||||
|
|
|
@ -70,8 +70,7 @@
|
||||||
/* Found get_current_dir_name */
|
/* Found get_current_dir_name */
|
||||||
#cmakedefine HAVE_GET_CURRENT_DIR_NAME
|
#cmakedefine HAVE_GET_CURRENT_DIR_NAME
|
||||||
|
|
||||||
/* Found the uuid library */
|
/* Found uuid_unparse_lower in the uuid library */
|
||||||
#cmakedefine HAVE_UUID
|
|
||||||
#cmakedefine HAVE_UUID_UNPARSE_LOWER
|
#cmakedefine HAVE_UUID_UNPARSE_LOWER
|
||||||
|
|
||||||
/* Undefine this to eliminate the execute command */
|
/* Undefine this to eliminate the execute command */
|
||||||
|
|
|
@ -161,12 +161,6 @@ int CmdDiagnostics::execute (std::string& output)
|
||||||
<< " -random"
|
<< " -random"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_UUID
|
|
||||||
<< " +uuid"
|
|
||||||
#else
|
|
||||||
<< " -uuid"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef HAVE_LIBGNUTLS
|
#ifdef HAVE_LIBGNUTLS
|
||||||
<< " +tls"
|
<< " +tls"
|
||||||
#else
|
#else
|
||||||
|
@ -175,12 +169,10 @@ int CmdDiagnostics::execute (std::string& output)
|
||||||
<< "\n";
|
<< "\n";
|
||||||
|
|
||||||
out << " libuuid: "
|
out << " libuuid: "
|
||||||
#if defined (HAVE_UUID) and defined (HAVE_UUID_UNPARSE_LOWER)
|
#ifdef HAVE_UUID_UNPARSE_LOWER
|
||||||
<< "libuuid + uuid_unparse_lower"
|
<< "libuuid + uuid_unparse_lower"
|
||||||
#elif defined (HAVE_UUID) and !defined (HAVE_UUID_UNPARSE_LOWER)
|
|
||||||
<< "libuuid, no uuid_unparse_lower"
|
|
||||||
#else
|
#else
|
||||||
<< "n/a"
|
<< "libuuid, no uuid_unparse_lower"
|
||||||
#endif
|
#endif
|
||||||
<< "\n";
|
<< "\n";
|
||||||
|
|
||||||
|
|
29
src/util.cpp
29
src/util.cpp
|
@ -230,8 +230,6 @@ int autoComplete (
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
#ifdef HAVE_UUID
|
|
||||||
|
|
||||||
#ifndef HAVE_UUID_UNPARSE_LOWER
|
#ifndef HAVE_UUID_UNPARSE_LOWER
|
||||||
// Older versions of libuuid don't have uuid_unparse_lower(), only uuid_unparse()
|
// Older versions of libuuid don't have uuid_unparse_lower(), only uuid_unparse()
|
||||||
void uuid_unparse_lower (uuid_t uu, char *out)
|
void uuid_unparse_lower (uuid_t uu, char *out)
|
||||||
|
@ -256,33 +254,6 @@ const std::string uuid ()
|
||||||
return std::string (buffer);
|
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.
|
// On Solaris no flock function exists.
|
||||||
#ifdef SOLARIS
|
#ifdef SOLARIS
|
||||||
|
|
|
@ -34,9 +34,7 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <Task.h>
|
#include <Task.h>
|
||||||
|
|
||||||
#ifdef HAVE_UUID
|
|
||||||
#include <uuid/uuid.h>
|
#include <uuid/uuid.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
// util.cpp
|
// util.cpp
|
||||||
bool confirm (const std::string&);
|
bool confirm (const std::string&);
|
||||||
|
@ -46,7 +44,7 @@ void delay (float);
|
||||||
std::string formatBytes (size_t);
|
std::string formatBytes (size_t);
|
||||||
int autoComplete (const std::string&, const std::vector<std::string>&, std::vector<std::string>&, int minimum = 1);
|
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);
|
void uuid_unparse_lower (uuid_t uu, char *out);
|
||||||
#endif
|
#endif
|
||||||
const std::string uuid ();
|
const std::string uuid ();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue