DESTDIR implementation [Was:: ATTENTION: is the way DESTDIR was introduced completely wrong?]

Dmitry Marakasov amdmi3 at mail.ru
Tue Aug 15 12:36:10 UTC 2006


* G??bor K??vesd??n (gabor at FreeBSD.org) wrote:
> >Now, if we want to fix these, we'll need to change variables in
> >REINPLACE_CMD lines: LOCALBASE to LOCALBASE_REL, X11BASE to X11BASE_REL
> >and DATADIR... hmm, we have no DATADIR_REL, so all is left is
> >${PREFIX}/share/${PORTNAME}. That's unforgivable.
> Yes, that's right as well, but note if we had left LOCALBASE, LINUXBASE, 
> X11BASE unchanged, we would need to change them in the *_DEPENDS lines. 
> That's true that we don't have DATADIR_REL, etc. We could introduce them 
> if needed, but that substitution can be done with make :S as well. 
> DESTDIR implementation is complicated in many ways, no perfect 
> implementation exist. As you said LOCALBASE is used in substitutions, bu 
> also used in *_DEPENDS as well. Now those two cases have to be 
> distinguished. One of them should have been changed at all... That's why 
> I say no perfect implementation exist. If we implement new functions 
> later, it can be very difficult...
I don't quite understand what problems with _DEPENDS will there be, as
DESTDIR can always be prepended to path when checking depends.

> >Please tell that I'm stupid if I am wrong somewhere, but I think
> >DESTDIR support, being introduced into ports collection in a way it's
> >currently introduced, will bring much pain.
> It will, but I tried to avoid the most of the necessary pain. Changing 
> all of *_DEPENDS would be good? I don't think so... As for this change, 
> it is actually wrong. I CC'd the maintainer.
> In the HEADS-UP message I sent, I wrote that one can feel free to 
> contact me to review and test patches. Some people already did so. As my 
> time lets me doing so, I test every patches sent to me.
> >What I propose is:
> >- Change variable naming scheme.
> >All *BASE and *DIR vars should be reverted to their original meanings
> >(i.e. local paths). Instead, INSTALL_ vars should be introduced:
> >INSTALL_LOCALBASE=${DESTDIR}/${LOCALBASE}
> >INSTALL_X11BASE=${DESTDIR}/${X11BASE}
> >INSTALL_PREFIX=${DESTDIR}/${PREFIX}
> >INSTALL_DATADIR=${DESTDIR}/${DATADIR}
> I don't think it will happen. It just makes the whole thing much more 
> complicated.
Why? I don't think introducing INSTALL_* vars is more complicated
than introducing *_REL, with the difference that it'll be more clear 
what to use in ports and it'll be easier to convert ports. Yes, there'll
be some additional changes to Mk/* (hm, prepending DESTDIR where
necessary doesn't seem compicating to me at all) but am I now right
that Mk/* exists to support ports, not otherwise? Also, I may be wrong
here, but I think that smaller set of wars is used in installation that
in build process. At the end, DESTDIR is about installation - it seems
pretty unlogical to me that everything except installation in ports have
to be changed. Even not all vars were introduced (I think using :S to
get local DATADIR is not the good way).

> >etc. These should be used in do-install target.
> >
> >* This is far more clean and understandable, 
> >* This allows us to make all ports (around 5k) that define do-install 
> >target
> >  DESTDIR-compatible (there still may be issues, but nevertheless).
> >
> >- Introduce variable DESTDIR_COMPATIBLE to explititely mark
> >  DESTDIR-compatible ports.
> This is going to happen but in the opposite manner. We are planning to 
> run an -exp run in the pointyhat cluster with DESTDIR set, and fix at 
> least some of the most common ports, and mark the other ones NO_DESTDIR 
> or something like that.
Uh, that's good then. What's -exp by the way?

> >* I don't think DESTDIR compatibility can be tested automatically, so
> >  this would make freebsd user's life easier (user will be sure that after 
> >  he
> >  installs ports into [jail|other freebsd installation mounted via
> >  nfs|locally] being set corresponging DESTDIR, nothing will break).
> >  Without such variable, he'll never be sure.
> >* Port maintainers will know what ports still are to be converted.
> >  Nothing will be forgotten.
> P.S.: Please don't make other people panic with such subject. Other 
> people also reviewed my code. We are just people, so we can make 
> mistakes as well, but you can be sure that such a big change like 
> DESTDIR got enough reviewal and test before committed into Mk. Portmgr 
> is for ensuring people that only rational and working code gets 
> committed into bsd.port.mk.
> John, the author of an earlier DESTDIR implementation also reviewed my 
> changes and helped to fix some minor issues.
Yep, sorry for emotions. I have nothing against your or your code or
people who reviewed it. It works pretty well, DESTDIR support is of
course thing to have. But, we still have 15k ports to support it as
well. So, what I propose is to make necessary changes in ports
well-determined (i.e. only change known set of vars - X11BASE, PREFIX,
DATADIR etc to their INSTALL_* equivalents in install targets - and
nothing else, and if port doesn't support DESTDIR, cause is 100% in
install process - and nowhere else), so no other parts of any port
are to be touched (changing * to *_REL in post-patch and other
targets will lead to more potential errors). Also what I propose
satisfy UNIX's rules of clarity and least surprise more.

-- 
Best regards,
 Dmitry                          mailto:amdmi3 at mail.ru


More information about the freebsd-ports mailing list