# Calculate comment=# protected
# vim: set syntax=sh
#
# Copyright 2020 Calculate Ltd. http://www.calculate-linux.org
#
#  Licensed under the Apache License, Version 2.0 (the "License");
#  you may not use this file except in compliance with the License.
#  You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0

calculate_lockfile=/var/calculate/tmp/portage/$CATEGORY/.$PN.calculate_lockfile

calculate_lock_setup() {
	if calculate_configurable_package
	then
		flock -x -w 120 $calculate_lockfile true
	fi
}

calculate_unlock_setup() {
	if calculate_configurable_package
	then
		rm $calculate_lockfile
	fi
}

[[ $EBUILD_PHASE == "instprep" ]] && calculate_lock_setup
