site  contact  subhomenews

Woof progress: magic 'findpkgs' script

August 18, 2011 — BarryK
I have written a new script support/findpkgs in Woof, that replaces a whole lot of klutzy code and adds great new features.

Using Slacko as the example, file DISTRO_PKGS_SPECS-slackware-13.37 has variable PKGS_SPECS_TABLE that has a list of entries that specify what packages are to be in the Puppy build, for example:

yes|glibc|glibc-solibs,glibc-zoneinfo|exe,dev,doc,nls

yes|glibc_locales|glibc|exe,dev,doc,nls>exe| #slackware glibc-i18n- does not have enough files, need to extract from full glibc.
no|glibc_i18n_en||exe
yes|glibmm||exe>dev
no|glipper||exe,dev>null,doc,nls
yes|gmeasures||exe,dev>null,doc,nls


If the 3rd field is empty, see gmeasures entry, it means find a package named 'gmeasures' in the PET repositories.
If the 3rd field is not empty, see glibc entry, then look for packages named 'glibc-solibs,glibc-zoneinfo' (glob wildcards allowed) in the compatible-distro repos (Slackware repos) and combine them into a package named 'glibc' for inclusion into the Puppy build.

My new script has backwards compatibility, but you can add more stuff to narrow or force the search. Generalizing, the format is, where [] designate optional:

yes|genericpkgname|[pkgnames]|[splitup]|[pet:[repo]]
yes|genericpkgname|[pkgnames]|[splitup]|[compat:[repo]]


Take the gmeasures example, we can extend like this:
yes|gmeasures|gmeasures-2*|exe,dev,doc,nls|pet:4

...the optional 3rd field can be used to narrow the search to a specific version. The 'pet:4' means only look in the Packages-puppy-4-official db file.

Actually, the 'pet' on the end overrides the older interpretation, forcing search of PET repos, regardless of whether anything in 3rd field. For example:
yes|gmeasures||exe,dev,doc,nls|compat
...means look for package in compat-distro repos.

In the case of Slacko, the compat-distro package db files are:
Packages-slackware-13.37-official
Packages-slackware-13.37-salix
Packages-slackware-13.37-slacky


If we wanted to force 'glibc' to be got from the 'salix' repo only:
yes|glibc|glibc-solibs,glibc-zoneinfo|exe,dev,doc,nls|compat:salix

Note, as before, as well as wildcards, the '-' exclusion prefix is still supported, for example:
yes|xorg-server|xf86-video-*,xf86-input-*,-xf86-video-cirrus|exe,dev,doc,nls

'findpkgs' has very rigorous searching, with well-defined rules. It takes into account the versioned-dependencies in the dependencies field of a pkg db entry, and there can now be more than one condition, for example:
|+linux_kernel&ge2.6.32&lt2.6.33|

This is a progress report. I have a couple of things to do to finish the script, then it has to be integrated into Woof.

Comments

Old stuff in PKGS_SPECS_TABLE
Username: BarryK
A note for Puppy builders using Woof, the variable PKGS_SPECS_TABLE in file DISTRO_PKGS_SPECS-* (ex: DISTRO_PKGS_SPECS-slackware-13.37) may have some old stuff in it like this: [code]no|hal|hal|exe,dev,doc,nls|+udev,+libvolume-id,+lsb-base,+policykit yes|hal||exe,dev,doc,nls|+udev,+libvolume-id yes|hardinfo||exe,dev,doc,nls|+libsoup[/code] Those entries tacked on the end were an idea early-on in Woof when I thought that dependencies could be specified there. However, that never happened, and now they are not just not used but are a syntax error. My new 'findpkgs' script works around them ok, however it would be good if you deleted them. That is: [code]no|hal|hal|exe,dev,doc,nls| yes|hal||exe,dev,doc,nls| yes|hardinfo||exe,dev,doc,nls| #+libsoup[/code] ...as shown in last line, if you do want a reminder to yourself about a dependency then make it a comment.

parsing *|*|....
Username: technosaurus
"here is a really fast shell only way to parse those types of files ... no error messages thus far AFAICT [code] while read LINE ; do DESC="" #some are missing case $LINE in *BuildingBlock*|*DEV*|*NLS*|*DOC*)continue;;#unnecessary to show these to the user *)#need name:$2 category:$5, folder:$7, .pet:$8, description:$10 ... maybe size:$6 & version:$3 ..deps??? NAME=${LINE#*|};NAME=${NAME%%|*} CAT=${LINE#*|*|*|*|};CAT=${CAT%%|*} #FOLDER=${LINE#*|*|*|*|*|*|};FOLDER=${FOLDER%%|*} #I think we can move this out based on the file name itself PET=${LINE#*|*|*|*|*|*|*|};PET=${PET%%|*} DESC=${LINE#*|*|*|*|*|*|*|*|*|};DESC=${DESC%%|*} ;; esac done < $FILE[/code]works great for parsing a whole file ... awk -F "|" ... works well for single lines, but since awk does math, I can see the "+" causing problems btw here is the awk calculator I use: calc[code] #!/bin/sh [ $DISPLAY ] && DIALOG=Xdialog || DIALOG=dialog A=`awk "BEGIN{print $@}"` A=`$DIALOG --stdout --inputbox "Simple calculator" 0 0 $A` [ $A ] && calc $A [/code] line3 by itself is great for doing non-integer math


Tags: woof