View | Details | Raw Unified
Collapse All | Expand All

(-)sisyphus-0.9.1/bin/sisyphus_relink.relink (-10 / +35 lines)
 Lines 56-76   unlink_symlinked() Link Here 
56
56
57
check_arch_dups()
57
check_arch_dups()
58
{
58
{
59
	local arch=$1
59
	local arch=$1
60
	shift
60
	shift
61
61
62
	echo "Checking layout dups for $arch"
62
	echo "Checking layout dups for $arch"
63
	local out
63
	local out
64
	out=$(cut -f1 "files/list.$arch".* |sort |uniq -c |awk '{if ($1!=1) print $2}')
64
	out=$(cut -f1 "files/list.$arch".* |sort |uniq -c |awk '{if ($1!=1) print $2}') #'
65
	if [ -n "$out" ]; then
65
	if [ -n "$out" ]; then
66
		echo "ERROR: duplicated names found in $arch layout:" >&2
66
		echo "ERROR: duplicated names found in $arch layout" >&2
67
		echo "$out" >&2
67
		duplicate_pkgs="$duplicate_pkgs
68
		return 1
68
$out
69
"
69
	fi
70
	fi
70
}
71
}
71
72
72
calc_arch_names()
73
calc_arch_names()
73
{
74
{
74
	local arch=$1
75
	local arch=$1
75
	shift
76
	shift
76
	local rpms=$1
77
	local rpms=$1
 Lines 89-114   check_arch_missing() Link Here 
89
90
90
	local list="$WORKDIR/$arch"
91
	local list="$WORKDIR/$arch"
91
	[ -s "$list" ] || return 0
92
	[ -s "$list" ] || return 0
92
93
93
	echo "Checking layout misses for $arch"
94
	echo "Checking layout misses for $arch"
94
	local out
95
	local out
95
	out=$(cut -f1 "files/list.$arch".* |sort -u |join "$list" - -v1 |cut -d' ' -f1 |sort -u)
96
	out=$(cut -f1 "files/list.$arch".* |sort -u |join "$list" - -v1 |cut -d' ' -f1 |sort -u)
96
	if [ -n "$out" ]; then
97
	if [ -n "$out" ]; then
97
		echo "ERROR: unlisted packages found in $arch layout:" >&2
98
		echo "ERROR: unlisted packages found in $arch layout">&2
98
		printf %s "$out" |join "$list" - -o 1.2 >&2
99
		missing_pkgs="$missing_pkgs
100
$(printf %s "$out" |join "$list" - -o 1.2)
101
"
99
		return 1
102
		return 1
100
	fi
103
	fi
101
	local f
104
	local f
102
	for f in "files/list.$arch".*; do
105
	for f in "files/list.$arch".*; do
103
		out=$(cut -f1 "$f" |sort -u |join "$list" - -v2 |cut -d' ' -f1 |sort -u)
106
		out=$(cut -f1 "$f" |sort -u |join "$list" - -v2 |cut -d' ' -f1 |sort -u)
104
		if [ -n "$out" ]; then
107
		if [ -n "$out" ]; then
105
			echo "WARNING: orphaned names found in ${f#files/list.} layout:" >&2
108
			echo "WARNING: orphaned names found in ${f#files/list.} layout" >&2
106
			echo "$out" >&2
109
			orphaned_pkgs="$orphaned_pkgs
110
$out
111
"
107
		fi
112
		fi
108
	done
113
	done
109
}
114
}
110
115
111
calc_comp()
116
calc_comp()
112
{
117
{
113
	local arch=$1
118
	local arch=$1
114
	shift
119
	shift
 Lines 160-185   relink_arch() Link Here 
160
		[ -f "$f" ] || continue
165
		[ -f "$f" ] || continue
161
		$debug ln -s $verbose "$r/$n" "$d/" || rc=1
166
		$debug ln -s $verbose "$r/$n" "$d/" || rc=1
162
	done
167
	done
163
	return $rc
168
	return $rc
164
}
169
}
165
170
166
problems_list=
171
problems_list=
167
172
173
duplicate_pkgs=
174
missing_pkgs=
175
orphaned_pkgs=
176
168
check_arch_dups "src" || exit
177
check_arch_dups "src" || exit
169
calc_arch_names "src" "SRPMS" || exit
178
calc_arch_names "src" "SRPMS" || exit
170
check_arch_missing "src" || problems_list="$problems_list src"
179
check_arch_missing "src" || problems_list="$problems_list src"
171
180
172
for arch in $ARCHITECTURES; do
181
for arch in $ARCHITECTURES; do
173
	check_arch_dups "$arch" || exit
182
	check_arch_dups "$arch" || exit
174
	calc_arch_names "$arch" "$arch/RPMS" || exit
183
	calc_arch_names "$arch" "$arch/RPMS" || exit
175
	if ! check_arch_missing "$arch"; then
184
	if ! check_arch_missing "$arch"; then
176
		problems_list="$problems_list $arch"
185
		problems_list="$problems_list $arch"
177
		continue
178
	fi
186
	fi
179
	for comp in $LINKONLY_COMPONENTS $MIXED_COMPONENTS; do
187
	for comp in $LINKONLY_COMPONENTS $MIXED_COMPONENTS; do
180
		calc_comp "$arch" "$comp" || exit
188
		calc_comp "$arch" "$comp" || exit
181
		unlink_symlinked "$arch/RPMS.$comp" || exit
189
		unlink_symlinked "$arch/RPMS.$comp" || exit
182
		if ! relink_arch "$arch" "$comp" "$arch/RPMS" "$arch/RPMS"; then
190
		if ! relink_arch "$arch" "$comp" "$arch/RPMS" "$arch/RPMS"; then
183
			echo "ERROR: $arch"
191
			echo "ERROR: $arch"
184
			problems_list="$problems_list $arch"
192
			problems_list="$problems_list $arch"
185
		fi
193
		fi
 Lines 189-202   for arch in $ARCHITECTURES; do Link Here 
189
		if ! relink_arch "src" "$comp" "$arch/SRPMS" "SRPMS"; then
197
		if ! relink_arch "src" "$comp" "$arch/SRPMS" "SRPMS"; then
190
			echo "ERROR: $arch"
198
			echo "ERROR: $arch"
191
			problems_list="$problems_list $arch"
199
			problems_list="$problems_list $arch"
192
		fi
200
		fi
193
	done
201
	done
194
	find "$WORKDIR" -type f -name 'src.*' -delete
202
	find "$WORKDIR" -type f -name 'src.*' -delete
195
done
203
done
196
204
197
[ -z "$problems_list" ] || Fatal "problems in:$problems_list"
205
[ -z "$problems_list" ] || printf '\n%s\n\n' "problems in:$problems_list" >&2
206
207
if [ -n "$duplicate_pkgs" ]; then
208
    Info "ERROR: duplicated names found:"
209
    printf %s\\n "$duplicate_pkgs" >&2
210
fi
211
212
if [ -n "$missing_pkgs" ]; then
213
    Info "ERROR: unlisted packages found:"
214
    printf %s\\n "$missing_pkgs" >&2
215
fi
216
217
if [ -n "$orphaned_pkgs" ]; then
218
    Info "ERROR: orphaned names found:"
219
    printf %s\\n "$orphaned_pkgs" >&2
220
fi
221
222
[ -z "$duplicate_pkgs" -a -z "$missing_pkgs" -a -z "$orphaned_pkgs" ] || exit 1
198
223
199
echo "Updating classic..."
224
echo "Updating classic..."
200
sisyphus_update_classic
225
sisyphus_update_classic
201
echo "Updating compatibility symlinks..."
226
echo "Updating compatibility symlinks..."
202
sisyphus_migration_hack
227
sisyphus_migration_hack