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

Diff of /eclass/savedconfig.eclass

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

Revision 1.10 Revision 1.11
1# Copyright 1999-2007 Gentoo Foundation 1# Copyright 1999-2007 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.10 2009/04/11 15:19:50 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/savedconfig.eclass,v 1.11 2009/10/30 00:05:25 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
83 unpack|compile|prepare) 83 unpack|compile|prepare)
84 ;; 84 ;;
85 *) die "Bad package! restore_config only for use in src_{unpack,compile,prepare} functions!" 85 *) die "Bad package! restore_config only for use in src_{unpack,compile,prepare} functions!"
86 ;; 86 ;;
87 esac 87 esac
88 local found; 88 local found check configfile
89 local base=${PORTAGE_CONFIGROOT}/etc/portage/savedconfig 89 local base=${PORTAGE_CONFIGROOT}/etc/portage/savedconfig
90 for check in {${CATEGORY}/${PF},${CATEGORY}/${P},${CATEGORY}/${PN}}; do 90 for check in {${CATEGORY}/${PF},${CATEGORY}/${P},${CATEGORY}/${PN}}; do
91 configfile=${base}/${CTARGET}/${check} 91 configfile=${base}/${CTARGET}/${check}
92 [[ -r ${configfile} ]] || configfile=${base}/${CHOST}/${check} 92 [[ -r ${configfile} ]] || configfile=${base}/${CHOST}/${check}
93 [[ -r ${configfile} ]] || configfile=${base}/${check} 93 [[ -r ${configfile} ]] || configfile=${base}/${check}
105 else 105 else
106 die "need to know the restoration filename" 106 die "need to know the restoration filename"
107 fi 107 fi
108 elif [[ -d ${found} ]]; then 108 elif [[ -d ${found} ]]; then
109 elog "Building using saved config directory ${found}" 109 elog "Building using saved config directory ${found}"
110 dest=${PWD} 110 local dest=${PWD}
111 pushd "${found}" > /dev/null 111 pushd "${found}" > /dev/null
112 treecopy . "${dest}" || die "Failed to restore ${found} to $1" 112 treecopy . "${dest}" || die "Failed to restore ${found} to $1"
113 popd > /dev/null 113 popd > /dev/null
114 elif [[ -a {found} ]]; then 114 elif [[ -a {found} ]]; then
115 die "do not know how to handle non-file/directory ${found}" 115 die "do not know how to handle non-file/directory ${found}"
116 else 116 else
117 # maybe the user is screwing around with perms they shouldnt #289168
118 if [[ -r ${base} ]] ; then
119 eerror "Unable to read ${base} -- perms are screwed ?"
120 die "fix your system"
121 fi
117 eerror "No saved config to restore - please remove USE=savedconfig or" 122 eerror "No saved config to restore - please remove USE=savedconfig or"
118 eerror "provide a configuration file in ${PORTAGE_CONFIGROOT}/etc/portage/savedconfig/${CATEGORY}/${PN}" 123 eerror "provide a configuration file in ${PORTAGE_CONFIGROOT}/etc/portage/savedconfig/${CATEGORY}/${PN}"
119 die "config file needed when USE=savedconfig is specified" 124 die "config file needed when USE=savedconfig is specified"
120 fi 125 fi
121} 126}

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

  ViewVC Help
Powered by ViewVC 1.1.20