Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

You're dead, Jim. -- McCoy, "Amok Time", stardate 3372.7


devel / comp.lang.ada / Raising "exception" in a .gpr file

SubjectAuthor
* Raising "exception" in a .gpr filemockturtle
+* Re: Raising "exception" in a .gpr fileDmitry A. Kazakov
|`* Re: Raising "exception" in a .gpr filemockturtle
| `* Re: Raising "exception" in a .gpr fileBjörn Lundin
|  `- Re: Raising "exception" in a .gpr fileMark Lorenzen
+- Re: Raising "exception" in a .gpr fileBritt
`- Re: Raising "exception" in a .gpr fileFabien Chouteau

1
Raising "exception" in a .gpr file

<ce96c9ca-ae18-4ccd-a6c9-768a6a28ff8cn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=5675&group=comp.lang.ada#5675

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:6214:e62:: with SMTP id jz2mr1363200qvb.21.1628839395121;
Fri, 13 Aug 2021 00:23:15 -0700 (PDT)
X-Received: by 2002:a25:818a:: with SMTP id p10mr1223890ybk.363.1628839394937;
Fri, 13 Aug 2021 00:23:14 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Fri, 13 Aug 2021 00:23:14 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=93.41.1.126; posting-account=9fwclgkAAAD6oQ5usUYhee1l39geVY99
NNTP-Posting-Host: 93.41.1.126
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ce96c9ca-ae18-4ccd-a6c9-768a6a28ff8cn@googlegroups.com>
Subject: Raising "exception" in a .gpr file
From: framefri...@gmail.com (mockturtle)
Injection-Date: Fri, 13 Aug 2021 07:23:15 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: mockturtle - Fri, 13 Aug 2021 07:23 UTC

Dear.all,
I am linting an old library of mine (suid_helper) thought to help in writing setuid programs. (Basically, it drops suid privileges when program starts and allows to run in privileged mode only via few selected procedures, see https://gitlab.com/mockturtle/suid-helper if you are curious).

At the moment the library works for Linux (since I use Linux) and I guess it could work with most other *nixes (but setuid stuff portability is tricky).
As you can imagine, there is a part that is OS-dependent. I isolated it into a directory that is selected in the gpr files on the basis of the current OS

(BTW: I am using an external value for this, there is some more "standard" way to get the OS within the gpr file?)

For sure it does not work with Windows since that OS does not have the concept of "setuid executable" (as far as I know).
It would be nice to be able to "raise an exception" when the OS is Windows, in the sense that the user that tries to compile (by mistake) the library under Windows gets a message like

"You cannot compile this in Windows since Windows has no setuid concept"

rather than getting some mysterious compile error later.

Just to be clear, I am thinking to something like

case OS is
...when "linux" =>
......Arch_Sources := "src/Linux";

...when "macos" =>
......Arch_Sources := "src/Mac";

...when "windows" =>
......raise "This library makes no sense with this OS";
end case;

I tried to look in the manual, this newsgroup and googled a bit, but I did not find anything. I am afraid that this is not possible (although I think it could be a nice addition).

Do you know if this is possible and how?

Thank you in advance

Riccardo

Re: Raising "exception" in a .gpr file

<sf57s9$ddn$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=5676&group=comp.lang.ada#5676

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!Hx95GBhnJb0Xc8StPhH8AA.user.46.165.242.91.POSTED!not-for-mail
From: mail...@dmitry-kazakov.de (Dmitry A. Kazakov)
Newsgroups: comp.lang.ada
Subject: Re: Raising "exception" in a .gpr file
Date: Fri, 13 Aug 2021 09:44:09 +0200
Organization: Aioe.org NNTP Server
Message-ID: <sf57s9$ddn$1@gioia.aioe.org>
References: <ce96c9ca-ae18-4ccd-a6c9-768a6a28ff8cn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="13751"; posting-host="Hx95GBhnJb0Xc8StPhH8AA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.13.0
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
 by: Dmitry A. Kazakov - Fri, 13 Aug 2021 07:44 UTC

On 2021-08-13 09:23, mockturtle wrote:

> Just to be clear, I am thinking to something like
>
> case OS is
> ...when "linux" =>
> ......Arch_Sources := "src/Linux";
>
> ...when "macos" =>
> ......Arch_Sources := "src/Mac";
>
> ...when "windows" =>
> ......raise "This library makes no sense with this OS";
> end case;
>
> I tried to look in the manual, this newsgroup and googled a bit, but I did not find anything. I am afraid that this is not possible (although I think it could be a nice addition).

There are many nice addition they could have, starting with predefined
variables for the host OS, host machine and a sane set of operations
defined on strings.

> Do you know if this is possible and how?

You could refer to an non-existing source file in the choice:

when "windows" =>
for Source_Files use ("This library makes no sense with this OS");

--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

Re: Raising "exception" in a .gpr file

<3e9e65ca-75a8-4df9-813d-8b053ecedd9fn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=5677&group=comp.lang.ada#5677

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:622a:4c7:: with SMTP id q7mr850607qtx.360.1628842292683;
Fri, 13 Aug 2021 01:11:32 -0700 (PDT)
X-Received: by 2002:a25:ea51:: with SMTP id o17mr1534404ybe.253.1628842292489;
Fri, 13 Aug 2021 01:11:32 -0700 (PDT)
Path: i2pn2.org!i2pn.org!paganini.bofh.team!usenet.pasdenom.info!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Fri, 13 Aug 2021 01:11:32 -0700 (PDT)
In-Reply-To: <sf57s9$ddn$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=93.41.1.126; posting-account=9fwclgkAAAD6oQ5usUYhee1l39geVY99
NNTP-Posting-Host: 93.41.1.126
References: <ce96c9ca-ae18-4ccd-a6c9-768a6a28ff8cn@googlegroups.com> <sf57s9$ddn$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <3e9e65ca-75a8-4df9-813d-8b053ecedd9fn@googlegroups.com>
Subject: Re: Raising "exception" in a .gpr file
From: framefri...@gmail.com (mockturtle)
Injection-Date: Fri, 13 Aug 2021 08:11:32 +0000
Content-Type: text/plain; charset="UTF-8"
 by: mockturtle - Fri, 13 Aug 2021 08:11 UTC

On Friday, August 13, 2021 at 9:44:13 AM UTC+2, Dmitry A. Kazakov wrote:
> There are many nice addition they could have, starting with predefined
> variables for the host OS, host machine and a sane set of operations
> defined on strings.

I agree. With just few additions the project files would much more powerful and easier to use.

Re: Raising "exception" in a .gpr file

<sf63oi$c1g$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=5678&group=comp.lang.ada#5678

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: b.f.lun...@gmail.com (Björn Lundin)
Newsgroups: comp.lang.ada
Subject: Re: Raising "exception" in a .gpr file
Date: Fri, 13 Aug 2021 17:40:02 +0200
Organization: A noiseless patient Spider
Lines: 100
Message-ID: <sf63oi$c1g$1@dont-email.me>
References: <ce96c9ca-ae18-4ccd-a6c9-768a6a28ff8cn@googlegroups.com>
<sf57s9$ddn$1@gioia.aioe.org>
<3e9e65ca-75a8-4df9-813d-8b053ecedd9fn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 13 Aug 2021 15:40:02 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="63d6850711691d77a3ef1ba54d2317ea";
logging-data="12336"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18TGaruhZqPymgbAu2SZXug"
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:78.0)
Gecko/20100101 Thunderbird/78.12.0
Cancel-Lock: sha1:3G603sYWBz0qLPbmhU7LSXusb2Q=
In-Reply-To: <3e9e65ca-75a8-4df9-813d-8b053ecedd9fn@googlegroups.com>
Content-Language: en-US
 by: Björn Lundin - Fri, 13 Aug 2021 15:40 UTC

Den 2021-08-13 kl. 10:11, skrev mockturtle:
> On Friday, August 13, 2021 at 9:44:13 AM UTC+2, Dmitry A. Kazakov wrote:
>> There are many nice addition they could have, starting with predefined
>> variables for the host OS, host machine and a sane set of operations
>> defined on strings.
>
> I agree. With just few additions the project files would much more powerful and easier to use.
>

I autogenerate such a file via a tcl-script as part of calling make.
It has to be done at least once - GPS it uses the file as is
(they are on 1 line but Thunderbird thinks they are too long)

--This file is autogenerated - DO NOT EDIT
--contents is from ada -z and ada -Z and some environment variables
--generated 2021-06-21 19:21:34

project Environment is
for Source_Dirs use (); -- to avoid warnings about no source files in
THIS project

type Compiler_Version_Type is ("2015", "2016", "2017", "2018",
"4.9.2", "6.0.2", "7.1.1", "7.3.2", "7.4.1", "7.4.2", "7.4lts",
"7.4ltsw", "17.2", "19.0w", "19.1", "19.2", "20.1", "20.2", "8.2.0",
"9.3.0");

type OS_Version_Type is ("AIX_7.1", "AIX_7.2", "windows_6.2",
"windows_10.0", "Linux_x86_64", "Linux_aarch64");

type Database_Type is ("oracle_10", "oracle_11", "oracle_12",
"sqlserver", "oci", "odbc_oracle", "odbc_postgresql", "postgresql");

type OS_Architecture_Type is ("aix_ppc", "win_x86", "lnx_x64",
"win_x64", "lnx_a64");

type IPC_Type is ("classic", "pipe", "rabbitmq");

OS_Version : OS_Version_Type := "Linux_x86_64";
OS_Architecture : OS_Architecture_Type := "lnx_x64";
IPC : IPC_Type := "pipe";

Compiler_Version : Compiler_Version_Type := "20.2";

Database : Database_Type := "oci";
Database_Version := "12";

Source_Dir := "/usr2/wcs/some_project/source";
Target_Dir := "/usr2/wcs/some_project/target";
Ada_Library_Root :=
"/usr2/wcs/some_project/target/adalib";
Ada_Library_Global :=
"/usr2/wcs/some_project/target/adalib/global_gpr";

end Environment;

Environment is then withed by other gpr files and used as

with "environment";
....

project Global is

Target_Machine : Environment.OS_Version_Type :=
Environment.Os_Version;
Compiler_Version : Environment.Compiler_Version_Type :=
Environment.Compiler_Version;
Data_Base : Environment.Database_Type :=
Environment.Database;
IPC : Environment.IPC_Type := Environment.IPC;

....

when "Linux_x86_64" =>
case Database is
when "oci" => Database_Libs := ("-L" & SOMEPATHE & "/lib",
"-lclntsh", "-L" & SATTMATE_OCILIB & "/lib", "-locilib");
when "sqlserver" => Data_Base_Libs := ("-lodbc");
when "odbc_oracle" => Data_Base_Libs := ("-lodbc");
when "odbc_postgresql" => Data_Base_Libs := ("-lodbc");
when others => null;
end case;

Platform_Dependent_Compiler_Switches := ();

case IPC is
when "classic" | "pipe" =>
case RPC_Enabled is
when "false" => null;
when "true" =>

--
Björn

Re: Raising "exception" in a .gpr file

<ca20b201-cf55-401d-b726-1f1752b10196n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=5680&group=comp.lang.ada#5680

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:ac8:7770:: with SMTP id h16mr10426574qtu.144.1629043240233;
Sun, 15 Aug 2021 09:00:40 -0700 (PDT)
X-Received: by 2002:a25:afcd:: with SMTP id d13mr14905172ybj.504.1629043240016;
Sun, 15 Aug 2021 09:00:40 -0700 (PDT)
Path: i2pn2.org!i2pn.org!aioe.org!news.mixmin.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Sun, 15 Aug 2021 09:00:39 -0700 (PDT)
In-Reply-To: <sf63oi$c1g$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=131.164.234.134; posting-account=Srm5lQoAAAAEMX9rv2ilEKR6FDPapmSq
NNTP-Posting-Host: 131.164.234.134
References: <ce96c9ca-ae18-4ccd-a6c9-768a6a28ff8cn@googlegroups.com>
<sf57s9$ddn$1@gioia.aioe.org> <3e9e65ca-75a8-4df9-813d-8b053ecedd9fn@googlegroups.com>
<sf63oi$c1g$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ca20b201-cf55-401d-b726-1f1752b10196n@googlegroups.com>
Subject: Re: Raising "exception" in a .gpr file
From: mark.lor...@gmail.com (Mark Lorenzen)
Injection-Date: Sun, 15 Aug 2021 16:00:40 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Mark Lorenzen - Sun, 15 Aug 2021 16:00 UTC

On Friday, August 13, 2021 at 5:40:05 PM UTC+2, björn lundin wrote:
> project Environment is
> for Source_Dirs use (); -- to avoid warnings about no source files in
> THIS project

You can declare the project as "abstract" and then you do not need to define Source_Dirs i.e:

abstract project Environment is
....
end Environment;

See https://docs.adacore.com/gprbuild-docs/html/gprbuild_ug/gnat_project_manager.html#sharing-between-projects

Regards,
Mark L

Re: Raising "exception" in a .gpr file

<524cd277-a645-4950-9c75-1ea9f7fedcc3n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=5681&group=comp.lang.ada#5681

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:620a:1446:: with SMTP id i6mr11945934qkl.63.1629044517573;
Sun, 15 Aug 2021 09:21:57 -0700 (PDT)
X-Received: by 2002:a25:d642:: with SMTP id n63mr16222285ybg.165.1629044517273;
Sun, 15 Aug 2021 09:21:57 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Sun, 15 Aug 2021 09:21:57 -0700 (PDT)
In-Reply-To: <ce96c9ca-ae18-4ccd-a6c9-768a6a28ff8cn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=173.225.51.130; posting-account=rdRzuwoAAAAyW3CSBhs_xgfCUJSc1aNt
NNTP-Posting-Host: 173.225.51.130
References: <ce96c9ca-ae18-4ccd-a6c9-768a6a28ff8cn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <524cd277-a645-4950-9c75-1ea9f7fedcc3n@googlegroups.com>
Subject: Re: Raising "exception" in a .gpr file
From: britt.sn...@gmail.com (Britt)
Injection-Date: Sun, 15 Aug 2021 16:21:57 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Britt - Sun, 15 Aug 2021 16:21 UTC

Since sometime in 2018, gpr files have supported a "Warning_Message" attribute" than can be used in a case statement, e.g.,

for Warning_Message use "This scenario variable combination is not supported.";

Unfortunately this feature is still not documented in the GPRbuild User's Guide.

- Britt

Re: Raising "exception" in a .gpr file

<1c9be25d-a03d-4b8c-bab2-df56a75818dbn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=5682&group=comp.lang.ada#5682

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a37:9e8c:: with SMTP id h134mr15292596qke.366.1629119585921;
Mon, 16 Aug 2021 06:13:05 -0700 (PDT)
X-Received: by 2002:a25:5556:: with SMTP id j83mr21301835ybb.309.1629119585699;
Mon, 16 Aug 2021 06:13:05 -0700 (PDT)
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!fdc3.netnews.com!news-out.netnews.com!news.alt.net!fdc2.netnews.com!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Mon, 16 Aug 2021 06:13:05 -0700 (PDT)
In-Reply-To: <ce96c9ca-ae18-4ccd-a6c9-768a6a28ff8cn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=89.157.139.225; posting-account=L3mulQoAAADsXVjCD5rM6Ap3Xy0U3ckB
NNTP-Posting-Host: 89.157.139.225
References: <ce96c9ca-ae18-4ccd-a6c9-768a6a28ff8cn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <1c9be25d-a03d-4b8c-bab2-df56a75818dbn@googlegroups.com>
Subject: Re: Raising "exception" in a .gpr file
From: fabien.c...@gmail.com (Fabien Chouteau)
Injection-Date: Mon, 16 Aug 2021 13:13:05 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1524
 by: Fabien Chouteau - Mon, 16 Aug 2021 13:13 UTC

On Friday, August 13, 2021 at 9:23:15 AM UTC+2, mockturtle wrote:
> Do you know if this is possible and how?

You are already using types:

type OS_Type is ("linux", "ms", "macos");
OS : OS_Type := external("OS", "linux");

If the external is set to a value that is not part of the type, gprbuild will fail with an error:
value "Windows_NT" is illegal for typed string "os_type"

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor