Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 686350 | Differences between
and this patch

Collapse All | Expand All

(-)a/eclass/savedconfig.eclass (-20 / +19 lines)
Lines 1-4 Link Here
1
# Copyright 1999-2019 Gentoo Authors
1
# Copyright 2007-2019 Gentoo Authors
2
# Distributed under the terms of the GNU General Public License v2
2
# Distributed under the terms of the GNU General Public License v2
3
3
4
# @ECLASS: savedconfig.eclass
4
# @ECLASS: savedconfig.eclass
Lines 113-136 restore_config() { Link Here
113
113
114
	use savedconfig || return
114
	use savedconfig || return
115
115
116
	local found check checked configfile
116
	local checked=() configfile found package_dependency_spec
117
	local base=${PORTAGE_CONFIGROOT%/}/etc/portage/savedconfig
117
	local base=${PORTAGE_CONFIGROOT%/}/etc/portage/savedconfig
118
	for check in {${CATEGORY}/${PF},${CATEGORY}/${P},${CATEGORY}/${PN}}; do
118
	for package_dependency_spec in {${CATEGORY}/${PF},${CATEGORY}/${P},${CATEGORY}/${PN}}; do
119
		configfile=${base}/${CTARGET:+"${CTARGET}/"}${check}
119
		for configfile in ${CTARGET:+"${base}/${CTARGET}/${package_dependency_spec}"} \
120
		[[ -r ${configfile} ]] || configfile=${base}/${CHOST:+"${CHOST}/"}${check}
120
			${CHOST:+"${base}/${CHOST}/${package_dependency_spec}"} \
121
		[[ -r ${configfile} ]] || configfile=${base}/${check}
121
			"${base}/${package_dependency_spec}"; do
122
		[[ "${checked}" == *"${configfile} "* ]] && continue
122
			has "${configfile}" "${checked[@]}" && continue
123
		einfo "Checking existence of \"${configfile}\" ..."
123
			einfo "Checking existence of \"${configfile}\" ..."
124
		if [[ -r "${configfile}" ]] ; then
124
			if [[ -r ${configfile} ]] ; then
125
			einfo "Found \"${configfile}\""
125
				einfo "Found \"${configfile}\""
126
			found=${configfile}
126
				found=${configfile}
127
			_SAVEDCONFIG_CONFIGURATION_FILE=${configfile#${base}/}
127
				_SAVEDCONFIG_CONFIGURATION_FILE=${configfile#${base}/}
128
			break
128
				break 2
129
		fi
129
			fi
130
130
131
		checked+="${configfile} "
131
			checked+=("${configfile}")
132
		done
132
	done
133
	done
133
134
	if [[ -f ${found} ]]; then
134
	if [[ -f ${found} ]]; then
135
		elog "Building using saved configfile \"${found}\""
135
		elog "Building using saved configfile \"${found}\""
136
		if [ $# -gt 0 ]; then
136
		if [ $# -gt 0 ]; then
Lines 145-157 restore_config() { Link Here
145
		treecopy . "${dest}" || die "Failed to restore ${found} to $1"
145
		treecopy . "${dest}" || die "Failed to restore ${found} to $1"
146
		popd > /dev/null
146
		popd > /dev/null
147
	else
147
	else
148
		# maybe the user is screwing around with perms they shouldnt #289168
148
		# maybe the user is screwing around with perms they shouldn't #289168
149
		if [[ ! -r ${base} ]] ; then
149
		if [[ ! -r ${base} ]] ; then
150
			eerror "Unable to read ${base} -- please check its permissions."
150
			eerror "Unable to read ${base} -- please check its permissions."
151
			die "Reading config files failed"
151
			die "Reading config files failed"
152
		fi
152
		fi
153
		ewarn "No saved config to restore - please remove USE=savedconfig or"
153
		ewarn "No saved config to restore - please remove USE=savedconfig or"
154
		ewarn "provide a configuration file in ${PORTAGE_CONFIGROOT%/}/etc/portage/savedconfig/${CATEGORY}/${PN}"
154
		ewarn "provide a configuration file in \"${base}/${CATEGORY}/${PN}\""
155
		ewarn "Your config file(s) will not be used this time"
155
		ewarn "Your config file(s) will not be used this time"
156
	fi
156
	fi
157
}
157
}
158
- 

Return to bug 686350