Git Product home page Git Product logo

ada-util's People

Contributors

adezxc avatar damdc91 avatar dependabot[bot] avatar jquorning avatar stcarrez avatar vpodzime avatar yrashk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ada-util's Issues

aws-client-ext__2.adb fails to compile

Mac OSX 10.13.6
Xcode 10.1
These are the latest OS versions that can be installed on my MacBook Air.
As I am getting messages when trying to build one of my projects that ada-utils sources were compiled with a different compiler version to my project files, I tried to rebuild ada-utils with
./configure
make
but the build failed at:

gprbuild -m -q -p -Putilada_aws.gpr -XHARDWARE_PLATFORM=x86_64 -XBUILD=distrib -XPROCESSORS=4 -XUTIL_LIBRARY_TYPE=static
aws-client-ext__2.adb:37:09: warning: unit "AWS.Utils" is not referenced [-gnatwu]
aws-client-ext__2.adb:239:23: error: "Open_Set_Common_Header" not declared in "HTTP_Utils"
aws-client-ext__2.adb:245:26: error: "Set_Header" not declared in "HTTP_Utils"
aws-client-ext__2.adb:252:49: error: no selector "F_Headers" for type "HTTP_Connection" defined at aws-client.ads:604
aws-client-ext.ads:33:06: warning: unnecessary with of ancestor [-gnatwr]

   compilation of aws-client-ext__2.adb failed

I also tried
gprbuild -aP.alire -Putilada_aws -p
which produced the same errors.

I have previously used ada-utils successfully but recently installed a new gcc complier (gcc-12.1.0)

Update utilada and related crates on alire to latest version

Currently the latest alire crate version for utilada and friends is version 2.1.0. Not sure if this is an LTS or whatnot, but since the later releases aren't actual branches, you can't checkout (say) version 2.4.1 with alr with --branch (git complains that 2.4.1 isn't a commit or branch). I can checkout master, but that's not stable.

util-http-clients-curl.ads missing after installation

Hello,

i'm encountering a strange issue :
file "util-http-clients-curl.ads" not found "Util" is not visible

I use successfully this list of commands to install ada-util, and all worked well without error :

`git clone --recursive https://github.com/stcarrez/ada-util.git

cd ada-util
./configure --prefix=/usr

sudo make

sudo make test

sudo bin/util_harness
(1 error but i guess no connexion with my problem :
Test Util.Dates.Formats.Format - util-dates-formats-tests.adb:90: Invalid result for: %j: expecting '323' value was '322' FAIL 0.000541000s

Test Util.Dates.RFC7231.Append_Date - util-dates-formats-tests.adb:443: Invalid date conversion: expecting 'Wed, 07 Oct 2015 03:41:11 GMT' value was 'Tue, 07 Oct 2015 03:41:11 GMT' FAIL 0.000505000s)

sudo make install`

I'm working on Ada with GPS, and when i open my project, no error is raised, so ada-util seems to be well found by GPS.
Do you have any idea ?
It was working by start of july.

Allow to read stdout and stderr as separate streams when spawning a process

The Util.Processses package allows to spawn a process and read the standard output and error but the current mode merges the standard output and error together (the spawned process still gets a separate standard output and standard error file descriptors).

In some situations, we don't want such merge and must be able to distinguish and read the standard output and standard error produced by the launched process as separate streams.

Logger: add a way to filter logs

I do not find a way to filter result of logs.

For example, I want a file foo.adb to be in INFO or completely disable it, and a file bar.adb with a DEBUG severity.

Currently, all units are in DEBUG verbosity, and it is quite difficult to debug with the amount of log.

make fails on FreeBSD ala.ala 12.1-RC1

config.status: creating utilada_lzma.gpr
config.status: creating utilada_tests.gpr
/home/x/ada-util-master %make 19-10-27 1:42
make: "/fbsd2/usr/home/x/ada-util-master/Makefile" line 11: Missing dependency operator
make: "/fbsd2/usr/home/x/ada-util-master/Makefile" line 13: Need an operator

No HTTP manager is defined (even though one should be)

@stcarrez So, I'm writing a parser for the Google API Discovery Service. I'm using CURL since I don't want to have to deal with AWS's license problems, and my program builds fine. However, when running it I get:

No HTTP manager was defined

raised PROGRAM_ERROR : No HTTP manager was defined.
[./bin/discovery-main]
0x55b8c9de1e8f Util.Http.Clients.Initialize at util-http-clients.adb:226
0x55b8c9dd703b Discovery.Parser at discovery-parser.adb:23
0x55b8c9db03c7 Adainit at b__discovery-main.adb:719
0x55b8c9db042b Main at b__discovery-main.adb:750
[/usr/lib/libc.so.6]
0x7f461489d28e
0x7f461489d348
[./bin/discovery-main]
0x55b8c9daf603 _start at start.S:115
0xfffffffffffffffe

I am calling Util.HTTP.Clients.CURL.Register at the top of my code:

with Discovery.Parser;
with Util.HTTP.Clients.Curl;
procedure Discovery.Main is
begin
   Util.HTTP.Clients.Curl.Register;
   Discovery.Parser.Parse_Discovery_Document;
end Discovery.Main;

Is this a bug?

util-files.adb "Into : out unbounded_string" not initialized

The code

with Ada.Strings.Unbounded;
with Ada.Text_IO; use Ada.Text_IO;
with Util.Files;

procedure testa is
   content : Ada.Strings.Unbounded.Unbounded_String;
begin
   Util.Files.Write_File ("file1", "text1A" & ASCII.LF & "text1B");
   Util.Files.Read_File ("file1", content);
   Put_Line ("file1");
   Put_Line (Ada.Strings.Unbounded.To_String (content));
   New_Line;
   
   --  procedure Read_File (Path     : in String;
   --                      Into     : out Unbounded_String;
   --                      Max_Size : in Natural := 0);
   Put_Line ("file2");
   Util.Files.Write_File ("file2", "text2A" & ASCII.LF & "text2B");
   Util.Files.Read_File ("file2", content);
   Put_Line ("file2=" & Ada.Strings.Unbounded.To_String (content));
end testa;

The output

file1
text1A
text1B

file2
file2=text1A
text1Btext2A
text2B

Expected result

file1
text1A
text1B

file2
file2=text2A
text2B

Cause

out parameter not initialized

Solution

In procedure Read_File (util-files.adb), add Into := Null_Unbounded_String;

 procedure Read_File (Path     : in String;
                        Into     : out Unbounded_String;
                        Max_Size : in Natural := 0) is
      use Ada.Streams;
      use Ada.Streams.Stream_IO;

      F      : File_Type;
      Buffer : Stream_Element_Array (1 .. 10_000);
      Pos    : Positive_Count := 1;
      Last   : Stream_Element_Offset;
      Space  : Natural;
   begin
      Into := Null_Unbounded_String;
      if Max_Size = 0 then
         Space := Natural'Last;
      else
         Space := Max_Size;
      end if;

alr

alr with utilada

Source

https://stackoverflow.com/questions/40621326/ada-out-parameter

AdaUtils cannot be built with msys2 64bits in windows 10

Hello

I tried to build this package with msys2 (64 bits) in Windows 10. My steps is the following

  • Run msys2 bash
  • Run ./configure
  • Run make

While compilation I observe the following error
gprbuild -m -q -p -Putilada_core.gpr -XHARDWARE_PLATFORM=unknown -XMODE=distrib -XCOVERAGE=no -XPROCESSORS=4 -XUTIL_LIBRARY_TYPE=static
gprbuild -m -q -p -Putilada_base.gpr -XHARDWARE_PLATFORM=unknown -XMODE=distrib -XCOVERAGE=no -XPROCESSORS=4 -XUTIL_LIBRARY_TYPE=static
gprbuild -m -q -p -Putilada_sys.gpr -XHARDWARE_PLATFORM=unknown -XMODE=distrib -XCOVERAGE=no -XPROCESSORS=4 -XUTIL_LIBRARY_TYPE=static
util-processes-tools.adb:19:06: file "util-systems-os.ads" not found

compilation of util-processes-tools.adb failed

gprbuild: *** compilation phase failed
make: *** [Makefile:32: static] Error 4

The file util-systems-os.ads exists. The windows version can be found in
src/sys/processes/os-win32

I think that corresponded option regarding compilation under Windows 64 bits is not set.
Are there ways to set up this option correctly?

Thanks
Alexander

gnatmake: "{...}/include/utilada_base.static/util-log-loggers.adb" compilation error

I'm unable to compile the json sample (or the log sample for that matter).

For the needed ada-util dependencies I've installed the packages provided by fedora.

$ uname -s -m -p -i -o
Linux x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/os-release
NAME=Fedora
VERSION="32 (MATE-Compiz)"
ID=fedora
VERSION_ID=32
VERSION_CODENAME=""
PLATFORM_ID="platform:f32"
PRETTY_NAME="Fedora 32 (MATE-Compiz)"
ANSI_COLOR="0;34"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:32"
HOME_URL="https://fedoraproject.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f32/system-administrators-guide/"
SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=32
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=32
PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy"
VARIANT="MATE-Compiz"
VARIANT_ID=matecompiz

Here is my configure (I don't have aws installed as it needs ssl_thin, or something related):

$ ./configure --disable-aws --disable-ahven --enable-aunit --disable-utilgen --prefix=${HOME}/opt/ada-util
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for pandoc... no
checking for dynamo... no
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking for gprbuild... gprbuild
checking for gprclean... gprclean
checking for gprinstall... gprinstall
checking whether make sets $(MAKE)... yes
checking whether ln -s works... yes
checking shared library support... no
checking default library type... static
checking distribution build... yes
checking coverage support... no
checking number of processors... 8
checking preparing for GNAT project utilada_core... done
checking preparing for GNAT project utilada_base... done
checking preparing for GNAT project utilada_sys... done
checking operating system... linux
checking hardware platform... x86_64
checking whether platform supports atomic inc/dec... yes
checking specific processor support... using intrinsic
checking whether utilgen support is required... no
checking whether directories project exists... yes
checking whether xmlada_sax project exists... yes
checking XML/Ada version... 4
checking preparing for GNAT project utilada_xml... done
checking Ada LZMA Library... 
checking traceback in log exceptions... yes
checking whether AUnit support is enabled... yes
checking whether Ahven internal support is enabled... 
checking whether aunit project exists... yes
checking curl HTTP client support in Ada Util... yes
checking for curl_easy_perform in -lcurl... yes
checking preparing for GNAT project utilada_curl... done
checking AWS support is enabled... no
checking checking AWS version... none
checking using AWS http client... 1
checking for gcc bug compiling Util.Serialize.Mappers.Vector_Mappers (Bug 53737)... no
checking whether the Util.Serialize.Mappers.Vector_Mappers package must be compiled... yes
checking for additional linker options for libutilada... none
checking for additional linker options for libutilada_curl... none
checking installation of Ada source files... <prefix>/include
checking installation of Ada ALI files... <prefix>/lib
checking installation of library files... <prefix>/lib
checking installation of GNAT project files... <prefix>/lib/gnat
configure: creating ./config.status
config.status: creating Makefile.conf
config.status: creating utilada.gpr
config.status: creating utilada_http.gpr
config.status: creating utilada_unit.gpr
config.status: creating utilada_xml.gpr
config.status: creating utilada_lzma.gpr
config.status: creating utilada_tests.gpr
config.status: creating utilada_conf.gpr

Here is the make result:

$ make
gprbuild -m -q -p -Putilada_core.gpr -XHARDWARE_PLATFORM=x86_64 -XBUILD=distrib -XPROCESSORS=8 -XUTIL_LIBRARY_TYPE=static
gprbuild -m -q -p -Putilada_base.gpr -XHARDWARE_PLATFORM=x86_64 -XBUILD=distrib -XPROCESSORS=8 -XUTIL_LIBRARY_TYPE=static
gprbuild -m -q -p -Putilada_sys.gpr -XHARDWARE_PLATFORM=x86_64 -XBUILD=distrib -XPROCESSORS=8 -XUTIL_LIBRARY_TYPE=static
gprbuild -m -q -p -Putilada_xml.gpr -XHARDWARE_PLATFORM=x86_64 -XBUILD=distrib -XPROCESSORS=8 -XUTIL_LIBRARY_TYPE=static
gprbuild -m -q -p -Putilada_curl.gpr -XHARDWARE_PLATFORM=x86_64 -XBUILD=distrib -XPROCESSORS=8 -XUTIL_LIBRARY_TYPE=static
gprbuild -m -q -p -Putilada_unit.gpr -XHARDWARE_PLATFORM=x86_64 -XBUILD=distrib -XPROCESSORS=8 -XUTIL_LIBRARY_TYPE=static
gprbuild -m -q -p -Putilada_http.gpr -XHARDWARE_PLATFORM=x86_64 -XBUILD=distrib -XPROCESSORS=8 -XUTIL_LIBRARY_TYPE=static
gnatprep -DHAVE_XML=yes -DHAVE_CURL=yes \
                 -DHAVE_AWS=no \
			 -DHAVE_VECTOR_MAPPERS=yes \
                 -DHAVE_LZMA=no \
	 -DOS_VERSION='""' \
	 regtests/util-testsuite.gpb regtests/util-testsuite.adb
gprbuild -m -q -p -Ptests_proc -XHARDWARE_PLATFORM=x86_64 -XBUILD=distrib -XPROCESSORS=8
gprbuild -m -q -p -Putilada_tests -XHARDWARE_PLATFORM=x86_64 -XBUILD=distrib -XPROCESSORS=8

Here is the make install result:

$ make install | sed "s,${HOME},\${HOME},"
gprinstall --uninstall -q -f --prefix=${HOME}/opt/ada-util -XHARDWARE_PLATFORM=x86_64 -XBUILD=distrib -XPROCESSORS=8 utilada_core.gpr
make: [Makefile:33: uninstall] Error 5 (ignored)
gprinstall --uninstall -q -f --prefix=${HOME}/opt/ada-util -XHARDWARE_PLATFORM=x86_64 -XBUILD=distrib -XPROCESSORS=8 utilada_base.gpr
make: [Makefile:34: uninstall] Error 5 (ignored)
gprinstall --uninstall -q -f --prefix=${HOME}/opt/ada-util -XHARDWARE_PLATFORM=x86_64 -XBUILD=distrib -XPROCESSORS=8 utilada_sys.gpr
make: [Makefile:35: uninstall] Error 5 (ignored)
gprinstall --uninstall -q -f --prefix=${HOME}/opt/ada-util -XHARDWARE_PLATFORM=x86_64 -XBUILD=distrib -XPROCESSORS=8 utilada_xml.gpr
make: [Makefile:38: uninstall] Error 5 (ignored)
gprinstall --uninstall -q -f --prefix=${HOME}/opt/ada-util -XHARDWARE_PLATFORM=x86_64 -XBUILD=distrib -XPROCESSORS=8 utilada_curl.gpr
make: [Makefile:42: uninstall] Error 5 (ignored)
gprinstall --uninstall -q -f --prefix=${HOME}/opt/ada-util -XHARDWARE_PLATFORM=x86_64 -XBUILD=distrib -XPROCESSORS=8 utilada_unit.gpr
make: [Makefile:53: uninstall] Error 5 (ignored)
gprinstall --uninstall -q -f --prefix=${HOME}/opt/ada-util -XHARDWARE_PLATFORM=x86_64 -XBUILD=distrib -XPROCESSORS=8 utilada_http.gpr
make: [Makefile:59: uninstall] Error 5 (ignored)
gprinstall -p -f --prefix=${HOME}/opt/ada-util -XHARDWARE_PLATFORM=x86_64 -XBUILD=distrib -XPROCESSORS=8 -XUTIL_LIBRARY_TYPE=static --build-name=static utilada_core.gpr  
Install project UtilAda_Core - static
gprinstall -p -f --prefix=${HOME}/opt/ada-util -XHARDWARE_PLATFORM=x86_64 -XBUILD=distrib -XPROCESSORS=8 -XUTIL_LIBRARY_TYPE=static --build-name=static utilada_base.gpr  
Install project UtilAda_Base - static
gprinstall -p -f --prefix=${HOME}/opt/ada-util -XHARDWARE_PLATFORM=x86_64 -XBUILD=distrib -XPROCESSORS=8 -XUTIL_LIBRARY_TYPE=static --build-name=static utilada_sys.gpr  
Install project UtilAda_Sys - static
gprinstall -p -f --prefix=${HOME}/opt/ada-util -XHARDWARE_PLATFORM=x86_64 -XBUILD=distrib -XPROCESSORS=8 -XUTIL_LIBRARY_TYPE=static --build-name=static utilada_xml.gpr  
Install project UtilAda_Xml - static
gprinstall -p -f --prefix=${HOME}/opt/ada-util -XHARDWARE_PLATFORM=x86_64 -XBUILD=distrib -XPROCESSORS=8 -XUTIL_LIBRARY_TYPE=static --build-name=static utilada_curl.gpr  
Install project UtilAda_Curl - static
gprinstall -p -f --prefix=${HOME}/opt/ada-util -XHARDWARE_PLATFORM=x86_64 -XBUILD=distrib -XPROCESSORS=8 -XUTIL_LIBRARY_TYPE=static --build-name=static utilada_unit.gpr  
Install project UtilAda_Unit - static
gprinstall -p -f --prefix=${HOME}/opt/ada-util -XHARDWARE_PLATFORM=x86_64 -XBUILD=distrib -XPROCESSORS=8 -XUTIL_LIBRARY_TYPE=static --build-name=static utilada_http.gpr  
Install project UtilAda_Http - static
Environment setup:
  export ADA_PROJECT_PATH=${HOME}/opt/ada-util/:
mkdir -p ${HOME}/opt/ada-util/lib/gnat
cp utilada_http.gpr ${HOME}/opt/ada-util/lib/gnat

Here is what I get when I try to build the json sample:

$ cd sample
$ gnatmake -I${HOME}/opt/ada-util/include/utilada_{sys,core,base}.static json.adb 2>stderr.log
$ <stderr.log sed "s,${HOME},\${HOME},g"
gcc -c -I${HOME}/opt/ada-util/include/utilada_sys.static -I${HOME}/opt/ada-util/include/utilada_core.static -I${HOME}/opt/ada-util/include/utilada_base.static json.adb
gcc -c -I${HOME}/opt/ada-util/include/utilada_sys.static -I${HOME}/opt/ada-util/include/utilada_core.static -I${HOME}/opt/ada-util/include/utilada_base.static mapping.adb
gcc -c -I./ -I${HOME}/opt/ada-util/include/utilada_sys.static -I${HOME}/opt/ada-util/include/utilada_core.static -I${HOME}/opt/ada-util/include/utilada_base.static -I- ${HOME}/opt/ada-util/include/utilada_core.static/util.ads
gcc -c -I./ -I${HOME}/opt/ada-util/include/utilada_sys.static -I${HOME}/opt/ada-util/include/utilada_core.static -I${HOME}/opt/ada-util/include/utilada_base.static -I- ${HOME}/opt/ada-util/include/utilada_base.static/util-beans.ads
gcc -c -I./ -I${HOME}/opt/ada-util/include/utilada_sys.static -I${HOME}/opt/ada-util/include/utilada_core.static -I${HOME}/opt/ada-util/include/utilada_base.static -I- ${HOME}/opt/ada-util/include/utilada_base.static/util-beans-objects.adb
gcc -c -I./ -I${HOME}/opt/ada-util/include/utilada_sys.static -I${HOME}/opt/ada-util/include/utilada_core.static -I${HOME}/opt/ada-util/include/utilada_base.static -I- ${HOME}/opt/ada-util/include/utilada_base.static/util-log.adb
gcc -c -I./ -I${HOME}/opt/ada-util/include/utilada_sys.static -I${HOME}/opt/ada-util/include/utilada_core.static -I${HOME}/opt/ada-util/include/utilada_base.static -I- ${HOME}/opt/ada-util/include/utilada_base.static/util-log-loggers.adb
cannot generate code for file util-log-loggers.adb (missing subunits)
util-log-loggers.adb:38:04: warning: subunit "Util.Log.Loggers.Traceback" in file "util-log-loggers-traceback.adb" not found
gnatmake: "${HOME}/opt/ada-util/include/utilada_base.static/util-log-loggers.adb" compilation error

I get similar results when trying to build the logging sample.

link of util_harness.adb failed

Hello,

First, let me say I'm a Ada beginner. I'm trying to install ada-util on Windows 10. From what I understand, Alire installed msys2.

  1. Started an msys2 shell.
  2. Cloned ada-util
  3. Installed mingw-w64-i686-toolchain (ada) and mingw-w64-i686-gprbuild.
  4. Added /mingw32/bin to PATH
  5. ./configure
  6. make
  7. It runs a while and I have a bunch of undefined reference : stat64, CloseHandle, etc.

I attached the output of the make command.

Thanks
out.log

Typo in procedure name

The private procedure Elligible_Files in Util.Files.Rolling. Should it be Eligible_Files of Illigeble_Files?

Input stream reader to read parts from another stream

Some files are composed of mime multi-part sections as described in the RFC 1341. Each multi-part section is separated by boundaries.

We can take the advantages of the stream composing framework available in Ada Utility Library to allow reading such multi-part files.

We could use such new Input_Part_Stream type as follows:

SEP     : constant String := "" & ASCII.LF;
File    : aliased Util.Streams.Files.File_Stream;
Parts   : Util.Streams.Buffered.Parts.Input_Part_Stream;
Head, Msg, sign : Ada.Strings.Unbounded.Unbounded_String;

  File.Open (Ada.Streams.Stream_IO.In_File, Path);
  Parts.Initialize (Input => File'Unchecked_Access, Size => 4096);
  Parts.Set_Boundary (SEP & "-----BEGIN PGP SIGNED MESSAGE-----" & SEP);
  Parts.Read (Head);
  Parts.Set_Boundary (SEP & "-----BEGIN PGP SIGNATURE-----" & SEP);
  Parts.Read (Msg);
  Parts.Set_Boundary (SEP & "-----END PGP SIGNATURE-----" & SEP);
  Parts.Read (Sign);

release of 1.9?

Hi Stephane,
I've been keeping my eye on this to see when 1.9 is released (hopefully with a git tag so that it shows in github as a release). Do you have any idea when that might happen?

Executor does not always stop the worker tasks

The Util.Executors.Stop procedure does not always stop correctly the worker tasks.

It looks at the tasks and enqueue a stop work to tell each active task to stop.
The issue is that it enqueue such stop work while checking and iterating over the list of tasks.
As soon as it enqueue a stop work, it is possible that a running task, not yet checked as par of the iteration, dequeues the stop job and stops immediately.
Then, at the next iteration that task is seen as terminated and no stop work is enqueue.
We therefore miss one (or more) stop job.

Alire lost reference to `utils-streams-buffered-parts.ads`

I was following the sample for sending multipart data and it was working until I start working on my project the next day and got this message:

service.adb:7:06: error: file "util-streams-buffered-parts.ads" not found

I did change nothing from yesterday, I just tried alr run as usual (even before writing something new in the code) and this happened.

utilada_curl crate uses wrong curl dependency

The utilada_curl crate is using curl as the dependency but this is for the curl command and not the libcurl.

We must add a libcurl crate and then make utilada_curl depend on it.

Change the log time from UTC to Local Time

When printing the time to the log, the current implementation uses the Ada.Calendar.Formatting.Image procedure. This causes the time to be recorded in UTC rather than the system's Local Time. It is hard-coded into the Format function in the /src/base/log/util-log-appenders.adb file.

I am using GNAT on Windows. System Time on my computer is UTC+9 (Seoul).

My Program:

   procedure Init is
      L : constant Loggers.Logger := Loggers.Create ("pdns");
   begin
      Util.Log.Loggers.Initialize ("log.properties");

      L.Info ("UTC = " & Ada.Calendar.Formatting.Image (Ada.Calendar.Clock));
      L.Info ("Local = " & Ada.Calendar.Formatting.Local_Image (Ada.Calendar.Clock));
   end Init;

Result:

C:\Users\Regentag\Desktop\Ada\pdns\bin\pdns.exe
[2024-01-23 14:40:48] INFO : UTC = 2024-01-23 14:40:48
[2024-01-23 14:40:48] INFO : Local = 2024-01-23 23:40:48
[2024-01-23 23:40:48] process terminated successfully, elapsed time: 00.31s

I propose to modify the time output function to be displayed in system local time using the 'Ada.Calendar.Formating.Local_Image' procedure.

Question about JSON serialization/deserialization

I'm thinking about writing a schema crate for the Matrix specification. The problem is that the Matrix specification is quite dynamic: the JSON content contains a "content" object that changes depending on the event in question. For example, when an m.identity_server event is received, the JSON might look like this:

{
  "content": {
    "base_url": "https://example.org"
  },
  "type": "m.identity_server"
}

Whereas if the event type is m.room.member, the JSON is significantly different and has far more fields:

{
  "content": {
    "membership": "join"
  },
  "event_id": "$26RqwJMLw-yds1GAH_QxjHRC1Da9oasK0e5VLnck_45",
  "origin_server_ts": 1632489532305,
  "room_id": "!jEsUZKDJdhlrceRyVU:example.org",
  "sender": "@example:example.org",
  "state_key": "@user:example.org",
  "type": "m.room.member",
  "unsigned": {
    "age": 1567437,
    "redacted_because": {
      "content": {
        "reason": "spam"
      },
      "event_id": "$Nhl3rsgHMjk-DjMJANawr9HHAhLg4GcoTYrSiYYGqEE",
      "origin_server_ts": 1632491098485,
      "redacts": "$26RqwJMLw-yds1GAH_QxjHRC1Da9oasK0e5VLnck_45",
      "room_id": "!jEsUZKDJdhlrceRyVU:example.org",
      "sender": "@moderator:example.org",
      "type": "m.room.redaction",
      "unsigned": {
        "age": 1257
      }
    }
  }
}

As you can see, the JSON can contain multiple events within one event classification, and I'm wondering how I could handle that. I'd use a library like JWX but I need to be able to both generate and parse JSON. (You can find many more examples of the Matrix JSON schema here.

So, I'm wondering how I might define this using utilada? I like the idea of being able to strongly type my data -- it makes things a lot easier to debug later.

make test fails on debian stretch

configure and make runs fine.
But make test produces on my system,
root@emiel:/home/y/ada-util/ada-util-master# make test
gprbuild -m -q -p -Putilada_core.gpr -XHARDWARE_PLATFORM=x86_64 -XMODE=distrib -XCOVERAGE=no -XPROCESSORS=8 -XUTIL_LIBRARY_TYPE=static
gprbuild -m -q -p -Putilada_base.gpr -XHARDWARE_PLATFORM=x86_64 -XMODE=distrib -XCOVERAGE=no -XPROCESSORS=8 -XUTIL_LIBRARY_TYPE=static
gprbuild -m -q -p -Putilada_sys.gpr -XHARDWARE_PLATFORM=x86_64 -XMODE=distrib -XCOVERAGE=no -XPROCESSORS=8 -XUTIL_LIBRARY_TYPE=static
gprbuild -m -q -p -Putilada_unit.gpr -XHARDWARE_PLATFORM=x86_64 -XMODE=distrib -XCOVERAGE=no -XPROCESSORS=8 -XUTIL_LIBRARY_TYPE=static
gprbuild -m -q -p -Putilada_http.gpr -XHARDWARE_PLATFORM=x86_64 -XMODE=distrib -XCOVERAGE=no -XPROCESSORS=8 -XUTIL_LIBRARY_TYPE=static
gprbuild -m -q -p -Ptests_proc -XHARDWARE_PLATFORM=x86_64 -XMODE=distrib -XCOVERAGE=no -XPROCESSORS=8
gprbuild -m -q -p -Putilada_tests -XHARDWARE_PLATFORM=x86_64 -XMODE=distrib -XCOVERAGE=no -XPROCESSORS=8
bin/util_harness -l utilada: -xml util-aunit.xml -timeout 30
Usage: test
b
c
d
e
f
Systems.Dlls:
Test Util.Systems.Dlls.Load - util-systems-dlls-tests.adb:68: At least on Load operation should have failedreturned null FAIL 0.000335000s
Test Util.Systems.Dlls.Get_Symbol - util-systems-dlls-tests.adb:68: At least on Load operation should have failedreturned null FAIL 0.000291000s
utilada: Tests run: 271, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 7.823453000
Makefile:63: recipe for target 'test' failed
make: [test] Error 1 (ignored)
root@emiel:/home/y/ada-util/ada-util-master#

Custom log appender

I've created my own custom implementation of a log appender, but I had to add the new derived type as a child of Util.Log.Appenders because there's no other way to initialize the private field Name, necessary for the logic to find the new Appender. Is this the intended way, have I missed something or can it be considered a bug/lack of a feature?

Can't use Ada-Util under GCC 10

System: Dockerized Ubuntu 21 under ArchLinux host machine, both x86_84
Ada Util Version: 2.4.1

Compilation of an example project that uses Ada-Util fails for GCC 10 only, GCC 9, 11 and 12 have no issue. The problem seems to be located in the properties part of the library, despite the example only using the HTTP part of the library.

Question 1: Do you care to fix this?
Question 2: Is there a way to fully exclude util-properties from the project when using the HTTP module?

The error in question:

util-properties.ads:301:50: missing ";"
util-properties.ads:304:38: "Manager_Type" is undefined (more references follow)
util-properties.ads:307:10: subprogram "Is_Shared" is not overriding
util-properties.ads:310:10: subprogram "Set_Shared" is not overriding
util-properties.ads:314:10: subprogram "Adjust" is not overriding
util-properties.ads:317:10: subprogram "Finalize" is not overriding

Here is a minimal reproducible example (using docker). To run it, create the 3 files Dockerfile, example.adb and example.gpr as the following:

Dockerfile:

FROM ubuntu:hirsute
MAINTAINER Alexander Winter <[email protected]>

ENV ADA_UTIL_VERSION=2.4.1

RUN apt-get update --fix-missing && apt-get install -y gnat-10 gprbuild gcc-10 make autoconf wget unzip libcurl4-openssl-dev
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10

# Ada Util
WORKDIR / 
RUN wget https://github.com/stcarrez/ada-util/archive/refs/tags/$ADA_UTIL_VERSION.zip
RUN unzip $ADA_UTIL_VERSION.zip
WORKDIR /ada-util-$ADA_UTIL_VERSION
RUN ./configure
RUN make
RUN make test
RUN make install prefix=/usr

example.adb:

with Ada.Text_IO;
with Util.Http.Clients;
with Util.Http.Clients.Curl;

procedure Example is
begin
    Util.Http.Clients.Curl.Register;
    declare
        Http     : Util.Http.Clients.Client;
        Response : Util.Http.Clients.Response;
    begin
        Http.Add_Header ("X-Requested-By", "wget");
        Http.Get ("http://www.google.com", Response);
        Ada.Text_IO.Put_Line(Response.Get_Body);
    end;
end Example;

example.gpr:

with "utilada_http";
with "utilada_curl";

project Example is
    type Mode_Type is ("debug", "release");         
    Mode : Mode_Type := external ("mode", "debug"); 

    for Languages use ("Ada");
    for Source_Dirs use ("./");
    for Object_Dir use "obj";
    for Exec_Dir use "bin";
    for Main use ("example.adb");

    package Compiler is
        case Mode is
            when "debug" =>
                for Default_Switches ("Ada") use ("-g", "-gnatX");
            when "release" => 
                for Default_Switches ("Ada") use ("-gnatX", "-O3");
        end case;
    end Compiler;

    package Binder is
        case Mode is
            when "debug" =>
                for Default_Switches ("Ada") use ("-E");
        end case;
    end Binder;
end Example;

Then run from the same directory:

docker build -t example .
docker run --rm -v $(pwd):/build example:latest gprbuild -d -p /build/example.gpr

Best,
Alexander Winter

128Bit AES-CTR Encoding doesn't work

Utilada version: 2.6.0

I have a simple utility that should be able to encrypt and decrypt files in AES-CTR 128Bit mode, but it fails and returns this CONSTRAINT_ERROR.

Constraint error in To_Unsigned_32

raised CONSTRAINT_ERROR : util-encoders-aes.adb:677 index check failed
[./bin/ada_aes]
0x59615ef1c835 Util.Encoders.Aes.Transform at util-encoders-aes.adb:677
0x59615ef717dd Util.Streams.Aes.Encoding.Write at util-streams-buffered-encoders.adb:83
0x59615ef7c2f7 Util.Streams.Copy at util-streams.adb:37
0x59615ef12313 Ada_Aes.Encrypt_File at ada_aes.adb:63
0x59615ef12e82 Ada_Aes at ada_aes.adb:84
0x59615ef1376c Main at b__ada_aes.adb:469
[/usr/lib/libc.so.6]
0x7697fe158cce
0x7697fe158d88
[./bin/ada_aes]
0x59615ef11bd3 _start at ???
0xfffffffffffffffe

With some debugging, it seems that it manages to go through one 4KB data block, then Offset is set to 15 and DataLast index is 16`, so it tries to access a non-existent element

I will add the program's source code in the comment

utilada_aws: raised PROGRAM_ERROR : SSL not supported.

@stcarrez I'm unsure if this is a bug on Utilada's end or not but it appears to be so. When I try to download content via HTTPS, this exception is thrown. I'm unsure how to enable TLS through utilada and I don't know if there's something I'm missing or not. Is this indeed a bug as I think it is?

Windows 10, problems

1) config.guess and config.sub hand out with ada-util are outdated:

$ ./configure --disable-ahven --disable-curl --disable-aws
checking build system type... ./config.guess: unable to guess system type

This script, last modified 2002-02-19, has failed to recognize
the operating system you are using. It is advised that you
download the most up to date version of the config scripts from

ftp://ftp.gnu.org/pub/gnu/config/

If the version you run (./config.guess) is already up to date, please
send the following data and any information you think might be
pertinent to [email protected] in order to provide the needed
information to handle your system.

2) After updating to latest config.guess and config.sub from ftp://ftp.gnu.org/pub/gnu/config/, configure passes but make is not going through:

$ make
/usr/bin/make UTIL_LIBRARY_TYPE=static build build-test
make[1]: Entering directory `/d/ShillBig/gnoga-code-1.2b/deps/ada-util'
gprbuild -m -p -P"util.gpr" -XMODE=debug -XCOVERAGE=no -XUTIL_LIBRARY_TYPE=stati c -XPROCESSORS=4 -XHARDWARE_PLATFORM=unknown
Compile
[Ada] util-processes-os.adb
[Ada] util-http.adb
[Ada] util-http-tools.adb
[Ada] util-http-rest.adb
util-processes-os.ads:24:09: type must be declared abstract or "Stop" overridden
util-processes-os.ads:24:09: "Stop" has been inherited from subprogram at util-p rocesses.ads:172

compilation of util-processes-os.adb failed

gprbuild: *** compilation phase failed
make[1]: *** [build] Error 4
make[1]: Leaving directory `/d/ShillBig/gnoga-code-1.2b/deps/ada-util'
make: *** [static] Error 2

I tapped into util.gpr to specify "os-win32" for Os_Version and Os_Src_Dir and build using gprbuild directly inside GPS. It worked.

Note: For example I am only interested in JSON serial/deserial. Maybe would it be possible to split the utils in more specific target eg. util-core, util-json, util-xml etc?

Compilation issues on NetBSD 9.2

The library does not compile on NetBSD 9.2:

  • the configure script does not recognize the netbsd9.2 target_os (it recognizes netbsdelf)
  • the os-netbsd64 is missing

Building ada-util without ./configure & make

Is there a way to provide a simpler build experience for ada-util? I'd love to be able to just gprbuild it without having to install a whole MSYS2/mingw environment on windows and hope it works.

Perf report generates incorrect XML title attributes

The Util.Measures package generates an XML perf report and if the title contains a <, it should escape id.
It generates:

<time count="1" time="3.000 us" title="Hashed_Maps<Unbounded,Unbounded..Find+Element"/>

Struggling to see how to create json with fields

Hi,

I have been trying to use json.adb in the samples directory to write my own serializers, and I have a couple of issues:

  1. Proxy functions with vector mappers -- can't get this to work. I have a record where one of the items is a vector and I can't work out what should go in the proxy field as the vector mappers don't have a Set_Member.
  2. Producing a json string from a vector of records of the form {"field1": [{"a": 1,"b":2}, {"a: 5, "b":6}]}. For some reason I can't get the output string to have the field names in, just lists the field content. What am I doing wrong there?
  procedure Print (P : in My_Type.Cursor);
    procedure Print (P : in My_Element);

    procedure Print (P : in My_Element) is
    begin
   Ada.Text_IO.Put_Line ("A       : " & P.A);
   Ada.Text_IO.Put_Line ("B : " & P.B);
    end Print;

    procedure Print (P : in My_Type.Cursor) is
    begin
       Print (My_Type.Element (P));
    end Print;



`        declare
          Buffer : aliased Util.Streams.Buffered.Output_Buffer_Stream;
          Print  : aliased Util.Streams.Texts.Print_Stream;
          Output : Util.Serialize.IO.JSON.Output_Stream;
          begin
              -- Convert to external facing type for conversion to json out to HTTP
          My_Type.Set_Type (To => List, From => Internal_Element);
          Buffer.Initialize (Size => 10000);
          Print.Initialize (Buffer'Unchecked_Access);
          Output.Initialize (Print'Unchecked_Access);
      Ada.Text_Io.Put_Line("Second Marker");
          Output.Write ("{""list"":");
          Internal_Vectors_Mapping.Write (Output, List);
      Output.Write ("}");

          Ada.Text_IO.Put_Line ("IO:");
          Ada.Text_IO.Put_Line (Util.Streams.Texts.To_String (Print));
       end;
    end;` 

Obviously there is a chance I'm doing this all wrong, in a fundamental way. I want to serialize my type to output it to json and then out to other executables, at which point it'll be deserialized and brought back into the internal code.

Support to build with -gnatW8

The Ada Util library does not work well when compiled with -gnatW8:

  • some test files are using UTF-8 characters in String which is forbidden because outside of Latin-1 charset,
  • the Ada.Text_IO assumes strings a Latin-1 but sometimes a String could contain UTF-8 byte sequence,
  • the Util.Log package write the log messages by using Ada.Text_IO but for some applications the message contains an UTF-8 sequence. This default must remain but must be configurable to choose a direct write on the console (or file).

See discussion on alire-project/alire#1334

Alire question

So, I know this isn't necessarily related to utilada but I'm really wanting to use Utilada.

I've pulled in the library (latest version 2.4.1) because the one on alire is majorly out of date. However, though I've got the utilada dependency, I need either utilada_curl or utilada_aws for the HTTP client. What is the (proper) way for doing this when I already have utilada from git? I included it like this:

alr with utilada --use https://github.com/stcarrez/ada-util --commit 02f8a8ddf4e19ed469c25f96acd0000b64f3eec8

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.