| |
@@ -18,7 +18,6 @@
|
| |
cat >&2 << EOF_USAGE
|
| |
Usage: $0 <action> [ [-h] ]
|
| |
[ [-p <prefix>] [-g <go path>] ]
|
| |
- [ [-s <go source dir> ] ]
|
| |
|
| |
<action> should be one of: provides, requires
|
| |
|
| |
@@ -26,24 +25,20 @@
|
| |
that do not apply to a specific action. Unless specified otherwise, all
|
| |
arguments are optional.
|
| |
|
| |
- Common arguments:
|
| |
+ Arguments:
|
| |
|
| |
-h print this help
|
| |
-p <prefix>: an optionnal prefix path such as %{buildroot}
|
| |
-g <go path>: the root of the Go source tree
|
| |
default value if not set: /usr/share/gocode
|
| |
|
| |
- Provide arguments
|
| |
- -s <go source dir> the source installation tree
|
| |
EOF_USAGE
|
| |
exit 1
|
| |
}
|
| |
|
| |
action=''
|
| |
- version=''
|
| |
prefix=''
|
| |
gopath=/usr/share/gocode
|
| |
- gosourcedir=/usr/share/gocode
|
| |
declare -A metadata
|
| |
flags_d=()
|
| |
flags_t=()
|
| |
@@ -61,7 +56,7 @@
|
| |
shift
|
| |
|
| |
if ! options=$(getopt -n $0 -o hp:g:s: \
|
| |
- -l help,prefix:,go-path:,go-source-dir: \
|
| |
+ -l help,prefix:,go-path: \
|
| |
-- "$@")
|
| |
then
|
| |
usage
|
| |
@@ -74,7 +69,6 @@
|
| |
-h|--help) usage ;;
|
| |
-p|--prefix) prefix=$(realpath -sm "$2") ; shift;;
|
| |
-g|--go-path) gopath="$2" ; shift;;
|
| |
- -s|--go-source-dir) gosourcedir="$2" ; shift;;
|
| |
(--) shift; break;;
|
| |
(-*) usage ;;
|
| |
(*) break;;
|
| |
@@ -137,14 +131,13 @@
|
| |
provides() {
|
| |
local goipath="${1}"
|
| |
fullprovides golang-symlink "${goipath}"
|
| |
- GOPATH="${gosourcedir}" \
|
| |
+ GOPATH="${prefix}${gopath}" \
|
| |
golist --provided --package-path "${goipath}" $(expandflags) |\
|
| |
while read -r -d $'\n' prov ; do
|
| |
fullprovides golang "${prov}"
|
| |
done
|
| |
}
|
| |
|
| |
- # Convert paths within gopath to version-constrained provides
|
| |
requires() {
|
| |
local r="golang-ipath(${1#${prefix}${gopath}/src/})"
|
| |
echo "${r}${metadata[version]:+ = ${metadata[version]}}"
|
| |
Use relative symlinks for goalts; workarounds
– https://pagure.io/golist/issue/12
– https://github.com/rpm-software-management/rpm/issues/671