Bug 829219

Summary: Packaging of Database libs
Product: [Fedora] Fedora Reporter: Eli Wapniarski <eli>
Component: baculaAssignee: Simone Caronni <negativo17>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 17CC: andreas, fschwarz, hhorak, limburgher, lnykryn, negativo17, paul, vanmeeuwen+fedora
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: 2012-06-11 20:36:39 EDT Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:

Description Eli Wapniarski 2012-06-06 04:58:20 EDT
Please consider this as a wishlist request

Description of problem:

The database libs for bacula are now in a monolithic rpm. Everytime an update is made /etc/alternates/libbaccats-*.so is overwritten and favors the postgresql driver.

Not all of us use postgresql and after updating bacula from this point forward, we will need to remember to recreate the link to the driver.

The old was was better with each driver sitting in its own rpm. That way update will go as smoothly as possible

Thanks for your consideration

Eli
Comment 1 Simone Caronni 2012-06-06 12:32:29 EDT
Hello,

if you go from one update to the other, you don't face the problem you're describing.

From example, if you update from 5.2.6-2.fc17 to 5.2.6-4.fc17 the alternatives system retains your preference (that's one of the main functions of it, by the way) because the file to be linked has the same name; for example here it kept the same preference:

# alternatives --config libbaccats.so

There are 6 programs which provide 'libbaccats.so'.

  Selection    Command
-----------------------------------------------
   1           /usr/lib64/libbaccats-mysql-5.2.6.so
 + 2           /usr/lib64/libbaccats-sqlite3-5.2.6.so
*  3           /usr/lib64/libbaccats-postgresql-5.2.6.so

Enter to keep the current selection[+], or type selection number: 


But I found another problem, after updating to the update into updates-testing (5.2.7-2) I got a problem because the library names are different. It still keeps my preference as expected but that's not the wanted behaviour:

[root@3zpc0560 ~]# alternatives --config libbaccats.so

There are 6 programs which provide 'libbaccats.so'.

  Selection    Command
-----------------------------------------------
   1           /usr/lib64/libbaccats-mysql-5.2.6.so
 + 2           /usr/lib64/libbaccats-sqlite3-5.2.6.so
*  3           /usr/lib64/libbaccats-postgresql-5.2.6.so
   4           /usr/lib64/libbaccats-mysql-5.2.7.so
   5           /usr/lib64/libbaccats-sqlite3-5.2.7.so
   6           /usr/lib64/libbaccats-postgresql-5.2.7.so

Enter to keep the current selection[+], or type selection number: 

Between the various iterations of Bacula into f17 development time everything changed multiple times, including the way Bacula itself handled the thing (unversioned shared objects, versioned shared objects with different soname, different shared objects providing multiple sonames with and without version).

I'm looking into this now, and the option seems to be only to go to multiple libs subpackages, i.e.:

bacula-libs-postgresql
bacula-libs-mysql
bacula-libs-sqlite

I will keep this ticket updated.
Comment 2 Paul Howarth 2012-06-06 14:04:45 EDT
Another option is to explicitly check the state of the user's preferences, e.g.:

if readlink /etc/alternatives/libbaccats.so | grep --silent mysql; then
    # set up for mysql backend
elif readlink /etc/alternatives/libbaccats.so | grep --silent sqlite; then
    # set up for sqlite backend
else
    # default to postgresql backend
fi

That approach would default to postgresql backend but would retain previously-set preferences even on version updates.
Comment 3 Simone Caronni 2012-06-06 14:08:29 EDT
Thanks for the input, I've created a build in Koji that sets the alternative this way:

# alternatives --config libbaccats.so

There are 3 programs which provide 'libbaccats.so'.

  Selection    Command
-----------------------------------------------
   1           /usr/lib64/libbaccats-mysql.so
   2           /usr/lib64/libbaccats-sqlite3.so
*+ 3           /usr/lib64/libbaccats-postgresql.so

I will keep that and maybe add what you suggested to keep the installed preference even if the links change.
Comment 4 Simone Caronni 2012-06-08 04:27:21 EDT
I'm building now the package in Koji 5.2.7-4.fc17 that closes other bugs, when it is available in updates-testing please remove your old links:

alternatives --remove /usr/lib64/libbaccats-mysql-5.2.6.so
alternatives --remove /usr/lib64/libbaccats-sqlite3-5.2.6.so
alternatives --remove /usr/lib64/libbaccats-postgresql-5.2.6.so

And then set again your preference database with:

# alternatives --config libbaccats.so

There are 3 programs which provide 'libbaccats.so'.

  Selection    Command
-----------------------------------------------
   1           /usr/lib64/libbaccats-mysql.so
 + 2           /usr/lib64/libbaccats-sqlite3.so
*  3           /usr/lib64/libbaccats-postgresql.so

Enter to keep the current selection[+], or type selection number:


According to the bugs that this build closes there seems not to be much use of Bacula inside Fedora, most of the users are based on RHEL/CentOS.
Comment 5 Fedora Update System 2012-06-08 04:37:40 EDT
bacula-docs-5.2.7-1.fc17,bacula-5.2.7-4.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/bacula-docs-5.2.7-1.fc17,bacula-5.2.7-4.fc17
Comment 6 Fedora Update System 2012-06-08 20:08:31 EDT
Package bacula-docs-5.2.7-1.fc17, bacula-5.2.7-4.fc17:
* should fix your issue,
* was pushed to the Fedora 17 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing bacula-docs-5.2.7-1.fc17 bacula-5.2.7-4.fc17'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-9159/bacula-docs-5.2.7-1.fc17,bacula-5.2.7-4.fc17
then log in and leave karma (feedback).
Comment 7 Paul Howarth 2012-06-09 04:49:33 EDT
(In reply to comment #4)
> I'm building now the package in Koji 5.2.7-4.fc17 that closes other bugs,
> when it is available in updates-testing please remove your old links:
> 
> alternatives --remove /usr/lib64/libbaccats-mysql-5.2.6.so
> alternatives --remove /usr/lib64/libbaccats-sqlite3-5.2.6.so
> alternatives --remove /usr/lib64/libbaccats-postgresql-5.2.6.so

That should be:

 alternatives --remove libbaccats.so /usr/lib64/libbaccats-mysql-5.2.6.so
 alternatives --remove libbaccats.so /usr/lib64/libbaccats-sqlite3-5.2.6.so
 alternatives --remove libbaccats.so /usr/lib64/libbaccats-postgresql-5.2.6.so

Otherwise seems OK so far.
Comment 8 Simone Caronni 2012-06-11 05:07:09 EDT
5.2.8 has come out upstream with many other bugs fixed.

Paul, I introduced a change in the spec file that checks for the obsolete symlinks for bacula-dir, bacula-sd (>=F16) and libbaccats-backend-version.so (=F17) and sets the new one accordingly so the change should not be done manually; based on your input.

So even an upgrade from F16 to F17 should be safe and retain the preferences.

Excerpt from the spec file:

# Fix for automatic selection of backends during upgrades
if readlink /etc/alternatives/libbaccats.so | grep --silent mysql || \
   readlink /etc/alternatives/bacula-dir | grep --silent mysql || \
   readlink /etc/alternatives/bacula-sd | grep --silent mysql; then
   /usr/sbin/alternatives --set libbaccats.so %{_libdir}/libbaccats-mysql.so
elif readlink /etc/alternatives/libbaccats.so | grep --silent sqlite || \
   readlink /etc/alternatives/bacula-dir | grep --silent sqlite || \
   readlink /etc/alternatives/bacula-sd | grep --silent sqlite; then
   /usr/sbin/alternatives --set libbaccats.so %{_libdir}/libbaccats-sqlite3.so
else
   /usr/sbin/alternatives --set libbaccats.so %{_libdir}/libbaccats-postgresql.so
fi

Regards,
--Simone
Comment 9 Fedora Update System 2012-06-11 06:18:20 EDT
bacula-docs-5.2.8-1.fc17,bacula-5.2.8-1.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/bacula-docs-5.2.8-1.fc17,bacula-5.2.8-1.fc17
Comment 10 Fedora Update System 2012-06-11 20:36:39 EDT
bacula-docs-5.2.8-1.fc17, bacula-5.2.8-1.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.