[opensuse-packaging] required perl modules not included in package Requires
Is there a reason why the required modules of a perl script are not encoded in the Requires of a package? In the example below I would expect a Requires: perl(Data::Dumper) to be included in inst-source-utils to pull in all required packages to actually run the script. Olaf root@carron:~/X # sed -n '/^[[:blank:]]*use[[:blank:]].*::/p' /usr/bin/createpatch use Data::Dumper; use File::stat; use File::Temp qw/ tempdir /; use Time::localtime; use Getopt::Long; root@carron:~/X # rpm -qf /usr/bin/createpatch inst-source-utils-2012.2.3-0.5.1 root@carron:~/X # rpm -qf --requires /usr/bin/createpatch gpg2 recode rpmlib(VersionedDependencies) <= 3.0.3-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1 rpmlib(CompressedFileNames) <= 3.0.4-1 /bin/bash /bin/sh /usr/bin/perl rpmlib(PayloadIsLzma) <= 4.4.6-1 -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
* V Pondělí 3. září 2012, 10:50:23 [CEST] Olaf Hering napsal:
Is there a reason why the required modules of a perl script are not encoded in the Requires of a package? In the example below I would expect a Requires: perl(Data::Dumper) to be included in inst-source-utils to pull in all required packages to actually run the script.
Data::Dumper module is in core Perl. So it's installed with Perl itself. But I think it's a good practice to mention it in requires. -- Vita Cizek
Quoting Olaf Hering <olaf@aepfle.de>:
Is there a reason why the required modules of a perl script are not encoded in the Requires of a package? In the example below I would expect a Requires: perl(Data::Dumper) to be included in inst-source-utils to pull in all required packages to actually run the script.
/usr/lib/rpm/fileattrs/perl.attr says:
cat perl.attr # disabled for now #%__perl_requires %{_rpmconfigdir}/perl.req %__perl_magic ^.*[Pp]erl .*$ %__perl_flags exeonly
=> the file is part of the rpm package itself. so having it disabled means no package will add any requires for perl() deps (except if there is a different logic somewhere) Dominique -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
Quoting "Dominique Leuenberger a.k.a DimStar" <DimStar@openSUSE.org>:
Quoting Olaf Hering <olaf@aepfle.de>:
/usr/lib/rpm/fileattrs/perl.attr says:
cat perl.attr # disabled for now #%__perl_requires %{_rpmconfigdir}/perl.req %__perl_magic ^.*[Pp]erl .*$ %__perl_flags exeonly
=> the file is part of the rpm package itself.
so having it disabled means no package will add any requires for perl() deps (except if there is a different logic somewhere)
For reference, this was disabled back in 2011: * Thu May 19 2011 mls [ at ] suse.de - disable perl requires generation completely Dominique -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
On 03.09.2012 10:50, Olaf Hering wrote:
Is there a reason why the required modules of a perl script are not encoded in the Requires of a package? In the example below I would expect a Requires: perl(Data::Dumper) to be included in inst-source-utils to pull in all required packages to actually run the script.
Olaf
root@carron:~/X # sed -n '/^[[:blank:]]*use[[:blank:]].*::/p' /usr/bin/createpatch
The reason is that such requires are *very* often just plain wrong. You can have modules, and you can have code like this: eval { require "Nowaythisisreal"; $somethingveryfishy=1; } Greetings, Stephan -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
Hello, Am Montag, 3. September 2012 schrieb Stephan Kulow:
On 03.09.2012 10:50, Olaf Hering wrote:
Is there a reason why the required modules of a perl script are not encoded in the Requires of a package? In the example below I would expect a Requires: perl(Data::Dumper) to be included in inst-source-utils to pull in all required packages to actually run the script.
In general yes (see Coolo's exception), and if the module is really required, then it should be mentioned in Requires:
root@carron:~/X # sed -n '/^[[:blank:]]*use[[:blank:]].*::/p' /usr/bin/createpatch The reason is that such requires are *very* often just plain wrong. You can have modules, and you can have code like this:
eval { require "Nowaythisisreal"; $somethingveryfishy=1; }
Indeed, there are cases where a Requires: makes no sense. Besides your fishy example, there might be cases where modules are only loaded conditionally (for example, if a script is called with a --use-more- modules ;-) option) OTOH, I'm not sure if having the automatic dependency detection completely disabled makes sense. Sure, there are cases where it bites back, but it will also cause some breakage if a required perl module isn't Required/installed. What about re-enabling the dependency detection for perl modules, but let it create Recommends: instead of Requires:? Or add a rpmlint check that warns about possibly missing Requires: or Recommends: to give packagers more control? I'd use a warning like "$script requires the Foo::Bar perl module, but this isn't mentioned in your spec file as Requires:perl(Foo::Bar) or Recommends:perl(Foo::Bar). Please add it, or $way_to_silence_this_warning_for_Foo::Bar" Gruß Christian Boltz -- Evolution ist ein echter Outlook-Clone - es kopiert saemtliche Fehler. [Thomas Hertweck in suse-linux] -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
On Thu, Sep 06, 2012 at 06:27:18PM +0200, Christian Boltz wrote:
OTOH, I'm not sure if having the automatic dependency detection completely disabled makes sense. Sure, there are cases where it bites back, but it will also cause some breakage if a required perl module isn't Required/installed.
CPAN gets the required dependencies from META.yml, why use a different mechanism than what upstream perl uses? Cheers, Michael. -- Michael Schroeder mls@suse.de SUSE LINUX Products GmbH, GF Jeff Hawn, HRB 16746 AG Nuernberg main(_){while(_=~getchar())putchar(~_-1/(~(_|32)/13*2-11)*13);} -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
Hello, On Thu, 06 Sep 2012, Michael Schroeder wrote:
On Thu, Sep 06, 2012 at 06:27:18PM +0200, Christian Boltz wrote:
OTOH, I'm not sure if having the automatic dependency detection completely disabled makes sense. Sure, there are cases where it bites back, but it will also cause some breakage if a required perl module isn't Required/installed.
I'd rather have that. That'd bite the packager. Not the user with missing modules.
CPAN gets the required dependencies from META.yml, why use a different mechanism than what upstream perl uses?
It's not always right either. And AFAIK _most_ packages still have no META.yml. But anyway: how about parsing META.yml/Makefile.PL files for Requires, .pm/.pl for "require"/"use" and use a "prune" list (rpm -q --provides of perl/perl-base) for pragmas and core modules? And output warnings, ideally with the right "Requires: perl(Foo::Bar)" for C&P in the output. Should be easy enough. -dnh -- Perl is the successful attempt to make a braindump executable. -- Lutz Donnerhacke -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
On 13.09.2012 19:55, David Haller wrote:
It's not always right either. And AFAIK _most_ packages still have no META.yml. But anyway: how about parsing META.yml/Makefile.PL files for Requires, .pm/.pl for "require"/"use" and use a "prune" list (rpm -q --provides of perl/perl-base) for pragmas and core modules? And output warnings, ideally with the right "Requires: perl(Foo::Bar)" for C&P in the output. Should be easy enough.
Give it a shot if you want it to happen. But cpanspec already parses META.yml and Makefile.PL and outputs requires. The original question was about *scripts* requiring - and those usually do not come from CPAN. Greetings, Stephan -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
participants (7)
-
Christian Boltz
-
David Haller
-
Dominique Leuenberger a.k.a DimStar
-
Michael Schroeder
-
Olaf Hering
-
Stephan Kulow
-
Vitezslav Cizek