Commit graph

44 commits

Author SHA1 Message Date
jperkin
d26e851380 mk: Remove an unwanted NetBSD RCS tag. 2020-08-27 11:56:38 +00:00
jperkin
dc189ce30d mk: Rewrite the checksum script in awk.
The previous shell script version's runtime was quadratic against the
number of distfiles to verify.  Historically this has not been an issue,
with usually only a handful of files per package.  However, with the
introduction of Go modules the number of distfiles used by a single
package can be very high.

For example, in an upcoming update of www/grafana to version 7.1.5, the
number of GO_MODULE_FILES is 821.  Running 'bmake checksum' takes:

  real    18m20.743s
  user    17m27.975s
  sys     0m49.239s

With the awk code, this is reduced to a far more sensible:

  real    0m4.330s
  user    0m3.241s
  sys     0m0.875s

The script has been written to emulate the previous version precisely,
preserving the same output and error messages and supporting all of its
behaviour, with the one exception that previous exit values of 128 have
been changed to 3, in order to avoid any potential signed 8-bit issues.

The one change in the pkgsrc infrastructure is that the mk/fetch/fetch
script no longer sets a working default value for ${CHECKSUM}.  This is
not a problem in a pkgsrc environment as all of the required variables
are set correctly, but if there happen to be any users who are using
this script in a standalone environment, they will need to set it
accordingly.  This was probably required in many situations previously
anyway, as none of the script's environment variables were set, and
trying to support this would be fragile at best.
2020-08-27 11:45:45 +00:00
maya
6c25dec844 Remove clauses 3,4 from TNF-only copyright blocks.
This is based on the decision The NetBSD Foundation made in 2008 to
do so, which was already applied to src.

This change has been applied to code which is likely not in other
repositories.

ok board@, reviewed by riastradh@
2018-08-22 20:48:36 +00:00
rillig
06317929ae Improved documentation for "make help".
The check for target(help) prevents a warning when "make help" is run from
a category directory.
2018-01-07 11:23:37 +00:00
dholland
ed95567cee Use :tA to make DISTINFO_FILE absolute when passing it to the fetch
and checksum scripts.

Fixes the problem where DISTINFO_FILE=../../foo/bar/distinfo doesn't
work without having an extraneous and ugly ${.CURDIR} stuffed into it
by hand.
2016-01-06 07:38:25 +00:00
agc
f8e65d3863 Now that it looks like SHA1 is getting closer to its end of life, add
the SHA512 digest to the mix of digests we keep for each distfile.

All part of providing stronger digests for pkgsrc, as discussed on
tech-pkg recently, with unanimous agreement.  There will be further
changes in this area in the near future, as we transit away from
reliance on SHA1 and RMD160.

New distinfo files will gain a SHA512 digest entry.  Existing
verification of distinfo files will just use the SHA1 and RMD160
digests which exist right now.
2015-10-12 18:23:48 +00:00
jakllsch
83b3d6ebca Ensure failure on failure of depends-fetch and depends-checksum targets. 2013-11-16 15:29:39 +00:00
tron
be7259c5f5 Remove work-arounds for Mac OS X Mountain Lion's broken "awk" as we are
no longer using it.
2013-06-14 15:09:47 +00:00
obache
ea6f1b43ce Use TOOLS_CMDLINE_SED instead of TOOLS_SED, to pass special arguments,
right now, `-b' option for Cygwin.
2013-05-16 08:31:07 +00:00
tron
1066e94a8e Also fix the "patch" target for patch files with broken UTF-8 sequences
in them under Mac OS X Mountain Lion.

The previous change only fixed the "makedistinfo" target.
2013-01-28 11:29:29 +00:00
tron
578f64c882 Force using the C locale while checking or generating patch file checksums.
Mac OS X Mountain Lion's "sed" will otherwise reject some patch files
(e.g. "pkgsrc/devel/libcfg+/patches/patch-ab") because of broken
UTF-8 encoding.

It would probably be better not to use the bundled "sed" under
Mac OS X Mountain Lion at all. But it seems that this is not
supported by "pkgsrc" at the moment.
2013-01-24 11:20:56 +00:00
jmmv
55799a2de0 Speed up the algorithm to determine the files left to check.
This change modifies the algorithm used to keep track of the files that
have not yet been checksummed to use a simple loop instead of shell pattern
matching.

For packages with few distinfo entries, either way yields the same result
as the list of files to check is very short.  But for those packages with
hundreds of distinfo entries (vim, I'm looking at you), the difference is
huge.  In my old macppc machine, the checksum of vim used to take around
40 minutes and now it takes ~35 seconds.  The difference is also clearly
visible in my faster amd64 machine (although I haven't bothered to time it).
2012-10-13 15:31:23 +00:00
abs
fc3bada41a Introduce PKGSRC_SETENV, defaulting to SETENV. Can be set to ${SETENV} -i
to santise environment
2011-09-08 20:17:15 +00:00
joerg
c0374130d8 Add depends-fetch and depends-checksum. They work like
show-depends-options, e.g. recurse. make fetch-list does not provide the
same functionality as it doesn't deal well with broken mirror.
2009-07-15 09:40:30 +00:00
joerg
b3354abe47 If _CKSUMFILES is empty, also skip checksum logic. Unbreaks meta
packages.
2008-05-22 20:47:21 +00:00
joerg
65244e1c32 Move digest dependency into checksum and fetch part.
Make _ALL_FILES and in turn _CKSUMFILES available earlier.
Use it to only depend on digest if _CKSUMFILES is non-empty.
NO_CHECKSUM will now only skip the checksum and checksum-phase
targets. FAILOVER_FETCH will independently check the sums on
distfiles and depend on digest, fixing the remaining issues
originally raised in PR 34914.
2008-05-22 16:27:22 +00:00
rillig
d3624fdf10 Made the .include directives simpler, since the directory of the
including file is always the first in the search path.
2008-01-04 01:46:24 +00:00
martti
bd986edbc7 Remove trailing spaces. 2007-10-09 19:19:08 +00:00
jlam
1bffbe5e1d Introduce a new target "checksum-phase" which is used as a dependency
target by pkgsrc.  This new target computes checksums only up until
the extract phase is complete.

The "checksum" target is now a target that can always be run by the
user at any time, regardless of the presence of the work directory.

These changes were proposed in PR pkg/36603 by Robert Elz.
2007-08-31 16:30:11 +00:00
jlam
207a8ff447 When verifying checksums of distfiles, simply verify every checksum
provided in the distinfo file for those distfiles, rather than checking
specifically for the ones listed in _DIGEST_ALGORITHMS.  If a distinfo
file actually provides checksums for other algorithms, e.g.  TIGER,
then go ahead and verify them too.
2007-08-24 03:30:54 +00:00
jlam
ba2e1cdc9e Fix accidental :dw in previous commit. 2007-08-24 03:12:33 +00:00
jlam
9a59593e3e Restore the tradition behaviour of the "checksum" target. It can be
run now at any time up until the "extract" phase completes, and the
"checksum" target no longer keeps a state (cookie) file.

From the checksum.mk file comments:

    We do not actually wish to create a cookie file for the completion
    of the checksum phase because we want to be able to detect if
    any of the files have changed right up until the distfiles are
    extracted.  Therefore, we use the presence of the cookie file
    from the "extract" phase to determine whether we need to continue
    to verify checksums.

This addresses PR pkg/36262 and PR pkg/36603.
2007-08-24 03:11:01 +00:00
jlam
8cd21c85a1 Allow for emulation-specific patches for binary-only packages. The
patches are named emul-${EMUL_PLATFORM}-patch-* and are located in
${PATCHDIR}.
2007-08-16 16:29:27 +00:00
jlam
3ff1bf7b40 Use a flag to the checksum script to tell it whether we're checking
a distfile or a pkgsrc patch.  It's simple, cleaner, less magic, etc.
(duh!).

While here, I notice that _CHECKSUM_CMD was already being defined in
mk/checksum/checksum.mk (as it should be), so update the definition
from mk/patch/patch.mk and remove it from patch.mk.
2007-08-15 13:56:24 +00:00
jlam
701b13909a Teach the pkgsrc/mk/checksum/checksum script how to verify patches by
first stripping them of NetBSD RCS ID tags.  Use the checksum script
in the patch module to verify patch checksums instead of hand-coding
a miniature version of the checksum script in the do-pkgsrc-patches
target.
2007-08-14 21:25:09 +00:00
jlam
ea9b9c675e Strip out *all* of the lines containing NetBSD RCS ID tags that may
be lurking in patches before computing their checksum.
2007-08-14 19:22:31 +00:00
jlam
597066239a Protect the template NetBSD RCS ID tag from being expanded. 2007-08-14 19:19:01 +00:00
jlam
a78cac15b0 Move the code that generates distinfo to a standalone AWK script. 2007-08-14 19:08:18 +00:00
rillig
64c66d1ff3 Removed many redundant comments and restructured the code, so that it
becomes a little shorter.
2007-03-07 01:06:11 +00:00
rillig
79c6d231d0 For all but a very few developers, it is sufficient to check the
distfiles' checksums once and only once, between fetching and extracting
them.

The DO_CHECKSUMS_REPEATEDLY variable can be set to "yes" by those who
need the checksums checked more than once.
2007-02-20 09:53:23 +00:00
martti
e2610fb8c8 Remove trailing tabs. 2006-12-15 13:15:06 +00:00
rillig
8a9fdf8254 Even if NO_CHECKSUM is set, the "checksum" target still needs to depend
on "fetch". Otherwise the distfiles are never fetched.
2006-09-19 00:03:44 +00:00
jlam
cc5761ea0f The "makedistinfo" target should actually be named "distinfo" to match
the old bsd.pkg.mk behavior (noted by adrianp in private email).  Keep
"makedistinfo" as an alias for "distinfo".

While here, sprinkle some .PHONY declarations for correctness.
2006-07-19 14:54:56 +00:00
jlam
3c73469517 Add a flag "-s suffix" for allowing the specified files to have a suffix
that will be removed before looking up the checksum in the distinfo file.
2006-07-18 21:39:39 +00:00
jlam
ecea1ccbaa Don't say "ERROR:" or "WARNING:"... be a more typical shell script by
just noting the error or warning to standard error.
2006-07-17 14:32:26 +00:00
jlam
6fd7abf147 Avoid using # and % to strip prefix/suffix from variable values -- not
enough agreement on how that should work amongst Bourne shell variants.
2006-07-14 16:17:08 +00:00
jlam
a29e44f51b Check whether the "checksum" target is defined beforehand to prevent
"duplicate script" collisions with the one defined by bsd.pkg.mk if
PKG_*_REASON is set.
2006-07-13 18:42:45 +00:00
jlam
a76b31a4d6 Check whether the checksum target is defined before defining one.
This fixes problems where a package sets PKG_*_REASON, which causes
bsd.pkg.mk to define its own "checksum" replacement, which causes a
"duplicate script" make error to occur.
2006-07-13 18:40:33 +00:00
jlam
8d03d36b6a * Fix bug when more than one file needed to be checksummed.
* Avoid shell differences between /bin/sh and Korn shell by using:

	while read line; do list; done < FILE

  instead of

	cat FILE | while read line; do list; done
2006-07-13 16:44:14 +00:00
jlam
7ef83e7139 Try to avoid possible differences in processing "$@". 2006-07-13 16:23:14 +00:00
jlam
34b72a488d Backslash escape the parentheses so the shell doesn't think it should
do shell expansion.  Fixes a bug picked up by /bin/ksh and by /bin/sh
in -current.
2006-07-13 16:11:39 +00:00
jlam
0aa9d5c11c Fix some quoting errors and a harmless copy-and-paste error. 2006-07-13 16:02:09 +00:00
jlam
fdd93c3336 Add a few more double-quotes around eval'ed variables. 2006-07-13 15:48:07 +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