--- Compile-pre_rpm	2006-09-09 15:19:48.000000000 -0300
+++ Compile	2006-09-09 16:06:10.000000000 -0300
@@ -764,6 +764,9 @@
    [ "$unpack" = "yes" ] && \
    for ((i=0; i < ${#files[@]}; i++))
    do
+      if [ "`basename ${files[i]}`" != "`basename ${files[i]} .src.rpm`" ]
+      then unpack_files=files_in_root
+      fi
       drop=.
       skipdir=
       if [ "$unpack_files" = "files_in_root" ]
@@ -800,7 +803,18 @@
       Log_Normal "Unpacking file ${files[i]}..."
       if [ "$uncompress" = "no" ]
       then cp -v "${files[i]}" "${tempdir}" >&$verboseFD || Die "Could not copy '$f'."
-      else aunpack --extract-to="${tempdir}" -f "${files[i]}" >&$verboseFD || Die "Could not unpack '$f'."
+      else
+         aunpack --extract-to="${tempdir}" -f "${files[i]}" >&$verboseFD || Die "Could not unpack '$f'."
+         if [ "`basename ${files[i]}`" != "`basename ${files[i]} .src.rpm`" ]
+         then
+            unpack_files=files_in_root
+	    Quiet pushd "${tempdir}"
+            [ "$rpm_tar_name" ] || rpm_tar_name="`find -name *.tar.gz`" && rpm_tar_name="${rpm_tar_name[0]}"
+            Log_Normal "Unpacking file ${files[i]}/`basename ${rpm_tar_name}`..."
+            aunpack --extract-to="." -f "${rpm_tar_name}" >&$verboseFD || Die "Could not unpack '${rpm_tar_name}'."
+            dir="$dir/`basename ${rpm_tar_name} .tar.gz`"
+	    Quiet popd
+	 fi
       fi
 
       if [ "$unpack_files" -o $i -eq $(( ${#files[@]} - 1 )) ]; then
