Bug 999427 - Publican 3.2.0 Not using /usr/share/publican for xsl and Common Content files.
Summary: Publican 3.2.0 Not using /usr/share/publican for xsl and Common Content files.
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Publican
Classification: Community
Component: publican
Version: future
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Jeff Fearn 🐞
QA Contact: tools-bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-08-21 10:10 UTC by Norman Dunbar
Modified: 2013-12-19 02:46 UTC (History)
3 users (show)

Fixed In Version: 4.0.0
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-12-19 02:46:32 UTC
Embargoed:


Attachments (Terms of Use)

Description Norman Dunbar 2013-08-21 10:10:56 UTC
Description of problem:

I installed Publican 3.2.0 from source, on a Linux Mint 13 KDE disto, 64 bit using the CPAN method as mentioned in README:

$ perl Build.PL
$ ./Build installdeps
$ ./Build
$ ./Build test
$ sudo ./Build install

This worked fine and the various xsl files and brands etc were installed to /usr/share/publican as expected.

When building a book, the brand files and pdf/xsl were loaded from the local directory where I had extracted the source code and built it:

/home/norman/Publican/Publican-v3.2.0/blib/datadir/Common_Contents etc.


I can work around this by using the comment_config parameter in my book's publican.cfg:

$ cat publican.cfg 
xml_lang: en-US
type: book
brand: jms
tmp_dir: build_tmp
debug: 1
# common_content: /usr/share/publican/Common_Content
common_config: /usr/share/publican

Using common_content makes no difference, hence it is commented out in publican.cfg. Using common_config as above forces publican to use the files in /usr/share/publican, as expected.


Version-Release number of selected component (if applicable):

Publican 3.2.0


How reproducible:

Constantly.


Steps to Reproduce:

1. Perform CPAN install of Publican 3.2.0 as detailed above.
2. Build a book that has built before. The output will show that the files used were taken from the source directory rather than where installed to.
3. Add common_config=/usr/share/publican to publican.cfg and it will use the expected files from /usr/share/publican.


Actual results:

Without common_config:

$ grep -i common publican.cfg 
### common_config: /usr/share/publican

$ publican build --formats-pdf --langs=en-US

DEBUG: Publican: config loaded
Setting up en-US
        Processing file build_tmp/en-US/xml/Common_Content/Conventions.xml -> build_tmp/en-US/xml/Common_Content/Conventions.xml
....
Beginning work on en-US
DTD Validation OK
        Starting pdf
        Using XML::LibXSLT on /home/norman/Publican/Publican-v3.2.0/blib/datadir/xsl/pdf.xsl
....
DEBUG: Publican::Builder: end of build

The "using XML::LibXSLT" line above shows the problem.



With common_config:


$ grep -i common publican.cfg 
### common_config: /usr/share/publican

$ publican build --formats-pdf --langs=en-US

DEBUG: Publican: config loaded
Setting up en-US
        Processing file build_tmp/en-US/xml/Common_Content/Conventions.xml -> build_tmp/en-US/xml/Common_Content/Conventions.xml
....
Beginning work on en-US
DTD Validation OK
        Starting pdf
        Using XML::LibXSLT on /usr/share/publican/xsl/pdf.xsl
....
DEBUG: Publican::Builder: end of build

The "using XML::LibXSLT" line above shows the change that common_config has made to allow Publican to use the installed files..


Expected results:

As per the second example above, by default, Publican should be using the files in /usr/share/publican and not those from the directory that the source code was compiled.


Additional info:

Jeff requested the output from the following command:

$ perl -e 'use Publican::ConfigData; print Publican::ConfigData->config('datadir'), "\n";'

/home/norman/Publican/Publican-v3.2.0/blib/datadir

This means that I must keep my source files hanging around to ensure that Publican works. Prior to the install there was no directory /usr/share/publican, that - and its contents - were created by the "sudo ./Build install" command.

$ whereis publican
publican: /usr/local/bin/publican /usr/share/publican


Jeff is of the opinion that the User Guide is incorrect and that neither common_contect or common_config should work in a publican.cfg file. However, it seems that at least one of them does, and helps me work around my problem. The section in the Publican 3.2 manual is:

Chapter 4. Creating a document - Page 22 (on A4 sized paper)
Appendix C. publican.cfg parameters - Page 120 (on A4 sized paper)

Appendix B. Command summary - Page 112 (on A4 sized paper) also details these two parameters but as command line options, not as configuration file options.


The following is the log/output from a complete session set up to display this problem:

$ ##############################################################################
$ ## Create dummy book.
$ ##############################################################################
$ publican create -type=book -name=Build_Problems --lang=en-US
        Processing file en-US/Author_Group.xml -> en-US/Author_Group.xml
        Processing file en-US/Book_Info.xml -> en-US/Book_Info.xml
        Processing file en-US/Build_Problems.xml -> en-US/Build_Problems.xml
        Processing file en-US/Chapter.xml -> en-US/Chapter.xml
        Processing file en-US/Preface.xml -> en-US/Preface.xml
        Processing file en-US/Revision_History.xml -> en-US/Revision_History.xml
        

$ ##############################################################################
$ ## Debugging enabled.
$ ##############################################################################
$ cd Build_Problems/
$ echo "debug: 1" >> publican.cfg


$ ##############################################################################
$ Check debugging enabled.
$ ##############################################################################
$ cat publican.cfg

# Config::Simple 4.59
# Wed Aug 21 10:56:44 2013

xml_lang: "en-US"
type: Book
brand: common
debug: 1


$ ##############################################################################
$ Test build. Should use local xsl and common content files.
$ ##############################################################################
$ publican build --formats=pdf --langs=all

DEBUG: Publican: config loaded
Setting up en-US
        Processing file tmp/en-US/xml/Common_Content/Conventions.xml -> tmp/en-US/xml/Common_Content/Conventions.xml
        Processing file tmp/en-US/xml/Common_Content/Feedback.xml -> tmp/en-US/xml/Common_Content/Feedback.xml
        Processing file tmp/en-US/xml/Common_Content/Legal_Notice.xml -> tmp/en-US/xml/Common_Content/Legal_Notice.xml
        Processing file tmp/en-US/xml/Common_Content/Program_Listing.xml -> tmp/en-US/xml/Common_Content/Program_Listing.xml
        Processing file tmp/en-US/xml/Common_Content/Revision_History.xml -> tmp/en-US/xml/Common_Content/Revision_History.xml
        Processing file tmp/en-US/xml_tmp/Author_Group.xml -> tmp/en-US/xml/Author_Group.xml
        Processing file tmp/en-US/xml_tmp/Book_Info.xml -> tmp/en-US/xml/Book_Info.xml
        Processing file tmp/en-US/xml_tmp/Build_Problems.xml -> tmp/en-US/xml/Build_Problems.xml
        Processing file tmp/en-US/xml_tmp/Chapter.xml -> tmp/en-US/xml/Chapter.xml
        Processing file tmp/en-US/xml_tmp/Preface.xml -> tmp/en-US/xml/Preface.xml
        Processing file tmp/en-US/xml_tmp/Revision_History.xml -> tmp/en-US/xml/Revision_History.xml
Beginning work on en-US
DTD Validation OK
        Starting pdf
        Using XML::LibXSLT on /home/norman/Publican/Publican-v3.2.0/blib/datadir/xsl/pdf.xsl
Making portrait pages on A4 paper (210mmx297mm)
[warning] /usr/bin/fop: Unable to locate servlet-api in /usr/share/java
Default page-height set to: 240mm
Default page-width set to: 120mm
        Finished pdf

DEBUG: Publican::Builder: end of build


$ ##############################################################################
$ Enable common_config.
$ ##############################################################################
$ echo "common_config: /usr/share/publican" >> publican.cfg


$ ##############################################################################
$ Check common_config enabled.
$ ##############################################################################
$ cat publican.cfg 

# Config::Simple 4.59
# Wed Aug 21 10:56:44 2013

xml_lang: "en-US"
type: Book
brand: common
debug: 1
common_config: /usr/share/publican



$ ##############################################################################
$ Test build. Should use global xsl and common content files.
$ ##############################################################################
$ publican build --formats=pdf --langs=all

DEBUG: Publican: config loaded
Setting up en-US
        Processing file tmp/en-US/xml/Common_Content/Conventions.xml -> tmp/en-US/xml/Common_Content/Conventions.xml
        Processing file tmp/en-US/xml/Common_Content/Feedback.xml -> tmp/en-US/xml/Common_Content/Feedback.xml
        Processing file tmp/en-US/xml/Common_Content/Legal_Notice.xml -> tmp/en-US/xml/Common_Content/Legal_Notice.xml
        Processing file tmp/en-US/xml/Common_Content/Program_Listing.xml -> tmp/en-US/xml/Common_Content/Program_Listing.xml
        Processing file tmp/en-US/xml/Common_Content/Revision_History.xml -> tmp/en-US/xml/Common_Content/Revision_History.xml
        Processing file tmp/en-US/xml_tmp/Author_Group.xml -> tmp/en-US/xml/Author_Group.xml
        Processing file tmp/en-US/xml_tmp/Book_Info.xml -> tmp/en-US/xml/Book_Info.xml
        Processing file tmp/en-US/xml_tmp/Build_Problems.xml -> tmp/en-US/xml/Build_Problems.xml
        Processing file tmp/en-US/xml_tmp/Chapter.xml -> tmp/en-US/xml/Chapter.xml
        Processing file tmp/en-US/xml_tmp/Preface.xml -> tmp/en-US/xml/Preface.xml
        Processing file tmp/en-US/xml_tmp/Revision_History.xml -> tmp/en-US/xml/Revision_History.xml
Beginning work on en-US
DTD Validation OK
        Starting pdf
        Using XML::LibXSLT on /usr/share/publican/xsl/pdf.xsl
Making portrait pages on A4 paper (210mmx297mm)
[warning] /usr/bin/fop: Unable to locate servlet-api in /usr/share/java
Default page-height set to: 240mm
Default page-width set to: 120mm
        Finished pdf

DEBUG: Publican::Builder: end of build

Comment 2 HSS Product Manager 2013-09-23 06:47:45 UTC
HSS-QE has reviewed and declined this request. QE for this bug will be handled by IED.

Comment 3 Jeff Fearn 🐞 2013-09-24 01:44:50 UTC
Hi Norman, I'm testing this in the devel & master branches and I can not duplicate this behavior. 

On a clean RHEL6 VM using the CPAN install instructions, after running 'sudo ./Build install' running `tail -n15 /usr/share/perl5/vendor_perl/Publican/ConfigData.pm` shows:

__DATA__
do{ my $x = [
       {
         'web' => '/usr/share/publican/sitetemplate',
         'rpm_templates' => '/usr/share/publican/rpm_templates',
         'docdir' => '/usr/share/doc/',
         'datadir' => '/usr/share/publican',
         'book_templates' => '/usr/share/publican/book_templates',
         'etc' => '/etc',
         'templates' => '/usr/share/publican/templates'
       },
       {},
       {}
     ];
$x; }

It's possible this is an issue with Module::Build, can you confirm which version of Module::Build you are using?

Comment 4 Jeff Fearn 🐞 2013-09-24 01:53:18 UTC
gah cut n paste from the VM failed, that file path should be /usr/local/share/perl5/Publican/ConfigData.pm but the content is still correct.

Comment 5 Norman Dunbar 2013-09-28 12:50:25 UTC
Hi Jeff,

sorry about the delay, I've just started a new job and things are a tad "intense" at the moment. This is the first time I've been at my computer in ages!

Anyway, I did the following and I can see different results from what you see. I'm on Linux Mint 13 KDE 64 bit at the moment, so the paths etc are not quite the same as yours:

$ tail -n15 /usr/local/share/perl/5.14.2/Publican/ConfigData.pm 

__DATA__
do{ my $x = [
       {
         'web' => '/home/norman/Publican/Publican-v3.2.1/blib/web',
         'docdir' => '/home/norman/Publican/Publican-v3.2.1/pod1',
         'datadir' => '/home/norman/Publican/Publican-v3.2.1/blib/datadir',
         'book_templates' => '/home/norman/Publican/Publican-v3.2.1/blib/book_templates',
         'etc' => '/home/norman/Publican/Publican-v3.2.1/blib/etc',
         'templates' => '/home/norman/Publican/Publican-v3.2.1/blib/templates'
       },
       {},
       {}
     ];
$x; }



Now, as for what version of Module::Build I'm using? I searched and found /usr/share/perl/5.14.2/Module/Build.pm which has this at the top:

...
use Module::Build::Base;

use vars qw($VERSION @ISA);
@ISA = qw(Module::Build::Base);
$VERSION = '0.3800';
$VERSION = eval $VERSION;


and /usr/share/perl/5.14.2/Module/Build/Base.pm which has this:

...
use vars qw($VERSION);
$VERSION = '0.3800';
$VERSION = eval $VERSION;


Is there a command to get the version of a Perl module? I'm not a Perl programmer so I'm afraid I'm pretty useless!


Thanks.

Comment 6 Jeff Fearn 🐞 2013-09-30 04:50:06 UTC
(In reply to Norman Dunbar from comment #5)
> Hi Jeff,
> 
> sorry about the delay, I've just started a new job and things are a tad
> "intense" at the moment. This is the first time I've been at my computer in
> ages!

That sounds like heaven!

> Anyway, I did the following and I can see different results from what you
> see. I'm on Linux Mint 13 KDE 64 bit at the moment, so the paths etc are not
> quite the same as yours:
> 
> $ tail -n15 /usr/local/share/perl/5.14.2/Publican/ConfigData.pm 
> 
> __DATA__
> do{ my $x = [
>        {
>          'web' => '/home/norman/Publican/Publican-v3.2.1/blib/web',
>          'docdir' => '/home/norman/Publican/Publican-v3.2.1/pod1',
>          'datadir' => '/home/norman/Publican/Publican-v3.2.1/blib/datadir',
>          'book_templates' =>
> '/home/norman/Publican/Publican-v3.2.1/blib/book_templates',
>          'etc' => '/home/norman/Publican/Publican-v3.2.1/blib/etc',
>          'templates' =>
> '/home/norman/Publican/Publican-v3.2.1/blib/templates'
>        },
>        {},
>        {}
>      ];
> $x; }

It looks like the path isn't getting updated when install is ran. Can you test install without running test?

e.g.

$ perl Bild.pm
$ ./Build
$ ./Bu
> 
> 
> Now, as for what version of Module::Build I'm using? I searched and found
> /usr/share/perl/5.14.2/Module/Build.pm which has this at the top:
> 
> ...
> use Module::Build::Base;
> 
> use vars qw($VERSION @ISA);
> @ISA = qw(Module::Build::Base);
> $VERSION = '0.3800';
> $VERSION = eval $VERSION;
> 
> 
> and /usr/share/perl/5.14.2/Module/Build/Base.pm which has this:
> 
> ...
> use vars qw($VERSION);
> $VERSION = '0.3800';
> $VERSION = eval $VERSION;
> 
> 
> Is there a command to get the version of a Perl module? I'm not a Perl
> programmer so I'm afraid I'm pretty useless!
> 
> 
> Thanks.

$ perl -MModule::Build -e 'print $Module::Build::VERSION, "\n"'

Comment 7 Norman Dunbar 2013-09-30 20:24:30 UTC
Evening Jeff,

Building & installing without testing:

$ perl Build.PL
Created MYMETA.yml and MYMETA.json
Creating new 'Build' script for 'Publican' version 'v3.2.1'


$ ./Build
Building Publican
DEBUG: Publican: config loaded
...
DEBUG: Publican::Builder: end of build


$ sudo ./Build install
[sudo] password for norman: 
Building Publican
...
DEBUG: Publican::Builder: end of build
Installing /usr/share/publican/Common_Content/jms/defaults.cfg
Installing /usr/local/share/perl/5.14.2/Publican/ConfigData.pm
Installing /usr/local/man/man3/Publican::ConfigData.3pm

So it looks like it's doing the right thing this time. 


Running your check again:

$  tail -n15 /usr/local/share/perl/5.14.2/Publican/ConfigData.pm

__DATA__
do{ my $x = [
       {
         'web' => '/usr/share/publican/sitetemplate',
         'docdir' => '/usr/share/doc/',
         'datadir' => '/usr/share/publican',
         'book_templates' => '/usr/share/publican/book_templates',
         'etc' => '/etc',
         'templates' => '/usr/share/publican/templates'
       },
       {},
       {}
     ];
$x; }


Module Build version:

perl -MModule::Build -e 'print $Module::Build::VERSION, "\n"'
0.38

This matches with the extract from the code above, ($VERSION = '0.3800';)

HTH

As for "Heaven", well, let's just say it's ok, until I manage to get to my laptop at the end of the week and have to deal with hundreds of emails etc! And not all of it is spam either.

At least there's cider! :-)

Cheers,
Norm.

Comment 8 Jeff Fearn 🐞 2013-10-01 00:52:51 UTC
I forced it to rewrite ConfigData.pm after running the tests, should work on all platforms now.

To ssh://git.fedorahosted.org/git/publican.git
   9d087c5..5d2eaf9  HEAD -> devel

mmm cider

Comment 9 Norman Dunbar 2013-10-05 13:49:35 UTC
Hi Jeff,

I had a look online at the git repository, I can't see that commit anywhere. However, I cloned the repo and I'll get around to a rebuild at some point soon.

Today, I'm making cider would you believe!


Cheers,
Norm.

Comment 10 Ruediger Landmann 2013-10-26 22:19:12 UTC
This still seems broken in 3.99-0.t20

I did a CPAN build on OpenSuSE 12.3 then tried building a book:

Beginning work on en-US
RelaxNG Validation OK
        Starting html
        Using XML::LibXSLT on /home/rlandmann/publican/blib/datadir/Common_Content/common-db5/xsl/html.xsl        

But:

> whereis publican
publican: /usr/bin/publican /usr/bin/X11/publican /usr/share/publican /usr/share/man/man1/publican.1

Does ConfigData.pm get rewritten only after a successful run of the tests?

Many tests failed for me because of a problem in my OpenSuSE DocBook 4 installation: lots of:

FATAL ERROR: en-US/Book_Info.xml: Can't resolve '-//OASIS//DTD DocBook XML V4.5//EN' at /usr/lib/perl5/vendor_perl/5.16.2/x86_64-linux-thread-multi/XML/Parser/Expat.pm line 470.
 at /usr/bin/publican line 790.

Norman, are you able to help verify this fix? Does it work for you?

(Alternatively, if someone can help me figure out what's broken in DocBook 4 on OpenSuSE, I'm happy to try again. I found this bug, which looks relevant, but I couldn't figure out where to apply the workaround: https://bugzilla.novell.com/show_bug.cgi?id=828872 The catalogs on my install look OK to me, so maybe it's not related after all?)

Comment 11 Ruediger Landmann 2013-10-27 01:58:40 UTC
I also tried to get this working on Mint 15, but it failed a large part of the test suite:

FATAL ERROR: en-US/Book_Info.xml: 
No such file or directory at /usr/lib/perl5/XML/Parser/Expat.pm line 470.
 at line 123, column 0, byte 4432
Handler couldn't resolve external entity at line 123, column 0, byte 4432
error in processing external entity reference at line 123, column 0, byte 4432
error in processing external entity reference at line 3, column 1, byte 163 at /usr/lib/perl5/XML/Parser.pm line 187.
 at /usr/local/bin/publican line 521.


And when I went ahead and installed the results anyway, it wouldn't even get as far as OpenSuSE did, so the bug didn't get a chance to present. So maybe this isn't an OpenSuSE problem?

Comment 12 Ruediger Landmann 2013-10-29 05:02:43 UTC
OK, well, at last I did a CPAN-based build on Fedora, building the deps that way instead of relying on what's shipped in the distro. Build passed all the tests, and then worked exactly as expected:

$ rpm -q publican
package publican is not installed
$ publican -v
version=v3.9.9

Then, when building a book:

Beginning work on en-US
DTD Validation OK
        Starting HTML
        Using XML::LibXSLT on /usr/share/publican/xsl/html.xsl


I'm calling it verified at this point, on 3.9.9-0%{?dist}.t23

Comment 13 Norman Dunbar 2013-10-29 19:04:11 UTC
Evening Ruediger,

I'm no longer using OpenSuse, but I'll set up a VirtualBox VM and install 12.4 as you requested and see if I can build a book for you.

I'm on Mint 13 KDE at the moment, on my laptop, and that's working fine with a CPAN based build.


Watch this space!

Cheers,
Norm.

Comment 14 Norman Dunbar 2013-11-15 15:02:46 UTC
(In reply to Ruediger Landmann from comment #10)
>

> 
> Does ConfigData.pm get rewritten only after a successful run of the tests?

I'm sure Jeff told me to try an install prior to running the tests. I did this and it was fine for me. That was on Linux Mint 13 KDE though.


> Many tests failed for me because of a problem in my OpenSuSE DocBook 4
> installation: lots of:
> 

> Norman, are you able to help verify this fix? Does it work for you?

I've got a VM running with OpenSuse 12.3 and Publican 3.2.1 still has this problem after a source build with CPAN.

What's the URL to grab the latest source code by the way, the one mentioned in the User Guide for Open Suse build instructions is no more - we seem to have left Subversion behind and moved to Git? 

I think, but I'm not sure, I need to get the latest development code rather than just the 3.2.1 release?

Then I can confirm if the problem has gone away, but I have so far only confirmed that it still exists in OpenSuse 12.3.

I do not get the XML Catalog problems though.


> (Alternatively, if someone can help me figure out what's broken in DocBook 4
> on OpenSuSE, I'm happy to try again. I found this bug, which looks relevant,
> but I couldn't figure out where to apply the workaround:
> https://bugzilla.novell.com/show_bug.cgi?id=828872 The catalogs on my
> install look OK to me, so maybe it's not related after all?)

Where are your catalogs located, and what do they look like, I'll compare with mine here if you like?


Cheers,
Norm.

Comment 15 Norman Dunbar 2013-11-15 15:58:50 UTC
Ok, I got the source for 3.9.9 and tried building it on Linux Mint first. I had a few new dependencies to install with CPAN, no problems there, but then this happened:



$ ./Build

...
Setting up fr-FR
        Merging fr-FR/Conventions.po >> en-US/Conventions.xml -> tmp/fr-FR/xml_tmp//Conventions.xml
        Merging fr-FR/Feedback.po >> en-US/Feedback.xml -> tmp/fr-FR/xml_tmp//Feedback.xml

undefined entity at line 4, column 53, byte 114:
<!DOCTYPE title [
]>
<title processed="1">Vos commentaires sont importants&nbsp;!</title>
====================================================^
 at /usr/lib/perl5/XML/Parser.pm line 187.


So it looks like something is broken, in French!


Cheers,
Norm.

Comment 16 Jeff Fearn 🐞 2013-11-25 06:46:22 UTC
The entity has been removed so the build works.


Note You need to log in before you can comment on or make changes to this bug.