Bug 798485

Summary: Support out-of-tree builds
Product: [Community] Publican Reporter: Peter Hutterer <peter.hutterer>
Component: publicanAssignee: Jeff Fearn <jfearn>
Status: CLOSED CURRENTRELEASE QA Contact: Ruediger Landmann <rlandman+disabled>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: futureCC: mhideo, rlandman+disabled, tcapek
Target Milestone: 3.0Keywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: 3.0.0 Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-10-30 23:11:15 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 820023    

Description Peter Hutterer 2012-02-28 21:15:21 EST
Description of problem:
Integrating publican builds with autotools is a pain ATM since publican must be run from the source directory. automake's make distcheck sets up a separate _build directory from which publican will be run if it is hooked up correctly. 

The config file can be specified on the commandline, but the source files cannot.

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

How reproducible:
Try to build from a directory elsewhere.

Steps to Reproduce:
1. publican create --name=foo
2. mkdir foo/_build # illustrates make distcheck structure
3. cd foo/_build
4. publican build --config=../publican.cfg --formats=html --lang=en-US 
Actual results:
Can't locate required file: en-US/Book_Info.xml at /usr/bin/publican line 647

Expected results:
A --source commandline flag or somesuch to specify the location of the source tree.

Additional info:
Automake makes the source tree read-only, so Bug 798484 comes into play here
Comment 1 Jeff Fearn 2012-02-29 00:59:48 EST
Added new option, src_dir, to allow specifying a directory to look for publican sources in. Since it seemed redundant to also specify the cfg file it looks for the cfg file relative to the source directory.

The main reason for the config_file parameter is it allows having multiple profiles for books, i.e. sharing a book between different versions or products, so it makes sense to do it this way.

$ grep tmp_dir /home/jfearn/publican/Users_Guide/publican.cfg 
tmp_dir: build

$ cd  /tmp

$ publican build --formats=html --lang=en-US --src_dir=/home/jfearn/publican/Users_Guide


$ firefox /tmp/build/en-US/html/index.html

$ w00t

Committed revision 2048 to trunk.
Comment 2 Peter Hutterer 2012-03-06 01:44:37 EST
Does this apply to brands as well?
i.e. can I specify the location of the brand source directory somehow?
Comment 3 Tomas Capek 2012-04-25 12:06:03 EDT
Hi, I tried to verify this and failed:

[publican-tester@fedora books]$ publican create --name=out-of-tree
	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/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
	Processing file en-US/out-of-tree.xml -> en-US/out-of-tree.xml
[publican-tester@fedora books]$ mkdir out-of-tree/_build
[publican-tester@fedora books]$ cd out-of-tree/_build/
[publican-tester@fedora _build]$ publican build --config=../publican.cfg --formats=html --lang=en-US 
Can't locate required file: en-US/Book_Info.xml at /usr/bin/publican line 632
Comment 4 Jeff Fearn 2012-04-26 03:02:48 EDT
Out of tree builds need to test --src_dir not --config.
Comment 5 Tomas Capek 2012-04-30 08:15:56 EDT
Ok, I tried again:

[publican-tester@fedora _build]$ cd ~/books/out-of-tree/_build/
[publican-tester@fedora _build]$ publican build --src_dir=.. --formats=html --lang=en-US


	Finished html

And it worked. If this concludes testing of this feature, I'd verify this BZ.

BTW, the "--src_dir" option seems to be missing from the User Guide. Should it be added there (I found brief description of it in the man page) ?
Comment 6 Jared MORGAN 2012-05-09 20:28:12 EDT
Documentation required for --src_dir option. Added this ticket to the Publican User Guide 3.0 ticket for tracking.