[rkward] macports: it's safer to set the default variants globally

m.eik michalke null at kde.org
Fri Apr 6 20:59:06 UTC 2018


Git commit 56946640604cb8adb714af1b779217ddbcc9fddc by m.eik michalke.
Committed on 06/04/2018 at 20:57.
Pushed by meikm into branch 'master'.

it's safer to set the default variants globally

M  +0    -9    macports/kf5/kf5-rkward-binary/Portfile
M  +29   -14   macports/update_bundle.sh

https://commits.kde.org/rkward/56946640604cb8adb714af1b779217ddbcc9fddc

diff --git a/macports/kf5/kf5-rkward-binary/Portfile b/macports/kf5/kf5-rkward-binary/Portfile
index a6e177ca..48cccabc 100755
--- a/macports/kf5/kf5-rkward-binary/Portfile
+++ b/macports/kf5/kf5-rkward-binary/Portfile
@@ -84,15 +84,6 @@ kf5.depends_frameworks \
                     kdoctools ki18n knotifications kparts \
                     ktexteditor kwidgetsaddons kwindowsystem kxmlgui
 
-# activate +replace_cocoa variant as default
-PortGroup active_variants 1.1
-require_active_variants port:kf5-osx-integration_devel replace_cocoa
-
-# do not install the following (indirect) dependencies with their +x11 variant:
-foreach dep {cairo giflib} {
-    require_active_variants ${dep} {} x11
-}
-
 depends_lib-append \
                     port:gettext \
                     port:kf5-osx-integration-devel \
diff --git a/macports/update_bundle.sh b/macports/update_bundle.sh
index b2964253..94107d56 100755
--- a/macports/update_bundle.sh
+++ b/macports/update_bundle.sh
@@ -330,6 +330,25 @@ portversion() {
   "${MPTINST}/bin/port" list $1 | sed -e "s/.*@//;s/[[:space:]].*//"
 }
 
+appendconfig () {
+  # appends given text as a new line to given file
+  # $1: file name, full path
+  # $2: stuff to grep for in $1 to check whether the entry is already there
+  # $3: full line to add to $1 otherwise
+  # $4: the key word "sudo" if sudo is needed for the operation
+  if ! [[ $(grep "$2" "$1") ]] ; then
+    echo -en "appending ${TXT_BLUE}$2${OFF} to ${TXT_BLUE}$1${OFF}..."
+    if [[ $4 == "sudo" ]] ; then
+      echo -e "$3" | sudo tee --append "$1" > /dev/null || exit 1
+    else
+      echo -e "$3" >> "$1" || exit 1
+    fi
+    alldone
+  else
+    echo -e "exists, ${TXT_BOLD}skip${OFF} appending to ${TXT_BLUE}$1${OFF} (${TXT_BLUE}$2${OFF})"
+  fi
+}
+
 # correct setting of RPATHFIX workaround, it's not needed
 # for binary subports since they don't include R.framework
 if $BINARY ; then
@@ -425,18 +444,11 @@ if $BLDSETUP ; then
     alldone
   fi
   linkbuildscript "${USERBIN}"
-  if [ -f "${HOME}/.bash_profile" ] ; then
-    BPFPATH=$(grep "^PATH" "${HOME}/.bash_profile")
-    if ! $(echo "${BPFPATH}" | grep -q "${USERBIN}/:${MPTINST}/bin/:") ; then
-      echo "PATH=${USERBIN}/:${MPTINST}/bin/:\$PATH" >> "${HOME}/.bash_profile"
-    fi
-    if ! $(echo "${BPFPATH}" | grep -q "KDE_SESSION_VERSION") ; then
-      echo "export KDE_SESSION_VERSION=5" >> "${HOME}/.bash_profile"
-    fi
-  else
-    echo "PATH=${USERBIN}/:${MPTINST}/bin/:\$PATH" > "${HOME}/.bash_profile"
-    echo "export KDE_SESSION_VERSION=5" >> "${HOME}/.bash_profile"
+  if ! [ -f "${HOME}/.bash_profile" ] ; then
+    touch "${HOME}/.bash_profile"
   fi
+  appendconfig "${HOME}/.bash_profile" "${USERBIN}/:${MPTINST}/bin/:" "PATH=${USERBIN}/:${MPTINST}/bin/:\$PATH"
+  appendconfig "${HOME}/.bash_profile" "KDE_SESSION_VERSION" "export KDE_SESSION_VERSION=5"
   . "${HOME}/.bash_profile"
   cd "${OLDWD}" || exit 1
   echo -e "${TXT_GREEN}successfully completed reincarnation of${OFF} ${TXT_BLUE}${GITROOT}${OFF} -- you can now invoke the \"-F\" option!"
@@ -469,12 +481,15 @@ if $FRESHMCP ; then
   sudo sed -i -e "s+#\(portautoclean[[:space:]]*\)yes+\1no+" "${MPTINST}/etc/macports/macports.conf"
   sudo sed -i -e "s+\(applications_dir[[:space:]]*\)/Applications/MacPorts+\1${APPLDIR}+" "${MPTINST}/etc/macports/macports.conf"
   sudo "${MPTINST}/bin/port" -v selfupdate || exit 1
-  echo -e "adding local portfiles to ${TXT_BLUE}${MPTINST}/etc/macports/sources.conf${OFF}..."
+  echo -en "adding local portfiles to ${TXT_BLUE}${MPTINST}/etc/macports/sources.conf${OFF}..."
   # sudo sed -i -e "s+rsync://rsync.macports.org.*\[default\]+file://${SRCPATH}/\\`echo -e '\n\r'`&+" "${MPTINST}/etc/macports/sources.conf" || exit 1
   # adding newlines with sed in macOS is totally f**ked up, here's an ugly workaround in three steps
   sudo sed -i -e $'s+rsync://rsync.macports.org.*\[default\]+file://_GITROOT_/macstrop/\\\nfile://_SRCPATH_/\\\n&+' "${MPTINST}/etc/macports/sources.conf" || exit 1
   sudo sed -i -e "s+file://_SRCPATH_+file://${SRCPATH}+" "${MPTINST}/etc/macports/sources.conf" || exit 1
   sudo sed -i -e "s+file://_GITROOT_+file://${GITROOT}+" "${MPTINST}/etc/macports/sources.conf" || exit 1
+  alldone
+  appendconfig "${MPTINST}/etc/macports/variants.conf" "^[[:space:]]*-x11 +no_x11 +quartz" "-x11 +no_x11 +quartz +replace_cocoa" "sudo"
+  appendconfig "${MPTINST}/etc/macports/variants.conf" "^[[:space:]]*+replace_cocoa" "+replace_cocoa" "sudo"
   # install a needed gcc/clang first?
   if [[ $CMPLR ]] ; then
     sudo "${MPTINST}/bin/port" -v install "${CMPLR}" "${LLVMFIX}" || exit 1
@@ -501,8 +516,8 @@ fi
 if $BUILDQT ; then
   echo -e "sudo ${TXT_BLUE}${MPTINST}/bin/port${OFF} -v install qt5-kde"
   sudo "${MPTINST}/bin/port" -v install qt5-kde || exit 1
-  echo -e "sudo ${TXT_BLUE}${MPTINST}/bin/port${OFF} -v install kf5-osx-integration +replace_cocoa"
-  sudo "${MPTINST}/bin/port" -v install kf5-osx-integration +replace_cocoa || exit 1
+  echo -e "sudo ${TXT_BLUE}${MPTINST}/bin/port${OFF} -v install kf5-osx-integration-devel +replace_cocoa"
+  sudo "${MPTINST}/bin/port" -v install kf5-osx-integration-devel +replace_cocoa || exit 1
   alldone
 fi
 



More information about the rkward-tracker mailing list