Anand Buddhdev
2015-Jun-28 21:26 UTC
[CentOS] Old and new package version numbers during RPM update
On 28/06/15 17:50, John R Pierce wrote:> On 6/27/2015 5:38 PM, Anand Buddhdev wrote: >> Thanks Joseph. I am aware of this option, but it would be only a last >> resort, because checking the format of the config file is error-prone. > > why doesn't the config file have the version in it ? not having that > makes your whole system error prone.Perhaps I wasn't clear. Version 1 of the package uses a config file that looks like this: system { setting1 value1; setting2 value2; } interfaces { iface1; iface2; } Version 2 of the package has switched to a YAML-based syntax, so the config file needs to look like this: system: setting1: value1 setting2: value2 So, I need to be able to program the RPM so that when upgrading from 1.x to 2.x, it triggers the conversion utility that converts from v1 to v2 format. Anand
John R Pierce
2015-Jun-28 21:37 UTC
[CentOS] Old and new package version numbers during RPM update
On 6/28/2015 2:26 PM, Anand Buddhdev wrote:> On 28/06/15 17:50, John R Pierce wrote: > >> why doesn't the config file have the version in it ? not having that >> makes your whole system error prone. > Perhaps I wasn't clear. Version 1 of the package uses a config file that > looks like this: > > system { > setting1 value1; > setting2 value2; > } > > interfaces { > iface1; > iface2; > } > > > Version 2 of the package has switched to a YAML-based syntax, so the > config file needs to look like this: > > system: > setting1: value1 > setting2: value2 > > > So, I need to be able to program the RPM so that when upgrading from 1.x > to 2.x, it triggers the conversion utility that converts from v1 to v2 > format.so a regex looking for "system:" vs "system {" should nicely delineate these. I dunno, I might even put that into the conversion utility and have it just quit if the file is already in the new format, and always run it. -- john r pierce, recycling bits in santa cruz
Kahlil Hodgson
2015-Jun-28 23:07 UTC
[CentOS] Old and new package version numbers during RPM update
On 29 June 2015 at 07:37, John R Pierce <pierce at hogranch.com> wrote:> so a regex looking for "system:" vs "system {" should nicely delineate > these. I dunno, I might even put that into the conversion utility and > have it just quit if the file is already in the new format, and always run > it. >?+1 for the idempotent approach. IMHO much more robust. Also consider what will happen if someone does a 'yum downgrade' on the package or a dependency -- you might want to allow the conversion to go both ways or at least complain appropriately. ?K?