tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: EXTRACT_USING improvements: a concrete proposal

Jonathan Perkin <> writes:

> I've kludged around it for now in our tree, but we'll need something
> better long-term.  One of the issues with setting things in platform/*
> is that they are parsed before tools, so you can't do something like:
>   .if defined(TOOLS_PLATFORM.gtar)
>   EXTRACT_USING?= gtar
>   .endif
> to cover any installs (mostly older releases or trimmed installs) that
> do not have it.  Adding duplicate .if exists() copies of tools logic
> feels wrong.

This is a real problem, but the Design By Contract software extremist in
me says we need to have a specification for the platform, check it, and
rely on it.  So that means either SunOS in general has to provide gtar,
and we use it, or we decide to use bsdtar and just build it from pkgsrc.
Or use gtar, and people without it have to manually set EXTRACT_USING to
bsdtar.  I would take the view that there are prereqs, and systems that
don't meet them need configuration.

To me the big bug now is that tools can leave gtar unset without an

Not sure what the right thing to do is about this.   I guess I come down

  pick one (always):
    require gtar and fail if not
    just use bsdtar and ignore gtar in base

> One thing that does seem to be a bug to me, or at least a slightly odd
> quirk, is that TAR is only set in the environment for
> mk/extract/extract if EXTRACT_USING=nbtar:
>   * mk/extract/ only adds USE_TOOLS+=tar if
>     EXTRACT_USING is set to nbtar.

Well, nbtar means it uses the tar TOOL, so that's right.   It is funny
that the tar tool is set to gtar and used via a nbtar word.

>   * mk/extract/ only sets TAR=${TOOLS_TAR} if TOOLS_TAR is
>     defined, which is only defined if "tar" is in USE_TOOLS.

should be ok, because otherwise ${TAR} should not be used.  Actually
perhaps all use of ${TAR} is buggy.  But overall this seems wrong, ish.

>   * mk/extract/extract uses ": ${TAR:=tar}", so unless
>     EXTRACT_USING=nbtar then it will execute plain "tar" and not
>     anything configured via pkgsrc.

That's definitely buggy.

There is a lot of swamp draining to be done here.

> On SunOS this results in plain "tar" being called, which is an old
> crufty version, hence the failure.  This feels very wrong to me when
> TOOLS_PLATFORM.tar is pointing to a perfectly working gtar binary.

1) I would say that use of tar should be via ${TOOLS_TAR}, not $TAR.

2) We should remove the entire notion of nbtar

> Anyway, it's a little complicated and it's late on a Friday night and
> I just need this build to start, so something to ponder for now,
> hopefully we can have a decent fix in time for the branch.

I think this is all quite fixable.  I personally am ok with a rapid
fix-it-now-and-pick-up-the-pieces approach.  My impresssion is that this
code is a mess and hasn't really been looked at in a long time.

Home | Main Index | Thread Index | Old Index