summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>2009-01-06 21:19:33 -0800
committerRoland McGrath <roland@redhat.com>2009-01-06 21:19:33 -0800
commit5fee4451816ab63111d2675b3999b96a4b8b16af (patch)
treede34878ae714fe9f485083beb864781181729e9f
parent23fc1b5ab44476fe22a9bf1de337a263c87a5b74 (diff)
downloaddebuginfo-test-scripts-5fee4451816ab63111d2675b3999b96a4b8b16af.tar.gz
debuginfo-test-scripts-5fee4451816ab63111d2675b3999b96a4b8b16af.tar.xz
debuginfo-test-scripts-5fee4451816ab63111d2675b3999b96a4b8b16af.zip
rejigger directory layout
-rw-r--r--README6
-rwxr-xr-xextract-distro.sh17
-rwxr-xr-xextract-rpm.sh27
-rwxr-xr-xpack-debuginfo.sh17
-rwxr-xr-xsingle-file-test.sh15
-rwxr-xr-xupdate-file-lists.mk30
6 files changed, 74 insertions, 38 deletions
diff --git a/README b/README
index 187de49..cc034a4 100644
--- a/README
+++ b/README
@@ -21,9 +21,9 @@ containing many .rpm files. The example is a mirror of rawhide; other
examples that work are .../releases/10/Everything and .../updates{,/testing}.
This will chug and chug for some hours, depending how much is in the
-directories you gave it. It fills the current directory with one
-subdirectory for each rpm it unpacked, with names from the rpm file names,
-e.g. foo-debuginfo-1.0-1.i386/.
+directories you gave it. It fills the current directory with a tree
+containing one subdirectory for each rpm it unpacked, with names from the
+rpm file names, e.g. i386/fo/o-/foo-debuginfo-1.0-1.i386/.
You can run this again later with more directories or the same ones.
It will silently skip any rpm files it has already unpacked.
diff --git a/extract-distro.sh b/extract-distro.sh
index ef8f452..348e7f9 100755
--- a/extract-distro.sh
+++ b/extract-distro.sh
@@ -7,11 +7,12 @@ PATH="$srcdir:$PATH"
here=`pwd`
df -h .
-for distro; do
- for dir in $distro/*/debug/; do
- echo "considering ${dir}..."
- (cd "$dir" && ls | extract-rpm.sh "$here") | pack-debuginfo.sh &
- done
- wait
- df -h .
-done
+
+find "$@" -name debug -o -name Debuginfo | (
+ echo 'all: \'
+ sed 's,^.*$,do/& \\,'
+ echo
+ echo 'do/%:;(cd $* && ls | extract-rpm.sh "$$here") | pack-debuginfo.sh'
+) | make -f - -r here="$here" -s -j$(getconf _NPROCESSORS_ONLN)
+
+df -h .
diff --git a/extract-rpm.sh b/extract-rpm.sh
index 1449660..9ed5253 100755
--- a/extract-rpm.sh
+++ b/extract-rpm.sh
@@ -8,23 +8,28 @@ fi
dest=$1; shift
-while read rpm; do
+while read file; do
- name="${rpm%.rpm}"
- if [ "$name" = "$rpm" ]; then
- [ $v -eq 0 ] || echo >&2 "not .rpm: $rpm"
+ name="${file%.rpm}"
+ if [ "$name" = "$file" ]; then
+ [ $v -eq 0 ] || echo >&2 "not .rpm: $file"
continue
fi
- name="${name##*/}"
- if [ -d "$dest/$name" ] && ! rmdir "$dest/$name" 2> /dev/null; then
- [ $v -eq 0 ] || echo >&2 "$name already there"
+ rpm="${name##*/}"
+
+ archless=${rpm%.*}
+ arch=${rpm##*.}
+ d=${arch}/${archless:0:2}/${archless:2:2}/$rpm
+
+ if [ -d "$d/$rpm" ] && ! rmdir "$d/$rpm" 2> /dev/null; then
+ [ $v -eq 0 ] || echo >&2 "$rpm already there"
continue
fi
- mkdir -p "$dest/$name" || exit
+ mkdir -p "$d/$rpm" || exit
rpm2cpio "$rpm" |
- (cd "$dest/$name"; cpio --quiet --extract --no-abs --make-dir ||
- echo >&2 "FAILED: $name")
+ (cd "$d/$rpm"; cpio --quiet --extract --no-abs --make-dir ||
+ echo >&2 "FAILED: $rpm")
- echo "$name"
+ echo "$rpm"
done
diff --git a/pack-debuginfo.sh b/pack-debuginfo.sh
index b950b5a..404ec19 100755
--- a/pack-debuginfo.sh
+++ b/pack-debuginfo.sh
@@ -43,8 +43,6 @@ END {
do_dir()
{
- cd "$dir"
-
do_src &
find usr/lib/debug -type f ! -links 1 -exec rm -f {} \; 2> /dev/null
@@ -66,19 +64,22 @@ do_dir()
echo " $summary" >> summary
- cd ..
-
echo "packed $dir"
}
-while read dir; do
+while read rpm; do
+
+ archless=${rpm%.*}
+ arch=${rpm##*.}
+ d=${arch}/${archless:0:2}/${archless:2:2}/$rpm
- if [ -r "$dir/summary" ]; then
- echo >&2 "$dir looks packed"
+ if [ -r "$d/summary" ]; then
+ echo >&2 "$rpm looks packed"
continue
fi
- do_dir
+ dir=$rpm
+ (cd "$d" && do_dir)
done
diff --git a/single-file-test.sh b/single-file-test.sh
index 6e8f5b5..fbdaf1c 100755
--- a/single-file-test.sh
+++ b/single-file-test.sh
@@ -9,13 +9,7 @@ shift
run_all()
{
set -e
- make -s -r -f - ${which}.list <<\EOF
-%.list: */summary
- (echo 'all:\'; \
- list-files.sh $* | sed 's,^.*$$,test@/&\\,'; \
- echo \;) > $@.new
- mv -f $@.new $@
-EOF
+ update-file-lists.mk which=${which}
# The spawn of make run copies that do run_one(), below.
make -s -j$(getconf _NPROCESSORS_ONLN) -r -f ${which}.list -f - <<EOF
@@ -31,8 +25,13 @@ run_one()
dir=${file//\//:}
name=${file##*/}
+ rpm=$file
+ archless=${rpm%.*}
+ arch=${rpm##*.}
+ d=${arch}/${archless:0:2}/${archless:2:2}
+
mkdir -p $work/$dir &&
- bunzip2 < $file.bz2 > $work/$dir/$name &&
+ bunzip2 < $d/$file.bz2 > $work/$dir/$name &&
echo "${*//{\}/$name}" > $work/$dir/cmd && {
(cd $work/$dir && . cmd) > $work/$dir/log 2>&1
diff --git a/update-file-lists.mk b/update-file-lists.mk
new file mode 100755
index 0000000..4922758
--- /dev/null
+++ b/update-file-lists.mk
@@ -0,0 +1,30 @@
+#!/usr/bin/make -srf
+
+summary := $(wildcard */summary)
+
+which ?= all
+
+ifeq (,$(summary))
+
+dirs := $(wildcard */)
+
+$(which).list: $(dirs:=$(which).list)
+ cat -- $^ > $@.new
+ mv -f $@.new $@
+
+me := $(MAKEFILE_LIST)
+
+FORCE:;
+$(dirs:=$(which).list): FORCE
+ $(MAKE) -f `(cd $(dir $(me)); pwd)`/$(notdir $(me)) \
+ -C $(@D) which=$(which)
+
+else
+
+$(which).list: %.list: $(summary)
+ (echo 'all:\'; \
+ list-files.sh $* | sed 's,^.*$$,test@/&\\,'; \
+ echo \;) > $@.new
+ mv -f $@.new $@
+
+endif