blob: b2d8dd835efda6a7087ec088817b876b3d03dcb3 [file] [log] [blame]
Sergio Slobodrian86843702017-09-05 23:22:39 -04001#!/bin/bash
2
3debDir="deb_files"
4
5rm -f deb_info.txt
6rm -f debFiles.txt
7rm -f sortedDebs.txt
8
9# Create the paackage information file for further processing by Python
10ls $debDir/*.deb | sed -e 's~deb_files/~~' > debFiles.txt
11
12
13for i in `cat debFiles.txt`
14do
15 pkgName=""
16 deps=""
17 pkgName=`dpkg -I $debDir/$i | egrep "^[ ]*Package:" | sed -e 's/Package://' | sed -e 's/\([ ]\+\)\|\([ ]\+$\)//'`
18 deps=`dpkg -I $debDir/$i | grep Depends: | sed -e 's/Depends://' | sed -e 's/\([ ]\+\)\|\([ ]\+$\)//'`
19 deps=`echo $deps | sed -e 's/|/,/g' | sed -e 's/([^)]\+)//g' | sed -e 's/:any//g' | sed -e 's/,//g'`
20 deps=`echo $deps | sed -e 's/[ ]\+/ /g' | sed -e 's/\(^[ ]\+\)\|\([ ]\+$\)//' | sed -e 's/ /,/g'`
21 #deps=`echo $deps | sed -e 's/^\(.\)/"\1/' | sed -e 's/\(.\)$/\1"/' | sed -s 's/,/","/g'`
22 echo "${pkgName}:${i}:${deps}" >> deb_info.txt
23done
24rm -f debFiles.txt
25
26# Now launch the python scrip that sorts the files based on the dependencies.
27./sort_packages.py > sortedDebs.txt
28
29rm -f deb_info.txt