/[gentoo-x86]/eclass/savedconfig.eclass
Gentoo

Diff of /eclass/savedconfig.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.17 Revision 1.18
1# Copyright 1999-2011 Gentoo Foundation 1# Copyright 1999-2011 Gentoo Foundation
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# $Header: /var/cvsroot/gentoo-x86/eclass/savedconfig.eclass,v 1.17 2012/01/04 06:19:09 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/savedconfig.eclass,v 1.18 2012/01/04 06:22:12 vapier Exp $
4 4
5# @ECLASS: savedconfig.eclass 5# @ECLASS: savedconfig.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# base-system@gentoo.org 7# base-system@gentoo.org
8# @BLURB: common API for saving/restoring complex configuration files 8# @BLURB: common API for saving/restoring complex configuration files
74# ${PORTAGE_CONFIGROOT}/etc/portage/savedconfig/${CTARGET}/${CATEGORY}/${PN} 74# ${PORTAGE_CONFIGROOT}/etc/portage/savedconfig/${CTARGET}/${CATEGORY}/${PN}
75# ${PORTAGE_CONFIGROOT}/etc/portage/savedconfig/${CHOST}/${CATEGORY}/${PN} 75# ${PORTAGE_CONFIGROOT}/etc/portage/savedconfig/${CHOST}/${CATEGORY}/${PN}
76# ${PORTAGE_CONFIGROOT}/etc/portage/savedconfig/${CATEGORY}/${PN} 76# ${PORTAGE_CONFIGROOT}/etc/portage/savedconfig/${CATEGORY}/${PN}
77# @CODE 77# @CODE
78restore_config() { 78restore_config() {
79 use savedconfig || return
80
81 case ${EBUILD_PHASE} in 79 case ${EBUILD_PHASE} in
82 unpack|compile|configure|prepare) ;; 80 unpack|compile|configure|prepare) ;;
83 *) die "Bad package! restore_config only for use in src_{unpack,compile,configure,prepare} functions!" ;; 81 *) die "Bad package! restore_config only for use in src_{unpack,compile,configure,prepare} functions!" ;;
84 esac 82 esac
83
84 use savedconfig || return
85
85 local found check configfile 86 local found check configfile
86 local base=${PORTAGE_CONFIGROOT}/etc/portage/savedconfig 87 local base=${PORTAGE_CONFIGROOT}/etc/portage/savedconfig
87 for check in {${CATEGORY}/${PF},${CATEGORY}/${P},${CATEGORY}/${PN}}; do 88 for check in {${CATEGORY}/${PF},${CATEGORY}/${P},${CATEGORY}/${PN}}; do
88 configfile=${base}/${CTARGET}/${check} 89 configfile=${base}/${CTARGET}/${check}
89 [[ -r ${configfile} ]] || configfile=${base}/${CHOST}/${check} 90 [[ -r ${configfile} ]] || configfile=${base}/${CHOST}/${check}

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.18

  ViewVC Help
Powered by ViewVC 1.1.20