ASSP out of date

Bryan Blackburn blb at macports.org
Wed Nov 5 20:05:11 PST 2008


On Wed, Nov 05, 2008 at 07:08:17PM -0800, Scott Haneda said:
[...]
>
> This is my first effort to make a port update file locally on my machine, 
> so be gentle :)

For a first Portfile, this is a bad choice, it does nearly all steps
manually (configure, no build, and destroot are all there in the Portfile).

>
> sudo port clean --work assp
> Password:
> --->  Cleaning assp
>
> I located this path:
> /opt/local/var/macports/sources/rsync.macports.org/release/ports/mail/ 
> assp/
> it would be nice to know how to locate that path with a command.

$ port dir assp

>
> Made a copy:
> -rw-r--r--  1 root  admin  4686 Nov  5 18:34 Portfile
> -rw-r--r--  1 root  admin  4686 Nov  5 16:52 Portfile.orig
>
> Original located here: http://pastebin.com/m7a3fb1d6
>
> sudo port edit assp
> Changed -> version                 1.4.3.0
> Changed -> maintainers             scott at newgeo.com
> Added   -> distname                ASSP_${version}-Install
>
> pre-patch seems to run around and look for two files, to rename
> file rename "${worksrcpath}/ASSP Documentation.htm" ${worksrcpath}/ 
> ASSPDocumentation.htm
> file rename "${worksrcpath}/Regular Expression Tutorial.htm" $ 
> {worksrcpath}/RegularExpressionutorial.htm
>
> Neither of them exist, and even if they did, they would have moved to the 
> docs/ directory.  Either way, I am not sure what was bad about spaces in 
> the files anyway, they are html files, and most browsers can deal with 
> that.

Both appear to be in ASSP/docs though the former is now "Legacy - ..."  The
pre-patch does hit more than just HTML though, there are also perl and shell
scripts in the glob, not sure how well those will run with DOS-style line
endings; though the .sh file I looked at was *nix-style, and so is at least
one perl script.
Not sure why the 'file rename' is being used, lots of files with spaces on
Macs.

>
> I simply removed those two lines.
>
> Removed -> patchfiles              patch-assp.pl.diff
> Here is where my lack of experience comes on, I have no idea if the patch 
> is needed, so at this point, I am commenting it out and just trying to get 
> it to build. I know it will build clean on a Intel machine, so I would 
> imagine, this patch is no longer needed with so many versions passing.

It would appear that the changes in that patch file are present in assp.pl,
so removing it is the right thing.  Upgrading a port with patches always
presents the issue of whether or not a patch is still needed.  Sometimes
(like in this case) it's not too difficult, you look for the line being
patched in the source file and compare, if it looks like it's already
applied, the patch can be removed.

>
> Save the file, and run:
> sudo port install assp
> * Error on checksum, after a bit of poking, I see there is:
> sudo port -d checksum assp
> Portfile checksum: ASSP_1.4.3.0-Install.zip md5  
> 55be31bab3efacc6bd964adf8cd25c83
> Distfile checksum: ASSP_1.4.3.0-Install.zip md5  
> e7fa4bfbed0e7cb7d430d1ebcd4b6eb1

Completely expected as the checksum on a new file will be different, and
'port -d checksum' is definitely the best way to get the new values.

>
> Updated -> checksums               md5 e7fa4bfbed0e7cb7d430d1ebcd4b6eb1
>
[...]
> And now, we get stuck when the portfile tries to glob through the source 
> files, I suspect because {worksrcpath} is somehow wrong. It looks to me 
> like this is the path that it is calling {workssrcpath}
> /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync 
> .macports.org_release_ports_mail_assp/work/ASSP_1.4.3.0-Install

The issue with worksrcpath/worksrcdir is that it seems the old version used
by the Portfile must have dumped the files from the zip into the current
directory, without any enclosing directory of its own.  1.4.3.0 does have an
enclosing directory, so the pre-extract and extract.dir lines can be
removed.

[...]
> * How do I debug and print out the {worksrcpath} so I can see what it is, 
> and what is it that sets that path as well?

worksrcpath ends up being the work directory
(/opt/local/var/macports/build/<port-specific-path) plus worksrcdir which is
usually based on the name of the file downloaded.  For this port, that works
fine since the file downloaded is ASSP_1.4.3.0-Install.zip and the
worksrcdir gets set to ASSP_1.4.3.0-Install.  Once the extract stuff is
removed like I mentioned above, this should work okay I believe.

>
> Looking at configure:
> configure {
>        reinplace "s%^#!.*perl%#![binaryInPath perl]%" \
>                ${worksrcpath}/assp.pl \
>                ${worksrcpath}/move2num.pl \
>                ${worksrcpath}/rebuildspamdb.pl \
>                ${worksrcpath}/repair.pl \
>                ${worksrcpath}/stat.pl
>        reinplace "s%/usr/local/assp%${assp_base}%" \
>                ${worksrcpath}/ASSPDocumentation.htm \
>                ${worksrcpath}/stats.sh \
>                ${worksrcpath}/assp.pl \
>                ${worksrcpath}/rc/assp.dat \
>                ${worksrcpath}/rc/start.dat \
>                ${worksrcpath}/rc/stop.dat
>        reinplace "s%/usr/local%${prefix}%" \
>                ${worksrcpath}/ASSPDocumentation.htm
> }
>
> I can see, I am pretty sure I need to delete the 2  
> "ASSPDocumentation.htm" lines, is this correct?

If you use the "Legacy - ASSP Documentation.htm" file in docs/ you'll want
to use that; the second reinplace here is just changing /usr/local/assp
paths to instead ${prefix}/var/assp which is where the Portfile will install
stuff.

>
> I am not sure what this does:
> reinplace "s%^#!.*perl%#![binaryInPath perl]%"

reinplace as a regex-based sed-like replacement tool, that does it
'in-place' as in the result is in the same file as the source.  You can
search the guide for reinplace for the full documentation.

This particular reinplace replaces perl shebang lines with the result of
[binaryInPath perl] which I actually disagree with; it should be using
${prefix}/bin/perl5 so make sure MacPorts' perl is used:

   reinplace "s%^#!.*perl%#!${prefix}/bin/perl5%"

>
> And as you can see, given the above mentioned {worksrcpath} configure is 
> never going to find those files.  As a first effort, I tried commenting 
> out:
> #extract.dir            ${worksrcpath}
> After than, I ran clean, then install...
> http://pastebin.com/m2053b159
>
> I think it is there, line 35, we sort of run into the same thing, which is 
> there is this "ASSP" directory path that is missing, and I do not know how 
> to add it in, without hard coding it, which if course, would make this too 
> hard to make an updated port file again in the future if the developer 
> moves stuff around.

You can either update paths in the Portfile to use ${worksrcpath}/ASSP or to
update worksrcdir to use ASSP as well; which to use really depends on
convenience in the Portfile: if you find you use ${worksrcpath}/ASSP all the
time, then update worksrcdir.

>
> Hopefully I have troubleshot this as best as I can, I am stuck at this  
> point, with this being my first attempt to make a port update file. Any 
> help is appreciated.

Again, this definitely isn't the simplest one.  Almost seems like it could
be easier to create a new Portfile for it, start fleshing that out and use
the old one for hints on a few things.

Bryan


>
> --
> Scott
>


More information about the macports-users mailing list