Commit graph

54 commits

Author SHA1 Message Date
dholland
2d17a64f1f Add note to SUBST_SED noting that -E is not a standard sed option.
From Leonardo Taccari in followup to PR 48254.
2013-10-13 21:38:36 +00:00
rillig
521367f105 See also: PLIST_SUBST 2008-01-26 15:23:21 +00:00
rillig
04cbcc5bc0 Made the wording more into an explanation. 2008-01-23 01:44:28 +00:00
rillig
884f21f398 If the package doesn't provide a SUBST_MESSAGE, generate a default one.
This way, file modifications cannot go unnoticed and at least appear in
the build logs. While here, fixed an ambiguity in the description of
SUBST_MESSAGE.
2008-01-18 11:26:11 +00:00
rillig
212334d5a8 Don't rely on file(1) to distinguish text files from binary files. This
has proven too unreliable in the past. For example, some Makefile.in
files were classified as "Quake I or II world or extension", just
because they happen to start with the letters "PACK". This method was
also subject to subtle differences in the locale.

The new method counts the number of NUL bytes in the file. It does not
depend on the locale settings. The -c option of wc(1) counts bytes, not
characters, and tr(1), which may interpret multibyte sequences, is
protected by LC_ALL. It should also work with the historical
implementations of tr(1) that could not handle NUL bytes and discarded
them, since this is exactly the intention.

See also:
* http://mail-index.netbsd.org/tech-pkg/2006/07/05/0000.html
* PR 37793
2008-01-18 11:16:08 +00:00
rillig
494c8050fe Replaced _PKG_SILENT and _PKG_DEBUG with RUN. 2008-01-18 10:41:05 +00:00
rillig
fa786ebc0c Explicitly mentioned that both SUBST_SED and SUBST_VARS may be used in a
class.
2007-11-19 23:38:03 +00:00
rillig
02052152d3 Before running _SUBST_IS_TEXT_FILE on a file, make sure that the file
exists.
2007-11-01 13:12:48 +00:00
wiz
23325b7421 Recognize XML files as text. 2007-04-05 18:33:09 +00:00
rillig
66bf916302 For all those who are interested in the inner workings of pkgsrc, there
is a new target "show-all" that fits to the existing "debug",
"show-tools", "show-vars" targets. It prints a list of the variables
that make up the public interface to pkgsrc. Running this target is
especially useful if you want to do some things, you know that they must
have been implemented but you don't know what it is called. It also
shows the "class" of a variable (user-defined, package-defined,
system-defined).
2007-03-15 22:54:24 +00:00
rillig
53cf03e2a6 Fixed the quoting for SUBST_VARS.*. Now every character gets replaced
properly. The regression test passes.
2007-03-07 21:27:59 +00:00
rillig
c55eb274b2 Some Makefile.in files start with the letters PACKAGE. NetBSD's file(1)
considers files starting with the letters PACK to be related to Quake.
2007-02-05 08:39:23 +00:00
rillig
a1fe379914 Since there are many cases where the string @FOO@ is replaced with the
pkgsrc variable ${FOO}, there is now a shorter variant for it. Instead
of defining SUBST_SED.*, just say SUBST_VARS.* = FOO.
2007-01-23 06:05:39 +00:00
rillig
4325294fae The new variable SUBST_SKIP_TEXT_CHECK.* can be set to "yes" to do the
substitutions in all files, whether or not file(1) says they are text.
2007-01-14 17:05:02 +00:00
rillig
86e14e4200 When a SUBST change leaves a file as-is, print an informational message.
For all messages, the current SUBST_CLASS is printed, too.
2007-01-11 12:12:12 +00:00
rillig
ea535fc2fd + keyword "subst" 2007-01-03 23:35:13 +00:00
reed
e89ec495e9 Also "Assembler source" is a text file for _SUBST_IS_TEXT_FILE.
(Really the file is a wdm config file. Noticed when building wdm.)
2006-12-10 02:25:13 +00:00
tron
5e12c6a0bc file(1) under NetBSD-sparc64 4.99.4 identifies the file
"gdk-pixbuf/Makefile.in" from the "gtk2" package as "libtool library file".
Change the textfile check to accept any file which file(1) identifies
as "<whatever>libtool<whateverelse>" to fix the build of the
"gtk2" package (and probably other packages).
2006-11-23 16:27:53 +00:00
rillig
7235ba2317 Clarify _who_ is supposed to set the SUBST_* variables. 2006-11-09 02:06:29 +00:00
rillig
465c404b46 Fixed the documentation for SUBST_SED.*, which is not _one_ sed
expression, but a list of sed expressions.
2006-07-02 09:35:05 +00:00
rillig
ba68c129fe SUBST_STAGE.* is currently not defined by all SUBST blocks, so disable
PKG_FAIL_REASON in that case. It didn't have an effect anyway for normal
builds, since subst.mk is included after checking PKG_FAIL_REASON.

Discussed with jlam.
2006-06-22 20:45:48 +00:00
rillig
56d01034de Simplified the code by reducing the number of different targets that are
evaluated. Now the SUBST_MESSAGE is only printed once when the
substitution is actually done. Before this change it had been printed
also when the subst-<class> target had been invoked a second time, but
the substitution didn't take place again, which had confused me. Also,
converted the code to use ${WARNING_MSG} and ${STEP_MSG}.
2006-06-17 22:42:00 +00:00
rillig
f134edb22f Reverted the change from 1.29 to 1.30, as it had led to build failures in
the "unwrap" class.
2006-01-08 01:07:35 +00:00
rillig
1f20649016 Added two missing :Q operators. One of them affects how the
SUBST_MESSAGE is printed. The ones that have been defined with "quotes"
in their Makefiles are printed with quotes (of course). This is the
consequence of the design pattern "quote-exactly-where-necessary", which
in fact should be have been applied to pkgsrc as a whole, but still isn't.
2006-01-07 23:27:41 +00:00
rillig
2e71854a23 Removed the use of ${FILE_CMD} from the substitution framework. The
detection whether a given file was a text file or some other file had
been unreliable. In the recent bulk builds, all of the warnings that had
appeared because of that unreliable detection had been false positives.
2006-01-07 18:43:05 +00:00
joerg
c750987c17 Adjust comment about SUBST_FILES to match reality:
absolute file names work as well.
2006-01-05 23:16:01 +00:00
rillig
e4af2b5124 Fixed some cases where the exitcode of child processes has been ignored.
This will cause package builds to fail instead of hiding bugs.
2006-01-01 22:52:16 +00:00
rillig
9a74bcedfd Fixed trivial pkglint warnings:
- Removed leading white-space in dependency lines.
- s/existant/existent/.
2006-01-01 22:30:35 +00:00
rillig
5878c465ce Allow absolute filenames for SUBST_FILES. Needed for converters/convmv and
maybe some others.
2005-12-06 17:17:30 +00:00
rillig
37b8605b92 Added another diagnostic message to distinguish the cases for non-text
file and non-existant file.
2005-11-24 20:02:40 +00:00
rillig
7dccf8e1ba A warning is printed for every non-text file. This helps in detecting
broken file(1) databases. It also gives an indication of whether this
test is necessary at all.
2005-11-17 23:17:02 +00:00
rillig
57994895c2 Changed the comment for SUBST_STAGE to be more complete. Started the other
sentences with an uppercase letter. No code changes.
2005-08-21 22:00:07 +00:00
rillig
54682e7ad9 Fixed a typo. 2005-06-09 19:49:48 +00:00
jlam
262ed77f43 Change instances where we stored shell command in a make variable into
variables that use the :sh modifier.  This still causes expansion to only
happen when referenced, and has the advantage of being :Q-safe.

Bring back the changes from revision 1.19 of mk/subst.mk now that the
problem noted above has been fixed.  This passes the buildlink-unwrap
regression test.
2005-05-20 21:36:05 +00:00
jlam
a95ee34254 Revert part of revision 1.18. The new quoting was breaking some
assumptions being made by the USE_PKGLOCALEDIR code and the wrapper
framework since it added backtick expressions to the SUBST_FILES.*
variables, which were being mangled by the :Q modifier.  This is
evident when running "make regress" in regress/buildlink-unwrap.

Mea culpa.
2005-05-20 18:40:42 +00:00
rillig
eba78b2381 Removed the quoting for SUBST_MESSAGE.<class>. Most packages unnecessarily
define that inside double quotes.
2005-05-18 03:33:51 +00:00
rillig
feabae83e2 Fixed shell quoting. Reviewed by jlam. 2005-05-17 19:01:36 +00:00
jlam
88a657f75e Avoid checking for !empty(...) so that we that defer variable references. 2005-04-30 15:05:06 +00:00
jlam
3a4481535e SUBST_POSTCMD must be globally defined or else it breaks. 2004-08-23 16:37:09 +00:00
jlam
4a7c06b1a3 Actually, it's okay if SUBST_FILTER_CMD is empty... the ${SUBST_COOKIE}
target takes care of this case already.
2004-08-23 16:36:00 +00:00
jlam
12887cdd6a Use _SUBST_BACKUP_SUFFIX instead of hardcoding ".subst.sav" everywhere. 2004-08-23 16:35:11 +00:00
jlam
dd5015fc43 SUBST_FILTER_CMD can't be empty. It must be a real filter cmd, so default
it to ${CAT} as a fall-through.
2004-08-23 09:01:57 +00:00
schmonz
105997fbc4 Usually there's no need to keep the original version of a file
"foo" as "foo.subst.sav". Implement SUBST_POSTCMD, which by default
cleans up these leftovers. If you need to keep them around, e.g.
while debugging, set it to ${DO_NADA}.

Remove superfluous whitespace in a comment.
2004-06-06 04:22:23 +00:00
grant
23d5ff9ee1 Solaris' file(1) reports "executable [path] script" on scripts which
arent't shell scripts, so allow them to be subst'd.
2004-03-07 09:29:25 +00:00
uebayasi
560987a2c5 * Document SUBST_CLASSES.
* Indent conditionals.

Reviewed By:	wiz
2004-03-01 09:57:10 +00:00
kim
9f554b136c Reinstate the fix in revision 1.6 2003-12-29 02:55:22 +00:00
kim
03373c1334 Revert revision 1.5 as binaries and directories are now being substed
unintentionally.

Also revert revision 1.6 as part of the overall change, as I suspect
the change might be unnecessary.  While I'm not 100% sure, this does
just revert to the previous behaviour.
2003-12-28 17:28:26 +00:00
jmmv
f559aca387 The generated target is subst-<class>, not <class>-subst. Fix comment
accordingly.
2003-12-28 15:57:29 +00:00
grant
c331d66fa1 bomb to prevent silent failure if we're unable to rename a file
before subst'ing it.

previously, only a warning would be printed and the .subst_done
cookie(s) would be created, indicating that the subst target was
successful when it really was not.
2003-12-27 03:05:53 +00:00
grant
74f8aaa8f9 remove somewhat bogus test for text files, which was dependent on the
output of file(1) which reports too many false negatives (not
detecting a file as a text file when it really is).

package developers are aware of which files the subst operation
applies to, since they need to specify the filenames, so this test is
not really required.

it's also not inconceivable that one would want to subst over a
non-text file, which is now possible.
2003-12-27 03:02:11 +00:00