Gentoo Archives: gentoo-commits

From: Sergei Trofimovich <slyfox@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/crossdev:master commit in: /
Date: Thu, 30 Jan 2020 08:36:58
Message-Id: 1580373395.71b2d76a8ae33cae46db8677f4d3cd52d3ec4b96.slyfox@gentoo
1 commit: 71b2d76a8ae33cae46db8677f4d3cd52d3ec4b96
2 Author: Göktürk Yüksek <gokturk <AT> gentoo <DOT> org>
3 AuthorDate: Thu Jan 30 02:58:56 2020 +0000
4 Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
5 CommitDate: Thu Jan 30 08:36:35 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/crossdev.git/commit/?id=71b2d76a
7
8 crossdev: create a repos.conf entry for the output overlay if necessary
9
10 If --ov-output is specified on the command line but there is no
11 corresponding repos.conf entry for the output overlay, it is of no use
12 since the package manager will not take it into consideration.
13
14 Determine and create a repos.conf entry when necessary for the output
15 overlay. Derive it's name from the basename of the overlay path and
16 also take into account possible file path collisions.
17
18 Signed-off-by: Göktürk Yüksek <gokturk <AT> gentoo.org>
19 Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
20
21 crossdev | 38 +++++++++++++++++++++++++++++++++++++-
22 1 file changed, 37 insertions(+), 1 deletion(-)
23
24 diff --git a/crossdev b/crossdev
25 index 8783a9a..b460d53 100755
26 --- a/crossdev
27 +++ b/crossdev
28 @@ -516,6 +516,30 @@ setup_portage_vars() {
29 done
30
31 : ${CROSSDEV_OVERLAY:=$(echo "${SEARCH_OVERLAYS}" | head -1)}
32 + else
33 + # Check if there is a repos.conf entry whose
34 + # location matches ${CROSSDEV_OVERLAY}
35 + local repo_name conf_base i=""
36 +
37 + repo_name="$(echo "${REPO_CONFIG}" | sed -n "\|:${CROSSDEV_OVERLAY}$|s,:.*,,p")"
38 + if [[ -n ${repo_name} ]]; then
39 + # Match the name specified in the corresponding repos.conf entry
40 + CROSSDEV_OVERLAY_NAME="${repo_name}"
41 + else
42 + # Derive the name
43 + : ${CROSSDEV_OVERLAY_NAME:="$(basename "${CROSSDEV_OVERLAY}")"}
44 + # Note that there is no repos.conf entry and set up the path for the conf file
45 + # We'll create the conf file itself in set_metadata()
46 + conf_base="${CONFIGROOT}/repos.conf/${CROSSDEV_OVERLAY_NAME}"
47 + while [[ -e "${conf_base}${i}.conf" ]]; do
48 + # If there is a file collision with the conf file we target,
49 + # we'll first append '1' before '.conf' and try.
50 + # If that doesn't work, we'll retry with an incremented number
51 + # Incrementing an empty string returns '1' in the shell
52 + i=$((i + 1))
53 + done
54 + CROSSDEV_OVERLAY_CREATE_REPOS_CONF="${conf_base}${i}.conf"
55 + fi
56 fi
57
58 # make sure we have a valid logdir
59 @@ -705,7 +729,8 @@ XPKGS=() XVERS=() XUSES=() XENVS=() XOVLS=()
60 DEFAULT_VER="[latest]"
61 SEARCH_OVERLAYS=""
62 CROSSDEV_OVERLAY=""
63 -CROSSDEV_OVERLAY_NAME="crossdev"
64 +CROSSDEV_OVERLAY_NAME=""
65 +CROSSDEV_OVERLAY_CREATE_REPOS_CONF=""
66 # These flags are always disabled for cross-gcc; either usually/always broken, or
67 # not tested, or doesn't make sense, or no one simply cares about them
68 GUSE_DISABLE="-boundschecking -d -gcj -gtk -libffi -mudflap -objc -objc++ -objc-gc"
69 @@ -1249,6 +1274,17 @@ set_metadata() {
70 repo-name = ${repo_name}
71 $(printf '%b' "${this_manifests}")
72 EOF
73 +
74 + # If there is no repos.conf entry for the output overlay, create one here
75 + if [[ -n ${CROSSDEV_OVERLAY_CREATE_REPOS_CONF} ]]; then
76 + cat <<-EOF > "${CROSSDEV_OVERLAY_CREATE_REPOS_CONF}" || die "could not create the repo conf"
77 + ${autogen_tag}
78 + [${repo_name}]
79 + location = ${CROSSDEV_OVERLAY}
80 + masters = ${masters% }
81 + auto-sync = no
82 + EOF
83 + fi
84 }
85
86 xmkdir -p "${CONFIGROOT}" "${CROSSDEV_OVERLAY}"/{cross-${CTARGET},profiles}