From 3b1d0aecec2136fad61c67f1cf914081862a73a7 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Mon, 16 Sep 2024 12:28:38 +0200 Subject: [PATCH] MT#61074 Unify UUID generation to libuuid-perl new API Instead of using two different modules to generate UUIDs and GUIDs, use a single implementation, which we use uniformly in all of our codebase, so that we can drop this from our dependency tree. Switch to use the new API, which simplifies the code. (cherry picked from commit 24a0a76c1e73b6e1da693202992678fed1a1a7dc) (cherry picked from commit 3109dacda1e50674252f521f6843999ee4358d6d) Change-Id: I5647ce08438f747dec78c05c52fcea002cb0397c --- Build.PL | 1 - debian/control | 2 -- lib/NGCP/BulkProcessor/Utils.pm | 12 ++---------- 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/Build.PL b/Build.PL index 912d1404..d092cf7a 100644 --- a/Build.PL +++ b/Build.PL @@ -34,7 +34,6 @@ my $builder = Module::Build->new( 'DBI' => '1.608', 'Data::Dump' => 0, 'Data::Rmap' => 0, - 'Data::UUID' => 0, 'Data::Validate::IP' => 0, 'Date::Calc' => 0, 'Date::Manip' => 0, diff --git a/debian/control b/debian/control index c0fa34dd..5d2470a6 100644 --- a/debian/control +++ b/debian/control @@ -5,7 +5,6 @@ Maintainer: Sipwise Development Team Rules-Requires-Root: binary-targets Build-Depends: debhelper-compat (= 13), - libdata-uuid-perl , libdata-validate-ip-perl , libdate-calc-perl , libdate-manip-perl , @@ -23,7 +22,6 @@ Depends: libconfig-any-perl, libdata-dump-perl, libdata-rmap-perl, - libdata-uuid-perl, libdata-validate-ip-perl, libdate-calc-perl, libdate-manip-perl, diff --git a/lib/NGCP/BulkProcessor/Utils.pm b/lib/NGCP/BulkProcessor/Utils.pm index 9a6fe6a1..58545b59 100644 --- a/lib/NGCP/BulkProcessor/Utils.pm +++ b/lib/NGCP/BulkProcessor/Utils.pm @@ -11,7 +11,6 @@ setlocale(LC_NUMERIC, 'C'); use List::Util qw(max min); -use Data::UUID qw(); use UUID qw(); use Data::Validate::IP qw(is_ipv4 is_ipv6); @@ -404,18 +403,11 @@ sub wrap_text { } sub create_guid { - - my $ug = Data::UUID->new(); - my $uuid = $ug->create(); - return $ug->to_string( $uuid ); - + return uc UUID::uuid(); } sub create_uuid { - my ($bin, $str); - UUID::generate($bin); - UUID::unparse($bin, $str); - return $str; + return UUID::uuid(); } sub urlencode {