|
From: John W. E. <jw...@be...> - 2006-08-22 18:38:41
|
On 22-Aug-2006, David Bateman wrote: | Soren, |=20 | As this should be applied to the octave core pkg.m function I've cc'e= d | the maintainers list. John can you look at this? |=20 | S=F8ren Hauberg wrote: |=20 | >man, 21 08 2006 kl. 18:43 +0200, skrev David Bateman: | > =20 | > | >>Ok, this makes sense, and I'd propose something like the attached p= atch | >>to address this. Though this needs further testing, it seems to wor= k for | >>the test case I've used based on the comms toolbox. Basically, this= | >>means that symbolic links should be handled by the developer either= | >>embedded in the code or as a seperate PKG_ADD file that is appended= to | >>the end of the PKG_ADD commands found in the source. | >> =20 | >> | >Looks good, but there are a few details I don't understand: | > | > =20 | > | >>+ function create_pkgadd (desc, packdir) | >>+ pkgadd =3D [desc.dir "/PKG_ADD"]; | >>+ rm_rf(pkgadd); | >> =20 | >> | >Why do you need to delete 'pkgadd'? 'desc.dir' should always be a ne= wly | >created directory, so 'pkgadd' should never exist. | > =20 | > | Ok, I'm not that familar with the package system yet. |=20 | > =20 | > | >>+ fid =3D fopen(pkgadd, "wt"); | >>+ if (fid >=3D 0) | >>+ ## Search all dot-m files for PKG_ADD commands | >>+ lst =3D dir ([packdir "inst"]); | >>+ for i=3D1:length(lst) | >>+ nm =3D lst(i).name; | >>+ if (length(nm) > 3 && strcmp (nm((end-1):end), ".m")) | >>+ fwrite (fid, extract_pkgadd (nm, '^[#%][#%]* *PKG_ADD: *(= .*)$')); | >>+ endif | >>+ endfor | >> =20 | >> | >Can't you simply write: | > lst =3D dir ([packdir "/inst/*.m"]); | > for i =3D 1:length(list) | > nm =3D list(i).name; | > fwrite (fid, extract_pkgadd (nm, '^[#%][#%]* *PKG_ADD: *(.*)$'= )); | > endfor | >and similar for the C++ files. | > =20 | > | Hey, it was a first pass. Ok, I've adapted the changes you suggested.= |=20 | >=20 | > =20 | > | >>+ ## Search all C++ source files for PKG_ADD commands | >>+ lst =3D dir ([packdir "src"]); | >>+ for i=3D1:length(lst) | >>+ nm =3D lst(i).name; | >>+ if (length(nm) > 4 && strcmp (nm((end-2):end), ".cc")) | >> =20 | >> | >Should we only handle *.cc files, or should we also handle *.cpp and= *.C | >(are there others?) ? Which reminds me: is MS Windows case sensitive= , or | >do we also need to handle *.M, *.CPP, etc.? | > =20 | > | The existing mkpkgadd funcion only search *.m and *.cc files. Its eas= y | to make it search other files, but do we want it to? |=20 | >Besides these details it looks good, and I think this should be appl= ied | >to CVS. Assuming this gets accepted into CVS, what else is needed to= aid | >package developers? | > =20 | > | Some way of treating additional directories in the package other than= | src/ and inst/, though I'll address that in a seperate mail.. |=20 | I attach the PKG_ADD patch for pkg.m that I'd like to see applied OK, I checked in this change. Thanks, jwe |