Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=kdetesting.git;a=commitdiff;h=55f69c6d5a2954909d5c8b71cf8b36dfecf2aa9e

commit 55f69c6d5a2954909d5c8b71cf8b36dfecf2aa9e
Author: Michel Hermier <herm...@frugalware.org>
Date:   Mon Jan 4 09:47:35 2010 +0100

include/util.sh

* Make Fsplit able to detect new (unexisting in a future version of
pacman-g2) subpackages.
* Make Fsplit able to properly detect wildcards. (Previous trick was to
remove the leading "/" but it simplier to escape the wildcards)

diff --git a/source/include/util.sh b/source/include/util.sh
index 69b205b..c7f21df 100644
--- a/source/include/util.sh
+++ b/source/include/util.sh
@@ -1125,24 +1125,29 @@ Fwrapper()
# * Fsplit(): Moves a file pattern to a subpackage. Parameters: 1) name of the
# subpackage 2) pattern of the files to move. Example: Fsplit libmysql /usr/lib.
#
-# NOTE: never use a leading slash when using wildcards!
+# NOTE: You have to quote wildcards to split the proper files! (/foo/* => 
/foo/\*)
###
Fsplit()
{
-       local subpkg=$1
+       local i dir path subpkg=$1
shift 1
-       local i
-       local dir
-       local path
-       for i in $@
-       do
-               # split the / suffix if used
-               path=`echo $i|sed 's|/$||'`
+       if [ ! -d $startdir/pkg.$subpkg ]; then
+               # FIXME Compatibility: check for $subpkg in subpkgs
+               warning "Trying to move $@ to undeclared subpackage $subpkg"
+               mkdir -p $startdir/pkg.$subpkg/
+#              Fdie
+       fi

-               Fmessage "Moving $path to subpackage $subpkg"
-               dir=`echo $path|sed 's|/[^/]*$||'`
-               mkdir -p $startdir/pkg.$subpkg/$dir/
-               mv $Fdestdir/$path $startdir/pkg.$subpkg/$dir/ || Fdie
+       for i in "$@"
+       do
+               Fmessage "Moving $i to subpackage $subpkg"
+               for path in $Fdestdir/$i
+               do
+                       path=`echo ${path%/}` # Remove / suffix if found
+                       dir=`dirname ${path#$Fdestdir}` # Remove $Fdestdir 
prefix, and last dir element
+                       mkdir -p $startdir/pkg.$subpkg/$dir/
+                       mv $path $startdir/pkg.$subpkg/$dir/ || Fdie
+               done
done
}
_______________________________________________
Frugalware-git mailing list
Frugalware-git@frugalware.org
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to