[Frugalware-git] kdetesting: include/util.sh
Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=kdetesting.git;a=commitdiff;h=876621cdb2139e633fa7f50adf6275b2f24fabbc commit 876621cdb2139e633fa7f50adf6275b2f24fabbc Author: Michel Hermier Date: Wed Jan 20 18:34:02 2010 +0100 include/util.sh * Fix missing line break typo. diff --git a/source/include/util.sh b/source/include/util.sh index e715aae..89d7886 100644 --- a/source/include/util.sh +++ b/source/include/util.sh @@ -491,7 +491,7 @@ Ftreecmp() { fi (cd "$1" && find $_F_treecmp_findopts | sort) > $old (cd "$2" && find $_F_treecmp_findopts | sort) > $new - diff --new-line-format='+%L' --old-line-format='-%L' + diff --new-line-format='+%L' --old-line-format='-%L' \ --unchanged-line-format='=%L' $old $new \ | while read line do ___ Frugalware-git mailing list Frugalware-git@frugalware.org http://frugalware.org/mailman/listinfo/frugalware-git
[Frugalware-git] kdetesting: include/util.sh: use mktemp in Ftreecmp()
Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=kdetesting.git;a=commitdiff;h=a808e2fb2e2c8b64f6946d01fa644fc13be065d8 commit a808e2fb2e2c8b64f6946d01fa644fc13be065d8 Author: Miklos Vajna Date: Wed Jan 20 13:40:51 2010 +0100 include/util.sh: use mktemp in Ftreecmp() diff --git a/source/include/util.sh b/source/include/util.sh index c82b145..e715aae 100644 --- a/source/include/util.sh +++ b/source/include/util.sh @@ -480,7 +480,7 @@ Fdeststrip() { # first tree to the second tree. ### Ftreecmp() { - local line + local line old=$(mktemp) new=$(mktemp) if [ ! -d "$1" -o ! -d "$2" ]; then Fmessage "$1 or $2 is not a directory" Fdie @@ -489,13 +489,15 @@ Ftreecmp() { Fmessage "Comparison function is empty" Fdie fi - diff --new-line-format='+%L' --old-line-format='-%L' --unchanged-line-format='=%L' \ - <(cd "$1" && find $_F_treecmp_findopts | sort) \ - <(cd "$2" && find $_F_treecmp_findopts | sort) \ + (cd "$1" && find $_F_treecmp_findopts | sort) > $old + (cd "$2" && find $_F_treecmp_findopts | sort) > $new + diff --new-line-format='+%L' --old-line-format='-%L' + --unchanged-line-format='=%L' $old $new \ | while read line do $3 $line done + rm $old $new } ### ___ Frugalware-git mailing list Frugalware-git@frugalware.org http://frugalware.org/mailman/listinfo/frugalware-git
[Frugalware-git] kdetesting: include/util.sh
Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=kdetesting.git;a=commitdiff;h=606a295498d08f549ba86f9ba0349de86beca133 commit 606a295498d08f549ba86f9ba0349de86beca133 Author: Michel Hermier Date: Wed Jan 20 09:53:18 2010 +0100 include/util.sh * Restore Ftreecmp. * Modify the shebang to bash. diff --git a/source/include/util.sh b/source/include/util.sh index c91ff9d..c82b145 100644 --- a/source/include/util.sh +++ b/source/include/util.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # No author, see below. @@ -489,13 +489,13 @@ Ftreecmp() { Fmessage "Comparison function is empty" Fdie fi - #diff --new-line-format='+%L' --old-line-format='-%L' --unchanged-line-format='=%L' \ - # <(cd "$1" && find $_F_treecmp_findopts | sort) \ - # <(cd "$2" && find $_F_treecmp_findopts | sort) \ - #| while read line - #do - # $3 $line - #done + diff --new-line-format='+%L' --old-line-format='-%L' --unchanged-line-format='=%L' \ + <(cd "$1" && find $_F_treecmp_findopts | sort) \ + <(cd "$2" && find $_F_treecmp_findopts | sort) \ + | while read line + do + $3 $line + done } ### ___ Frugalware-git mailing list Frugalware-git@frugalware.org http://frugalware.org/mailman/listinfo/frugalware-git
[Frugalware-git] kdetesting: include/util.sh
Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=kdetesting.git;a=commitdiff;h=f6d1714c1949b7599287a3f9d8f4386da87bf422 commit f6d1714c1949b7599287a3f9d8f4386da87bf422 Author: Michel Hermier Date: Mon Jan 18 23:50:52 2010 +0100 include/util.sh * Added Ftreecmp(): Utility to compare file tree and perform actions depending on the comparison result. * Added Fcleandesttree(): Utility to clean $Fdesttree of duplicates with subpackage (names must be passed as arguments). diff --git a/source/include/util.sh b/source/include/util.sh index c7f21df..c73c8b2 100644 --- a/source/include/util.sh +++ b/source/include/util.sh @@ -473,6 +473,59 @@ Fdeststrip() { } ### +# * Ftreecmp(): Compare 2 tree and do an action on a compare result. Parameters: +# 1) Fist tree 2) Second tree 3) Action to perform on compared item. The item +# is an inode item (relative to both tree) prefixed with '-', '=' or '+' +# depending if it deleted, still present or added in the comparison from the +# first tree to the second tree. +### +Ftreecmp() { + local line + if [ ! -d "$1" -o ! -d "$2" ]; then + Fmessage "$1 or $2 is not a directory" + Fdie + fi + if [ -z "$3" ]; then + Fmessage "Comparison function is empty" + Fdie + fi + diff --new-line-format='+%L' --old-line-format='-%L' --unchanged-line-format='=%L' \ + <(cd "$1" && find $_F_treecmp_findopts | sort) \ + <(cd "$2" && find $_F_treecmp_findopts | sort) \ + | while read line + do + $3 $line + done +} + +### +# * __Ftreecmp_cleandestdir: Internal +### +__Ftreecmp_cleandestdir() { + case "$1" in + =*) Frm "${1//=/}" ;; + esac +} + +### +# * Fcleandestdir(): Clean the $Fdestdir from subpackages files, to make +# them conflict less. Parameters: The subpackages to use. +### +Fcleandestdir() { + local i + for i in "$@" + do + if [ ! -d "$Fdestdir.$i" ]; then + Fmessage "$i is not an existing subpackage." + Fdie + fi + Fmessage "Removing conflicting files with $i subpackage." + _F_treecmp_findopts='! -type d' \ + Ftreecmp "$Fdestdir" "$Fdestdir.$i" __Ftreecmp_cleandestdir + done +} + +### # * __Fpatch(): Internal. Apply a patch with -p0 (or -p1 if -p0 fails). # Parameter: Patch to apply. ### ___ Frugalware-git mailing list Frugalware-git@frugalware.org http://frugalware.org/mailman/listinfo/frugalware-git
[Frugalware-git] kdetesting: include/util.sh
Git-Url: http://git.frugalware.org/gitweb/gitweb.cgi?p=kdetesting.git;a=commitdiff;h=55f69c6d5a2954909d5c8b71cf8b36dfecf2aa9e commit 55f69c6d5a2954909d5c8b71cf8b36dfecf2aa9e Author: Michel Hermier 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