Commit graph

284 commits

Author SHA1 Message Date
rillig
a2f9aae352 Added AUTO_MKDIRS as an alias for INSTALLATION_DIRS_FROM_PLIST. The
variable is much more comfortable than specifying all the directories in
INSTALLATION_DIRS that using such a long name for it feels like a
punishment. It also doesn't look nice in the package Makefiles, for
example:

old:
INSTALLATION_DIRS=	bin ${PKGMANDIR}/man1 ${PKGMANDIR}/man8

new:
AUTO_MKDIRS=		yes

The variable INSTALLATION_DIRS_FROM_PLIST will be deprecated slowly.
2007-12-07 05:25:25 +00:00
rillig
9fab8079e7 Removed _INTERACTIVE_COOKIE, after asking on tech-pkg if anyone needs
it. It had only been used to change the "nerrors" variable in bulk
builds, but this variable is not used further anyway.
2007-12-01 11:11:53 +00:00
rillig
2db8b70075 Moved common commands into a variable. This saves 15 lines. 2007-11-03 10:25:33 +00:00
rillig
5fa3759ae6 Simpler includes. 2007-11-03 09:12:46 +00:00
rillig
9993d0aa30 BINPKG_SITES may be empty, and most shells don't like syntactically
empty for loops.
2007-09-21 23:59:30 +00:00
rillig
7c0cf0016c Renamed pkgpath to pkg_path, since there exists a completely independent
variable PKGPATH. I hope this will avoid some confusion.
2007-09-19 13:32:59 +00:00
rillig
93100472de When using bin-install, the version of the installed package was checked
twice: First against the required package pattern (PKGNAME_REQD), and
then against the current version (PKGNAME). When only a binary package
for an old (but sufficient) version of a package was available, that
version had been installed and the current version been built
afterwards, which was unnecessary.

This problem was mentioned in PR 36146, and is hereby fixed.

By the way, the code was really ugly: The messages that had been printed
didn't reflect what the code was actually doing. This is fixed, too.
2007-09-19 13:26:19 +00:00
rillig
c7873e00e2 It has always annoyed be that package authors had to write ${PKGMANDIR}/
in the definition of INSTALLATION_DIRS, where a short man/ would be much
shorter. Since we already have that man-transforming magic in some other
places of pkgsrc, it's also here.

While here, documented INSTALLATION_DIRS and
INSTALLATION_DIRS_FROM_PLIST so they are found by "bmake help".
2007-09-13 09:44:58 +00:00
joerg
0f838e964b pkg_add can figure out the suffix itself, thanks. 2007-08-23 08:59:24 +00:00
joerg
651f00f91e Add cross-compiling support for bin-install and deinstall targets. 2007-08-20 10:59:05 +00:00
joerg
4a33463b76 Remove bootstrap-register, bootstrap was changed a while ago to use
normal building and installation.
2007-08-14 23:59:25 +00:00
joerg
8eae292c51 Fix a number of bugs in the DESTDIR support:
- check-perms.mk was not DESTDIR aware, prefix files before passing it
  to the directory extraction
- PKG_FILELIST_CMD was calling pkg_info, which is fine for normal
  installation, but fails of course for DESTDIR. Just drop the @ lines
  from ${_DEPENDS_PLIST} and use that.
- To make he former work, ensure that _flavor-generate-metadata is part
  of _INSTALL_ALL_TARGETS. It was normally a dependency of
  _flavor-register, but that is skipped for DESTDIR.
- Remove ${_DEPENDS_PLIST} when running install-clean.
2007-08-14 23:58:24 +00:00
jlam
6ea0c2868e Remove ${WRKDIR}/.pkgdb during "install-clean" as that directory
contains files that are generated during the "install" phase.  This
should fix the problem where PLIST modifications were ignored if the
PLIST was modified between a "make deinstall" and a "make reinstall".
2007-08-10 04:00:43 +00:00
joerg
005620851f Add core of the infrastructure support for cross-compilation.
- USE_CROSS_COMPILATION activates it, CROSS_DESTDIR specifies root of
  the target filesystem
- derive _CROSS_DESTDIR from CROSS_DESTDIR or MAKEOBJDIR
- buildlink3.mk prefixes the files to symlink with _CROSS_DESTDIR
- compiler/gcc.mk knows about the target prefix (e.g. i386--netbsdelf)
- PKG_DBDIR is prefixed with _CROSS_DESTDIR
- package-install and bin-install are not called with su
- install and strip are redirected to the tool version
- links for the target specific ar, as, ld, nm, objdump, ranlib and
  strip are added
- compiler wrapper detect if linking is requested or not
- special command sinks for CPP and CC/CXX add the cross-compile magic:
  - modify include dirs to get the target /usr/include
  - modify linker dirs and runpath to use target /usr/lib at link time,
    but keep correct rpath entries

Supported-by: Google SoC 2007
Basic tests by he@ on Sparc. Review from jlam@.
2007-08-02 18:19:31 +00:00
joerg
409b183fc0 Remove USE_MTREE support. Keep one copy (the NetBSD version) for
the purpose of print-PLIST in plist/common-dirs.mtree.

Discussed with wiz@, no objections on tech-pkg@.
2007-07-02 14:54:09 +00:00
xtraeme
74128fcaf3 Check if INSTALLATION_DIRS_FROM_PLIST is defined before using .if
!empty...

Reported by Mihai Chelaru.
2007-04-19 18:16:36 +00:00
joerg
5ca4038017 Drop NO_MTREE by making it the default. Introduce USE_MTREE to get the
old behaviour back. Discussed on tech-pkg@.
2007-04-19 16:52:03 +00:00
rillig
c66cd8fa30 Fixed pkglint warnings. 2007-03-09 03:28:58 +00:00
rillig
a22ded7626 Replaced PKG_SILENT/PKG_DEBUG with RUN. 2007-03-09 03:15:33 +00:00
rillig
feeac72e9a Replaced the remaining PKG_SILENT/PKG_DEBUG pairs with RUN. 2007-03-09 03:05:38 +00:00
rillig
3b97228894 Fixed the quoting in INSTALLATION_DIRS and install-dirs-from-PLIST.
In install-dirs-from-PLIST, all directories that don't contain an '@' or
'$' character are automatically installed.
2007-03-09 02:51:45 +00:00
rillig
836ffbe9b9 Added MAKEFLAGS to the RECURSIVE_MAKE call. Almost all other calls
already have it.
2007-03-09 00:45:54 +00:00
rillig
8dd9cf3d41 Renamed some more flavor-specific targets to have the form _flavor-*.
Split check-vulnerable into a general an a flavor-specific part, for
consistence with all the other targets.
2007-03-09 00:39:54 +00:00
rillig
dc31efeb7a Renamed replace-pkg to _flavor-replace and undo-replace-pkg to
_flavor-undo-replace. The leading underscore makes it obvious that these
targets are private, which saves redundant comments.
2007-03-08 23:06:37 +00:00
wiz
5dce6c7d9d Make MTREE_FILE and MTREE_ARGS internal by prefixing them with '_'.
They are not supposed to be set by the user.
2007-03-02 09:08:33 +00:00
wiz
1520ab35d5 Desupport unused FORCE_PKG_REGISTER. 2007-03-02 08:49:40 +00:00
wiz
fc3f7b9811 Remove support for obsolete and unused NO_PKG_REGISTER. 2007-03-02 05:54:18 +00:00
rillig
a856ec03a1 Cleaned up the code:
- Targets that are not intended to be defined here (replace-pkg and
  undo-replace-pkg) are not defined here. (Sounds obvious, but apparently
  isn't.)

- Targets that are intended to be defined here and only here (replace
  and undo-replace) do not need a multiple-definition protection.

- Moved all comments to the top of the file.
2007-02-20 11:17:03 +00:00
rillig
06e2f03ee1 Moved the code that installs check-files on the hook from install.mk to
check-files.mk, for two reasons:

1. It belongs there.
2. Now check-files is run before check-perms and check-interpreter.
2007-01-06 20:15:26 +00:00
joerg
72e97d6f60 Set NO_MTREE for packages flagged as allowing DESTDIR. They are supposed
to work without precreated directories anyway.
2006-12-15 20:54:47 +00:00
joerg
90db16ee98 Only set BINPKG_SITES to ftp.netbsd.org, if the OS is actually NetBSD. 2006-11-21 13:54:26 +00:00
rillig
0ba86a9a56 Removed the tests for CHECK_INTERPRETER and CHECK_PERMS. They are now in
../checks/*.mk.
2006-11-12 00:51:00 +00:00
rillig
5644aacf25 Moved the check for whether check-wrkref should be run from
install/install.mk to check/check-wrkref.mk.

Renamed the check-wrkref target to _check-wrkref.
2006-11-12 00:13:26 +00:00
rillig
8f9b2f0817 Added some documentation.
Since hooks should not be overwritten, removed the !target() check. That
way, one gets a warning when attempting to add some code to the hook.
2006-11-11 23:51:30 +00:00
rillig
06e3596610 Moved the check whether check-shlibs should be run from
install/install.mk to check/check-shlibs.mk.

Renamed check-shlibs to _check-shlibs. Since it had been declared as
"private" before, this will not break anything.
2006-11-11 23:31:38 +00:00
joerg
6500d1b655 Just make the PREFIX with INSTALL_DATA_DIR. Drop the conditional and
don't use mkdir, as the latter uses the group permissions of the
parent directory under BSDs, resulting in group leaks for
USE_DESTDIR=yes. Discussed with agc@.
2006-11-07 18:16:19 +00:00
rillig
9dfb6ae2ac When a package sets INSTALLATION_DIRS_FROM_PLIST to "yes", it does not
need to specify INSTALLATION_DIRS itself. Instead, the list is generated
from the static PLIST files. Like for INSTALLATION_DIRS, mtree is
disabled when this variable is set.
2006-11-04 07:42:51 +00:00
joerg
dcda4fd1f6 Fix thinko: INSTALLATION_DIRS entries don't have ${DESTDIR} as prefix,
just ${PREFIX}.
2006-11-03 15:48:48 +00:00
joerg
ba4ea7aabe Don't reset the "installed" state when using DESTDIR operations on
deinstall. The semantic of deinstall should stay as "remove the
installed version" and the old behaviour force a repackaging.
2006-11-03 08:04:06 +00:00
joerg
62b03eb280 Add package-install. For non-DESTDIR builds, package and package-install
are identical. For DESTDIR builds, the package is not installed to
PREFIX as part of the build, so package-install does exactly that after
package is done. Change bin-install to call package-install.
2006-11-03 08:01:04 +00:00
rillig
43f0fe2662 Change INSTALL_MAKE_FLAGS to be _appended_ to MAKE_FLAGS when running
"make install". That way, packages don't have to say:

    INSTALL_MAKE_FLAGS+=    ${MAKE_FLAGS} foo=bar,

instead it suffices to say

    INSTALL_MAKE_FLAGS+=    foo=bar,

which is also more appropriate since multiple files (Makefile,
Makefile.common, options.mk, *.mk) don't need to care about whether
INSTALL_MAKE_FLAGS already includes MAKE_FLAGS or not.

Note: It is no longer possible to override MAKE_FLAGS completely. But
except for some exotic platforms, the default value is empty anyway.
2006-10-26 20:05:03 +00:00
rillig
20d92f3be1 Added a new post-installation check to see whether the files have their
permissions properly set. See mk/check/check-perms.mk and
sysutils/checkperms for details.
2006-10-13 06:32:15 +00:00
joerg
5b374e445d Main infrastructure for DESTDIR support.
Packages may set PKG_DESTDIR_SUPPORT to either "destdir" or
"user-destdir" to flag support for this, following the same
rules as PKG_INSTALLATION_TYPES (e.g. define before first include
of bsd.prefs.mk).

The user activates it via USE_DESTDIR. When set to "yes",
packages with "user-destdir" are handled as "destdir".
The installation of the package will not go to ${LOCALBASE},
but a subdirectory of ${WRKDIR} instead. pre/post install scripts are
not run and the package is not registered either. A binary package
can be created instead to be installed normally with pkg_add.

For "user-destdir" packages, everything is run as normal user and
ownership is supposed to be correctled by pkg_create later. Since
the current pkg_install code uses pax and it doesn't allow overwriting
owners, this does not work yet.

For "destdir" packages, installation, packaging and cleaning is run as
root.

This commit does not change the handling of DEPENDS_TARGET or
bin-install to allow recursive usage.
2006-10-09 12:25:44 +00:00
joerg
a8e7008902 Add variable to control whether the install target is run as root. 2006-10-09 11:59:08 +00:00
rillig
343b18a86f Added more error checking: If a directory is specified in
INSTALLATION_DIRS but a regular file of the same name already exists,
the BSD install(1) program doesn't care but exits successfully.

To avoid much more confusing error messages, this is checked here, and a
_good_ error message is printed.
2006-10-06 20:13:10 +00:00
rillig
9af6cadbee Both, the pkgsrc user and the package maintainer must agree that this
package should run the CHECK_FILES test. Otherwise we cannot prevent the
broken shells/standalone-tcsh from scanning the whole filesystem. (hi
agc!)
2006-10-05 01:10:59 +00:00
rillig
114453d16b Rewrote the bin-install target so that it doesn't lock LOCALBASE
recursively. This bug was reported by Hans Rosenfeld in

    http://mail-index.netbsd.org/tech-pkg/2006/10/03/0002.html

As a side effect, when bin-install fails to install a binary package,
the package is still built from source, but not as a privileged user.
2006-10-03 11:07:05 +00:00
obache
33d4b2b7d2 Rename variable MAKEFILE to MAKE_FILE, as suggested in PR 28392. 2006-09-09 02:35:13 +00:00
jlam
76a1020667 Drop .ORDER declarations since pkgsrc doesn't support "make -j ...". 2006-08-09 15:31:01 +00:00
jlam
39b54abe7c Only acquire the localbase lock after acquiring root privileges. This
fixes "make install" using just-in-time su-to-root.
2006-08-09 15:25:49 +00:00
rillig
a5c5777ae5 Fixed the locking, as suggested by Johnny on the tech-pkg mailing list.
Added two targets acquire-localbase-lock and release-localbase-lock,
which mark the complete LOCALBASE directory as locked, so that multiple
packages cannot run the install, deinstall or bin-install targets at the
same time.

The install target aquires locks in both WRKSRC and LOCALBASE, the other
two targets only need the LOCALBASE lock, since they may be run without
WRKSRC being present on the system.

locking.mk must be included before tools.mk and the PKG_FAIL_REASON
check.
2006-08-04 20:52:27 +00:00
rillig
edafa3ed56 Rewrote the header comment so that "bin-install" can be found by "bmake
help".
2006-08-04 07:17:58 +00:00
rillig
2b12ad4712 Moved the bin-install target from bsd.pkg.mk to install/bin-install.mk.
Added documentation. Added locking around the real installation.
2006-08-04 07:04:38 +00:00
rillig
7487a78a0c When installing or deinstalling a package, it is not enough to lock the
WRKDIR against foreign processes. Instead, the PKG_DBDIR is locked,
preventing other (pkgsrc) processes from modifying the set of installed
packages while another one is doing that.

This allows to use "bmake update" efficiently on multi-processor
machines by just running it in four different package directories.

Note that the pkg_add and pkg_delete tools may still interfere with this
locking when they are directly run.
2006-08-03 19:12:42 +00:00
jlam
c489860d62 Whenever we invoke a recursive make, we need to ensure that the proper
environment ${PKGSRC_MAKE_ENV} is also passed along.  Create a
convenience variable RECURSIVE_MAKE that does exactly this and that
can be used in place of MAKE when invoking make recursively.

Use RECURSIVE_MAKE everywhere in pkgsrc/mk that we invoke make
recursively.
2006-07-27 21:46:45 +00:00
jlam
77b719dae8 Modify the barrier so that we always invoke the recursive make process
when passing through the barrier.  This ensures the PATH (passed via
PKGSRC_MAKE_ENV) is correctly set for all phases after the barrier.

This fixes a bug in "interactive" pkgsrc use, where if you have no
work directory and type "make build && make install", then the "install"
step does not have a PATH set to include all the wrapper and tools
directories.
2006-07-22 16:31:35 +00:00
jlam
33879949fb The package directory path is "PKGPATH", not "PKG_PATH", which is used
by pkg_add(1).
2006-07-20 14:17:48 +00:00
jlam
01df22aa06 Add a "bootstrap-register" target used specially by the bootstrap script
to register packages that were installed by the bootstrap script.
2006-07-14 17:37:03 +00:00
jlam
7a2c97d53f * Add a new stage "bootstrap-depends" that happens before all other
stages, and that installs dependencies listed in BOOTSTRAP_DEPENDS.
  The bootstrap-depends step works just like the normal depends step
  and honors the value of DEPENDS_TARGET.  It's now possible to add
  dependencies solely to facilitate fetching the distfiles, e.g.

	BOOTSTRAP_DEPENDS+=	curl-[0-9]*:../../www/curl

* Teach the tools framework about ":bootstrap" as a tools modifier
  which indicates the tool should be added as a dependency via
  BOOTSTRAP_DEPENDS.

* Add "digest" to the tools framework.

* Use USE_TOOLS+=digest:bootstrap to force pkgsrc to install digest
  before anything else.  Get rid of unused "uptodate-digest" target
  and related digest version-checking code.

* Finish the refactoring work: split checksum-related code out of
  bsd.pkg.mk and into pkgsrc/mk/checksum and replace the "checksum"
  target command list with a script that does all the real work.

* Make DIGEST_ALGORITHMS and PATCH_DIGEST_ALGORITHM into private
  variables by prepending them with an underscore.  Also, rename
  _PATCH_DIGEST_ALGORITHM to _PATCH_DIGEST_ALGORITHMS and adjust the
  makepatchsum target to allow that variable to contain a list of
  algorithms, all of which are used when creating the patch checksums
  for ${DISTINFO_FILE}.
2006-07-13 14:02:34 +00:00
jlam
356f5e8af5 Rename <phase>_COOKIE variables to _COOKIE.<phase>. These are private
variables so there are no user-visible changes.  This change just makes
it a little easier to write for loops.
2006-07-07 21:24:27 +00:00
jlam
bf9607f39e Make configure, install, and package barrier-aware even if NO_CONFIGURE,
NO_INSTALL, or NO_PACKAGE are defined.
2006-07-07 13:39:52 +00:00
jlam
a8fcae3925 The cookie files are indirectly made using *-cookie targets, so verify
that they are never being created more than once by inserting a check
into the *-cookie targets.
2006-07-06 22:29:52 +00:00
jlam
b8d23232b8 Flatten out recursive makes into a single re-invocation of make by
introducing the concept of a "barrier".  We separate the user-invokable
targets into ones that must happen before the barrier, and ones that
must happen after the barrier.  The ones that happen after the barrier
are run in a sub-make process.  In this case, the targets that must
be run after the barrier are from the "wrapper" step and beyond.  We
rewrite the various "flow" targets, e.g. wrapper, configure, build,
etc., so that they of the right form to use the barrier target.

This now completely removes the concept of PKG_PHASE from pkgsrc.  It
is replaced with the concept of "before" and "after" the barrier, and
this state can be checked by testing for the existence of the barrier
cookie file.  Because we've removed most of the recursive makes, there
is now nowhere to hook the PKG_ERROR_HANDLER.* commands, so remove
them for now.

As part of this commit, put back the logic that conditionalized the
sources for the various cookie files.  Because the sources are all
"phony" targets, they were always run, regardless of whether or not
the cookie file already existed.  Now, if a cookie file exists, then
that entire phase associated with that cookie file is skipped.

Lastly, fix a thinko in configure/bsd.configure.mk where setting
NO_CONFIGURE in a package Makefile would manage to skip the "wrapper"
step altogether.  Fix this by correctly noting "wrapper" and not
"patch" as the preceding step to "configure".
2006-07-05 22:21:02 +00:00
jlam
990d0b5377 Make the check-vulnerable target more self-sufficient, by moving some
of the logic from fetch/fetch.mk into flavor/pkg/check.mk, so that
check-vulnerable can be used as a source target.

Make check-vulnerable a source target for every phase of the build
workflow, which ensures that it is always run if the user starts a
new phase from the command line.

Fix the cookie-generation targets so that they don't append, only
overwrite to the cookie file.  This works around potential problems
due to recursive makes.

Move the cookie checks so that they surround the corresponding phase
target.  The presence of the cookie should now inform the make process
to avoid doing any processing of phases that occur before the phase
corresponding to the cookie.
2006-07-05 09:08:35 +00:00
jlam
773389471a Insert cookie checks into the "real-install" and "real-package" targets,
which are invoked in recursive make calls for the "install" and
"package" targets respectvely.  These recursive make calls prevent
the top-level make from seeing all of the targets and computing a full
dependency graph, so it becomes possible for some targets to be invoked
more than once.  This change passes enough information along to the
recursive make calls and ensures that the source targets for the real-*
targets are only invoked once.
2006-06-14 07:51:47 +00:00
jlam
85c5451053 Restore missing ${SETENV} ${BUILD_ENV} that was dropped during the initial
package system flavors commit.
2006-06-10 03:23:46 +00:00
jlam
8c10d39139 Introduce the capability to gather all the warnings and errors that
are generated for a target and output them all at once at the conclusion
of the target's invocation.  The implementation is in bsd.pkg.error.mk,
which defines a macro target "error-check" that will print out any
non-empty warning and error files in ${WARNING_DIR} and ${ERROR_DIR}
and exit appropriately if there were errors.

Convert some targets that were just long sequences of ${ERROR_MSG} or
${WARNING_MSG} within a single shell statement to use the new delayed
error output via error-check.

Modify the compiler "fail" wrappers for C++ and Fortran to be less
verbose during invocation.  Instead collect the warnings and only
print them at the end of the completed phase, e.g. after "configure"
and/or "build" completes.
2006-06-09 13:59:06 +00:00
jlam
e95152039c If the install cookie file exists, then we don't need to do anything.
Also, move the interactive check into a separate target as a prelude
to removing the recursive make for invoking "real-install".
2006-06-08 15:47:10 +00:00
tron
6e1ed39e5d 1.) Remove all instances of '@${WARNING_MSG} "Warning: ...' which resulted
in error message like 'WARNING: Warning: ...'.
2.) Replace "WARN_MSG" with "WARNING_MSG" which makes the "make package"
    target work again for restricted packages like "acroread7".
2006-06-07 10:04:03 +00:00
jlam
3058ace76f Move some variable definitions out of bsd.prefs.mk and back into
bsd.pkg.mk.  They didn't actually need to be defined in bsd.prefs.mk,
just somewhere before the "main" bsd.<phase>.mk files were included.
This moves some conditional (?=) definitions back into bsd.pkg.mk so
they won't conflict with any conditional definitions in package
Makefiles.

This should fix the "checksum" problems in lang/php-gd as noted here:

    http://mail-index.netbsd.org/pkgsrc-users/2006/06/05/0012.html

where EXTRACT_SUFX had the wrong value due to the order in while *.mk
files were included.
2006-06-06 15:28:51 +00:00
jlam
7136ee2fac Remove trailing blank line. 2006-06-06 00:25:26 +00:00
jlam
3fbe129b69 Use PHASE_MSG, STEP_MSG, WARNING_MSG, and ERROR_MSG in place of ECHO_MSG
in various places.
2006-06-05 22:49:44 +00:00
jlam
e3f0f1869f Allow overrides of the public targets, e.g. "install", "package", etc.
if PKG_SKIP_REASON or PKG_FAIL_REASON is defined.  This commit adds
!target(...) guards around those target definitions to avoid "duplicate
target definition" warnings.
2006-06-05 17:41:11 +00:00
jlam
aa5856070f Move definitions for UPDATE_TARGET and DEPENDS_TARGET closer to where
they are used.  Also, move UPDATE_RUNNING into the install module where
it is used, and make it "private" by prepending with an underscore.
2006-06-05 17:21:54 +00:00
jlam
e5eb2c56af First pass at implementing support for package system flavors other
than pkgsrc's current one.  This is an important lead-up to any project
that redesigns the pkg_* tools in that it doesn't tie us to past design
(mis)choices.  This commit mostly deals with rearranging code, although
there was a considerable amount of rewriting done in cases where I
thought the code was somewhat messy and was difficult to understand.

The design I chose for supporting multiple package system flavors is
that the various depends, install, package, etc.  modules would define
default targets and variables that may be overridden in files from
pkgsrc/mk/flavor/${PKG_FLAVOR}.  The default targets would do the
sensible thing of doing nothing, and pkgsrc infrastructure would rely
on the appropriate things to be defined in pkgsrc/mk/flavor to do the
real work.  The pkgsrc/mk/flavor directory contains subdirectories
corresponding to each package system flavor that we support.  Currently,
I only have "pkg" which represents the current pkgsrc-native package
flavor.  I've separated out most of the code where we make assumptions
about the package system flavor, mostly either because we directly
use the pkg_* tools, or we make assumptions about the package meta-data
directory, or we directly manipulate the package meta-data files, and
placed it into pkgsrc/mk/flavor/pkg.

There are several new modules that have been refactored out of bsd.pkg.mk
as part of these changes: check, depends, install, package, and update.
Each of these modules has been slimmed down by rewriting them to avoid
some recursive make calls.  I've also religiously documented which
targets are "public" and which are "private" so that users won't rely
on reaching into pkgsrc innards to call a private target.

The "depends" module is a complete overhaul of the way that we handle
dependencies.  There is now a separate "depends" phase that occurs
before the "extract" phase where dependencies are installed.  This
differs from the old way where dependencies were installed just before
extraction occurred.  The reduce-depends.mk file is now replaced by
a script that is invoked only once during the depends phase and is
used to generate a cookie file that holds the full set of reduced
dependencies.  It is now possible to type "make depends" in a package
directory and all missing dependencies will be installed.

Future work on this project include:

    * Resolve the workflow design in anticipation of future work on
      staged installations where "package" conceptually happens before
      "install".

    * Rewrite the buildlink3 framework to not assume the use of the
      pkgsrc pkg_* tools.

    * Rewrite the pkginstall framework to provide a standard pkg_*
      tool to perform the actions, and allowing a purely declarative
      file per package to describe what actions need to be taken at
      install or deinstall time.

    * Implement support for the SVR4 package flavor.  This will be
      proof that the appropriate abstractions are in place to allow
      using a completely different set of package management tools.
2006-06-03 23:11:42 +00:00
jlam
143b5f7d14 Move mk/install to mk/pkginstall to better reflect the contents (the
pkginstall framework).
2006-05-21 23:50:15 +00:00
jlam
408b9158bd Avoid a difference in shell implementation between IRIX 5.3 and newer
UNIX systems which caused recursive script invocations to not work.
Patch from Georg Schwarz in private email.
2006-05-21 00:14:51 +00:00
jlam
74ffb73d57 Fix missing quotes that were causing the group and user existence checks
to break.
2006-05-10 05:41:40 +00:00
jlam
2ab9b7d728 Use the meta-data directory as the location for all temporary files
used by the various scriptlets.  Also, consistently use the idiom of
creating a temporary directory with mode 700 and creating temporary
files underneath that directory to avoid race conditions.
2006-05-01 14:56:23 +00:00
jlam
ebe8e867eb Ensure that @VAR@ placeholders in usergroupfuncs are properly substituted
for by running it through a separate FILES_SUBST_SED filter.  This fixes
the case where the user wasn't being created if USERGROUP_PHASE was
defined.
2006-04-29 04:36:13 +00:00
jlam
1685213908 Always remove the intermediate files, even if the +USERGROUP script
determines the users and/or groups don't exist.  This makes "make clean"
work properly for non-root users.
2006-04-29 03:54:10 +00:00
jlam
ffdf92793e Remove the test file in all exit conditions. 2006-04-29 03:49:12 +00:00
jlam
0022419f9d Allow for just-in-time su when creating users and groups if
USERGROUP_PHASE is defined.
2006-04-29 03:09:40 +00:00
jlam
24ad3a7f29 Use a better default user comment if none is specified -- if the username
matches ${PKGBASE}, then use "${PKGBASE} user", otherwise we use
"${PKGBASE} $user user".
2006-04-27 22:44:09 +00:00
jlam
b01f35bb33 Allow a package to specify the ownership and permission on
${PKG_SYSCONFDIR} if PKG_SYSCONFSUBDIR is defined and non-empty.  A
package may now set PKG_SYSCONFDIR_PERMS to an "owner group mode"
triplet, which defaults to "${ROOT_USER} ${ROOT_GROUP} 755".
2006-04-26 05:58:44 +00:00
jlam
70c1c5f45f Rename the test directory to a more suggestive name. 2006-04-25 22:35:46 +00:00
jlam
98afa666a4 Modify the DIRS line format to match the FILES one, where the mode
precedes the user and group.
2006-04-25 22:32:44 +00:00
jlam
057ec88ef7 Use colons as separators instead of slashes on the off-chance that "/"
is used in either the user or group name due to some bizarro set of
circumstances.
2006-04-25 20:12:35 +00:00
jlam
ede4976eb9 First try at fixing a deficiency in the package +INSTALL scripts,
where they don't verify that any pre-existing config files and
directories have the correct permissions.  For example, if you are
upgrading a package to a newer version and the config files and
directories used by the package need to have different permissions
than in previous versions of the package, then the new package may
fail to work because it can't access pre-existing files and directories.

This commit improves on this by doing the following:

(1) Teach the +FILES and +DIRS scriptlets two new actions "PERMS" and
    "CHECK-PERMS".  "PERMS" fixes permissions on existing files and
    directories.  "CHECK-PERMS" will verify those same bits and warn
    the user when they are wrong.  The "CHECK-PERMS" actions for the
    two scriptlets are run immediately after the "ADD" actions.

(2) Add a new variable PKG_CONFIG_PERMS that controls whether the
    "PERMS" action will automatically fix permissions.  PKG_CONFIG_PERMS
    is only consulted if PKG_CONFIG is "yes".  PKG_CONFIG_PERMS can
    be set in the shell environment when running pkg_add, e.g.:

        export PKG_CONFIG=yes
        export PKG_CONFIG_PERMS=yes
        pkg_add /path/to/binary/package.tgz

    The default value of PKG_CONFIG_PERMS embedded into the +INSTALL
    script may also be set in /etc/mk.conf.  This value defaults to
    "no", so that by default, the +INSTALL script will not modify or
    destroy any existing configuration files or directories.

The +INSTALL script will now always warn you if there are files or
directories whose permissions differ from what the package is expecting
to use, and if PKG_CONFIG_PERMS is set to "yes", then it will go ahead
and fix those permissions for you automatically.
2006-04-25 19:54:39 +00:00
jlam
31e0ac81c5 Fix typos in comments, noted by Yoshito Komatsu in private email. 2006-04-24 23:44:18 +00:00
jlam
ec33004d29 Fix {group,user}_exists functions when the numeric ID is not set. Fix
provided in PR pkg/33346 by Yoshito Komatsu.
2006-04-24 15:44:32 +00:00
jlam
2797f2c4fb Add two new capabilities to the pkginstall framework:
(1) Allow specifying the numeric UID and GID for users and groups in
    /etc/mk.conf by setting PKG_UID.<user> and PKG_GID.<group> to
    those values.  If these values are specified, then the +USERGROUP
    script will verify that existing users and groups match the
    requested UIDs and GIDs for the package, and otherwise create them
    with these UIDs and GIDs.  For example:

	PKG_UID.courier=	10001
	PKG_GID.mail=		6

    In this example, the courier-authlib binary package will be created
    to use uid 10001 for the "courier" user and gid 6 for the "mail"
    group.

(2) Allow a package to request that users and groups be created prior
    to configuring or building a package by setting USERGROUP_PHASE
    to "configure" or "build".  Because the reason for this is typically
    to hardcode the UIDs and GIDs of requested users and groups directly
    into the package's executables, these hardcoded values will be
    automatically determined and put into the +USERGROUP script.  For
    example:

	USERGROUP_PHASE=	configure

	PKG_GROUPS=	qmail nofiles
	PKG_USERS+=	qmaill:nofiles
	PKG_USERS+=	qmailq:qmail

    In this example, the users and groups are created before the
    configure phase when building qmail, and the qmail binary package's
    +INSTALL script will try to create (or verify) users and groups
    with the same UIDs and GIDs that were used during the build.

As part of these changes, the format for PKG_USERS and PKG_GROUPS has
changed -- the optional parts of the corresponding entries are no
longer used and cannot be specified.  Instead, the following variables
should be set:

        PKG_GID.<group> is the group's numeric GID.
        PKG_UID.<user> is the user's numeric UID.
        PKG_GECOS.<user> is the user's description.
        PKG_HOME.<user> is the user's home directory.
        PKG_SHELL.<user> is the user's login shell.

A separate commit will follow which will fix all packages that set
PKG_USERS and PKG_GROUPS to use the new syntax and variables.
2006-04-23 00:00:43 +00:00
jlam
f85023f9da Now that all info file entries have been pushed from INFO_FILES into
the PLISTs, drop support for listing info files in INFO_FILES.  The
INFO_FILES variable is now strictly defined/undefined.
2006-04-16 04:27:17 +00:00
jlam
530fe2b25a Better error-checking in the +INFO_FILES scriptlet:
(1) Don't claim to be adding and removing the info file if it does
    exist at all.

(2) Always try to create and remove the directory containing the "dir"
    index file to avoid failures.
2006-04-12 21:13:56 +00:00
jlam
1d415956a8 Resurrect INFO_DIR for another purpose -- if defined, it sets the
directory containing the "dir" file that is updated.  This allows
packages to install info files in one place but update the dir file
in a separate location.
2006-04-06 17:57:34 +00:00
jlam
29fefe52e3 * Creates a new variable PKGINFODIR (named similarly to PKGMANDIR)
that is a purely user-settable variable to represent the relative
  path under ${PREFIX} where info files are stored and "dir" files
  are managed.  PKGINFODIR defaults to "info".  INFO_DIR still works,
  but will be obsoleted after the 2006Q1 branch.

* Modify GNU_CONFIGURE_INFODIR to only honor ${PKGINFODIR} if the
  package installs directly into ${PREFIX} and not some subdirectory
  under ${PREFIX}.  This fixes packages that don't really honor
  $(infodir) all that well, and also avoids PLIST problems relating
  to directory removal for those packages.

* Since the majority of Emacs Lisp packages use GNU_CONFIGURE, just
  set GNU_CONFIGURE_INFODIR directly to ${EMACS_INFOPREFIX}, which is
  the Emacs-distro-specific location for info files.  Also pass
  EMACS_INFOPREFIX through PLIST_SUBST for PLIST substitution.

* INFO_FILES should be defined if the package installs info files.
  If the info files are not listed in the PLIST, then INFO_FILES
  must list the filenames for the info files installed by the package,
  which are assumed to be located in ${PREFIX}/${PKGINFODIR}.

* The plist module can now better detect info files listed in PLISTs
  and exports a command to the pkginstall module to append info file
  names to the +INFO_FILES scriptlet at install-time.

* The print-PLIST target is updated to properly list info files in
  the auto-generated PLIST.

* The check-files code is updated to skip all "dir" Info database files.
2006-03-20 01:48:57 +00:00
jlam
44b11e928c Modify the INSTALL script to allow for selective unpacking of a scriptlet. 2006-03-19 23:58:14 +00:00
jlam
8679fd0ed3 Ensure that we invoke a brand new make when creating the INSTALL/DEINSTALL
and rc.d scripts so that we source the latest makevars.mk file and
get the latest set of cached variables.  This fixes problems where
BUILDLINK_PREFIX.* wasn't being expanded correctly when substituting
into an INSTALL script.
2006-03-17 18:22:30 +00:00
jlam
47283bca00 Always run the pkginstall framework targets to generate the
INSTALL/DEINSTALL and rc.d scripts, regardless of whether NO_BUILD is
defined or not.

We do this by renaming the main "build" target to "_build", and creating
a new "build" target that has "_build" and "pkginstall" as dependencies.
This allows the "build" and "install" targets to be consecutive, so
no changes in behavior are visible to the user.

Because the pkginstall targets are no longer run within the protection
of the locks during the build phase, we need to manage locking within
a new "pkginstall" target.
2006-03-15 16:20:11 +00:00
jlam
d4ca1fbd6b Rototill of how the various template parts of the INSTALL and DEINSTALL
scripts are generated.  The various scriptlets in pkgsrc/mk/install
are now full templates that can be combined to form the INSTALL and
DEINSTALL scripts.  All of the templates have either leading or trailing
blank lines so that when they are concatentated, the full INSTALL and
DEINSTALL scripts will still be easy to read.

All of the generated template sources for the INSTALL and DEINSTALL
scripts are now stored in ${WRKDIR}/.pkginstall for local consistency
and have been renamed so that they are not dot-files.

The "data" for the +* scriptlets are now generated in a separate step
and instead of being appended to the unpacked scriptlet are now appended
to the INSTALL script itself.  When the scriptlets are unpacked, the
corresponding data lines for each scriptlet are pulled out of the
INSTALL script and put into the unpacked scriptlets.  This makes it
easy to append more data lines during the install phase without needing
to regenerate the INSTALL script.
2006-03-15 04:52:57 +00:00