change install location of files in rpm generated with cpan2rpm - perl

I am trying to generate RPMs with cpan2rpm command.
The generated rpm places files in /usr/local/share/perl5 instead of /usr/share/perl5.
cpan2rpm help doesn't seem to mention any option to do this.
Is it possible to change the location to /usr/share/perl5
command used
cpan2rpm --version 0.27 --release 1000000000.el8 --debug=1 --packager=XXXXXXX --distribution=unknown --author XXXXXXX (unknown) --no-sign Catalyst-Plugin-Session-0.40.tar.gz
perl version 5.26
as suggested in comments, I had configured the environment variable
export PERL_INSTALL_ROOT=/usr/share/perl5
but still the files are being generated to /usr/local/share/perl5
$ rpm -qlp /output/perl-Catalyst-Plugin-Session-0.40-1000000000.el8.noarch.rpm
/usr/local/share/man
/usr/local/share/man/man3
/usr/local/share/man/man3/Catalyst::Plugin::Session.3pm
/usr/local/share/man/man3/Catalyst::Plugin::Session::State.3pm
/usr/local/share/man/man3/Catalyst::Plugin::Session::Store.3pm
/usr/local/share/man/man3/Catalyst::Plugin::Session::Store::Dummy.3pm
/usr/local/share/man/man3/Catalyst::Plugin::Session::Test::Store.3pm
/usr/local/share/man/man3/Catalyst::Plugin::Session::Tutorial.3pm
/usr/local/share/perl5/Catalyst
/usr/local/share/perl5/Catalyst/Plugin
/usr/local/share/perl5/Catalyst/Plugin/Session
/usr/local/share/perl5/Catalyst/Plugin/Session.pm
/usr/local/share/perl5/Catalyst/Plugin/Session/State.pm
/usr/local/share/perl5/Catalyst/Plugin/Session/Store
/usr/local/share/perl5/Catalyst/Plugin/Session/Store.pm
/usr/local/share/perl5/Catalyst/Plugin/Session/Store/Dummy.pm
/usr/local/share/perl5/Catalyst/Plugin/Session/Test
/usr/local/share/perl5/Catalyst/Plugin/Session/Test/Store.pm
/usr/local/share/perl5/Catalyst/Plugin/Session/Tutorial.pod
/usr/share/doc/perl-Catalyst-Plugin-Session
/usr/share/doc/perl-Catalyst-Plugin-Session/Changes
/usr/share/doc/perl-Catalyst-Plugin-Session/README
/usr/share/doc/perl-Catalyst-Plugin-Session/inc
/usr/share/doc/perl-Catalyst-Plugin-Session/inc/Module
/usr/share/doc/perl-Catalyst-Plugin-Session/inc/Module/Install
/usr/share/doc/perl-Catalyst-Plugin-Session/inc/Module/Install.pm
/usr/share/doc/perl-Catalyst-Plugin-Session/inc/Module/Install/AuthorTests.pm
/usr/share/doc/perl-Catalyst-Plugin-Session/inc/Module/Install/Base.pm
/usr/share/doc/perl-Catalyst-Plugin-Session/inc/Module/Install/Can.pm
/usr/share/doc/perl-Catalyst-Plugin-Session/inc/Module/Install/Fetch.pm
/usr/share/doc/perl-Catalyst-Plugin-Session/inc/Module/Install/Makefile.pm
/usr/share/doc/perl-Catalyst-Plugin-Session/inc/Module/Install/Metadata.pm
/usr/share/doc/perl-Catalyst-Plugin-Session/inc/Module/Install/Win32.pm
/usr/share/doc/perl-Catalyst-Plugin-Session/inc/Module/Install/WriteAll.pm

Related

How to install libdata-validate-ip-perl in centos

I'm trying to use IP in my perl script and i got module not found error. When i tried to install it with dnf im getting no match found for the package.
use Data::Validate::IP;
Can't locate Data/Validate/IP.pm in #INC (you may need to install the
Data::Validate::IP module) (#INC contains: ../utils
/usr/local/lib64/perl5 /usr/local/share/perl5
/usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl
/usr/lib64/perl5 /usr/share/perl5) at ../utils/VM.pm line 5. BEGIN
failed--compilation aborted at ../utils/VM.pm line 5. Compilation
failed in require at ./myscript.pl line 37.
#dnf install libdata-validate-ip-perl
Extra Packages for Enterprise Linux 8 - Epel (Intel mirror) 5.6 kB/s | 4.7 kB 00:00
Last metadata expiration check: -1596 days, 2:25:26 ago on Wed 09 Nov 2022 09:59:43 AM IST.
No match for argument: libdata-validate-ip-perl
Error: Unable to find a match: libdata-validate-ip-perl
Looking for suggestions to install perl missing modules
"libdata-validate-ip-perl" would be the name of the package on Debian-based distributions, such as Ubuntu.
Redhat-based distributions use a different naming convention for their packages. Try "perl-Data-Validate-IP".
I would use
sudo cpan Data::Validate::IP
See here https://perldoc.perl.org/cpan

Executing DB2 commands '' db2start: command not found ''

I have one virtual server running on centos7. I configure it for the Nagios monitoring tool. I created the config file etc. I have 9 DB instances. When I migrated the DB config file with Nagios(adding to the Nagios )
I saw this error code on http://mysiteipaddr/nagios
CRITICAL - cannot connect to db.ipaddress.com. install_driver(DB2) failed: Can't locate DBD/DB2.pm in #INC (#INC contains: /usr/local/nagios/libexec /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at (eval 10) line 3.
After this error, I realize the DB2 is not installed on my machine. I've installed the DB2 drivers and when I execute this command I'm facing this output.
db2ls
-------------------------------------------------------------------------------------------------------------------
/opt/ibm/db2/V9.7 11.1.1.1 1 Fri Jan 31 11:33:28 2020 +03 0
[root#backup ~]#
But when I want to execute DB2 command like db2start, db2stop, db2status, it won't execute and I got this error code.
bash: db2stop: command not found
bash: db2start:command not found
Do you have an instance created? run /opt/ibm/db2/V9.7/instance/db2ilist
Please check the folder /home/tobe/sqllib/adm for db2start and db2stop commands. You can also define an alias if you want to call them directly.
Install below package in all of the instances:
yum -y install perl-CPAN
hope so this will be helpful for you....!!!!

How to write a spec file to build an rpm package?

How can I write a spec file for building an rpm package, if I have only 4 tasks?
Place my_file in /usr/local/mydir
Place the configuration file in the rsyslog.d
Place the logrotate file in logrptate.d
Echo "something" /etc/programm/programm.conf
My attempt:
1. Name: my_file
2. Version: 1.0
3. Release: 1
4. Summary: A sample package
5. Group: Applications/Productivity
6. License: GPL
7. Source0: my_file-1.0.tar.gz
8. BuildArch: i386
9. BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}.x86-64
10.
11. %description
12. This package basically does nothing, but it potentially could
13. do something useful.
14.
15.
16. %prep
17. %setup -q
18.
19. %build
20.
21.
22. %install
23. mkdir -p $RPM_BUILD_ROOT/usr/local/myfile
24.
25. install my_file $RPM_BUILD_ROOT/usr/local/myfile
26. install myfile-rsyslog.conf $RPM_BUILD_ROOT/etc/rsyslog.d
27.
28. install myfile-logrotate $RPM_BUILD_ROOT/etc/logrotate.d
29.
30. %files
31. %defattr(-,root,root)
32. /usr/local/myfile/my_file
33. /etc/rsyslog.d/myfile-rsyslog.conf
34. /etc/logrotate.d/myfile-logrotate
35.
36. %clean
37.
38. rm -rf $RPM_BUILD_ROOT
39.
40. %post
41. echo "something " >> /etc/programm/programm.conf
What did I understand wrong? Since I do not create a directory in %install, then when building rpm, the build tries to make an install to rsyslog.d and fails. What should be the correct sequence of actions? And then the task is simple - only 3 files, but solutions are offered everywhere difficult.
You are missing Requires and yes, you need to create those directories, if you want to install your files into them..
Somewhere between Line 9-11:
Requires: logrotate
Requires: rsyslog
Then in the install section:
%{__install} -Dm 0644 myfile-rsyslog.conf $RPM_BUILD_ROOT/etc/logrotate.d/myfile-rsyslog.conf
%{__install} -Dm 0644 myfile-logrotate $RPM_BUILD_ROOT/etc/rsyslog.d/myfile-logrotate
Here, %{__install} -Dm 0644 puts the file into the target directory and creates the target directory if it's missing. Your package shouldn't own the directory.

DBD::Sybase error

First of all, let me thank you for your time and knowledge sharing, I'm kind of an ignorant in trems of perl modules
I have a 64bit ubuntu Server 12.04, with Perl version 14, subversion 2 (v5.14.2) built for x86_64-linux-gnu-thread-multi and CPAN exploration and modules installation (v2.10).
I'm trying to use a perl script accessing a Microsoft SQL Server and I'm having a really hard time upon the DBD::Sybase module
When I try to install DBD::Sybase CPAN tells me it's already installed:
cpan[1]> install DBD::Sybase
Reading '/root/.cpan/Metadata'
Database was generated on Wed, 29 Apr 2015 14:53:21 GMT
DBD::Sybase is up to date (1.15).
I also find multiple Sybase.pm files on my filesystem, some of them are under Perl path
root#server:# find /* -name Sybase.pm
/home/usriten/download/DBD-Sybase-1.15/Sybase.pm
/root/.cpan/build/DBD-Sybase-1.15-TtUI0T/Sybase.pm
/root/.cpan/build/DBD-Sybase-1.15-kNqdf7/Sybase.pm
/root/.cpan/build/DBD-Sybase-1.15-rZgcTa/Sybase.pm
/usr/local/lib/perl/5.14.2/Sybase.pm
/usr/local/lib/perl/5.14.2/DBD/Sybase.pm
/usr/local/lib/perl/5.14.2/DBI/Sybase.pm
But when I try to run my script it returns an error on a line that calls 'if ($self->{handle} = DBI->connect('
# ./check_mssql_health --hostname <MSSQL_Server_IP> --username <SQL_User> --password <Pass> --mode connection-time
mode connection-time
CRITICAL - cannot connect to <MSSQL_Server_IP>. install_driver(Sybase) failed: Can't locate loadable object for module DBD::Sybase in #INC (#INC contains: . /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl) at (eval 10) line 3
Compilation failed in require at (eval 10) line 3.
Perhaps a module that DBD::Sybase requires hasn't been fully installed
at ./check_mssql_health line 3192
I've already spent a lot of time scavenging posts but I did not find a solution or at least one I could understand and Implement.
Best regards, SebastiĆ£o
When I try to install DBD::Sybase CPAN tells me it's already installed:
That simply means it found a DBD/Sybase.pm. No tests are performed; the module isn't even loaded.
In an act of desperation I've copied the Sybase.pm to the DBD/
That's the cause of the error you're asking about. Perl is finding the .pm you copied over, but not the other files created as part of the installation process.
Delete the files you created[1], then install the module properly (e.g. using your system's package manager if it has one, or cpan DBD::Sybase if it doesn't).
You appear to have created at least the following files:
/usr/local/lib/perl/5.14.2/Sybase.pm
/usr/local/lib/perl/5.14.2/DBD/Sybase.pm
/usr/local/lib/perl/5.14.2/DBI/Sybase.pm
I got it working with a different setup.
Don't use DBD::Sybase, but install freetds, unixodbc, and then DBD::ODBC. In the freetds.conf file set the appropriate parameters. Mine looks like this
[myMSSL]
host = 111.22.33.44
port = 1433
tds version = 7.2
client charset = UTF-8
and /etc/odbc.ini
[mySQSL_mydb]
APP = unixodbc
Description = Database mydb on myMSSQL
Driver = TDSdriver
Server = myhost
Database = mydb
Port = 1433
#Trace = No
I think these are the packages that you need.
libdbd-freetds - Freetds database server driver for libdbi
tdsodbc -ODBC driver for connecting to MS SQL and Sybase SQL servers
freetds-bin - FreeTDS command-line utiliti
ALternatively, see also this post:
Using Ubuntu, how do I install DBD::Sybase from CPAN?
(and some others, e.g this one: Access SQL Server from Solaris)
I would try and install it via apt
sudo apt-get install libdbd-sybase-perl -y
I've found CPAN to sometimes miss dependencies.

Perl - Getting an error with Net/SSLeay.pm - I am trying to POST XML via HTTPS web service

I am trying to use Net/SSLeay.pm in Perl, code says use Net::SSLeay
Error message says the following -
Can't locate Net/SSLeay.pm in #INC (#INC contains: C:/Perl/site/lib C:/Perl/lib .) at test.pl line 7.
BEGIN failed--compilation aborted at test.pl line 7.
I installed SSLeay.pm via Perl Package Manager and verified it -
Crypt-SSLeay
OpenSSL support for LWP
Version: 0.57
Released: 2008-05-02
Author: David Landgren
CPAN: http://search.cpan.org/dist/Crypt-SSLeay-0.57/
Installed files:
C:/Perl/lib/Crypt/SSLeay.pm
C:/Perl/lib/Crypt/SSLeay/CTX.pm
C:/Perl/lib/Crypt/SSLeay/Conn.pm
C:/Perl/lib/Crypt/SSLeay/Err.pm
C:/Perl/lib/Crypt/SSLeay/MainContext.pm
C:/Perl/lib/Crypt/SSLeay/X509.pm
C:/Perl/lib/Net/SSL.pm
C:/Perl/lib/auto/Crypt/SSLeay/.packlist
C:/Perl/lib/auto/Crypt/SSLeay/SSLeay.bs
C:/Perl/lib/auto/Crypt/SSLeay/SSLeay.dll
C:/Perl/lib/auto/Crypt/SSLeay/SSLeay.exp
C:/Perl/lib/auto/Crypt/SSLeay/SSLeay.lib
I am unsure as to why my script does not find it, any help would be appreciated.
Crypt-SSLeay and Net-SSLeay are two different CPAN distributions. If you want to use Net::SSLeay, install "Net-SSLeay" ppm distribution.