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

Collapse All | Expand All

(-)a/bin/dispatch-conf (-1 / +7 lines)
Lines 29-34 from portage.process import find_binary, spawn Link Here
29
FIND_EXTANT_CONFIGS  = "find '%s' %s -name '._cfg????_%s' ! -name '.*~' ! -iname '.*.bak' -print"
29
FIND_EXTANT_CONFIGS  = "find '%s' %s -name '._cfg????_%s' ! -name '.*~' ! -iname '.*.bak' -print"
30
DIFF_CONTENTS        = "diff -Nu '%s' '%s'"
30
DIFF_CONTENTS        = "diff -Nu '%s' '%s'"
31
31
32
if "case-insensitive-fs" in portage.settings.features:
33
    FIND_EXTANT_CONFIGS = \
34
        FIND_EXTANT_CONFIGS.replace("-name '._cfg", "-iname '._cfg")
35
32
# We need a secure scratch dir and python does silly verbose errors on the use of tempnam
36
# We need a secure scratch dir and python does silly verbose errors on the use of tempnam
33
oldmask = os.umask(0o077)
37
oldmask = os.umask(0o077)
34
SCRATCH_DIR = None
38
SCRATCH_DIR = None
Lines 144-150 class dispatch: Link Here
144
        protect_obj = portage.util.ConfigProtect(
148
        protect_obj = portage.util.ConfigProtect(
145
            config_root, config_paths,
149
            config_root, config_paths,
146
            portage.util.shlex_split(
150
            portage.util.shlex_split(
147
            portage.settings.get('CONFIG_PROTECT_MASK', '')))
151
            portage.settings.get('CONFIG_PROTECT_MASK', '')),
152
            case_insensitive = ("case-insensitive-fs"
153
            in portage.settings.features))
148
154
149
        def diff(file1, file2):
155
        def diff(file1, file2):
150
            return diffstatusoutput(DIFF_CONTENTS, file1, file2)
156
            return diffstatusoutput(DIFF_CONTENTS, file1, file2)
(-)a/bin/etc-update (-3 / +11 lines)
Lines 67-72 scan() { Link Here
67
	mkdir "${TMP}"/files || die "Failed mkdir command!"
67
	mkdir "${TMP}"/files || die "Failed mkdir command!"
68
	count=0
68
	count=0
69
	input=0
69
	input=0
70
	local basename
70
	local find_opts
71
	local find_opts
71
	local path
72
	local path
72
73
Lines 75-87 scan() { Link Here
75
76
76
		if [[ ! -d ${path} ]] ; then
77
		if [[ ! -d ${path} ]] ; then
77
			[[ ! -f ${path} ]] && continue
78
			[[ ! -f ${path} ]] && continue
78
			local my_basename="${path##*/}"
79
			basename="${path##*/}"
79
			path="${path%/*}"
80
			path="${path%/*}"
80
			find_opts=( -maxdepth 1 -name "._cfg????_${my_basename}" )
81
			find_opts=( -maxdepth 1 )
81
		else
82
		else
83
			basename=*
82
			# Do not traverse hidden directories such as .svn or .git.
84
			# Do not traverse hidden directories such as .svn or .git.
83
			find_opts=( -name '.*' -type d -prune -o -name '._cfg????_*' )
85
			find_opts=( -name '.*' -type d -prune -o )
84
		fi
86
		fi
87
		${case_insensitive} && \
88
			find_opts+=( -iname ) || find_opts+=( -name )
89
		find_opts+=( "._cfg????_${basename}" )
85
		find_opts+=( ! -name '.*~' ! -iname '.*.bak' -print )
90
		find_opts+=( ! -name '.*~' ! -iname '.*.bak' -print )
86
91
87
		if [ ! -w "${path}" ] ; then
92
		if [ ! -w "${path}" ] ; then
Lines 623-628 ${SET_X} && set -x Link Here
623
type -P portageq >/dev/null || die "missing portageq"
628
type -P portageq >/dev/null || die "missing portageq"
624
portage_vars=(
629
portage_vars=(
625
	CONFIG_PROTECT{,_MASK}
630
	CONFIG_PROTECT{,_MASK}
631
	FEATURES
626
	PORTAGE_CONFIGROOT
632
	PORTAGE_CONFIGROOT
627
	PORTAGE_INST_{G,U}ID
633
	PORTAGE_INST_{G,U}ID
628
	PORTAGE_TMPDIR
634
	PORTAGE_TMPDIR
Lines 633-638 portage_vars=( Link Here
633
eval $(${PORTAGE_PYTHON:+"${PORTAGE_PYTHON}"} "$(type -P portageq)" envvar -v ${portage_vars[@]})
639
eval $(${PORTAGE_PYTHON:+"${PORTAGE_PYTHON}"} "$(type -P portageq)" envvar -v ${portage_vars[@]})
634
export PORTAGE_TMPDIR
640
export PORTAGE_TMPDIR
635
SCAN_PATHS=${*:-${CONFIG_PROTECT}}
641
SCAN_PATHS=${*:-${CONFIG_PROTECT}}
642
[[ " ${FEATURES} " == *" case-insensitive-fs "* ]] && \
643
	case_insensitive=true || case_insensitive=false
636
644
637
TMP="${PORTAGE_TMPDIR}/etc-update-$$"
645
TMP="${PORTAGE_TMPDIR}/etc-update-$$"
638
trap "die terminated" SIGTERM
646
trap "die terminated" SIGTERM
(-)a/bin/portageq (-3 / +4 lines)
Lines 379-386 def is_protected(argv): Link Here
379
	protect = portage.util.shlex_split(settings.get("CONFIG_PROTECT", ""))
379
	protect = portage.util.shlex_split(settings.get("CONFIG_PROTECT", ""))
380
	protect_mask = portage.util.shlex_split(
380
	protect_mask = portage.util.shlex_split(
381
		settings.get("CONFIG_PROTECT_MASK", ""))
381
		settings.get("CONFIG_PROTECT_MASK", ""))
382
	protect_obj = ConfigProtect(root, protect, protect_mask)
382
	protect_obj = ConfigProtect(root, protect, protect_mask,
383
383
		case_insensitive = ("case-insensitive-fs" in settings.features))
384
	if protect_obj.isprotected(f):
384
	if protect_obj.isprotected(f):
385
		return 0
385
		return 0
386
	return 1
386
	return 1
Lines 414-420 def filter_protected(argv): Link Here
414
	protect = portage.util.shlex_split(settings.get("CONFIG_PROTECT", ""))
414
	protect = portage.util.shlex_split(settings.get("CONFIG_PROTECT", ""))
415
	protect_mask = portage.util.shlex_split(
415
	protect_mask = portage.util.shlex_split(
416
		settings.get("CONFIG_PROTECT_MASK", ""))
416
		settings.get("CONFIG_PROTECT_MASK", ""))
417
	protect_obj = ConfigProtect(root, protect, protect_mask)
417
	protect_obj = ConfigProtect(root, protect, protect_mask,
418
		case_insensitive = ("case-insensitive-fs" in settings.features))
418
419
419
	errors = 0
420
	errors = 0
420
421
(-)a/bin/quickpkg (-1 / +3 lines)
Lines 102-108 def quickpkg_atom(options, infos, arg, eout): Link Here
102
			if not include_config:
102
			if not include_config:
103
				confprot = ConfigProtect(eroot,
103
				confprot = ConfigProtect(eroot,
104
					shlex_split(settings.get("CONFIG_PROTECT", "")),
104
					shlex_split(settings.get("CONFIG_PROTECT", "")),
105
					shlex_split(settings.get("CONFIG_PROTECT_MASK", "")))
105
					shlex_split(settings.get("CONFIG_PROTECT_MASK", "")),
106
					case_insensitive = ("case-insensitive-fs"
107
					in settings.features))
106
				def protect(filename):
108
				def protect(filename):
107
					if not confprot.isprotected(filename):
109
					if not confprot.isprotected(filename):
108
						return False
110
						return False
(-)a/man/make.conf.5 (+4 lines)
Lines 265-270 Build binary packages for just packages in the system set. Link Here
265
Enable a special progress indicator when \fBemerge\fR(1) is calculating
265
Enable a special progress indicator when \fBemerge\fR(1) is calculating
266
dependencies.
266
dependencies.
267
.TP
267
.TP
268
.B case\-insensitive\-fs
269
Use case\-insensitive file name comparisions when merging and unmerging
270
files.
271
.TP
268
.B ccache
272
.B ccache
269
Enable portage support for the ccache package.  If the ccache dir is not
273
Enable portage support for the ccache package.  If the ccache dir is not
270
present in the user's environment, then portage will default to
274
present in the user's environment, then portage will default to
(-)a/pym/_emerge/depgraph.py (-1 / +3 lines)
Lines 7799-7805 class depgraph(object): Link Here
7799
				settings = self._frozen_config.roots[root].settings
7799
				settings = self._frozen_config.roots[root].settings
7800
				protect_obj[root] = ConfigProtect(settings["EROOT"], \
7800
				protect_obj[root] = ConfigProtect(settings["EROOT"], \
7801
					shlex_split(settings.get("CONFIG_PROTECT", "")),
7801
					shlex_split(settings.get("CONFIG_PROTECT", "")),
7802
					shlex_split(settings.get("CONFIG_PROTECT_MASK", "")))
7802
					shlex_split(settings.get("CONFIG_PROTECT_MASK", "")),
7803
					case_insensitive = ("case-insensitive-fs"
7804
					in settings.features))
7803
7805
7804
		def write_changes(root, changes, file_to_write_to):
7806
		def write_changes(root, changes, file_to_write_to):
7805
			file_contents = None
7807
			file_contents = None
(-)a/pym/portage/_global_updates.py (-1 / +3 lines)
Lines 208-214 def _do_global_updates(trees, prev_mtimes, quiet=False, if_mtime_changed=True): Link Here
208
		update_config_files(root,
208
		update_config_files(root,
209
			shlex_split(mysettings.get("CONFIG_PROTECT", "")),
209
			shlex_split(mysettings.get("CONFIG_PROTECT", "")),
210
			shlex_split(mysettings.get("CONFIG_PROTECT_MASK", "")),
210
			shlex_split(mysettings.get("CONFIG_PROTECT_MASK", "")),
211
			repo_map, match_callback=_config_repo_match)
211
			repo_map, match_callback = _config_repo_match,
212
			case_insensitive = "case-insensitive-fs"
213
			in mysettings.features)
212
214
213
		# The above global updates proceed quickly, so they
215
		# The above global updates proceed quickly, so they
214
		# are considered a single mtimedb transaction.
216
		# are considered a single mtimedb transaction.
(-)a/pym/portage/const.py (+1 lines)
Lines 125-130 SUPPORTED_FEATURES = frozenset([ Link Here
125
	"buildpkg",
125
	"buildpkg",
126
	"buildsyspkg",
126
	"buildsyspkg",
127
	"candy",
127
	"candy",
128
	"case-insensitive-fs",
128
	"ccache",
129
	"ccache",
129
	"cgroup",
130
	"cgroup",
130
	"chflags",
131
	"chflags",
(-)a/pym/portage/dbapi/vartree.py (-1 / +31 lines)
Lines 1052-1057 class vardbapi(dbapi): Link Here
1052
		def add(self, cpv):
1052
		def add(self, cpv):
1053
			eroot_len = len(self._vardb._eroot)
1053
			eroot_len = len(self._vardb._eroot)
1054
			contents = self._vardb._dblink(cpv).getcontents()
1054
			contents = self._vardb._dblink(cpv).getcontents()
1055
1056
			if "case-insensitive-fs" in self._vardb.settings.features:
1057
				contents = dict((k.lower(), v)
1058
					for k, v in contents.items())
1059
1055
			pkg_hash = self._hash_pkg(cpv)
1060
			pkg_hash = self._hash_pkg(cpv)
1056
			if not contents:
1061
			if not contents:
1057
				# Empty path is a code used to represent empty contents.
1062
				# Empty path is a code used to represent empty contents.
Lines 1189-1194 class vardbapi(dbapi): Link Here
1189
			hash_pkg = owners_cache._hash_pkg
1194
			hash_pkg = owners_cache._hash_pkg
1190
			hash_str = owners_cache._hash_str
1195
			hash_str = owners_cache._hash_str
1191
			base_names = self._vardb._aux_cache["owners"]["base_names"]
1196
			base_names = self._vardb._aux_cache["owners"]["base_names"]
1197
			case_insensitive = "case-insensitive-fs" \
1198
				in vardb.settings.features
1192
1199
1193
			dblink_cache = {}
1200
			dblink_cache = {}
1194
1201
Lines 1205-1210 class vardbapi(dbapi): Link Here
1205
			while path_iter:
1212
			while path_iter:
1206
1213
1207
				path = path_iter.pop()
1214
				path = path_iter.pop()
1215
				if case_insensitive:
1216
					path = path.lower()
1208
				is_basename = os.sep != path[:1]
1217
				is_basename = os.sep != path[:1]
1209
				if is_basename:
1218
				if is_basename:
1210
					name = path
1219
					name = path
Lines 1236-1241 class vardbapi(dbapi): Link Here
1236
1245
1237
							if is_basename:
1246
							if is_basename:
1238
								for p in dblink(cpv).getcontents():
1247
								for p in dblink(cpv).getcontents():
1248
									if case_insensitive:
1249
										p = p.lower()
1239
									if os.path.basename(p) == name:
1250
									if os.path.basename(p) == name:
1240
										owners.append((cpv, p[len(root):]))
1251
										owners.append((cpv, p[len(root):]))
1241
							else:
1252
							else:
Lines 1265-1272 class vardbapi(dbapi): Link Here
1265
			if not path_list:
1276
			if not path_list:
1266
				return
1277
				return
1267
1278
1279
			case_insensitive = "case-insensitive-fs" \
1280
				in self._vardb.settings.features
1268
			path_info_list = []
1281
			path_info_list = []
1269
			for path in path_list:
1282
			for path in path_list:
1283
				if case_insensitive:
1284
					path = path.lower()
1270
				is_basename = os.sep != path[:1]
1285
				is_basename = os.sep != path[:1]
1271
				if is_basename:
1286
				if is_basename:
1272
					name = path
1287
					name = path
Lines 1285-1290 class vardbapi(dbapi): Link Here
1285
				for path, name, is_basename in path_info_list:
1300
				for path, name, is_basename in path_info_list:
1286
					if is_basename:
1301
					if is_basename:
1287
						for p in dblnk.getcontents():
1302
						for p in dblnk.getcontents():
1303
							if case_insensitive:
1304
								p = p.lower()
1288
							if os.path.basename(p) == name:
1305
							if os.path.basename(p) == name:
1289
								search_pkg.results.append((dblnk, p[len(root):]))
1306
								search_pkg.results.append((dblnk, p[len(root):]))
1290
					else:
1307
					else:
Lines 1540-1546 class dblink(object): Link Here
1540
			portage.util.shlex_split(
1557
			portage.util.shlex_split(
1541
				self.settings.get("CONFIG_PROTECT", "")),
1558
				self.settings.get("CONFIG_PROTECT", "")),
1542
			portage.util.shlex_split(
1559
			portage.util.shlex_split(
1543
				self.settings.get("CONFIG_PROTECT_MASK", "")))
1560
				self.settings.get("CONFIG_PROTECT_MASK", "")),
1561
			case_insensitive = ("case-insensitive-fs"
1562
					in self.settings.features))
1544
1563
1545
		return self._protect_obj
1564
		return self._protect_obj
1546
1565
Lines 2762-2768 class dblink(object): Link Here
2762
			filename.lstrip(os_filename_arg.path.sep)))
2781
			filename.lstrip(os_filename_arg.path.sep)))
2763
2782
2764
		pkgfiles = self.getcontents()
2783
		pkgfiles = self.getcontents()
2784
2785
		preserve_case = None
2786
		if "case-insensitive-fs" in self.settings.features:
2787
			destfile = destfile.lower()
2788
			preserve_case = dict((k.lower(), k) for k in pkgfiles)
2789
			pkgfiles = dict((k.lower(), v) for k, v in pkgfiles.items())
2790
2765
		if pkgfiles and destfile in pkgfiles:
2791
		if pkgfiles and destfile in pkgfiles:
2792
			if preserve_case is not None:
2793
				return preserve_case[destfile]
2766
			return destfile
2794
			return destfile
2767
		if pkgfiles:
2795
		if pkgfiles:
2768
			basename = os_filename_arg.path.basename(destfile)
2796
			basename = os_filename_arg.path.basename(destfile)
Lines 2855-2860 class dblink(object): Link Here
2855
				for p_path in p_path_list:
2883
				for p_path in p_path_list:
2856
					x = os_filename_arg.path.join(p_path, basename)
2884
					x = os_filename_arg.path.join(p_path, basename)
2857
					if x in pkgfiles:
2885
					if x in pkgfiles:
2886
						if preserve_case is not None:
2887
							return preserve_case[x]
2858
						return x
2888
						return x
2859
2889
2860
		return False
2890
		return False
(-)a/pym/portage/update.py (-2 / +4 lines)
Lines 282-288 def parse_updates(mycontent): Link Here
282
		myupd.append(mysplit)
282
		myupd.append(mysplit)
283
	return myupd, errors
283
	return myupd, errors
284
284
285
def update_config_files(config_root, protect, protect_mask, update_iter, match_callback = None):
285
def update_config_files(config_root, protect, protect_mask, update_iter,
286
	match_callback = None, case_insensitive = False):
286
	"""Perform global updates on /etc/portage/package.*, /etc/portage/profile/package.*,
287
	"""Perform global updates on /etc/portage/package.*, /etc/portage/profile/package.*,
287
	/etc/portage/profile/packages and /etc/portage/sets.
288
	/etc/portage/profile/packages and /etc/portage/sets.
288
	config_root - location of files to update
289
	config_root - location of files to update
Lines 406-412 def update_config_files(config_root, protect, protect_mask, update_iter, match_c Link Here
406
							sys.stdout.flush()
407
							sys.stdout.flush()
407
408
408
	protect_obj = ConfigProtect(
409
	protect_obj = ConfigProtect(
409
		config_root, protect, protect_mask)
410
		config_root, protect, protect_mask,
411
		case_insensitive = case_insensitive)
410
	for x in update_files:
412
	for x in update_files:
411
		updating_file = os.path.join(abs_user_config, x)
413
		updating_file = os.path.join(abs_user_config, x)
412
		if protect_obj.isprotected(updating_file):
414
		if protect_obj.isprotected(updating_file):
(-)a/pym/portage/util/__init__.py (-2 / +9 lines)
Lines 1555-1564 class LazyItemsDict(UserDict): Link Here
1555
			return result
1555
			return result
1556
1556
1557
class ConfigProtect(object):
1557
class ConfigProtect(object):
1558
	def __init__(self, myroot, protect_list, mask_list):
1558
	def __init__(self, myroot, protect_list, mask_list,
1559
		case_insensitive = False):
1559
		self.myroot = myroot
1560
		self.myroot = myroot
1560
		self.protect_list = protect_list
1561
		self.protect_list = protect_list
1561
		self.mask_list = mask_list
1562
		self.mask_list = mask_list
1563
		self.case_insensitive = case_insensitive
1562
		self.updateprotect()
1564
		self.updateprotect()
1563
1565
1564
	def updateprotect(self):
1566
	def updateprotect(self):
Lines 1572-1577 class ConfigProtect(object): Link Here
1572
		for x in self.protect_list:
1574
		for x in self.protect_list:
1573
			ppath = normalize_path(
1575
			ppath = normalize_path(
1574
				os.path.join(self.myroot, x.lstrip(os.path.sep)))
1576
				os.path.join(self.myroot, x.lstrip(os.path.sep)))
1577
			if self.case_insensitive:
1578
				ppath = ppath.lower()
1575
			try:
1579
			try:
1576
				if stat.S_ISDIR(os.stat(ppath).st_mode):
1580
				if stat.S_ISDIR(os.stat(ppath).st_mode):
1577
					self._dirs.add(ppath)
1581
					self._dirs.add(ppath)
Lines 1584-1589 class ConfigProtect(object): Link Here
1584
		for x in self.mask_list:
1588
		for x in self.mask_list:
1585
			ppath = normalize_path(
1589
			ppath = normalize_path(
1586
				os.path.join(self.myroot, x.lstrip(os.path.sep)))
1590
				os.path.join(self.myroot, x.lstrip(os.path.sep)))
1591
			if self.case_insensitive:
1592
				ppath = ppath.lower()
1587
			try:
1593
			try:
1588
				"""Use lstat so that anything, even a broken symlink can be
1594
				"""Use lstat so that anything, even a broken symlink can be
1589
				protected."""
1595
				protected."""
Lines 1604-1609 class ConfigProtect(object): Link Here
1604
		masked = 0
1610
		masked = 0
1605
		protected = 0
1611
		protected = 0
1606
		sep = os.path.sep
1612
		sep = os.path.sep
1613
		if self.case_insensitive:
1614
			obj = obj.lower()
1607
		for ppath in self.protect:
1615
		for ppath in self.protect:
1608
			if len(ppath) > masked and obj.startswith(ppath):
1616
			if len(ppath) > masked and obj.startswith(ppath):
1609
				if ppath in self._dirs:
1617
				if ppath in self._dirs:
1610
- 

Return to bug 524236