Commit graph

21 commits

Author SHA1 Message Date
schmonz
318812e1f2 The non-writability check for DISTDIR is intended to prevent wasting
resources when fetchers wouldn't be able to save what they download. On
my build farm with pkgsrc (and pkgsrc/distfiles) mounted over NFS,
however, the check gives false positives for NetBSD 9.2 and -current.
Downgrade it to a warning so that these fetches can succeed, while
leaving a breadcrumb in case someone encounters a true positive.

It would of course be interesting to sort out why, in my environment, a
wide variety of other OSes get 1 for "${TEST} ! -w $fetchdir" while
NetBSD gets 0. In the meantime, joerg@ suggested this workaround and
gdt@ agrees it's reasonable to try.
2021-12-16 14:10:46 +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
dsainty
004b23284b Alter the behaviour of the "fetch" executable to accept zero download sites
as an acceptable input.

Fixes Pkgsrc for users that set PKG_RESUME_TRANSFERS=yes in their mk.conf if
installing a package that has an interactive fetch stage, after
mk/fetch/fetch.mk revision 1.66.

Tested for all combinations of:

+ PKG_RESUME_TRANSFERS=yes/no; and
+ interactive fetch=yes/no; and
+ distfile=downloaded/not downloaded

... with no signs of misbehaviour.

The specific case that was broken, and this change fixes, is:

+ PKG_RESUME_TRANSFERS=yes; and
+ interactive fetch=yes; and
+ distfile=downloaded

This change was designed with the following considerations:

1. Given it's a freeze, keep it simple.

2. The change in behaviour allows 'fetch' to succeed where it would previously
   fail fatally, so it's unlikely to affect any (intentional) existing
   behaviour in Pkgsrc.

3. The behaviour of 'fetch' with zero sites is essentially the same as a
   fetch where all the possible download sites fail, I.e. Pkgsrc already
   expects to handle such behaviour.

ok gdt@
2015-09-19 11:45:56 +00:00
joerg
d047710b53 Make the post-fetch hook a bit more useful by also handing down the URL
the file was obtained from. This makes it easier to skip any local
mirrors.
2015-09-08 12:37:56 +00:00
joerg
0cf087a0ae Add a hook for running an action after a successful fetch.
This is intended for keeping distfile archives synchronised between
different machines without requiring NFS mounts or the like.
2015-09-08 11:13:12 +00:00
obache
c75fa9d794 Remove fetched file if fetch command succeeds to fetch but checksum mismatch
with PKG_RESUME_TRANSFERS=YES.

PR 39896.
2013-02-16 07:32:28 +00:00
joerg
7cc2780855 Add support for fetching from URLs that do not end in the distfile.
If the URL is prefixed with a dash, it is considered complete.
2009-08-02 02:38:52 +00:00
tnn
37e6cb108f Specify the name of the distfile instead of allowing the fetch tool to
infer it from the URL. No objections on tech-pkg@
2009-07-20 09:09:02 +00:00
taca
beb4f88cfa Remove extra debug codes which noted by Ryo HAYASAKA as PR pkg/40175. 2008-12-15 09:01:30 +00:00
rillig
5a901cfed5 Added a -v flag to the verify_file function, which in case of a
verification failure prints a useful and concrete error message.
2008-12-14 14:09:32 +00:00
rillig
930598a2d4 Corrected the usage message. 2008-09-15 21:07:46 +00:00
obache
1d2a0b073b Move ${DISTDIR} write permission check to just before really need to write.
Patch provided by Aleksej Saushev in PR 36473.
2007-08-04 15:00:29 +00:00
rillig
777113885f Backed out my previous change. The variable fetchdir needs to be a
relative path.

The error message nevertheless includes the full path.
2007-01-18 10:51:48 +00:00
rillig
39f6b30d1d It's more informative to use absolute pathnames in error messages than
just ".".
2007-01-10 14:31:35 +00:00
jlam
f3381a1115 Typo in comment. 2006-08-03 14:02:58 +00:00
joerg
eeaca99630 verify_file() returns a non-zero result whenever the distfile does not
currently exist. This triggers a bug in the Bourne shell of at least
DragonFly and Irix, when set -e is also active. Remove set -e to avoid
this. Discussed with jlam@, shown by DragonFly bulk builds, complains on
DragonFly's user list and PR 34036.

A test case for this shell bug is, which should return 0:

set -e

testf () {
	test -f /nonexistent || return 1
	return 0
}

if testf; then
	exit 1
fi
exit 0
2006-07-20 13:31:08 +00:00
jlam
ec6f4ba413 Comment the code a bit more. 2006-07-19 15:13:40 +00:00
jlam
2936f01adf Add a verbose flag to the fetch script to output the actual fetch command. 2006-07-19 14:16:29 +00:00
jlam
833691e2fe Overhaul fetch module:
* All the smarts is now encapsulated in the "fetch" script.  The fetch
  script understands how to use the distinfo file (if specified) to
  look up the size and checksums of the file to fetch and will use
  that information to verify checksums of the fetched files or resume
  transfers of interrupted fetches.

* Move the default settings for FETCH_RESUME_ARGS and FETCH_OUTPUT_ARGS
  for "ftp" from mk/defaults/mk.conf into mk/fetch/fetch.mk.  We rewrite
  it to avoid needing conditional statements.

* Avoid spawning a new make(1) process just to mirror a distfile.

* Split out fetch-list targets into a separate file fetch-list.mk.
  These targets should probably be moved into a standalone script.

* Fix distclean target to properly remove partial downloads.
2006-07-18 22:41:06 +00:00
jlam
e65b7c1371 First cut at a fetch script to replace the humungous fetch "macros" in
fetch.mk.  This script currently completely replaces the functionality
in _FETCH_FILE.  I will eventually add the ability to resume a file
transfer to this script.
2006-07-17 15:34:22 +00:00