Sergio Slobodrian | 8684370 | 2017-09-05 23:22:39 -0400 | [diff] [blame] | 1 | #!/bin/bash |
Zack Williams | 41513bf | 2018-07-07 20:08:35 -0700 | [diff] [blame] | 2 | # Copyright 2017-present Open Networking Foundation |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
Sergio Slobodrian | 8684370 | 2017-09-05 23:22:39 -0400 | [diff] [blame] | 15 | |
| 16 | debDir="deb_files" |
| 17 | |
| 18 | rm -f deb_info.txt |
| 19 | rm -f debFiles.txt |
| 20 | rm -f sortedDebs.txt |
| 21 | |
| 22 | # Create the paackage information file for further processing by Python |
| 23 | ls $debDir/*.deb | sed -e 's~deb_files/~~' > debFiles.txt |
| 24 | |
| 25 | |
| 26 | for i in `cat debFiles.txt` |
| 27 | do |
| 28 | pkgName="" |
| 29 | deps="" |
| 30 | pkgName=`dpkg -I $debDir/$i | egrep "^[ ]*Package:" | sed -e 's/Package://' | sed -e 's/\([ ]\+\)\|\([ ]\+$\)//'` |
| 31 | deps=`dpkg -I $debDir/$i | grep Depends: | sed -e 's/Depends://' | sed -e 's/\([ ]\+\)\|\([ ]\+$\)//'` |
| 32 | deps=`echo $deps | sed -e 's/|/,/g' | sed -e 's/([^)]\+)//g' | sed -e 's/:any//g' | sed -e 's/,//g'` |
| 33 | deps=`echo $deps | sed -e 's/[ ]\+/ /g' | sed -e 's/\(^[ ]\+\)\|\([ ]\+$\)//' | sed -e 's/ /,/g'` |
| 34 | #deps=`echo $deps | sed -e 's/^\(.\)/"\1/' | sed -e 's/\(.\)$/\1"/' | sed -s 's/,/","/g'` |
| 35 | echo "${pkgName}:${i}:${deps}" >> deb_info.txt |
| 36 | done |
| 37 | rm -f debFiles.txt |
| 38 | |
| 39 | # Now launch the python scrip that sorts the files based on the dependencies. |
| 40 | ./sort_packages.py > sortedDebs.txt |
| 41 | |
| 42 | rm -f deb_info.txt |