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

Collapse All | Expand All

(-)/lib/rcscripts/awk/cachedepends.awk (-2 / +4 lines)
Lines 3-14 Link Here
3
# $Header: /home/cvsroot/gentoo-src/rc-scripts/src/awk/cachedepends.awk,v 1.17 2004/04/21 17:09:18 vapier Exp $
3
# $Header: /home/cvsroot/gentoo-src/rc-scripts/src/awk/cachedepends.awk,v 1.17 2004/04/21 17:09:18 vapier Exp $
4
4
5
function print_start() {
5
function print_start() {
6
	print "source /sbin/functions.sh" >> TMPCACHE
7
	print "" >> TMPCACHE
8
	print "need() {" >> TMPCACHE
6
	print "need() {" >> TMPCACHE
9
	print "	echo \"NEED $*\"; return 0" >> TMPCACHE
7
	print "	echo \"NEED $*\"; return 0" >> TMPCACHE
10
	print "}" >> TMPCACHE
8
	print "}" >> TMPCACHE
11
	print "" >> TMPCACHE
9
	print "" >> TMPCACHE
10
	print "needsme() {" >> TMPCACHE
11
	print "	echo \"NEEDSME $*\"; return 0" >> TMPCACHE
12
	print "}" >> TMPCACHE
13
	print "" >> TMPCACHE
12
	print "use() {" >> TMPCACHE
14
	print "use() {" >> TMPCACHE
13
	print "	echo \"USE $*\"; return 0" >> TMPCACHE
15
	print "	echo \"USE $*\"; return 0" >> TMPCACHE
14
	print "}" >> TMPCACHE
16
	print "}" >> TMPCACHE
(-)/lib/rcscripts/awk/gendepends.awk (-10 / +60 lines)
Lines 66-71 Link Here
66
	return 1
66
	return 1
67
}
67
}
68
68
69
# bool add_deptree_item_by_name(name, type, item)
70
#
71
#   Add an item(s) 'item' to the DEPTREE array at index [rcnumber,type]
72
#
73
function add_deptree_item_by_name(name, type, item)
74
{
75
	if (IMPOSEDTREE[name,type] != "")
76
		IMPOSEDTREE[name,type] = IMPOSEDTREE[name,type] " " item
77
	else
78
		IMPOSEDTREE[name,type] = item
79
80
	return 1
81
}
82
83
# array find_services(pat)
84
#
85
#   Search for all services whose name matches the given pattern.
86
#
87
function find_services(pat)
88
{
89
	delete FOUND_SERVICES
90
	for (x = 1; x <= RC_NUMBER; ++x) {
91
		if (match(DEPTREE[x,NAME], pat)) {
92
			FOUND_SERVICES[DEPTREE[x,NAME]] = 1;
93
		}
94
	}
95
}
96
69
# bool add_provide(service, provide)
97
# bool add_provide(service, provide)
70
#
98
#
71
#   Add a name of a virtual service ('provide') that 'service' Provides
99
#   Add a name of a virtual service ('provide') that 'service' Provides
Lines 401-415 Link Here
401
			add_db_entry(DEPTREE[RC_NUMBER,NAME], MTIME, $0)
429
			add_db_entry(DEPTREE[RC_NUMBER,NAME], MTIME, $0)
402
		}
430
		}
403
	}
431
	}
432
433
	if ($1 == "NEEDSME") {
434
		sub(/NEEDSME[[:space:]]*/, "")
435
436
		if ($0 != "") {
437
			split($0, imposedupon, " ")
438
			for (depend in imposedupon)
439
				add_deptree_item_by_name(imposedupon[depend],
440
						NEED, DEPTREE[RC_NUMBER,NAME])
441
		}
442
	}
404
}
443
}
405
444
406
END {
445
END {
407
	# Add the 'net' service if it do not exist ...
408
	if (!check_service("net")) {
409
		RC_NUMBER++
410
		DEPTREE[RC_NUMBER,NAME] = "net"
411
	}
412
	
413
	# Calculate all the provides and parallels ...
446
	# Calculate all the provides and parallels ...
414
	for (x = 1;x <= RC_NUMBER;x++) {
447
	for (x = 1;x <= RC_NUMBER;x++) {
415
448
Lines 420-439 Link Here
420
			add_parallel(DEPTREE[x,NAME], DEPTREE[x,PARALLEL])
453
			add_parallel(DEPTREE[x,NAME], DEPTREE[x,PARALLEL])
421
	}
454
	}
422
455
456
	# Add the 'net' service if it do not exist ...
457
	if (!check_service("net")) {
458
		RC_NUMBER++
459
		DEPTREE[RC_NUMBER,NAME] = "net"
460
	}
461
423
	# Now do NEED, USE, BEFORE and AFTER
462
	# Now do NEED, USE, BEFORE and AFTER
424
	for (x = 1;x <= RC_NUMBER;x++) {
463
	for (x = 1;x <= RC_NUMBER;x++) {
425
	
464
	
465
		name=DEPTREE[x,NAME]
466
426
		if ((x,NEED) in DEPTREE)
467
		if ((x,NEED) in DEPTREE)
427
			resolve_depend(NEED, DEPTREE[x,NAME], DEPTREE[x,NEED])
468
			resolve_depend(NEED, name, DEPTREE[x,NEED])
428
469
429
		if ((x,USE) in DEPTREE)
470
		if ((x,USE) in DEPTREE)
430
			resolve_depend(USE, DEPTREE[x,NAME], DEPTREE[x,USE])
471
			resolve_depend(USE, name, DEPTREE[x,USE])
431
472
432
		if ((x,BEFORE) in DEPTREE)
473
		if ((x,BEFORE) in DEPTREE)
433
			resolve_depend(BEFORE, DEPTREE[x,NAME], DEPTREE[x,BEFORE])
474
			resolve_depend(BEFORE, name, DEPTREE[x,BEFORE])
434
475
435
		if ((x,AFTER) in DEPTREE)
476
		if ((x,AFTER) in DEPTREE)
436
			resolve_depend(AFTER, DEPTREE[x,NAME], DEPTREE[x,AFTER])
477
			resolve_depend(AFTER, name, DEPTREE[x,AFTER])
478
	}
479
480
	# Now impose dependancies on other services (how rude!)
481
	for (depend in IMPOSEDTREE) {
482
		split(depend, nameandtype, SUBSEP)
483
		find_services(nameandtype[1])
484
		for (service in FOUND_SERVICES) {
485
			resolve_depend(nameandtype[2], service, IMPOSEDTREE[depend])
486
		}
437
	}
487
	}
438
488
439
	for (x = TYPES_MIN; x <= TYPES_MAX; x++)
489
	for (x = TYPES_MIN; x <= TYPES_MAX; x++)

Return to bug 70226