Bug 661948 - Updating the database for packaged books is fragile
Updating the database for packaged books is fragile
Status: CLOSED CURRENTRELEASE
Product: Publican
Classification: Community
Component: publican (Show other bugs)
2.5
Unspecified Unspecified
low Severity medium
: ---
: ---
Assigned To: Jeff Fearn
Ruediger Landmann
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-12-09 22:35 EST by Jeff Fearn
Modified: 2011-07-25 20:42 EDT (History)
3 users (show)

See Also:
Fixed In Version: 2.6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2011-07-25 20:42:35 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Jeff Fearn 2010-12-09 22:35:55 EST
Description of problem:
The way the database is updated for packaged books is very fragile, prone to breaking, and not very cross platform friendly.

This becomes particularly apparent when the underlying perl code changes and the install (e.g. RPM spec) files need to be updated. 

Instead of using naked perl in the install files publican should have a CLI action to allow the database to be updated. This way the install files are less likely to break and will require modification less often.

e.g.

$ publican update_db --add --lang en-US --formats html,pdf --name Foo \
--name_label "foo is good" --version 0.1 --version_label UNUSED \
--product Bar --product_label "To the bar" \
--subtitle "A guide to Bar Foo" \
--abstract "There once was a Foo from Bar ..."

$ publican update_db --del --lang en-US --name Foo --version 0.1 --product Bar \
--site_config /usr/share/bar/foo.cfg
Comment 1 Jeff Fearn 2010-12-13 23:28:31 EST
Added update_db action, updated web-spec.xsl, POD, and bash complete.

Fixed in revision 1686
Comment 2 Jeff Fearn 2011-07-07 06:59:41 EDT
Back ported to branches/publican-2x

Committed revision 1812.
Comment 3 Ruediger Landmann 2011-07-18 01:34:06 EDT
I tested this in build 2.5-2.fc15.t14

When I tried to update a package, yum gave me:

Error in PREUN scriptlet in rpm package Documentation-0806-0-web-en-US
Documentation-0806-0-web-en-US-0-0.el5.noarch was supposed to be removed but is not!

so then I tried to remove the existing package with RPM and got:

Unknown option: add
Unknown option: lang
Unknown option: formats
Unknown option: name
Unknown option: version
Unknown option: product
Unknown option: subtitle
Unknown option: abstract

I recognised these as the options for the update_db action, so I thought I'd just try "publican update_db" on the command line, which gave me:

'update_db' is an unknown action!
Valid actions are:
<followed by a list of valid publican actions, update_db not among them>
Comment 4 Ruediger Landmann 2011-07-18 02:17:07 EDT
However, another package installed and uninstalled cleanly:

Red_Hat_Enterprise_Linux-Power_Management_Guide-6-web-de-DE.noarch 0:1.0-4.fc15
Comment 5 Ruediger Landmann 2011-07-18 02:26:38 EDT
(In reply to comment #4)
> However, another package installed and uninstalled cleanly:
> 
> Red_Hat_Enterprise_Linux-Power_Management_Guide-6-web-de-DE.noarch 0:1.0-4.fc15

Heh; of course this used the raw perl command because I just built it with rpmbuild --rebuild... D'oh!
Comment 6 Jeff Fearn 2011-07-18 02:40:57 EDT
Oops, missed the action entry when back porting this code.

Committed revision 1837.

$ publican update_db --help
update_db
    Add or remove database entries. Used for processing pre-build books, such as when building packages.

	Options:
        --help                    Display help message
        --config=s                Use a nonstandard config file
        --common_config=s         Override path to Common_Config directory
        --common_content=s        Override path to Common_Content directory
        --nocolours               Disable ANSI colourisation of logging.
        --quiet                   Disable all logging.
        --site_config=<SITE_CONFIG>    WebSite configuration file to use or create.
        --add                     Add a database enrty
        --del                     Delete a database entry
        --lang=<LANG>             The language the XML will be written in
        --product=<PRODUCT>       The name of the product
        --version=<VERSION>       The version of the product
        --name=<NAME>             The name of the book, article, set, or brand
        --formats=<FORMATS>       Comma-separated list of formats, for example: html,pdf,html-single,html-desktop,txt,epub
        --subtitle=<SUBTITLE>     Sub title for a book
        --abstract=<ABSTRACT>     Abstract for a book
        --product_label=<PRODUCT_LABEL>    product label for a book
        --version_label=<VERSION_LABEL>    version label for a book
        --name_label=<NAME_LABEL>    name label for a book

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