Lines 114-130
cleanup_incoming()
Link Here
|
114 |
local f |
114 |
local f |
115 |
for f in "$@"; do |
115 |
for f in "$@"; do |
116 |
if [ ! -r "$f" ]; then |
116 |
if [ ! -r "$f" ]; then |
117 |
FileError "unavailable" "$f" |
117 |
FileError "unavailable" "$f" |
118 |
continue |
118 |
continue |
119 |
fi |
119 |
fi |
120 |
local type rpm_arch component |
120 |
local type rpm_arch component |
121 |
type="$(file -b "$f")" || { rc=1; continue; } |
121 |
type="$(file -b "$f")" || { rc=1; continue; } |
122 |
rpm_arch="$(printf %s "$f" | sed -ne 's,^.*\.\([^.]\+\)\.rpm$,\1,p')" || |
122 |
rpm_arch="$f"; rpm_arch="${rpm_arch%.rpm}"; rpm_arch="${rpm_arch##*.}" |
|
|
123 |
[ -n "$rpm_arch" ] || |
123 |
{ rc=1; continue; } |
124 |
{ rc=1; continue; } |
124 |
valid_architecture "$rpm_arch" || |
125 |
valid_architecture "$rpm_arch" || |
125 |
{ FileError "invalid architecture: $rpm_arch" "$f"; rc=1; continue; } |
126 |
{ FileError "invalid architecture: $rpm_arch" "$f"; rc=1; continue; } |
126 |
if [ -z "${type##RPM v3 src *}" ]; then |
127 |
if [ -z "${type##RPM v3 src *}" ]; then |
127 |
target_cleanup "$f" "$NEW_FILE_PREFIX/SRPMS" || rc=1 |
128 |
target_cleanup "$f" "$NEW_FILE_PREFIX/SRPMS" || rc=1 |
128 |
elif [ -z "${type##RPM v3 bin *}" ]; then |
129 |
elif [ -z "${type##RPM v3 bin *}" ]; then |
129 |
target_cleanup "$f" "$NEW_FILE_PREFIX/$rpm_arch/RPMS" || rc=1 |
130 |
target_cleanup "$f" "$NEW_FILE_PREFIX/$rpm_arch/RPMS" || rc=1 |
130 |
else |
131 |
else |
Lines 164-180
upload_bin_new()
Link Here
|
164 |
local f rpm_arch |
165 |
local f rpm_arch |
165 |
for f in *.rpm; do |
166 |
for f in *.rpm; do |
166 |
if [ ! -f "$f" ]; then |
167 |
if [ ! -f "$f" ]; then |
167 |
[ "$f" != '*.rpm' ] || continue |
168 |
[ "$f" != '*.rpm' ] || continue |
168 |
FileError "not a regular file" "$f" |
169 |
FileError "not a regular file" "$f" |
169 |
rc=1 |
170 |
rc=1 |
170 |
continue |
171 |
continue |
171 |
fi |
172 |
fi |
172 |
rpm_arch="$(printf %s "$f" | sed -ne 's,^.*\.\([^\.]\+\)\.rpm$,\1,p')" || |
173 |
rpm_arch="$f"; rpm_arch="${rpm_arch%.rpm}"; rpm_arch="${rpm_arch##*.}" |
|
|
174 |
[ -n "$rpm_arch" ] || |
173 |
{ rc=1; continue; } |
175 |
{ rc=1; continue; } |
174 |
valid_architecture "$rpm_arch" || |
176 |
valid_architecture "$rpm_arch" || |
175 |
{ FileError "invalid architecture: $rpm_arch" "$f"; rc=1; continue; } |
177 |
{ FileError "invalid architecture: $rpm_arch" "$f"; rc=1; continue; } |
176 |
$test cp -pv -- "$f" "$PREFIX/$NEW_FILE_PREFIX/$rpm_arch/RPMS" |
178 |
$test cp -pv -- "$f" "$PREFIX/$NEW_FILE_PREFIX/$rpm_arch/RPMS" |
177 |
done |
179 |
done |
178 |
|
180 |
|
179 |
cleanup_incoming *.rpm |
181 |
cleanup_incoming *.rpm |
180 |
|
182 |
|
Lines 186-230
check_missing_srpms()
Link Here
|
186 |
{ |
188 |
{ |
187 |
local rpms_dir="$1" |
189 |
local rpms_dir="$1" |
188 |
shift || return |
190 |
shift || return |
189 |
local srpms_dir="$1" |
191 |
local srpms_dir="$1" |
190 |
shift || return |
192 |
shift || return |
191 |
|
193 |
|
192 |
local rc=0 |
194 |
local rc=0 |
193 |
local f n |
195 |
local f n |
|
|
196 |
local repo_src="$PREFIX/$NEW_SRC_REPOSITORIES" |
194 |
|
197 |
|
195 |
for f in "$rpms_dir"/*.rpm; do |
198 |
for f in "$rpms_dir"/*.rpm; do |
196 |
if [ ! -f "$f" ]; then |
199 |
if [ ! -f "$f" ]; then |
197 |
[ "$f" != "$rpms_dir/*.rpm" ] || continue |
200 |
[ "$f" != "$rpms_dir/*.rpm" ] || continue |
198 |
FileError "not a regular file" "$f" |
201 |
FileError "not a regular file" "$f" |
199 |
rc=1 |
202 |
rc=1 |
200 |
continue |
203 |
continue |
201 |
fi |
204 |
fi |
202 |
n=`LANG=C LANGUAGE=C LC_ALL=C rpmquery -p --qf '%{SOURCERPM}' -- "$f"` || |
205 |
n=`LANG=C LANGUAGE=C LC_ALL=C rpmquery -p --qf '%{SOURCERPM}' -- "$f"` || |
203 |
{ rc=1; continue; } |
206 |
{ rc=1; continue; } |
204 |
n="${n%.src.rpm}" |
207 |
n="${n%.src.rpm}" |
205 |
n="${n%.nosrc.rpm}" |
208 |
n="${n%.nosrc.rpm}" |
206 |
if ! [ -f "$srpms_dir/$n.src.rpm" -o -f "$srpms_dir/$n.nosrc.rpm" ]; then |
209 |
if ! [ -f "$srpms_dir/$n.src.rpm" -o -f "$srpms_dir/$n.nosrc.rpm" ] && |
|
|
210 |
! [ -f "$repo_src/$n.src.rpm" -o -f "$repo_src/$n.nosrc.rpm" ]; then |
207 |
FileError "$n" "$f" |
211 |
FileError "$n" "$f" |
208 |
rc=1 |
212 |
rc=1 |
209 |
fi |
213 |
fi |
210 |
done |
214 |
done |
211 |
|
215 |
|
212 |
return $rc |
216 |
return $rc |
213 |
} |
217 |
} |
214 |
|
218 |
|
215 |
# find orphaned SRPMS |
219 |
# find orphaned SRPMS |
216 |
check_obsolete_srpms() |
220 |
check_obsolete_srpms() |
217 |
{ |
221 |
{ |
218 |
local rpms_dir="$1" |
222 |
local rpms_dir="$1" |
219 |
shift || return |
223 |
shift || return |
220 |
local srpms_dir="$1" |
224 |
local srpms_dir="$1" |
221 |
shift || return |
225 |
shift || return |
222 |
|
226 |
|
|
|
227 |
[ -n "$(find "$rpms_dir" -mindepth 1 -maxdepth 1 -type f -name '*src\.rpm' -print -quit)" ] || |
228 |
return 0 |
229 |
|
223 |
local rc=0 |
230 |
local rc=0 |
224 |
local list= |
231 |
local list= |
225 |
local f n |
232 |
local f n |
226 |
|
233 |
|
227 |
pushd "$rpms_dir" >/dev/null #RPMS |
234 |
pushd "$rpms_dir" >/dev/null #RPMS |
228 |
for f in *.rpm; do |
235 |
for f in *.rpm; do |
229 |
if [ ! -f "$f" ]; then |
236 |
if [ ! -f "$f" ]; then |
230 |
[ "$f" != '*.rpm' ] || continue |
237 |
[ "$f" != '*.rpm' ] || continue |
Lines 246-262
$n"
Link Here
|
246 |
if [ ! -f "$f" ]; then |
253 |
if [ ! -f "$f" ]; then |
247 |
[ "$f" != '*.rpm' ] || continue |
254 |
[ "$f" != '*.rpm' ] || continue |
248 |
FileError "not a regular file" "$f" |
255 |
FileError "not a regular file" "$f" |
249 |
rc=1 |
256 |
rc=1 |
250 |
continue |
257 |
continue |
251 |
fi |
258 |
fi |
252 |
n="${f%.src.rpm}" |
259 |
n="${f%.src.rpm}" |
253 |
n="${n%.nosrc.rpm}" |
260 |
n="${n%.nosrc.rpm}" |
254 |
if ! printf %s "$list" |grep -qs "^$n\$"; then |
261 |
if ! printf %s "$list" |grep -m1 -qsxF "$n"; then |
255 |
FileError "$f" |
262 |
FileError "$f" |
256 |
rc=1 |
263 |
rc=1 |
257 |
fi |
264 |
fi |
258 |
done |
265 |
done |
259 |
popd >/dev/null |
266 |
popd >/dev/null |
260 |
|
267 |
|
261 |
return $rc |
268 |
return $rc |
262 |
} |
269 |
} |