summaryrefslogtreecommitdiff
path: root/Mk/Scripts/functions.sh (follow)
Commit message (Collapse)AuthorAgeFilesLines
* framework: Remove $FreeBSD$Mathieu Arnold2021-04-061-1/+0
| | | | Where appropriate fiddle with a few other things.
* Prevent globbing before validating env vars.Baptiste Daroussin2019-08-271-0/+2
| | | | | Submitted by: dillon Obtained from: dports (dragonfly)
* Reduce code duplication from r504140.Bryan Drewery2019-06-301-7/+8
| | | | | Suggested by: cem Sponsored by: DellEMC
* parse_plist: Avoid excess fork+exec inside the loop for stripping (mode) lines.Bryan Drewery2019-06-131-5/+9
| | | | | Need to do it still after stripping away @comment though. The @dir handling could probably be improved as well somehow.
* SC2046: Quote this to prevent word splitting.Mathieu Arnold2018-06-081-2/+2
| | | | | | | | | | | | | | | | | | | When command expansions are unquoted, word splitting and globbing will occur. This often manifests itself by breaking when filenames contain spaces. Trying to fix it by adding quotes or escapes to the data will not work. Instead, quote the command substitution itself. If the command substitution outputs multiple pieces of data, use a loop instead. Add an exception when using set -- where splitting is intended. PR: 227109 Submitted by: mat Exp-run by: antoine Sponsored by: Absolight
* SC2163: Exporting an expansion rather than a variable.Mathieu Arnold2018-06-011-0/+2
| | | | | | | | | | | | | export takes a variable name, but shellcheck has noticed that you give it an expanded variable instead. The problematic code does not export MYVAR but a variable called foo if any. Add exception when using indirections where the variable to extract is actually the value of the variable. PR: 227109 Submitted by: mat Sponsored by: Absolight
* SC2034: <some var> appears unused. Verify it or export it.Mathieu Arnold2018-06-011-1/+1
| | | | | | | | | Variables not used for anything are often associated with bugs, so ShellCheck warns about them. PR: 227109 Submitted by: mat Sponsored by: Absolight
* SC2145: Argument mixes string and array. Use * or separate argument.Mathieu Arnold2018-06-011-6/+6
| | | | | | | | | | | | | | The behavior when concatenating a string and array is rarely intended. The preceeding string is prefixed to the first array element, while the succeeding string is appended to the last one. The middle array elements are unaffected. For example, with the parameters foo,bar,baz, "--flag=$@" is equivalent to the three arguments "--flag=foo" "bar" "baz". PR: 227109 Submitted by: mat Sponsored by: Absolight
* Add PORTS_ENV_VARS caching support to USES=objc.Bryan Drewery2018-03-131-1/+1
| | | | Approved by: portmgr (implicit)
* Avoid double exporting PORTS_ENV.Bryan Drewery2018-03-031-0/+6
| | | | Approved by: portmgr (implicit)
* Add compiler.mk to PORTS_ENV.Bryan Drewery2018-02-281-1/+1
| | | | | | | | | | This only handles the default CC=cc but is enough to significantly improve INDEX/Poudriere ports var gathering due to reducing around a dozen cc fork+exec for every port that all have the same result. These values are reused during the port build as well which reduces more fork+exec contention there. Approved by: portmgr (implicit)
* ports_env: Store list of variables to export in PORTS_ENV_VARS in mk files.Bryan Drewery2018-02-281-18/+2
| | | | | | | | This will avoid renamed/removed variables being orphaned, and allows for exporting variables in ports_env that are not wanted to be exported in sub-makes via _EXPORTED_VARS. Approved by: portmgr (implicit)
* Chase r459584: Remove _PYTHON_DEFAULT_VERSION.Bryan Drewery2018-02-281-1/+0
| | | | Approved by: portmgr (implicit)
* ports_env: Fix OPSYS not being exported.Bryan Drewery2017-02-171-1/+1
| | | | | | | | | | | | | | | This was causing excessive 'uname -s' executions during Poudriere dependency calculations. The reasoning is due to HAVE_COMPAT_IA32_KERN having a newline quoted at the end of it as '\ ' by bmake: # make -f Mk/bsd.port.mk -V 'HAVE_COMPAT_IA32_KERN=${HAVE_COMPAT_IA32_KERN:Q}' | cat -v HAVE_COMPAT_IA32_KERN=YES\ This resulted in the following being executed: export HAVE_COMPAT_IA32_KERN="YES OPSYS=FreeBSD" With hat: portmgr
* - Replace Mk/bsd.linux-apps.mk and Mk/bsd.linux-rpm.mk withTijl Coosemans2016-09-051-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mk/Uses/linux.mk. - Replace USE_LINUX=yes with USES+=linux and USE_LINUX=(.*) with USES+=linux:\1 in all ports. - Replace USE_LINUX_APPS with USE_LINUX in all ports. - Use INSTALL_SCRIPT instead of INSTALL_PROGRAM to install scripts in some ports. - When USE_LINUX_RPM is defined, simplify the way DISTFILES and EXTRACT_ONLY are defined. - Remove BRANDELF_DIRS and BRANDELF_FILES handling. In the very rare cases that it is still necessary ports can run ${BRANDELF} from post-patch. - Remove AUTOMATIC_PLIST handling. Only one port used it. - Fix Linux MASTER_SITES. - Replace OVERRIDE_LINUX_BASE_PORT and OVERRIDE_LINUX_NONBASE_PORTS with default versions framework. - bsd.port.mk: - Move Linux related bits to Uses/linux.mk, except USE_LINUX_PREFIX. - Put USE_LINUX_PREFIX handling after USES processing. - Define DOCSDIR, DATADIR, etc. after handling USE_LINUX_PREFIX so it can give these variables a different default value. - When a package needs to run Linux ldconfig check before installation if Linux support is enabled. - emulators/linux_base-*: - Use USES=linux and remove duplication. - Remove files/lp. FreeBSD or CUPS lp(1) should work. - Remove files/yp.conf. No longer seems to be used. - Remove pkg-deinstall and move pkg-install into pkg-plist. - Update pkg-descr and pkg-message. - Fix handling of ldconfig cache in pkg-plist. - devel/fb-adb: Use a Linux shell to run a Linux script but patch the script to use FreeBSD mkdir so mkdir -p $path creates $path and not /compat/linux/$path. PR: 211645 Exp-run by: antoine Approved by: portmgr (antoine)
* Add a function port_var_fetch() for fetching multiple variables from a port.Bryan Drewery2016-06-241-0/+29
| | | | This is taken from Poudriere (uncommitted)
* Fix make check-plist with new @xmlcatmgr keywordBaptiste Daroussin2016-05-251-1/+1
|
* Extract the larger bsd.port.mk targets into separate scripts.Mathieu Arnold2016-05-251-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | Refactor all the fetch code so that there are not 6 slightly different versions of it but one that does it all. The targets that have been extracted are: - check-vulnerable - do-fetch - fetch-list - fetch-url-list-int - fetch-urlall-list - checksum. - makesum. - check-checksum-algorithms Run the fetch code directly from make makesum instead of calling make fetch, this is because some port change the options with OPTIONS_*_FORCE when make(makesum) to be able to add all distfiles in one go, which was a nice, non working, idea. PR: 208916 Submitted by: mat Exp-run by: antoine With hat: portmgr Sponsored by: Absolight Differential Revision: https://reviews.freebsd.org/D5997
* Do not cache PYTHON_PORTVERSION, it is not invariant between portsAntoine Brodin2015-12-251-1/+0
|
* Fix partial tree checkouts with 'all-depends-list', 'make clean', etc, afterBryan Drewery2015-11-091-1/+1
| | | | | | | inclusion of the ports_env feature into that handling around r399791. With hat: portmgr Reported by: ian, lev
* Avoid redundantly looking up python command executions for dependency ↵Bryan Drewery2015-10-191-3/+8
| | | | | | | | | calculation. This gets all-depends-list in x11/kde4 down to 30 seconds after the 52->41 second improvement in r399703. With hat: portmgr
* Avoid redundantly looking up perl version when looking up dependencies or in ↵Bryan Drewery2015-10-191-0/+3
| | | | | | sub-makes. With hat: portmgr
* Follow-up r399170 with a script, ports_env.sh, that can be used for the purpose.Bryan Drewery2015-10-131-3/+3
| | | | | | | | | This will allow Poudriere to know if it is possible to use the feature or not by the existence of the file. Also fix quoting issues. With hat: portmgr
* Add a function to export vars that bsd.port.mk generates from fork/exec.Bryan Drewery2015-10-121-0/+51
| | | | | | | | | | | | | | | | | This will be useful in Poudriere to avoid needless fork/exec for every port when gathering dependencies. Example usage: MAKE=make sh -c '. Mk/Scripts/functions.sh; export_index_env; export PACKAGE_BUILDING=1; truss -f make -C sysutils/zfstools -V BUILD_DEPENDS 2>&1' | grep exec This eliminates 14 exec/fork calls for this example, when PACKAGE_BUILDING is also set during -V. Care should be taken with UID not being passed down into actual builds as it may conflict with non-root builds. With hat: portmgr
* Use -r flag for read command, this fixes handling of paths containingDmitry Marakasov2015-10-121-1/+1
| | | | | | | backslashes, and, in result, stage-qa for archivers/deco Approved by: portmgr (antoine) Differential Revision: D3862
* Extend @sample to accept argumentsBaptiste Daroussin2015-09-261-10/+15
| | | | | | | | Maintainers can now use @sample sample_file target_file for all cases that does not fall into the usual @sample something.sample Reviewed by: antoine Differential Revision: https://reviews.freebsd.org/D3734
* Factorize the function to validate envBaptiste Daroussin2015-07-011-0/+14
| | | | | Reviewed by: antoine Differential Revision: https://reviews.freebsd.org/D2966
* - Move parse_plist() into a new file, functions.sh.Bryan Drewery2015-01-081-0/+141
With hat: portmgr