Closed Bug 679965 (bz_packagers) Opened 14 years ago Closed 13 years ago

Offer Linux packagers an easy way to specify the location of the Bugzilla modules

Categories

(Bugzilla :: Bugzilla-General, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 4.4

People

(Reporter: LpSolit, Assigned: LpSolit)

Details

Attachments

(2 files, 2 obsolete files)

In most Linux distributions, the Bugzilla modules (Bugzilla.pm and Bugzilla/*.pm) are not in the same directory as the *.cgi scripts when provided by a RPM or other package format. This forces them to edit all *.cgi scripts to fix the use lib qw(. lib); line to make it point to the new location, e.g. /usr/share/bugzilla/lib. The attached file is a fake Bugzilla.pm module which the packagers can put in the Perl directory, e.g. in /usr/lib/perl5/vendor_perl/5.x.y/ which will be loaded when the real Bugzilla.pm cannot be found. This module contains a $bz_root_dir variable which must point to the new location of the Bugzilla modules. With the example above, it would be: $bz_root_dir = '/usr/share/bugzilla/lib'; It will then add the new location in @INC and load the real Bugzilla.pm module transparently for the caller. This fake module requires *no* code change upstream and so works with all versions of Bugzilla. We could either offer this module in contrib/, or let it in this bug so that Linux packagers can find it and use it.
Comment on attachment 553979 [details] fake Bugzilla.pm module for Linux packagers >my ($bz_root_dir, @bugzilla_lib_paths); Those would have to be "our" instead of "my".
I think we should throw this in contrib or something, though, I like it.
s/my/our/
Attachment #553979 - Attachment is obsolete: true
Flags: approval?
Target Milestone: --- → Bugzilla 5.0
Comment on attachment 560826 [details] fake Bugzilla.pm module for Linux packagers, v1.1 > # Specify the path to the real Bugzilla.pm file. > # Some Linux distros may set it to '/usr/share/bugzilla/lib'. > # That's the single line you are supposed to edit in this file!! > $bz_root_dir = '/usr/share/bugzilla/lib'; You could also do this with a "use constant", which would eliminate the need for a BEGIN block.
Also, I think the one line that is going to be edited should be nearer the top of the file.
Now using constants. Tested, and works fine.
Attachment #560826 - Attachment is obsolete: true
Attachment #599392 - Flags: review?(dkl)
Comment on attachment 599392 [details] fake Bugzilla.pm module for Linux packagers, v2 Also asking bkor for review as he uses this file for real in the bugzilla RPM in Mageia.
Attachment #599392 - Flags: review?(bugzilla-mozilla)
Comment on attachment 599392 [details] fake Bugzilla.pm module for Linux packagers, v2 >use constant BZ_ROOT_DIR => '/usr/share/bugzilla/lib'; >use constant BZ_LIB_DIR => BZ_ROOT_DIR . '/lib'; These are effectively the same. Should it not be instead: use constant BZ_ROOT_DIR => '/usr/share/bugzilla'; FWIW, Fedora uses /usr/share/bugzilla as well but they leave all of Bugzilla.pm and Bugzilla/*.pm modules in the BZ_ROOT_DIR so this would not be necessary. But I can still test it and make sure it does work properly. dkl
I am getting errors from this based on Bugzilla::Constants::bz_locations gets the $libpath value based on where Bugzilla/Constants.pm resides. So if my Bugzilla modules are located at /usr/share/bugzilla/lib, bz_locations things the data files for example are /usr/share/bugzilla/lib/data/params which is incorrect. The data dir is in the same patch as my *.cgi scripts at a different location. How were you able to work around this in your testing? dkl
Comment on attachment 599392 [details] fake Bugzilla.pm module for Linux packagers, v2 r- based on comment 9 unless I am doing something wrong. dkl
Attachment #599392 - Flags: review?(dkl) → review-
Comment on attachment 599392 [details] fake Bugzilla.pm module for Linux packagers, v2 You of course have to fix paths specified in bz_locations() if they are not standard. This fake Bugzilla.pm is not going to do it for you. Its goal is to let .cgi and .pl scripts find the real Bugzilla.pm and others Bugzilla/*.pm files. From there, it's the job of bz_locations() to have the right data in it.
Attachment #599392 - Flags: review- → review?(dkl)
Comment on attachment 599392 [details] fake Bugzilla.pm module for Linux packagers, v2 I dont understand. all of the comment in bz_locations() says that it assumes all bz data is in the same dir as Bugzilla/Constants.pm. With your comment im 679965, the comments are therefore wrong So the packager would either 1) leave Bugzilla/Constants.pm in the cgi dir, 2) make bz_locations() use a different method of determining its current directory or 3) require the packager to manually add the right paths to Bugzilla/Constants.pm wherever the modules reside. dkl
Comment on attachment 599392 [details] fake Bugzilla.pm module for Linux packagers, v2 r+ knowing that packagers will need to manually patch Constants.pm and checksetup.pl to work with the fake Bugzilla.pm module. dkl
Attachment #599392 - Flags: review?(dkl) → review+
Attachment #599392 - Flags: review?(bugzilla-mozilla)
Flags: approval? → approval+
Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/trunk/ added contrib/Bugzilla.pm Committed revision 8150.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
I forgot to fix permissions for contrib/Bugzilla.pm. By default, all files in contrib/ are executable. This shouldn't be the case for Bugzilla.pm. Committing to: bzr+ssh://lpsolit%40gmail.com@bzr.mozilla.org/bugzilla/trunk/ modified Bugzilla/Install/Filesystem.pm Committed revision 8175.
Comment on attachment 613393 [details] [diff] [review] fix perms on contrib/Bugzilla.pm >+ 'contrib/Bugzilla.pm', => { perms => OWNER_WRITE }, FYI, I removed the extra comma before => on checkin.
Added to relnotes for 4.4.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: