#!/bin/sh cd /home/ketas/devel/fbsd/ports || exit 1 if [ "$1" = stage2 ] then if [ ! "$2" ] then echo "$0 $1: error: \$2 empty" exit 1 fi arg="$2" #portpath="`echo \"$arg\" | cut -d : -f 1`" #plistfile="`echo \"$arg\" | cut -d : -f 2`" plistfile="$arg" #port="`basename \"$portpath\"`" #origin="`echo \"$portpath\" | sed 's|^/usr/ports/||'`" #safe_plistfile="`echo \"$plistfile\" | tr / -`" #echo #echo #echo "[ portpath=$portpath; plistfile=$plistfile; port=$port ]" #echo "[ origin=$origin; plistfile=$plistfile ]" #echo "[ plistfile=$plistfile ]" #echo plistfile_makere="`echo \"$plistfile\" | sed -E 's|\,|\\\,|g; s|\.|\\\.|g; s|\+|\\\+|g'`" #portsearch -f '^sbin/fsck' -o rawfiles #origins_for_plistfile="`portsearch -f \"^$plistfile\$\" -o path | grep '^Path:' | awk '{print \$2}' | sed 's|^/usr/ports/||'`" origins_for_plistfile="`portsearch -f \"^$plistfile_makere\$\" -o path | grep '^Path:' | awk '{print \$2}' | sed 's|^/usr/ports/||'`" ocount="`echo \"$origins_for_plistfile\" | wc -l | xargs`" origins_for_plistfile_xargs="`echo \"$origins_for_plistfile\" | xargs`" #echo "origins_for_plistfile=$origins_for_plistfile" #echo "origins_for_plistfile=`echo \"$origins_for_plistfile\"`" #conflicts_required_regex="`echo \"$origins_for_plistfile\" | sed 's|^.*/||' | xargs | sed 's/ /|/g; s/^/(/; s/\$/)/'`" #origin_regex="`echo \"$origins_for_plistfile\" | xargs | sed 's|\,|\\\,|g; s|\.|\\\.|g; s|\+|\\\+|g; s/ /|/g; s/^/(/; s/\$/)/'`" origin_regex="`echo \"$origins_for_plistfile\" | xargs | sed 's|\,|\\\,|g; s|\.|\\\.|g; s|\+|\\\+|g; s/ /|/g; s/^/(/; s/\$/)/'`" conflicts_required="`echo \"$origins_for_plistfile\" | sed 's|^.*/||' | xargs`" #echo "conflicts_required_regex=$conflicts_required_regex" echo echo #echo "[ origins = $origins_for_plistfile_xargs / plistfile = $plistfile ]" #echo "[ File $plistfile is owned by $origins_for_plistfile_xargs ]" #echo "[ File $plistfile shared with $origins_for_plistfile_xargs ]" #echo "[ file = $plistfile / ports = $origins_for_plistfile_xargs ]" echo "[ File = $plistfile / Ports = $origins_for_plistfile_xargs ]" echo #echo "origin_regex=$origin_regex" #echo "ocount='$ocount'" ocount_m1=$(($ocount - 1)) #portnames="`portsearch -p \"$origin_regex\" -o name | grep '^Port:' | awk '{print \$2}' | xargs`" #portnames_lf="`portsearch -p \"$origin_regex\" -o name | grep '^Port:' | awk '{print \$2}'`" #portnames_lf="`portsearch -p \"^$origin_regex\$\" -o name | grep '^Port:' | awk '{print \$2}'`" portnames_lf="`portsearch -p \"^/usr/ports/$origin_regex\$\" -o name | grep '^Port:' | awk '{print \$2}'`" #echo "portnames=$portnames" #echo "portnames_lf=$portnames_lf" #exit 0 #pcount=0 #mcount=0 for curr_origin in $origins_for_plistfile do #echo "curr_origin=$curr_origin" #pcount=$(($pcount + 1)) curr_port="`basename \"$curr_origin\"`" curr_portname="`portsearch -p \"^/usr/ports/$curr_origin\$\" -o name | grep '^Port:' | awk '{print \$2}' | xargs`" #echo "curr_portname=$curr_portname" currorigin_makere="`echo \"$curr_origin\" | sed -E 's|\,|\\\,|g; s|\.|\\\.|g; s|\+|\\\+|g'`" #curr_maint="`portsearch -p \"^/usr/ports/$curr_origin\$\" -o maint | grep '^Maint:' | awk '{print \$2}' | xargs`" curr_maint="`portsearch -p \"^/usr/ports/$currorigin_makere\$\" -o maint | grep '^Maint:' | awk '{print \$2}' | xargs`" currportname_makere="`echo \"$curr_portname\" | sed -E 's|\,|\\\,|g; s|\.|\\\.|g; s|\+|\\\+|g'`" #portnames_wocurr="`echo \"$portnames\" | sed 's|$currportname_makere||'`" #portnames_wocurr_lf="`echo \"$portnames_lf\" | fgrep -v \"$curr_portname\"`" portnames_wocurr_lf="`echo \"$portnames_lf\" | egrep -v \"^$curr_portname\$\"`" portnames_wocurr_lf_xargs="`echo \"$portnames_wocurr_lf\" | xargs`" #echo "portnames_wocurr_lf=$portnames_wocurr_lf" #conflicts="`make -C \"/usr/ports/$curr_origin\" -V CONFLICTS`" conflicts="`make -C \"/usr/ports/$curr_origin\" -V CONFLICTS -V CONFLICTS_INSTALL | xargs`" if [ "$conflicts" ] then conflicts_makere="`echo \"$conflicts\" | sed -E 's|\!|^|g; s|\?|\\\?|g; s|\.|\\\.|g; s|\*|.*|g; s|\+|\\\+|g; s/[[:space:]]+/|/g; s|^|^(|; s|\$|)\$|'`" #echo "conflicts_makere=$conflicts_makere" #exit 0 #echo #echo "echo '$conflicts_required' | egrep '$conflicts_makere'" #echo "echo '$portnames' | egrep -q '$conflicts_makere'" #echo "echo '$portnames_wocurr' | egrep -q '$conflicts_makere'" #echo "echo '$portnames_lf' | grep -v '$curr_portname' | egrep -q '$conflicts_makere'" #echo "echo '$portnames_wocurr_lf' | egrep '$conflicts_makere'" #echo "$conflicts_required" | egrep -q "$conflicts_makere" #echo "$portnames" | egrep -q "$conflicts_makere" #echo "$portnames" | sed "s|$curr_port||" | egrep -q "$conflicts_makere" #echo "$portnames" | sed "s|$curr_portname||" #echo "$portnames" | sed "s|$curr_portname||" | egrep -q "$conflicts_makere" #echo "$portnames_lf" | grep -v "$curr_portname" | egrep -q "$conflicts_makere" #echo "$portnames_lf" | fgrep -v "$curr_portname" | egrep -q "$conflicts_makere" #echo "$portnames_wocurr_lf" | egrep -q "$conflicts_makere" #grepout="`echo \"$portnames_wocurr_lf\" | egrep \"$conflicts_makere\"`" grepout="`echo \"$portnames_wocurr_lf\" | egrep -c \"$conflicts_makere\"`" #echo "$portnames_lf" | grep -v "$curr_portname" | egrep -v "$conflicts_makere" #echo "$portnames_lf" | grep -v "$curr_portname" | egrep -c "$conflicts_makere" #echo "$portnames" | sed "s|$currportname_makere||" | egrep -q "$conflicts_makere" #echo "$portnames_wocurr" | egrep -q "$conflicts_makere" #echo "$conflicts_required" | sed "s|$curr_port||" | egrep -q "$conflicts_makere" #echo "$conflicts" | egrep -q "$conflicts_required_regex" grepstatus=$? #echo "grepstatus=$grepstatus" #echo "grepout='$grepout'" #if [ "$portnames_wocurr_lf" ] #then # #elif [ $grepstatus -gt 0 ] #if [ $grepstatus -gt 0 ] if [ $grepstatus -gt 0 -o "$grepout" -lt "$ocount_m1" ] #if [ $grepstatus -gt 0 -a "$portnames_wocurr_lf" ] then #echo "Conflicts error 1" #echo "Mutual CONFLICTS failure (entry does not match) for $curr_origin ... overlapping file $plistfile" #echo "portnames=$portnames" #echo "curr_portname=$curr_portname" #echo "conflicts=$conflicts" #echo "echo '$portnames_wocurr_lf' | egrep -v '$conflicts_makere' | xargs" #echo "Port $curr_portname should have CONFLICTS for all of $portnames_wocurr_lf_xargs but has only $conflicts" #echo -n "===> Port $curr_origin / $curr_portname should have CONFLICTS for: " #echo -n "===> Port $curr_origin should have CONFLICTS for: " #echo -n "===> Port $curr_origin misses CONFLICTS with: " #echo -n "===> $curr_origin misses CONFLICTS with: " #echo -n "===> $curr_origin missing CONFLICTS with: " #echo -n "===> $curr_origin Missing CONFLICTS: " #echo -n "$curr_origin Missing CONFLICTS: " #echo -n "File: $plistfile Port: $curr_origin Missing CONFLICTS: " #echo -n "$plistfile ... $curr_origin Missing " #echo -n "$curr_origin Missing1 " echo -n "$curr_origin Missing " #echo -n 'Missing entries: ' #echo -n "`echo "$portnames_wocurr_lf" | egrep -v "$conflicts_makere" | xargs`" #echo -n "`echo \"$portnames_wocurr_lf\" | egrep -v \"$conflicts_makere\" | xargs`" confl_missing="`echo \"$portnames_wocurr_lf\" | egrep -v \"$conflicts_makere\" | xargs`" echo -n "$confl_missing" #echo " / currently only $conflicts" #echo " Currently: $conflicts" #echo " Currently $conflicts" echo -n " Currently $conflicts" echo -n " Offending file $plistfile" echo " Blame $curr_maint" #echo -n 'cvsline=' ( \ echo -n "$curr_origin" | tr -d ';' ; \ echo -n ';' ; \ echo -n "$confl_missing" | tr -d ';' ; \ echo -n ';' ; \ echo -n "$conflicts" | tr -d ';' ; \ echo -n ';' ; \ echo -n "$plistfile" | tr -d ';' ; \ echo -n ';' ; \ echo -n "$curr_maint" | tr -d ';' ; \ echo \ ) >> tmp/ports-conflicts.log else #echo "Mutual CONFLICTS ok (entry matches) for $curr_origin ... overlapping file $plistfile" #echo "portnames=$portnames" #echo "portnames_lf=$portnames_lf" #echo "curr_portname=$curr_portname" #echo "conflicts=$conflicts" #echo fi #echo "portnames_wocurr=$portnames_wocurr" #echo "curr_portname=$curr_portname" #echo "conflicts=$conflicts" #echo #pcount=0 #mcount=0 #for conflict_i in $conflicts; #do # #echo # #echo "curr_conflict=$curr_conflict" # #echo "conflict_i=$conflict_i" # # # #pcount=0 # #mcount=0 # # #for port_i in $portnames # for port_i in $portnames_wocurr # do # #echo "curr_req_confl=$curr_req_confl" # #echo "port_i=$port_i" # # #pcount=$(($pcount + 1)) # # # #evalsafe="`portsearch -n \"^$port_i\$\" -o path | grep '^Path:' | awk '{print \$2}' | sed 's|^/usr/ports/||' | tr -c '0-9a-zA-Z_' _`" # # # #eval "__var=\$__foundvarp_$evalsafe" # # # #if [ ! "$__var" ] # #then # # #echo "C MATCH: $port_i matches $conflict_i" # # # # pcount=$(($pcount + 1)) # # # # eval "__foundvarp_$evalsafe=yes" # # # # #echo "--->$port_i<--- -$evalsafe-" # # #exit 0 # #fi # # # #port_i_to_origin="`portsearch -n \"^$port_i\$\" -o path | grep '^Path:' | awk '{print \$2}' | sed 's|^/usr/ports/||'`" # # # #if [ "$port_i" = "$curr_port" ] # #if [ "$port_i_to_origin" = "$curr_origin" ] # #then # # echo 'SAME' # #fi # # # case "$port_i" # in # $conflict_i) # #echo "MATCH: $port_i matches $conflict_i" # # #echo HERE # #exit 0 # # evalsafe="`portsearch -n \"^$port_i\$\" -o path | grep '^Path:' | awk '{print \$2}' | sed 's|^/usr/ports/||' | tr -c '0-9a-zA-Z_' _`" # # #eval "__var=\$__foundvar_$port_i" # eval "__var=\$__foundvar_$evalsafe" # # if [ ! "$__var" ] # then # #echo "C MATCH: $port_i matches $conflict_i" # echo "MATCH: $port_i matches $conflict_i" # # mcount=$(($mcount + 1)) # # eval "__foundvar_$evalsafe=yes" # # #echo "--->$port_i<--- -$evalsafe-" # #exit 0 # fi # ;; # *) # echo "NOMATCH: $port_i does not match $conflict_i" # ;; # esac # done # # # #if [ "$pcount" = "$mcount" ] # #then # # echo "MATCH OK for $curr_origin, $pcount = $mcount" # #else # # echo "MATCH ERR for $curr_origin, $pcount != $mcount" # #fi #done #if [ "$mcount" -ge "$pcount" ] #then # echo "MATCH OK for $curr_origin, $mcount -ge $pcount" #else # echo "MATCH ERR for $curr_origin, $mcount !(-ge) $pcount" #fi #if [ "$mcount" -ge "$ocount_m1" ] #then # echo "MATCH OK for $curr_origin, $mcount -ge $ocount_m1" #else # echo "MATCH ERR for $curr_origin, $mcount !(-ge) $ocount_m1" #fi else #echo "Conflicts error 2" #echo "Mutual CONFLICTS failure (entry not found) for $curr_origin ... overlapping file $plistfile" #echo -n "===> Port $curr_origin / $curr_portname should have CONFLICTS for: " #echo -n "===> Port $curr_origin should have CONFLICTS for: " #echo -n "===> Port $curr_origin misses CONFLICTS with: " #echo -n "===> $curr_origin misses CONFLICTS with: " #echo -n "===> $curr_origin missing CONFLICTS with: " #echo -n "===> $curr_origin Missing CONFLICTS: " #echo -n "$curr_origin Missing CONFLICTS: " #echo -n "File: $plistfile Port: $curr_origin Missing CONFLICTS: " #echo -n "$plistfile ... $curr_origin Missing " #echo -n "$curr_origin Missing2 " echo -n "$curr_origin Missing " #echo -n "`echo "$portnames_wocurr_lf" | egrep -v "$conflicts_makere" | xargs`" #echo -n "`echo "$portnames_wocurr_lf" | xargs`" #echo "`echo "$portnames_wocurr_lf" | xargs`" #echo "---2--->echo '$portnames_wocurr_lf' | egrep -v '$conflicts_makere' | xargs<---" #echo "`echo \"$portnames_wocurr_lf\" | egrep -v \"$conflicts_makere\" | xargs`" #echo "`echo \"$portnames_wocurr_lf\" | xargs`" #echo -n "`echo \"$portnames_wocurr_lf\" | xargs`" confl_missing="`echo \"$portnames_wocurr_lf\" | xargs`" echo -n "$confl_missing" #echo " / currently NONE" #echo " / currently: NONE" #echo " Currently NONE" echo -n " Currently NONE" echo -n " Offending file $plistfile" echo " Blame $curr_maint" #echo -n 'cvsline=' ( \ echo -n "$curr_origin" | tr -d ';' ; \ echo -n ';' ; \ echo -n "$confl_missing" | tr -d ';' ; \ echo -n ';' ; \ echo -n 'NONE' ; \ echo -n ';' ; \ echo -n "$plistfile" | tr -d ';' ; \ echo -n ';' ; \ echo -n "$curr_maint" | tr -d ';' ; \ echo \ ) >> tmp/ports-conflicts.log fi #echo "$conflicts" | egrep -q "$conflicts_required_regex" # #grepstatus=$? #for curr_conflict in $conflicts; #do # echo # echo "curr_conflict=$curr_conflict" # # # #for curr_req_confl in $conflicts_required # #do # # echo "curr_req_confl=$curr_req_confl" # # # # # # case "$curr_req_confl" # # in # # $curr_conflict) # # echo "MATCH: $curr_req_confl matches $curr_conflict" # # ;; # # *) # # echo "NOMATCH: $curr_req_confl does not match $curr_conflict" # # ;; # # esac # #done #done #conflicts_shpattern="`echo \"$conflicts\" | sed -E 's/[[:space:]]+/|/g'`" #echo "conflicts_shpattern=$conflicts_shpattern" #if [ "$conflicts_shpattern" ] #then # case "$conflicts_required" # in # $conflicts_shpattern) # echo "MATCH: $conflicts_required matches $conflicts_shpattern" # ;; # *) # echo "NOMATCH: $conflicts_required does not match $conflicts_shpattern" # ;; # esac #fi #if [ $grepstatus -gt 0 ] #then # echo "Conflicts error" #fi done #if [ "$mcount" -ge "$pcount" ] #then # echo "F MATCH OK for $plistfile, $mcount -ge $pcount" #else # echo "F MATCH ERR for $plistfile, $mcount !(-ge) $pcount" # #echo "portnames=$portnames" #fi #grep '^CONFLICTS=' "$portpath/Makefile" #make -C /usr/ports/emulators/linux_base-gentoo-stage3 -V CONFLICTS | fgrep linux #conflicts="`make -C "$portpath" -V CONFLICTS`" # #if [ ! "$conflicts" ] #then # #echo "Mutual CONFLICTS failure for $portpath ... overlapping file $plistfile" # echo "Mutual CONFLICTS failure for $origin ... overlapping file $plistfile" #fi #echo "$origin" -to--to- "tmp/$safe_plistfile" exit 0 fi #echo #filefilter='^sbin/fsck' #filefilter='^sbin/' #filefilter='^sbin/c' #filefilter='^sbin/co' #filefilter='^sbin/ab' #filefilter='^sbin/a' #filefilter='^sbin/b' #filefilter='^sbin/bacula' #filefilter='^sbin/(authtest|astman|ab)$' #filefilter='^sbin/(authtest|astman)$' #filefilter='^sbin/pkgfe$' #filefilter='^bin/file' filefilter='^bin/' #filefilter='^bin/E' #portsearch -f "$filefilter" -o rawfiles \ #| awk -F : '{print $2" "$1}' \ #| sort \ #| awk '{print $2" "$1}' \ #| uniq -df1 \ #| cut -d ' ' -f 2 \ #| sort \ #| sed 's|^|^|; s|$|$|' \ #| xargs -n 1 -J % portsearch -f % -o rawfiles \ #| cut -d : -f 2 \ #| sort \ #| uniq \ #| xargs -n 1 -I % echo sh "$0" stage2 % portsearch -f "$filefilter" -o rawfiles \ | awk -F : '{print $2" "$1}' \ | sort \ | awk '{print $2" "$1}' \ | uniq -df1 \ | cut -d ' ' -f 2 \ | sort \ | uniq \ | xargs -n 1 -I % sh "$0" stage2 % #portsearch -f "$filefilter" -o rawfiles \ #| awk -F : '{print $2" "$1}' \ #| sort \ #| awk '{print $2" "$1}' \ #| uniq -df1 \ #| cut -d ' ' -f 2 # \ #| sort \ #| uniq \ #| xargs -n 1 -I % sh "$0" stage2 % echo echo