| 1 |
AUTHOR: "Chuck Rhode" <crhode@excel.net> |
|---|
| 2 |
|
|---|
| 3 |
DATE: 2004-04-19 |
|---|
| 4 |
|
|---|
| 5 |
LICENSE: Public Domain |
|---|
| 6 |
|
|---|
| 7 |
SYNOPSIS: BLFS Package Dependencies. |
|---|
| 8 |
|
|---|
| 9 |
DESCRIPTION: |
|---|
| 10 |
Extract a database of software packages from the BLFS book and order |
|---|
| 11 |
them in prerequisite installation sequence. |
|---|
| 12 |
|
|---|
| 13 |
ATTACHMENTS: |
|---|
| 14 |
* BLFS-Deps.bz2 |
|---|
| 15 |
|
|---|
| 16 |
PREREQUISITES: |
|---|
| 17 |
* BLFS 5.0 |
|---|
| 18 |
* python |
|---|
| 19 |
* patch for xml.sax.handler (included) |
|---|
| 20 |
|
|---|
| 21 |
HINT: |
|---|
| 22 |
|
|---|
| 23 |
Beyond Linux from Scratch 5.0 contains a list of a couple hundred |
|---|
| 24 |
software packages with installation instructions and code examples. |
|---|
| 25 |
|
|---|
| 26 |
Packages are cited in prerequisite order. Prerequisites are those |
|---|
| 27 |
packages that a given package depends on. When installing a given |
|---|
| 28 |
package, the User must be sure all of its prerequisites have already |
|---|
| 29 |
been installed. However, not all the preceding packages are necessarily |
|---|
| 30 |
prerequisite to the given one. The given package may be optional and in |
|---|
| 31 |
turn may depend on other optional packages. The User is expected to skip |
|---|
| 32 |
optional packages that he does not need. Prerequisites in turn may have |
|---|
| 33 |
their own prerequisites. Determining which packages are in the |
|---|
| 34 |
dependency cascade leading to the given package is non-trivial. |
|---|
| 35 |
|
|---|
| 36 |
There are many code examples in BLFS. I have written some scripts to |
|---|
| 37 |
extract the code examples from the BLFS text and build a database of |
|---|
| 38 |
packages and prerequisites. A User may submit a package name and receive |
|---|
| 39 |
a script for installing not only the given package but also its |
|---|
| 40 |
prerequisites in prerequisite order. |
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 |
PrerequisitePackages.py |
|---|
| 44 |
|
|---|
| 45 |
PrerequisitePackages.py sorts and lists the dependency tree for a given |
|---|
| 46 |
package (or list of packages). For example: |
|---|
| 47 |
|
|---|
| 48 |
echo linc > wishlist.txt |
|---|
| 49 |
./PrerequisitePackages.py -W wishlist.txt |
|---|
| 50 |
|
|---|
| 51 |
... would print the following report: |
|---|
| 52 |
|
|---|
| 53 |
# Install packages in this order: |
|---|
| 54 |
pkgconfig (pkgconfig-0.15.0) |
|---|
| 55 |
GLib2 (GLib-2.2.3) |
|---|
| 56 |
openssl (OpenSSL-0.9.7c) |
|---|
| 57 |
linc (linc-1.0.3) |
|---|
| 58 |
4 packages needed. |
|---|
| 59 |
|
|---|
| 60 |
All of the parameters are optional: |
|---|
| 61 |
|
|---|
| 62 |
./PrerequisitePackages.py -P pkgs.dat -W wishlist.txt -O wishlist.txt |
|---|
| 63 |
|
|---|
| 64 |
... would expand the wishlist to include all prerequisites. |
|---|
| 65 |
|
|---|
| 66 |
* If omitted, -P defaults to pkgs.dat, the packages database. A |
|---|
| 67 |
version of pkgs.dat corresponding to BLFS 5.0 is included in the |
|---|
| 68 |
tarball for this hint. |
|---|
| 69 |
* If omitted, -W defaults to standard input. |
|---|
| 70 |
* If omitted, -O defaults to standard output. |
|---|
| 71 |
|
|---|
| 72 |
More than one package may be named in wishlist.txt, separated by spaces |
|---|
| 73 |
or newlines. The package names are the ones in alllist.txt. To see if a |
|---|
| 74 |
package is in alllist.txt: |
|---|
| 75 |
|
|---|
| 76 |
grep -i linc alllist.txt |
|---|
| 77 |
|
|---|
| 78 |
A version of alllist.txt corresponding to BLFS 5.0 is included in the |
|---|
| 79 |
tarball for this hint. |
|---|
| 80 |
|
|---|
| 81 |
|
|---|
| 82 |
DownloadPackages.py |
|---|
| 83 |
|
|---|
| 84 |
DownloadPackages.py generates a wget script for downloading the |
|---|
| 85 |
requisite packages. For example: |
|---|
| 86 |
|
|---|
| 87 |
./DownloadPackages.py -W wishlist.txt -O /usr/src/download.sh |
|---|
| 88 |
|
|---|
| 89 |
... would place the script in the source library where it could be |
|---|
| 90 |
executed like this: |
|---|
| 91 |
|
|---|
| 92 |
cd /usr/src |
|---|
| 93 |
chmod 755 download.sh |
|---|
| 94 |
./download.sh |
|---|
| 95 |
|
|---|
| 96 |
Here is what the script looks like: |
|---|
| 97 |
|
|---|
| 98 |
wget ftp://ftp.netbuddy.org/linux/pkgconfig-0.15.0.tar.gz |
|---|
| 99 |
wget ftp://ftp.gtk.org/pub/gtk/v2.2/glib-2.2.3.tar.bz2 |
|---|
| 100 |
wget ftp://ftp.openssl.org/source/openssl-0.9.7c.tar.gz |
|---|
| 101 |
wget ftp://ftp.openssl.org/source/openssl-0.9.7c.tar.gz |
|---|
| 102 |
wget ftp://ftp.gnome.org/pub/GNOME/sources/linc/1.0/linc-1.0.3.tar.bz2 |
|---|
| 103 |
|
|---|
| 104 |
All of the parameters are optional: |
|---|
| 105 |
|
|---|
| 106 |
./DownloadPackages.py -P pkgs.dat -W wishlist.txt -O download.sh |
|---|
| 107 |
|
|---|
| 108 |
* If omitted, -P defaults to pkgs.dat, the packages database. |
|---|
| 109 |
* If omitted, -W defaults to standard input. It should be the |
|---|
| 110 |
expanded wishlist output by PrerequisitePackages.py. |
|---|
| 111 |
* If omitted, -O defaults to standard output. It is a shell script. |
|---|
| 112 |
|
|---|
| 113 |
|
|---|
| 114 |
InstallPackages.py |
|---|
| 115 |
|
|---|
| 116 |
InstallPackages.py generates a script for installing the requisite |
|---|
| 117 |
packages. For example: |
|---|
| 118 |
|
|---|
| 119 |
./InstallPackages.py -W wishlist.txt -O /usr/src/install.sh |
|---|
| 120 |
|
|---|
| 121 |
... would place the script in the source library where it could be |
|---|
| 122 |
executed like this: |
|---|
| 123 |
|
|---|
| 124 |
cd /usr/src |
|---|
| 125 |
chmod 755 install.sh |
|---|
| 126 |
./install.sh |
|---|
| 127 |
|
|---|
| 128 |
The script must be edited first, though. It contains install and |
|---|
| 129 |
configuration code fragments from BLFS. Where alternates are given, all |
|---|
| 130 |
options have been exhaustively expressed, and you must elide those not |
|---|
| 131 |
relevant to your installation. As nice as it is not to have to copy |
|---|
| 132 |
these code fragments from the book, it is not a substitute for reading |
|---|
| 133 |
and understanding the sections where they are described. |
|---|
| 134 |
|
|---|
| 135 |
All of the parameters are optional: |
|---|
| 136 |
|
|---|
| 137 |
./InstallPackages.py -P pkgs.dat -W wishlist.txt -O install.sh \ |
|---|
| 138 |
-S /usr/src |
|---|
| 139 |
|
|---|
| 140 |
* If omitted, -P defaults to pkgs.dat, the packages database. |
|---|
| 141 |
* If omitted, -W defaults to standard input. It should be the |
|---|
| 142 |
expanded wishlist output by PrerequisitePackages.py. |
|---|
| 143 |
* If omitted, -O defaults to standard output. It is a shell script. |
|---|
| 144 |
* If omitted, -S defaults to /usr/src, the source library. |
|---|
| 145 |
|
|---|
| 146 |
Once the packages are successfully installed, add their names to the end |
|---|
| 147 |
of donelist.txt, a permanent file. |
|---|
| 148 |
|
|---|
| 149 |
sed "s/ .*\$//" wishlist.txt | sed "s/\$/ /" | sed s/^/\^/ \ |
|---|
| 150 |
> patterns.txt |
|---|
| 151 |
grep -f patterns.txt alllist.txt >> donelist.txt |
|---|
| 152 |
|
|---|
| 153 |
... where wishlist.txt contains the list of packages just recently |
|---|
| 154 |
installed. |
|---|
| 155 |
|
|---|
| 156 |
alllist.txt contains the list of all the packages in BLFS. |
|---|
| 157 |
alllist.txt is included in the tarball for this hint. |
|---|
| 158 |
|
|---|
| 159 |
|
|---|
| 160 |
MaskDonePackages.py |
|---|
| 161 |
|
|---|
| 162 |
The next time after you run PrerequisitePackages.py, you need to remove |
|---|
| 163 |
the names of the packages in donelist.txt from the output wishlist.txt |
|---|
| 164 |
to avoid reinstalling them. This may be accomplished with |
|---|
| 165 |
MaskDonePackages.py. For example: |
|---|
| 166 |
|
|---|
| 167 |
./MaskDonePackages.py -W wishlist.txt -D donelist.txt -O wishlist.txt |
|---|
| 168 |
|
|---|
| 169 |
... would restrict the wishlist to exclude already installed packages. |
|---|
| 170 |
|
|---|
| 171 |
All of the parameters are optional: |
|---|
| 172 |
|
|---|
| 173 |
* If omitted, -W defaults to standard input. It should be the |
|---|
| 174 |
expanded wishlist output by PrerequisitePackages.py. |
|---|
| 175 |
* If omitted, -D defaults to donelist.txt. |
|---|
| 176 |
* If omitted, -O defaults to standard output. |
|---|
| 177 |
|
|---|
| 178 |
MaskDonePackages.py does not update donelist.txt. |
|---|
| 179 |
|
|---|
| 180 |
|
|---|
| 181 |
UninstallPackages.py |
|---|
| 182 |
|
|---|
| 183 |
UninstallPackages.py generates a script for uninstalling the requisite |
|---|
| 184 |
packages. |
|---|
| 185 |
|
|---|
| 186 |
All of the parameters are optional: |
|---|
| 187 |
|
|---|
| 188 |
./UninstallPackages.py -P pkgs.dat -W wishlist.txt -O uninstall.sh \ |
|---|
| 189 |
-S /usr/src |
|---|
| 190 |
|
|---|
| 191 |
* If omitted, -P defaults to pkgs.dat, the packages database. |
|---|
| 192 |
* If omitted, -W defaults to standard input. It should be the list |
|---|
| 193 |
of packages to uninstall. |
|---|
| 194 |
* If omitted, -O defaults to standard output. It is a shell script. |
|---|
| 195 |
* If omitted, -S defaults to /usr/src, the source library. |
|---|
| 196 |
|
|---|
| 197 |
|
|---|
| 198 |
PackageDB.py |
|---|
| 199 |
|
|---|
| 200 |
PackageDB.py defines objects used by the other scripts. |
|---|
| 201 |
|
|---|
| 202 |
|
|---|
| 203 |
HarvestPackages.py |
|---|
| 204 |
|
|---|
| 205 |
HarvestPackages.py extracts a new packages database from the BLFS xml |
|---|
| 206 |
document. |
|---|
| 207 |
|
|---|
| 208 |
The tarball for this hint includes pkgs.dat and alllist.txt, which are |
|---|
| 209 |
derived from BLFS 5.0 with this script and the next two. Unless you |
|---|
| 210 |
plan to install from a newer version of BLFS, you should not need to |
|---|
| 211 |
run these scripts. The swindle is that they are not guaranteed to work |
|---|
| 212 |
with any level of BLFS other than 5.0. |
|---|
| 213 |
|
|---|
| 214 |
./HarvestPackages.py -I index.xml -P pkgs.dat |
|---|
| 215 |
|
|---|
| 216 |
* If omitted, -I defaults to ~/BLFS/BOOK/index.xml. |
|---|
| 217 |
* If omitted, -P defaults to standard output. It is the new output |
|---|
| 218 |
packages database. |
|---|
| 219 |
|
|---|
| 220 |
|
|---|
| 221 |
AuditPackages.py |
|---|
| 222 |
|
|---|
| 223 |
AuditPackages.py identifies any inconsistencies in the database |
|---|
| 224 |
generated automatically by HarvestPackages.py. |
|---|
| 225 |
|
|---|
| 226 |
All parameters are optional: |
|---|
| 227 |
|
|---|
| 228 |
./AuditPackages.py -P pkgs.dat -O rept.txt -A -C -U -S -L \ |
|---|
| 229 |
-I PkgName -F |
|---|
| 230 |
|
|---|
| 231 |
* If omitted, -P defaults to pkgs.dat, the packages database. |
|---|
| 232 |
* If omitted, -O defaults to standard output. It is a report. |
|---|
| 233 |
* -A reports packages that have no tarball. |
|---|
| 234 |
* -C reports packages that have no install code fragments. |
|---|
| 235 |
* -U reports packages that depend on unknown packages. |
|---|
| 236 |
* -S reports packages that are not in a dependency cascade leading |
|---|
| 237 |
to any other package. |
|---|
| 238 |
* -L lists the names of all packages. |
|---|
| 239 |
* -I reports packages that immediately depend on PkgName. |
|---|
| 240 |
* -F updates pkgs.dat (in place) with information that could not be |
|---|
| 241 |
extracted automatically from BLFS 5.0. |
|---|
| 242 |
|
|---|
| 243 |
|
|---|
| 244 |
ReportPackages.py |
|---|
| 245 |
|
|---|
| 246 |
ReportPackages.py writes a full report of the packages database. |
|---|
| 247 |
|
|---|
| 248 |
./ReportPackages.py -P pkgs.dat -O rept.txt |
|---|
| 249 |
|
|---|
| 250 |
* If omitted, -P defaults to pkgs.dat, the packages database. |
|---|
| 251 |
* If omitted, -O defaults to standard output. It is a report. |
|---|
| 252 |
|
|---|
| 253 |
|
|---|
| 254 |
xml.sax.expatreader.patch |
|---|
| 255 |
|
|---|
| 256 |
The xml.sax.expatreader.patch for PyXML 0.8.3 or Python 2.3.3 is |
|---|
| 257 |
required by HarvestPackages.py and is included in the tarball for this |
|---|
| 258 |
hint. Please do not apply this patch unless you plan to run |
|---|
| 259 |
HarvestPackages.py. Most people shouldn't need to. To apply the patch, |
|---|
| 260 |
see xml.sax.expatreader.patch.README. |
|---|
| 261 |
|
|---|
| 262 |
ACKNOWLEDGMENTS: |
|---|
| 263 |
* "Joern Abatz" <joern@abatz.de> for depsort hint for BLFS 1.0 2003-09-23 |
|---|
| 264 |
|
|---|
| 265 |
CHANGELOG: |
|---|
| 266 |
[2004-04-19] |
|---|
| 267 |
* First Release. |
|---|