Up to [cvs.NetBSD.org] / pkgsrc / mk / pkgformat / pkg
Request diff between arbitrary revisions
Keyword substitution: kv
Default branch: MAIN
mk: Move _KEEP_BIN_PKGS logic to package-install. Having it done at the install level meant that anything that called bin-install would go directly to package-install, and end up overwriting package files in PACKAGES even with PKGSRC_KEEP_BIN_PKGS=no. Have been testing this locally for around 8 months with no issues.
mk/pkgformat/pkg: Use extended `-m "OS/ARCH VER"' syntax. Requires pkg_install>=20240125. No change to native builds, not even the pkg_install requirement, because this is conditional on cross builds. Proposed on tech-pkg: https://mail-index.netbsd.org/tech-pkg/2024/01/13/msg028825.html
Split native and cross LOCALBASE for cross-compilation.
This way, you can use an unprivileged prefix of ~/cross/pkg to
cross-compile packages that, when installed, will go in /usr/pkg.
In mk.conf:
- Set CROSS_LOCALBASE to determine the installation prefix of
packages that you cross-compile.
- Set LOCALBASE to determine the installation prefix of native
packages needed for cross compilation.
Both default to /usr/pkg. Note: CROSS_LOCALBASE defaults to /usr/pkg
even if you set LOCALBASE. Of course, if you're not cross-compiling,
this has no effect.
When cross-compiling a package:
- LOCALBASE is where cross-compiled packages will be installed.
(`make install' will put it in ${CROSS_DESTDIR}${LOCALBASE}, of
course, but when you later use pkg_add to install the binary
package on the system you're compiling it for, it will go in
${LOCALBASE}. And you can still set PREFIX for an individual
package, but LOCALBASE refers to where cross-compiled packages are
generally installed, other than the specific ones that override
PREFIX.)
- TOOLBASE is where tool dependencies are installed and available to
be executed at build-time.
For example, if you have TOOL_DEPENDS on a program that is
installed in (say) foo/bin/xyz which is not in PATH so you have to
refer ot its full pathname, you can execute ${TOOLBASE}/foo/bin/xyz
instead of ${LOCALBASE}/foo/bin/xyz.
I chose this split, rather than the other way around, because I
expect that references that are baked into installed packages to be
more common than references that are executed at build-time, but I
didn't do an extensive study of the matter. I chose the name
TOOLBASE because it's where TOOL_DEPENDS go.
mk: pkgformat performance improvements.
Inline ${RUN} calls where appropriate. Only call mkdir when necessary.
Remove useless use of cat(1). Avoid unnecessary expr(1). Use bmake
loop expansion. Avoid unnecessary temporary files.
Saves around 50 execs per build.
I export pkgsrc over NFS from a macOS host to a variety of VMs, each of
which sets ${PACKAGES} to a subdir of ${PKGSRCDIR}/packages (on the same
NFS mount) so that the generated packages all land in one place.
From my Debian, Devuan, Ubuntu, and CentOS 8 (but not 7) VMs,
copying ${STAGE_PKGFILE} to ${PKGFILE} fails to preserve permissions,
which fails the copy and the "package" target with it. The error
looks like so:
===> Building binary package for foo-4.2
=> Creating binary package /home/schmonz/trees/pkgsrc-cvs/packages/Debian/All/foo-4.2.tgz
/bin/cp: preserving permissions for ‘/home/schmonz/trees/pkgsrc-cvs/packages/Debian/All/foo-4.2.tgz’: Operation not permitted
Assuming permissions on built packages are merely a nice-to-have, avoid
failing if we couldn't preserve them. Patch from sjmulder@, for whom
this fixes a similar problem with FreeBSD with ZFS.
Run pkg_add(1) and pkg_delete(1) using ${SETENV} ${PKGTOOLS_ENV}.
PKGTOOLS_ENV allows for passing environment variables to the
package install and deinstall scripts.
Stop creating category symlinks in ${PACKAGES}, but keep All/ for now.
Remove support for USE_DESTDIR=no.
Changed "Install binary package" to "Installing binary package"
Perform signing at the staged package stage rather than only during the copy to the target pkgfile. Ensures consistency at all stages, means we can support verifying the signature at install time, and also fixes signed packages with recent pbulk changes which now invoke 'stage-package-create' rather than 'package'.
Switch to globbing for package symlinks to delete. This provides significant performance improvements on at least OSX and SunOS, where each file is stat'd rather than just the links we are looking for, especially with large package directories over NFS.
Add a new ulimit modifier for cputime. Support raising limits for package creation. There are very few things in pkgsrc that needs more than one hour per process on decently fast hardware, so setting that as (soft) limit for bulk builds avoids the infinite loops seen in some other packages. There are a few select exceptions, i.e. flightgear-data needs more than one hour for pkg_create when using xz. This flag allows selectively giving those places more time without wasting resources in the broken cases.
Put back PKGNAME_REQD fix for su-real-package-install.
Revert "Pass PKGNAME_REQD to su-real-package-install", proposed/discussed is required for such infrastructure changes.
Remove pkg_views support, second part: infrastructure.
Pass PKGNAME_REQD to su-real-package-install, for multiversion packages not using default version.
Fixes undefined variable references.
Create signed packages automatically if desired. It is disabled by default, and documented in mk/defaults/mk.conf. Both the "gpg" and "x509" methods supported by pkg_admin(1) are supported. With package signing enabled, a staging, unsigned copy of the package is always created, and its final copy to the package repository is done with pkg_admin(1) instead of "ln || cp". Proper operation should otherwise not be affected. Tested both with and without user-destdir support in packages. "can live with it" joerg@ From EdgeBSD.
drop unwanted stage-package-remove before stage-package-create, to avoid unwanted stage binary package removal/regeneration.
prevent to generate binary package in ${PACKAGES} from the side effect of
`install' with USE_DESTDIR=yes.
This changes prevent to unwanted overwite of existing binary packages with
test installation (`stage-install', `replace' & `undo-replace', and so on).
To do both `install' and `package', you can still use `package-install' target,
same as USE_DESTDIR=no.
Rename "flavor" to "pkgformat". This is from Anton Panev's GSoC 2011 project to add RPM and DPKG support to pkgsrc. (I am not adding that further support in this commit.) This is just a rename of the existing functionality. Now it will be easy to test the GSoC work by simply putting in a single directory (such as "rpm" or "deb"). See http://addpackageforma.sourceforge.net/ for some details. This is from Anton's CVS, but I made some minor changes: - changed plural pkgformats to singular pkgformat (to be consistent) - fixed a few places (in comments) that were missed - catch up on some additions to flavor not in the pkgforma cvs: PKGSRC_SETENV and _flavor-destdir-undo-replace and undo-destdir-replace-install.