|
From: David B. <Dav...@mo...> - 2006-08-22 08:17:34
|
Soren,
As this should be applied to the octave core pkg.m function I've cc'ed
the maintainers list. John can you look at this?
S=C3=B8ren Hauberg wrote:
>man, 21 08 2006 kl. 18:43 +0200, skrev David Bateman:
> =20
>
>>Ok, this makes sense, and I'd propose something like the attached patch
>>to address this. Though this needs further testing, it seems to work fo=
r
>>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 newly
>created directory, so 'pkgadd' should never exist.
> =20
>
Ok, I'm not that familar with the package system yet.
> =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
>
>>+ ## 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 easy
to make it search other files, but do we want it to?
>Besides these details it looks good, and I think this should be applied
>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..
I attach the PKG_ADD patch for pkg.m that I'd like to see applied
Regards
David
2006-08-22 David Bateman <dba...@fr...>
* pkg/pkg.m: Search inst/*.m and src/*.m files in the package for
PKG_ADD directives. Append user supplied PKG_ADD as well.
--=20
David Bateman Dav...@mo...
Motorola Labs - Paris +33 1 69 35 48 04 (Ph)=20
Parc Les Algorithmes, Commune de St Aubin +33 6 72 01 06 33 (Mob)=20
91193 Gif-Sur-Yvette FRANCE +33 1 69 35 77 01 (Fax)=20
The information contained in this communication has been classified as:=20
[x] General Business Information=20
[ ] Motorola Internal Use Only=20
[ ] Motorola Confidential Proprietary
|