Re: On the dangers of PKGNAME=.
Bram Moolenaar <[email protected]>
| Newsgroups | gmane.comp.tools.aap.devel |
|---|---|
| Message-ID | <[email protected]> |
Adriaan de Groot wrote:
> Since an empty PKGNAME isn't allowed, yet KDE expects to put things directly
> under $PREFIX/share and not in $PREFIX/share/$PKGNAME (It's often installed
> in a separate prefix entirely, so having $PKGNAME in there would be
> redundant), I've been reduced to setting PKGNAME=. in KDE recipes.
This sounds like an ugly solution to me. Setting $PKGNAME to "." is
alsmost the same as setting it to "".
> This triggers a bug, though:
>
> eggs.ebn.kun.nl$aap install PREFIX=/tmp/kde
> Aap: Creating directory "/tmp/kde/share/./apps/kpilot/sysinfoconduit"
Isn't this similar to using a package name "apps/kpilot"? From this
short snippit I would think that's the package name.
> Aap: Internal Error
> Aap: Traceback (most recent call last):
> File "/home/adridg/aap/Exec-cvs/Process.py", line 1115, in Process
> exec script_string in recdict, recdict
> File "<string>", line 12, in ?
> File "/home/adridg/aap/Exec-cvs/RecPython.py", line 1022, in install_files
> os.makedirs(destloc)
> File "/usr/local/lib/python2.2/os.py", line 203, in makedirs
> makedirs(head, mode)
> File "/usr/local/lib/python2.2/os.py", line 203, in makedirs
> makedirs(head, mode)
> File "/usr/local/lib/python2.2/os.py", line 203, in makedirs
> makedirs(head, mode)
> File "/usr/local/lib/python2.2/os.py", line 204, in makedirs
> mkdir(name, mode)
> OSError: [Errno 17] File exists: '/tmp/kde/share/.'
>
> I imagine this is because makedirs recurses and makes each component of the
> requested path, and /tmp/kde/share and /tmp/kde/share/., while separate
> components, are the same directory. The attached patch adds a special-case
> for PKGNAME=. to default.aap; it's probably not the best solution. It's
> probably better to catch OSError File exists exceptions in make_installdirs
> and deal with it there. I'll send a different patch shortly.
I don't understand how this can go wrong. Aap only calls os.makedirs()
if the directory doesn't exist yet. And os.makedirs() only recurses for
directories that don't exist. Did Python 2.2 have a bug in
path.exists()? Try this manually:
python
>>> import os
>>> os.makedirs("some_dir/./new_dir")
Does this fail as well?
--
FATHER: Who are you?
PRINCE: I'm ... your son ...
FATHER: Not you.
LAUNCELOT: I'm ... er ... Sir Launcelot, sir.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
\\\ Project leader for A-A-P -- http://www.A-A-P.org ///
\\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///
-------------------------------------------------------
This SF.net email is sponsored by OSDN developer relations
Here's your chance to show off your extensive product knowledge
We want to know what you know. Tell us and you have a chance to win $100
http://www.zoomerang.com/survey.zgi?HRPT1X3RYQNC5V4MLNSV3E54