Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to specify "useithreads" in a distroprefs

0 views
Skip to first unread message

Alceu Rodrigues de Freitas Junior via cpan-testers-discuss

unread,
Jun 8, 2022, 12:00:03 PM6/8/22
to cpan-teste...@perl.org
Hello there,

I've struggling to define distroprefs and include "useithreads"
information for a perl that doesn't support it.

If I define it like this:

---
comment: Tests hang smoker
disabled: 1
match:
  distribution: ^PRBRENAN/Nasm-X86
  perlconfig:
    archname: i386-openbsd
    osname: openbsd
    useithreads: null

The distribution is skipped just fine, but then I start to get warning
like this one:

validation of distropref
'/home/goku/cpan-openbsd-smoker/prefs/PRBRENAN.Nasm-X86.yml'[0] against
schema '/home/goku/perl5/lib/perl5/CPAN/Kwalify/distroprefs.yml'
failed:   - [/match/perlconfig/useithreads] Non-valid data 'undef',
expected text

I already tried to configure like this instead:

---
comment: Tests hang smoker
disabled: 1
match:
  distribution: ^PRBRENAN/Nasm-X86
  perlconfig:
    archname: i386-openbsd
    osname: openbsd
    no_useithreads: defined

But then the distribution is not skipped anymore.

I went through Kwalify documentation, but couldn't figure out where the
CPAN distroprefs schema is define so I can figure out how to accomplish
both things (skipping the distribution and not getting warnings).

Thanks in advance,

Alceu


Slaven Rezic

unread,
Jun 9, 2022, 3:45:04 PM6/9/22
to cpan-teste...@perl.org

08. 06. 2022. u 17:43, Alceu Rodrigues de Freitas Junior via cpan-testers-discuss piše:

Hi Alceu,

I think that

    useithreads: undef

should work, using exactly the string which is returned by

    perl -V:useithreads

Regards, Slaven


Slaven Rezic

unread,
Jun 9, 2022, 4:15:04 PM6/9/22
to cpan-teste...@perl.org

09. 06. 2022. u 21:38, Slaven Rezic piše:

Actually, looking at this distropref file https://github.com/eserte/srezic-cpan-distroprefs/blob/8c3ae5d7b4071f9639ccfcea4f44764c2699e27e/Devel-CallParser.yml#L5 it seems that the value is interepreted as a regexp, so you want to anchor it with ^ and $ for extra safety.

Regards, Slaven

Alceu Rodrigues de Freitas Junior via cpan-testers-discuss

unread,
Jun 12, 2022, 3:00:04 PM6/12/22
to cpan-teste...@perl.org
Hello Slaven,

On 09/06/2022 16:57, Slaven Rezic wrote:
>
> 09. 06. 2022. u 21:38, Slaven Rezic piše:
>
>> Hi Alceu,
>>
>> I think that
>>
>>     useithreads: undef
>>
>> should work, using exactly the string which is returned by
>>
>>     perl -V:useithreads
>>
>>
> Actually, looking at this distropref file
> https://github.com/eserte/srezic-cpan-distroprefs/blob/8c3ae5d7b4071f9639ccfcea4f44764c2699e27e/Devel-CallParser.yml#L5
> it seems that the value is interepreted as a regexp, so you want to
> anchor it with ^ and $ for extra safety.
>
I'm afraid that neither the options you proposed: I tried both and the
result is the same: Kwalify doesn't complain anymore but the
distribution is not skipped.

On the other hand, using:

    useithreads: null

Generates the opposite outcome.

Not sure how Kwalify works (both Ruby's and Perl's implementation from
it), but the direct translation from Perl's undef would be null in YAML.


Slaven Rezic

unread,
Jun 14, 2022, 5:45:04 PM6/14/22
to Alceu Rodrigues de Freitas Junior, cpan-teste...@perl.org

12. 06. 2022. u 20:42, Alceu Rodrigues de Freitas Junior via cpan-testers-discuss piše:

Hi Alceu,

Kwalify is just a schema for validating data structures and it does not do any parsing or matching using the distroprefs data. The latter is done by CPAN::Distroprefs.

That said, I tried "useithreads: undef" and it did not work. So it looks like the matching is not done against what is displayed in "perl -V" (in this case the string "undef"), but what is in the Config data structure (the value undef).

However, the distroprefs code only does regexp matches against the stringified values, so to match the stringified undef (the empty string) one has to use '^$'. Below is a distroprefs file just for demonstration purposes, and it works on my system.

Regards, Slaven

---
match:
  distribution: Kwalify
  perlconfig:
    useithreads: '^$'
pl:
  commandline: "echo unthreaded perl deteted; exit 1"
---
match:
  distribution: Kwalify
  perlconfig:
    useithreads: '^define$'
pl:
  commandline: "echo threading perl deteted; exit 1"
---
match:
  distribution: Kwalify
pl:
  commandline: "echo nothing matched; exit 1"

Alceu Rodrigues de Freitas Junior via cpan-testers-discuss

unread,
Jun 14, 2022, 11:45:03 PM6/14/22
to cpan-teste...@perl.org
Hello Slaven,

On 14/06/2022 18:37, Slaven Rezic wrote:
>
> Hi Alceu,
>
> Kwalify is just a schema for validating data structures and it does
> not do any parsing or matching using the distroprefs data. The latter
> is done by CPAN::Distroprefs.
>
> That said, I tried "useithreads: undef" and it did not work. So it
> looks like the matching is not done against what is displayed in "perl
> -V" (in this case the string "undef"), but what is in the Config data
> structure (the value undef).
>
> However, the distroprefs code only does regexp matches against the
> stringified values, so to match the stringified undef (the empty
> string) one has to use '^$'. Below is a distroprefs file just for
> demonstration purposes, and it works on my system.
>
Thank you for that!

Just tried with the regex "^$" on OpenBSD 7.1 and worked without the
warning.

On the other hand, I tried both methods on my Ubuntu box and both worked
without any warning, which isn't the expected:

me:~/.cpan/prefs$ cat test.yml
---
disabled: 1
match:
  distribution: ^MIK/CryptX
  perlconfig:
    #useithreads: null
    useithreads: '^$'

me:~/.cpan/prefs$ cpan -t CryptX
CPAN: CPAN::SQLite loaded ok (v0.219)
Database was generated on Wed, 15 Jun 2022 03:16:47 GMT
Running test for module 'CryptX'
CPAN: YAML::XS loaded ok (v0.83)
CPAN: CPAN::Kwalify loaded ok (v5.50)

______________________ D i s t r o P r e f s ______________________
test.yml[0]
  MIK/CryptX-0.076.tar.gz
  [disabled] -- NA Disabled via prefs file
'/home/semantix/.cpan/prefs/test.yml' doc 0
me:~/.cpan/prefs$ vi test.yml

me:~/.cpan/prefs$ cat test.yml
---
disabled: 1
match:
  distribution: ^MIK/CryptX
  perlconfig:
    useithreads: null
    #useithreads: '^$'

me:~/.cpan/prefs$ cpan -t CryptX
CPAN: CPAN::SQLite loaded ok (v0.219)
Database was generated on Wed, 15 Jun 2022 03:16:47 GMT
Running test for module 'CryptX'
CPAN: YAML::XS loaded ok (v0.83)
CPAN: CPAN::Kwalify loaded ok (v5.50)

______________________ D i s t r o P r e f s ______________________
test.yml[0]
  MIK/CryptX-0.076.tar.gz
  [disabled] -- NA Disabled via prefs file
'/home/semantix/.cpan/prefs/test.yml' doc 0

Now, testing on OpenBSD, I got the warning if using "undef", as previous
stated.

Comparing the systems, the only thing I got that is different is the
perl itself:

[goku@cpan-smoker-openbsd:~/cpan-openbsd-smoker]$ mversion CPAN::Kwalify
5.50
[goku@cpan-smoker-openbsd:~/cpan-openbsd-smoker]$ mversion CPAN::Distroprefs
6.0001
[goku@cpan-smoker-openbsd:~/cpan-openbsd-smoker]$ perl -v

This is perl 5, version 32, subversion 1 (v5.32.1) built for i386-openbsd

The Ubuntu box is running:

perl 5, version 34, subversion 0 (v5.34.0) built for x86_64-linux.

Both without ithreads support, but the perl on OpenBSD is patched (by
the maintainers), so that might explain the difference.

Anyway, I think it's worth to document all this and I'm willing to
provide a PR for that. Any suggestions where I should do it? Maybe the
CPAN's distribution Pod?

Regards,

Alceu





0 new messages