Rob Landley wrote: > On 05/03/2013 09:54:42 PM, Bruce Dubbs wrote: >> I'm going to write a program to automatically identify out of date >> packages for LFS. Has anyone already done such a beast? >> >> As I review the packages, it seems that the only constant is >> inconsistency. Trying to parse versions is quite package specific. >> Packages may have versions with a single number (systemd, kbd, less), >> two numbers (vim, psmisc, etc), three numbers (most), and even four >> numbers (shadow). In one case, the version has a letter (tzdata). > > For my aboriginal linux project > > http://landley.net/aboriginal/about.html > > I have the following horrible regex: > > # Given a filename.tar.ext, return the version number. > > getversion() > { > echo "$1" | sed -e > 's/.*-\(\([0-9\.]\)*\([_-]rc\)*\(-pre\)*\([0-9][a-zA-Z]\)*\)*\(\.tar\..z2*\)$/'"$2"'\1/' > } > >> Some packages change the version scheme depending on release >> (util-linux-2.22.1 vs util-linux-2.23, gcc, linux kernel, etc. ) >> >> In addition, some directories that contain the packages vary with >> version (e.g. v2.23/util-linux..., check/0.9.10/..., gmp-5.1.1/..., >> 1.0.6/bzip..., mpfr-3.1.2/... ). Some sites don't allow a directory >> of >> the parent location so other means of determining the most recent >> version are needed (e.g. bzip2). > > I do a variant of: > > mkdir tmpdir > cd tmpdir > tar xvjf /path/to/tarball > mv * ~/newlocation/packagename > > It's in the extract_package function of: > > > http://landley.net/hg/aboriginal/file/1599/sources/download_functions.sh#l71 > >> Writing a script to do all this is not particularly hard, but just >> long >> and tedious. There are some common elements in most of the packages >> from ftp.gnu.org. >> >> Has anyone else looked at this? > > I've done it, and debugged it over a period of several years. :) > > My automatic "build linux from scratch under the resulting system" > package is still on 6.8 (I've been busy with other things), and I had > to adjust four package names in order for the automated machinery to be > able to extract the tarballs out of the big tarball: > > > http://landley.net/hg/control-images/file/34/images/lfs-bootstrap/download.sh#l32 > > Basically the limitation is that my regex thinks that the filename ends > with "-" (not necessarily the _first_ -, but there's gotta be one > between name and version), and some things (like squashfs tools) don't > do that. When i'm downloading an individual tarball I can put a rewrite > rule in the download request, ala: > > http://landley.net/hg/aboriginal/file/1599/download.sh#l109 > > I've been meaning to fix that up and switch to 7.3, but... day job and > so much else to do...
Thanks for the input, but I've now got a script that seems to work. I am going to set it up to email the output to lfs-book once a day. I'll get that up later today. I'll post the source too. It's a little over 300 lines of php code. -- Bruce -- http://linuxfromscratch.org/mailman/listinfo/lfs-dev FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page