Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 456128 - [NEW FEATURE] Support for RPM distributions in etc-update
Summary: [NEW FEATURE] Support for RPM distributions in etc-update
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Enhancement/Feature Requests (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 484436
  Show dependency tree
 
Reported: 2013-02-08 09:54 UTC by Michal Hrusecky (RETIRED)
Modified: 2017-08-11 21:11 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
RPM based distributions support for etc-update (rpm-distribution.patch,2.48 KB, patch)
2013-02-08 09:55 UTC, Michal Hrusecky (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michal Hrusecky (RETIRED) gentoo-dev 2013-02-08 09:54:05 UTC
etc-update is a really helpfull tool that Gentoo has. Let's let other distributions (RPM based) use it as well.

Reproducible: Always

Steps to Reproduce:
1. Install for example openSUSE
2. Modify configuration files
3. Update
Actual Results:  
Try to figure out what files need merging and merge them one by one

Expected Results:  
Run etc-update and let it take care of everything
Comment 1 Michal Hrusecky (RETIRED) gentoo-dev 2013-02-08 09:55:40 UTC
Created attachment 338306 [details, diff]
RPM based distributions support for etc-update

Providing patch that implements the requested functionality. Tested on openSUSE and so far works.
Comment 2 Zac Medico gentoo-dev 2013-02-08 17:53:50 UTC
I think there needs to be a better way to detect the rpm-based distro than lack of portageq. I would like it to die if portageq is not found and an rpm-based distro is not detected. I don't want it check for /etc/gentoo-release at all, since we may have derived distros like funtoo.

Anything that's different between portage and rpm based distros should be split out into functions that behave differently depending on the distro type. For example:

if ${RPM_DISTRO} ; then
  basename_find_opts() {
    echo \-name "${1}.rpmnew"
  }
else
  basename_find_opts() {
    echo \-name "._cfg????_${1}"
  }
fi
Comment 3 Theo Chatzimichos (RETIRED) archtester Gentoo Infrastructure gentoo-dev Security 2013-02-23 12:09:31 UTC
The best way to check for operating system information is to check /etc/*-version. As a reference, the same logic is followed by facter (a tool used by puppet to get system information)

https://github.com/puppetlabs/facter/blob/master/lib/facter/operatingsystem.rb
Comment 4 Theo Chatzimichos (RETIRED) archtester Gentoo Infrastructure gentoo-dev Security 2014-11-08 16:52:00 UTC
https://github.com/gentoo/portage/pull/7
Comment 5 Zac Medico gentoo-dev 2014-11-08 18:54:18 UTC
(In reply to Theo Chatzimichos from comment #4)
> https://github.com/gentoo/portage/pull/7

Looks good to me, except $name_opt needs quotes (may contain whitespace or special shell characters).
Comment 6 Zac Medico gentoo-dev 2014-11-08 19:02:15 UTC
Also, since function calls inherit local variables from the calling function, get_live_file can use the local variables from where the function was called. So, get_live_file can have no arguments, and the function can use the local variables like this:

if [[ $OS_FAMILY == 'gentoo' ]]; then
	get_live_file() {
		echo "${rpath}/${rfile:10}"
	}
else
	get_live_file() {
		echo "${cfg_file%.rpmnew}"
	}
fi

I think that's better because it separates the implementation-specific details.
Comment 7 Theo Chatzimichos (RETIRED) archtester Gentoo Infrastructure gentoo-dev Security 2014-11-08 19:44:15 UTC
both done
Comment 9 Zac Medico gentoo-dev 2017-08-11 21:11:58 UTC
Fixed in 2.2.15.