Changeset d7c07e0
- Timestamp:
- 11/07/2015 11:36:11 AM (9 years ago)
- Branches:
- 2.4, ablfs-more, legacy, new_features, trunk
- Children:
- 5fb012d
- Parents:
- 1670a20
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
BLFS/libs/func_dependencies
r1670a20 rd7c07e0 21 21 # (building a subtree or browsing the tree), but it allows to # 22 22 # check whether a dependency is circular, and to find its parent. # 23 # Circular dependencies: # 24 # In case we find a cirdular dependency, it has the form : # 25 # parent->dependency_0->...->dependency_n->dependency_0 # 26 # If we want to build dependency_n before dependency_0, no problem: # 27 # we just prune the tree at dependency_n. If we want to build first # 28 # dependency_0, we need to put dependency_n as a dependency of parent, # 29 # then erase and rebuild the subtree from there. Now, we may have met # 30 # another circular dependency in the subtree, and erasing the tree makes # 31 # us forget the decision which was made. So, after first generating the # 32 # list of dependencies from packages.xml, we keep the generated list in # 33 # a file <nodeName>.odep, which we modify according to the decision which # 34 # was made. # 23 35 #---------------------------------------------------------------------------# 24 36 … … 28 40 declare -a exchange_triplet 29 41 30 # In case we find a cirdular dependency, it has the form : 31 # parent->dependency_0->...->dependency_n->dependency_0 32 # If we want to build dependency_n before dependency_0, 33 # no problem: we just prune the tree at dependency_n. 34 # If we want to build first dependency_0, we need to 35 # put dependency_n as a dependency of parent and build 36 # the subtree from there. In this case, the triplet 37 # above shall contain (parent dependency_0 dependency_n) 42 # When we are backing up from a circular dependency, `exchange_triplet' 43 # shall contain (parent dependency_0 dependency_n) 38 44 39 45 #----------------------------# … … 75 81 if (( $DEP_LEVEL > 2 )) && (( $depth > 1 )); then dep_level=2; fi 76 82 srootlink="${rootlink[*]} " 77 # start of Dep file83 # start of DepFile 78 84 echo -en "\nNode: $depth${spaceSTR:0:$depth}${RED}$DepFile${OFF}" 79 85 … … 112 118 exchange_triplet=($parent $id_of_dep ${DepFile%.dep}) 113 119 return 1 114 else # no exchange: prune 120 else # no exchange: prune and remove the line(s) from odep... 115 121 lines_to_remove="$lines_to_remove $id_of_dep" 122 sed -i "/$id_of_dep/d" ${DepFile/.dep/.odep} 116 123 fi 117 124 else # not circular: prune … … 127 134 while [ $flag = true ]; do 128 135 flag=false 129 xsltproc --stringparam dependencies ${dep_level} \ 136 if [ ! -f "${id_of_dep}.odep" ]; then 137 xsltproc --stringparam dependencies ${dep_level} \ 130 138 --stringparam idofdep $id_of_dep \ 131 -o ${id_of_dep}. dep \139 -o ${id_of_dep}.odep \ 132 140 ../xsl/dependencies.xsl ../packages.xml 133 134 if [[ -f ${id_of_dep}.dep ]]; then # this dependency has dependencies 135 sed -i "1i${rootlink[*]} $count" ${id_of_dep}.dep # add the link 141 fi 142 143 # Use -s, because it may happen that after removing lines, .odep exists 144 # but is empty. 145 if [[ -s ${id_of_dep}.odep ]]; then # this dependency has dependencies 146 sed "1i${rootlink[*]} $count" < ${id_of_dep}.odep \ 147 > ${id_of_dep}.dep # add the link 136 148 generate_dependency_tree ${id_of_dep}.dep 137 149 # Test return value, in case we exchange dependencies … … 149 161 lineno=$(sed -n /${id_of_dep}/= $DepFile | head -n1) 150 162 sed -i "${lineno}s@${id_of_dep}@${exchange_triplet[2]}@" $DepFile 163 # Do the same for the odep file: 164 local OdepFile=${DepFile/.dep/.odep} 165 lineno=$(sed -n /${id_of_dep}/= $OdepFile | head -n1) 166 sed -i "${lineno}s@${id_of_dep}@${exchange_triplet[2]}@" $OdepFile 151 167 id_of_dep=${exchange_triplet[2]} 152 168 flag=true # we have to regenerate the tree for the new dependency
Note:
See TracChangeset
for help on using the changeset viewer.