Commit graph

69 commits

Author SHA1 Message Date
Ed Maste f72b4f7e14 etcupdate: temporarily comment out one tzsetup test
This test fails after tzsetup was changed to symlink rather than copy
the zoneinfo file (5e16809c95).
2023-11-24 17:31:28 -05:00
Warner Losh fa9896e082 Remove $FreeBSD$: two-line nroff pattern
Remove /^\.\\"\n\.\\"\s*\$FreeBSD\$$\n/
2023-08-16 11:55:10 -06:00
Warner Losh d0b2dbfa0e Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16 11:55:03 -06:00
Jessica Clarke 309ec6ab28 etcupdate: Remove redundant semicolons
Fixes:	03e62670c3 ("etcupdate: Consolidate nobuild cases and make more robust")
2023-07-27 07:55:13 +01:00
Jessica Clarke 246364454f etcupdate: Use new buildetc and installetc targets when available
These new targets avoid the need to invoke internal build system targets
or set internal variables when building, and also have the added benefit
of working with BUILD_WITH_STRICT_TMPPATH. Old source trees lacking such
targets will not work with BUILD_WITH_STRICT_TMPPATH; they could be made
to work by copying the steps, but it's not worth doing so, as they never
have worked in the past. The primary goal of this is to support changing
the default of BUILD_WITH_STRICT_TMPPATH to enabled.

Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D41206
2023-07-27 05:10:49 +01:00
Jessica Clarke 03e62670c3 etcupdate: Consolidate nobuild cases and make more robust
The distrib-dirs and distribution steps are shared between the two, the
only difference is whether MAKEOBJDIRPREFIX is in the environment for
the latter. Having in the environment for the former is currently not
needed but does no harm and will be needed in future, so we can just
export it up-front in the subshell. When we do distrib-dirs relative to
_obj and everything also doesn't matter, so move it next to distribution
where it makes more sense. Finally, to avoid complicated && chains, use
"|| exit 1" everywhere to make the subshell fail, and add an extra one
on to the cd $SRCDIR to handle that failing (otherwise we'd go on and
try to build the current directory after cd prints its error, which is
unhelpful).

These changes will make it easier to bundle these steps up into new
top-level targets to allow the build system to manage the steps rather
than etcupdate, which will also handle BUILD_WITH_STRICT_TMPPATH, which
currently does not work with etcupdate.

Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D41204
2023-07-27 05:10:48 +01:00
Warner Losh 4d846d260e spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with:		pfg
MFC After:		3 days
Sponsored by:		Netflix
2023-05-12 10:44:03 -06:00
Xin LI 4bbf45cf56 etcupdate: Chase test case after pwd_mkdb(8) no longer copies comments.
MFC after:	3 days
2023-01-29 20:40:58 -08:00
Jessica Clarke e571b0f8f8 etcupdate: Fix -N support for build command
Whilst febca0e643 added -N for both build and extract, it only fully
worked for extract; build would perform the actual tree build with
-DNO_ROOT and construct the intended METALOG, but the subsequent tarball
creation did not take this into account and just tarred up the the
directory as-is rather than using the METALOG. This resulted in the
permissions and ownership not being correct, as well as there being a
stray METALOG file in the tarball's root.

Reported by:	avg
Reviewed by:	avg, jhb, imp
Tested by:	avg
Fixes:		febca0e643 ("etcupdate: Add a -N flag to perform a NO_ROOT build")
Differential Revision:	https://reviews.freebsd.org/D36845
2022-10-03 17:16:19 +01:00
Jessica Clarke febca0e643 etcupdate: Add a -N flag to perform a NO_ROOT build
This is in preparation for including an etcupdate tree when performing a
-DNO_ROOT release image build. Although -DNO_ROOT can be passed via -M,
to be useful we need to mangle the resulting METALOG to mirror the
various cleanups to the tree that are done after the build (removing
generated files, empty files and empty directories), so etcupdate needs
its own flag.

Reviewed by:	jhb, pauamma
Obtained from:	CheriBSD
Differential Revision:	https://reviews.freebsd.org/D35857
2022-08-09 22:57:47 +01:00
Jessica Clarke c5e30fbdb7 etcupdate: Prefer POSIX -depth to BSD -d
This is in preparation for building an etcupdate tree on non-FreeBSD
when building release images. The -d option is documented as a
BSD-specific equivalent to the POSIX -depth primary. Whilst GNU find
sort of accepts it in an attempt to be compatible, it still doesn't
permit it coming before the paths, unlike BSD find, and prints a
deprecation warning either way. Thus, use the equivalent POSIX -depth to
ensure it works correctly and without warning everywhere.

Reviewed by:	jhb
Obtained from:	CheriBSD
Differential Revision:	https://reviews.freebsd.org/D35856
2022-08-09 22:57:22 +01:00
Jessica Clarke 5513d7dee5 etcupdate: Add a -m flag to change the make binary that's run
This will allow release/Makefile to forward on ${MAKE} to allow building
on non-FreeBSD systems where ${MAKE} is something other than make, as
make is typically GNU make in such situations.

Reviewed by:	jhb, pauamma
Obtained from:	CheriBSD
Differential Revision:	https://reviews.freebsd.org/D35854
2022-08-09 22:56:19 +01:00
John Baldwin f8287caae4 etcupdate: Preserve permissions when installing a resolved file.
Similar to the change in 1a04446f08, use
cat to overwrite the contents of the existing file rather than cp so
that metadata of the existing file such as permissions and ownership
is preserved.

PR:		255514
Reported by:	uqs
MFC after:	1 week
2022-05-25 14:20:40 -07:00
John Baldwin 431944fb5f etcupdate: Don't rotate trees for a dry run.
When performing a dry run, remove the temporary tree created rather
than rotating the trees.  Rotating the trees meant that etcupdate
thought the latest changes were already merged and would not merge
them on the next real run.

PR:		260281
Reported by:	Tomoaki AOKI <junchoon@dec.sakura.ne.jp>
Fixes:		0611aec3cf etcupdate: Always extract to a temporary tree.
MFC after:	1 week
2022-05-25 14:02:51 -07:00
Tom Jones 016bfb0a97 etcupdate: remove redundant diff3 flag
-A and -m select different output modes output modes for diff3. When
both flags are present gnu diff3 prefers -m, drop the extra -A flag in
etcupdate.

Reviewed by:	pstef, 0mp
MFC after:	3 days
Sponsored by:	Klara Inc
Differential Revision:	<https://reviews.freebsd.org/D###>
2022-04-13 16:05:32 +01:00
Ceri Davies 64e6e1e463 secure/caroot, certctl: Rename secure/caroot/blacklisted
Old certctl commands still work for compatability, but are deprecated.

Approved by:	secteam (gordon)
Differential Revision: https://reviews.freebsd.org/D30807
2021-06-18 13:38:07 +01:00
John Baldwin 5eb9c93a20 etcupdate: Add -D destdir to usage for 'extract'.
Reported by:	Mark Millard <marklmi@yahoo.com>
MFC after:	1 week
2021-04-26 09:49:34 -07:00
John Baldwin b0df36580d etcupdate: Remove the old pre-world tree when rotating for -p.
This fixes a bug in an earlier change to move tree rotation to
the end of the update where the step to make room for the new
preworld tree was deleting the old "current" tree instead of
the old "preworld" tree.

Reported by:	olivier, dhw
Fixes:		0611aec3cf
MFC after:	2 weeks
2021-04-23 09:44:18 -07:00
John Baldwin ba30215ae0 etcupdate: Add a revert mode to restore one or more stock files.
Reviewed by:	imp
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D29846
2021-04-20 13:23:08 -07:00
John Baldwin ada7fd17d5 etcupdate: Trim trailing whitespace.
Reviewed by:	imp
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D29845
2021-04-20 13:22:24 -07:00
John Baldwin 1f7afa9364 etcupdate: Gracefully handle SIGINT when building trees.
Run the 'build_tree' function inside of a subshell and trap SIGINT to
return an error to the caller.  This allows callers to gracefully
cleanup a partially created tree.

While here, redirect stdout/stderr of the subshell to the log file
instead of applying redirections individually to each command executed
while building the tree.

Reviewed by:	imp
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D29844
2021-04-20 13:22:11 -07:00
John Baldwin 0611aec3cf etcupdate: Always extract to a temporary tree.
etcupdate has had a somewhat nasty race condition since its creation
in that its state machine can get very confused if it is interrupted
while building the tree to compare against.  This is exacerbated by
the fact that etcupdate doesn't emit any output while building the
tree which can take several seconds (especially in recent years with
the addition of the tree-wide buildconfig/installconfig passes).

To mitigate this, always install a new tree into a temporary directory
created via mktemp as was previously done only for dry-runs via -n.
The existing trees are only rotated and the new tree installed as
/var/db/etcupdate/current after the update command has completed.

Reported by:	dim, np (and many others)
Reviewed by:	imp
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D29843
2021-04-20 13:21:42 -07:00
Kyle Evans 0da4b4089c Unbreak etcupdate(8) and mergemaster(8) after r352950
r352950 introduced improper case fall-through for shell scripts. Fix it with
a pipe.

Reported by:	lwhsu, David Wolfskill
2019-10-02 12:46:28 +00:00
Kyle Evans bbb8014f09 [3/3] etcupdate and mergemaster support for certctl
This commit add support for certctl in mergemaster and etcupdate. Both will
either rehash or prompt for rehash as new certificates are
trusted/blacklisted.

This work was done primarily by allanjude@, with minor contributions by
myself.

No objection from:	secteam
Differential Revision:	https://reviews.freebsd.org/D17389
2019-10-02 01:06:37 +00:00
Baptiste Daroussin 45a13fd899 Move back group, master.passwd and shells to etc directory
Use the .PATH mechanism instead so keep installing them from lib/libc/gen

While here revert 347961 and 347893 which are no longer needed

Discussed with:	manu
Tested by:	manu
ok manu@
2019-05-23 18:37:05 +00:00
Emmanuel Vadot d0ba99d943 etcupdate: Add missing directory when building the tree
Missed in 348151

Reported by:	lwshu, ci
2019-05-23 14:05:42 +00:00
Emmanuel Vadot 6f4c12f301 etcupdate: Fix -p after the move of the passwd related files
Since PREWORLD_FILES only contain files that needs to be copied into /etc
copy directly those files there.

Reported by:	many
2019-05-23 07:59:16 +00:00
Brad Davis 11f8f36fb9 Fix mergemaster after r347638 and the master.passwd / group move.
Check the legacy directory and use it instead if present.

Install these first if using beinstall.

UPDATING entry to follow.

Approved by:	allanjude (mentor, in person)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D20279
2019-05-16 21:50:12 +00:00
Mateusz Piotrowski e36f62bda6 Cross-reference mergemaster(8) & etcupdate(8).
Suggested by:	Daniel Ebdrup
Reviewed by:	bcr
Approved by:	bcr (doc), krion (mentor, implicit), mat (mentor, implicit)
Differential Revision:	https://reviews.freebsd.org/D18350
2018-11-27 10:31:29 +00:00
Pedro F. Giffuni 1de7b4b805 various: general adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

No functional change intended.
2017-11-27 15:37:16 +00:00
Enji Cooper d511b20a69 Add HAS_TESTS to all Makefiles that are currently using the
`SUBDIR.${MK_TESTS}+= tests` idiom.

This is a follow up to r321912.
2017-08-02 08:50:42 +00:00
Enji Cooper 4b330699f8 Convert traditional ${MK_TESTS} conditional idiom for including test
directories to SUBDIR.${MK_TESTS} idiom

This is being done to pave the way for future work (and homogenity) in
^/projects/make-check-sandbox .

No functional change intended.

MFC after:	1 weeks
2017-08-02 08:35:51 +00:00
Eric van Gyzen 1a04446f08 etcupdate: preserve the metadata of the destination file
When using diff3 to perform a three-way merge, etcupdate lost the destination
file's metadata. The metadata from the temporary file were used instead.
This was unpleasant for rc.d scripts, which require execute permission.
Use "cat >" to overwrite the destination file's contents while preserving its
metadata.

Reviewed by:	bapt
Sponsored by:	Dell Technologies
Differential Revision:	https://reviews.freebsd.org/D7817
2016-09-08 15:53:49 +00:00
Baptiste Daroussin a7212e5721 etcupdate: directly use diff3(1) instead of merge(1)
During the last attempt to rmeove GNU rcs, 2 blockers were spotted:
We need an ident(1) and etcupdate(8) uses merge(1).

Now nothing should prevent to remove rcs from base

Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D7401
2016-08-05 19:22:33 +00:00
Bryan Drewery ffe0dde6c6 META_MODE: Don't require filemon(4) for mergemaster(8)/etcupdate(8)
New .meta files will be created without filemon data, but any future build
that wants filemon data will force a rebuild due to the missing data
due to use of bmake's .MAKE.MODE=missing-filemon=yes feature.

Reported by:	np
Sponsored by:	EMC / Isilon Storage Division
MFC after:	3 days
2016-07-12 19:47:01 +00:00
Enji Cooper 430f7286a5 Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installed
after r298107

Summary of changes:

- Replace all instances of FILES/TESTS with ${PACKAGE}FILES. This ensures that
  namespacing is kept with FILES appropriately, and that this shouldn't need
  to be repeated if the namespace changes -- only the definition of PACKAGE
  needs to be changed
- Allow PACKAGE to be overridden by callers instead of forcing it to always be
  `tests`. In the event we get to the point where things can be split up
  enough in the base system, it would make more sense to group the tests
  with the blocks they're a part of, e.g. byacc with byacc-tests, etc
- Remove PACKAGE definitions where possible, i.e. where FILES wasn't used
  previously.
- Remove unnecessary TESTSPACKAGE definitions; this has been elided into
  bsd.tests.mk
- Remove unnecessary BINDIRs used previously with ${PACKAGE}FILES;
  ${PACKAGE}FILESDIR is now automatically defined in bsd.test.mk.
- Fix installation of files under data/ subdirectories in lib/libc/tests/hash
  and lib/libc/tests/net/getaddrinfo
- Remove unnecessary .include <bsd.own.mk>s (some opportunistic cleanup)

Document the proposed changes in share/examples/tests/tests/... via examples
so it's clear that ${PACKAGES}FILES is the suggested way forward in terms of
replacing FILES. share/mk/bsd.README didn't seem like the appropriate method
of communicating that info.

MFC after: never probably
X-MFC with: r298107
PR: 209114
Relnotes: yes
Tested with: buildworld, installworld, checkworld; buildworld, packageworld
Sponsored by: EMC / Isilon Storage Division
2016-05-04 23:20:53 +00:00
Bjoern Heidotting 7bb0da8d70 Remove redundant word.
Reviewed by:	 bjk, bcr
Differential Revision:	https://reviews.freebsd.org/D6064
2016-04-26 18:54:44 +00:00
Glen Barber 876d357fa7 MFH
Sponsored by:	The FreeBSD Foundation
2016-04-11 15:24:59 +00:00
Enji Cooper ce570b1e96 Chase r296204 by renaming tzsetup(1) to tzsetup(8) in the tests
MFC after: 3 days
X-MFC with: r296204
Sponsored by: EMC / Isilon Storage Division
2016-04-06 03:12:44 +00:00
Glen Barber 7d536dc855 MFH
Sponsored by:	The FreeBSD Foundation
2016-03-10 21:16:01 +00:00
Bryan Drewery 15c433351f DIRDEPS_BUILD: Connect MK_TESTS.
Sponsored by:	EMC / Isilon Storage Division
2016-03-09 22:46:01 +00:00
Glen Barber 52259a98ad MFH
Sponsored by:	The FreeBSD Foundation
2016-03-02 16:14:46 +00:00
Edward Tomasz Napierala 3c9ac704ee tzsetup(1) -> tzsetup(8)
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2016-02-29 17:24:34 +00:00
Glen Barber 43faedc133 First pass to fix the 'tests' packages.
Sponsored by:	The FreeBSD Foundation
2016-02-02 22:26:49 +00:00
Enji Cooper b2d48be1bc Refactor the test/ Makefiles after recent changes to bsd.test.mk (r289158) and
netbsd-tests.test.mk (r289151)

- Eliminate explicit OBJTOP/SRCTOP setting
- Convert all ad hoc NetBSD test integration over to netbsd-tests.test.mk
- Remove unnecessary TESTSDIR setting
- Use SRCTOP where possible for clarity

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Divison
2015-10-12 08:16:03 +00:00
Bryan Drewery 749146414d Document the post-merge actions of calling tzsetup(8) and services_mkdb(8)
added in r259134.

MFC after:	3 days
2015-09-29 17:49:59 +00:00
Simon J. Gerraty ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Simon J. Gerraty 44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Simon J. Gerraty 98e0ffaefb Merge sync of head 2015-05-27 01:19:58 +00:00
John Baldwin 179fa75e6e Reassign copyright statements on several files from Advanced
Computing Technologies LLC to Hudson River Trading LLC.

Approved by:	Hudson River Trading LLC (who owns ACT LLC)
MFC after:	1 week
2015-04-23 14:22:20 +00:00