aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGöktürk Yüksek <gokturk@gentoo.org>2020-01-29 21:58:56 -0500
committerSergei Trofimovich <slyfox@gentoo.org>2020-01-30 08:36:35 +0000
commit71b2d76a8ae33cae46db8677f4d3cd52d3ec4b96 (patch)
tree2308f46e4410dd4f5cb90dd8ff444529b30c57b5
parentcrossdev: adjust repo-name in layout.conf based on repos.conf (diff)
downloadcrossdev-71b2d76a8ae33cae46db8677f4d3cd52d3ec4b96.tar.gz
crossdev-71b2d76a8ae33cae46db8677f4d3cd52d3ec4b96.tar.bz2
crossdev-71b2d76a8ae33cae46db8677f4d3cd52d3ec4b96.zip
crossdev: create a repos.conf entry for the output overlay if necessary
If --ov-output is specified on the command line but there is no corresponding repos.conf entry for the output overlay, it is of no use since the package manager will not take it into consideration. Determine and create a repos.conf entry when necessary for the output overlay. Derive it's name from the basename of the overlay path and also take into account possible file path collisions. Signed-off-by: Göktürk Yüksek <gokturk@gentoo.org> Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
-rwxr-xr-xcrossdev38
1 files changed, 37 insertions, 1 deletions
diff --git a/crossdev b/crossdev
index 8783a9a..b460d53 100755
--- a/crossdev
+++ b/crossdev
@@ -516,6 +516,30 @@ setup_portage_vars() {
done
: ${CROSSDEV_OVERLAY:=$(echo "${SEARCH_OVERLAYS}" | head -1)}
+ else
+ # Check if there is a repos.conf entry whose
+ # location matches ${CROSSDEV_OVERLAY}
+ local repo_name conf_base i=""
+
+ repo_name="$(echo "${REPO_CONFIG}" | sed -n "\|:${CROSSDEV_OVERLAY}$|s,:.*,,p")"
+ if [[ -n ${repo_name} ]]; then
+ # Match the name specified in the corresponding repos.conf entry
+ CROSSDEV_OVERLAY_NAME="${repo_name}"
+ else
+ # Derive the name
+ : ${CROSSDEV_OVERLAY_NAME:="$(basename "${CROSSDEV_OVERLAY}")"}
+ # Note that there is no repos.conf entry and set up the path for the conf file
+ # We'll create the conf file itself in set_metadata()
+ conf_base="${CONFIGROOT}/repos.conf/${CROSSDEV_OVERLAY_NAME}"
+ while [[ -e "${conf_base}${i}.conf" ]]; do
+ # If there is a file collision with the conf file we target,
+ # we'll first append '1' before '.conf' and try.
+ # If that doesn't work, we'll retry with an incremented number
+ # Incrementing an empty string returns '1' in the shell
+ i=$((i + 1))
+ done
+ CROSSDEV_OVERLAY_CREATE_REPOS_CONF="${conf_base}${i}.conf"
+ fi
fi
# make sure we have a valid logdir
@@ -705,7 +729,8 @@ XPKGS=() XVERS=() XUSES=() XENVS=() XOVLS=()
DEFAULT_VER="[latest]"
SEARCH_OVERLAYS=""
CROSSDEV_OVERLAY=""
-CROSSDEV_OVERLAY_NAME="crossdev"
+CROSSDEV_OVERLAY_NAME=""
+CROSSDEV_OVERLAY_CREATE_REPOS_CONF=""
# These flags are always disabled for cross-gcc; either usually/always broken, or
# not tested, or doesn't make sense, or no one simply cares about them
GUSE_DISABLE="-boundschecking -d -gcj -gtk -libffi -mudflap -objc -objc++ -objc-gc"
@@ -1249,6 +1274,17 @@ set_metadata() {
repo-name = ${repo_name}
$(printf '%b' "${this_manifests}")
EOF
+
+ # If there is no repos.conf entry for the output overlay, create one here
+ if [[ -n ${CROSSDEV_OVERLAY_CREATE_REPOS_CONF} ]]; then
+ cat <<-EOF > "${CROSSDEV_OVERLAY_CREATE_REPOS_CONF}" || die "could not create the repo conf"
+ ${autogen_tag}
+ [${repo_name}]
+ location = ${CROSSDEV_OVERLAY}
+ masters = ${masters% }
+ auto-sync = no
+ EOF
+ fi
}
xmkdir -p "${CONFIGROOT}" "${CROSSDEV_OVERLAY}"/{cross-${CTARGET},profiles}