Bug 1026652

Summary: openshift-origin-cartridge-perl/bin/build tries to update dependencies it cannot build (DB_File)
Product: OpenShift Online Reporter: mephinet <mephinet>
Component: ImageAssignee: Michal Fojtik <mfojtik>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 2.xCC: bmeng, dmcphers, mfojtik, tdawson, yadu
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-01-30 00:49:47 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description mephinet 2013-11-05 07:15:21 UTC
In order to get a simple persistent cache for my database update script in my perl-cartridge based openshift app, I decided to use DB_File. As it's part of perl 5, I did not add it to the deplist.txt. However, after a git push, deploying fails. It turns out that the reason for this is that the deploy script detects DB_File as a depencency and adds it to the modules to be cpanm'ed. cpanm realizes that the DB_File of perl5 is not up-to-date (1.820 vs. 1.830) and tries to install it - resulting in:

Note (probably harmless): No library found for -ldb
...
version.c:30:16: error: db.h: No such file or directory

This makes it impossible to use DB_File with openshift. Possible solutions I could think of:
* Excluding this module from the update list
* More general, adding a blocklist.txt for purposes where I do not want to have a dependency updated
* installing db-devel on the openshift nodes so that building DB_File is successful

Steps to reproduce:

* create an empty perl cartridge
* add a script to the repository that contains "use DB_File;"
* call git push

Expected result:
* git push is successful

Actual result:
* git push fails when trying to update DB_File

Comment 4 Michal Fojtik 2013-11-06 20:16:37 UTC
I reproduced this issues on devenv, after installing db4-devel I was able to successfully push the perl app with 'use DB_File;'. The DB_File module is compiled without errors.

remote: Building Perl cartridge
remote: --> Working on DB_File
remote: Fetching http://mirror1.ops.rhcloud.com/mirror/perl/CPAN/authors/id/P/PM/PMQS/DB_File-1.830.tar.gz ... OK
remote: Configuring DB_File-1.830 ... OK
remote: Building DB_File-1.830 ... OK
remote: Successfully installed DB_File-1.830 (upgraded from 1.820)
remote: 1 distribution installed
remote: Preparing build for deployment
remote: Deployment id is b450a780
remote: Activating deployment
remote: Starting Perl cartridge
remote: Result: success
remote: Activation status: success
remote: Deployment completed with status: success
To ssh://527aa2e1f3f3dddb1e0004b2.rhcloud.com/~/git/perl01.git/
   8efe8b2..4bc1948  master -> master

Comment 5 Michal Fojtik 2013-11-06 20:20:55 UTC
mephinet: I asked Operations guys to push the -devel RPM into OpenShift Online. We will update this bug once it will be ready for consumption. Thanks for reporting this one!

Comment 6 Dan McPherson 2013-11-06 20:29:59 UTC
@michal  I think you want to add the require to the rpm.

Comment 7 mephinet 2013-11-06 20:49:05 UTC
Great, thanks!

Comment 10 Michal Fojtik 2013-11-07 09:56:37 UTC
Meng Bo: Can you please try again? I think I was too fast setting this bug ON_QA. Sorry.

Comment 11 Meng Bo 2013-11-08 06:06:00 UTC
Checked on devenv_4003, issue has been fixed.

remote: Building Perl cartridge
remote: --> Working on DB_File
remote: Fetching http://mirror1.ops.rhcloud.com/mirror/perl/CPAN/authors/id/P/PM/PMQS/DB_File-1.830.tar.gz ... OK
remote: Configuring DB_File-1.830 ... OK
remote: Building DB_File-1.830 ... OK
remote: Successfully installed DB_File-1.830 (upgraded from 1.820)
remote: 1 distribution installed
remote: Preparing build for deployment
remote: Deployment id is 595a81f1
remote: Activating deployment
remote: Starting Perl cartridge
remote: Result: success
remote: Activation status: success
remote: Deployment completed with status: success

Move bug to verified.

Comment 12 Yan Du 2013-12-25 03:21:26 UTC
Test on devenv_4170

create a perl app, add "use DB_File;" to index.pl, and git push 

remote: Building Perl cartridge
remote: ***   Skipping module DB_File install from CPAN (found in system).
remote: ***   Please add DB_File to deplist.txt to install it from CPAN.
remote: Preparing build for deployment
remote: Deployment id is 50ef05d2
remote: Activating deployment
remote: Starting Perl cartridge
remote: Result: success
remote: Activation status: success
remote: Deployment completed with status: success


then add DB_File to deplist.txt and push again, still show the above information.

Comment 13 Michal Fojtik 2014-01-03 13:52:26 UTC
remote: Building Perl cartridge
remote: ***   Skipping module DB_File install from CPAN (found in system).

this means the module was found in system which is what we want :-)

Comment 14 mephinet 2014-01-03 13:59:17 UTC
I disagree, it does not work as advertised, as the next line states:

remote: ***   Please add DB_File to deplist.txt to install it from CPAN.

which is what I want to do (because the one found in system is too old for my requirements).

Comment 15 Michal Fojtik 2014-01-03 14:56:38 UTC
mephinet: Ah I see, so specifying the module in deplist does not work when the module is found in system. I will take a look.

Comment 16 Michal Fojtik 2014-01-03 15:12:56 UTC
https://github.com/openshift/origin-server/pull/4410

This should fix the problem, with this fix all system/local checks are disabled when the module is listed in deplist.txt.

Comment 17 mephinet 2014-01-05 17:43:19 UTC
Your fix looks good (it seems to me as if this rather addresses #1046753 then the DB_File issue, though)

Comment 18 openshift-github-bot 2014-01-06 11:44:41 UTC
Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/605a838475bab6ab1cf6dcbe1cb26aae5cb83b5a
Bug 1026652 - Skip module checks if module exists in perl deplist.txt

Comment 19 Yan Du 2014-01-07 02:28:28 UTC
Test on devenv_4191, 

1. Create a perl app, add "use DB_File;" to index.pl, and git push

remote: Stopping Perl cartridge
remote: [Mon Jan 06 21:25:17 2014] [warn] PassEnv variable SHELL was undefined
remote: [Mon Jan 06 21:25:17 2014] [warn] PassEnv variable USER was undefined
remote: [Mon Jan 06 21:25:17 2014] [warn] PassEnv variable LOGNAME was undefined
remote: Waiting for stop to finish
remote: Building git ref 'master', commit bd58898
remote: Building Perl cartridge
remote: ***   Skipping module DB_File install from CPAN (found in system).
remote: ***   Please add DB_File to deplist.txt to install it from CPAN.
remote: Preparing build for deployment
remote: Deployment id is 6e0e71e5
remote: Activating deployment
remote: Starting Perl cartridge
remote: Result: success
remote: Activation status: success
remote: Deployment completed with status: success
To ssh://52cb64d70b8a3a3c3a000007.rhcloud.com/~/git/perl.git/
   a5231c8..bd58898  master -> master

2. Add DB_File to deplist.txt and push again

remote: Stopping Perl cartridge
remote: Waiting for stop to finish
remote: Building git ref 'master', commit b58ce55
remote: Building Perl cartridge
remote: --> Working on DB_File
remote: Fetching http://mirror1.ops.rhcloud.com/mirror/perl/CPAN/authors/id/P/PM/PMQS/DB_File-1.831.tar.gz ... OK
remote: Configuring DB_File-1.831 ... OK
remote: Building DB_File-1.831 ... OK
remote: Successfully installed DB_File-1.831 (upgraded from 1.820)
remote: 1 distribution installed
remote: Preparing build for deployment
remote: Deployment id is b7cfa1e3
remote: Activating deployment
remote: Starting Perl cartridge
remote: Result: success
remote: Activation status: success
remote: Deployment completed with status: success
To ssh://52cb64d70b8a3a3c3a000007.rhcloud.com/~/git/perl.git/
   bd58898..b58ce55  master -> master


Issue have been fixed. Move to verified. Thanks.