public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] dev/axs:master commit in: /, profiles/updates/, profiles/base/
@ 2012-07-01 16:56 Ian Stakenvicius
  0 siblings, 0 replies; only message in thread
From: Ian Stakenvicius @ 2012-07-01 16:56 UTC (permalink / raw
  To: gentoo-commits

commit:     bd2318b2ecc9f7a68e321c9f2ddcbe08825ccaef
Author:     Ian Stakenvicius <axs <AT> gentoo <DOT> org>
AuthorDate: Sun Jul  1 16:55:20 2012 +0000
Commit:     Ian Stakenvicius <axs <AT> gentoo <DOT> org>
CommitDate: Sun Jul  1 16:55:20 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=dev/axs.git;a=commit;h=bd2318b2

Added script hack-4slotabi-into-portagedb.sh to upgrade any existing EAPI=4 packages to EAPI=4-slot-abi in /var/db/pkg

---
 hack-4slotabi-into-portagedb.sh |  151 +++++++++++++++++++++++++++++++++++++++
 profiles/base/package.keywords  |    1 -
 profiles/updates/1Q-2099        |   15 ----
 3 files changed, 151 insertions(+), 16 deletions(-)

diff --git a/hack-4slotabi-into-portagedb.sh b/hack-4slotabi-into-portagedb.sh
new file mode 100755
index 0000000..385d152
--- /dev/null
+++ b/hack-4slotabi-into-portagedb.sh
@@ -0,0 +1,151 @@
+#!/bin/sh
+
+if [ ! -e /var/lib/layman/axs/hack-4slotabi-into-portagedb.sh ]; then
+	if [ ! -e "$1"/hack-4slotabi-into-portagedb.sh ]; then
+		echo "Error - could not find axs developer overlay in layman repos."
+		echo "Please 'layman -a axs' or specify path to the overlay as a parameter."
+		exit 1
+	else
+		opath=$1
+	fi
+else
+	opath=/var/lib/layman/axs
+fi
+
+echo "checking to ensure a version of portage supporting 4-slot-abi is installed..."
+emerge -u =sys-apps/portage-9999 || exit 1
+
+echo ""
+echo "WARNING WARNING WARNING"
+echo "This script is about to modify your portage database ( /var/db/pkg ) directly"
+echo "There is a HIGH possiblity that anything going wrong here will completely"
+echo "and unrecoverably BORK your portage."
+echo ""
+echo "pausing for 5 seconds, break out to abort..."
+sleep 5
+echo "pausing for 5 more seconds, just in case..."
+sleep 5
+echo "last chance, will start in 3 seconds."
+sleep 3
+echo "Too late -- may the diety of your choosing have mercy on us all.."
+echo ""
+echo ""
+
+echo "Upgrading currently-installed entries with EAPI=4 to EAPI=4-slot-abi if applicable"
+didsomething=0
+processedatoms=
+cd /var/db/pkg
+for atom in `find -mindepth 2 -type d |sed -e 's#^\./##'`; do
+	if [[ $(cat "$atom/EAPI") == "4" ]]; then
+		ofile=${opath}/$(echo $atom |sed -e 's#/#/*/#').ebuild
+		if grep '^EAPI.*4-slot-abi' ${ofile} &>/dev/null; then
+			echo -n "    updating $atom ..."
+
+			# update the abi
+			echo '4-slot-abi' >"${atom}/EAPI"
+
+			# set the package as coming from this repos
+			cat "${opath}/profiles/repo_name" >"${atom}/repository"
+
+			# update the ebuild so it matches what's in the repos
+			cp ${ofile} "${atom}/"
+
+			# update the slot, if slot has changed
+			if grep '^SLOT=' ${ofile} |grep '/' &>/dev/null; then
+				grep '^SLOT=' ${ofile} \
+				|sed -e 's/SLOT=//' -e 's/"//g' >"${atom}/SLOT"
+			fi
+
+			# update DEPEND, RDEPEND
+			for dependitem in DEPEND RDEPEND PDEPEND; do 
+			if [ -e ${atom}/${dependitem} ]; then
+				mydep=$(portageq metadata / ebuild ${atom} ${dependitem}); 
+				# make a list of use flags not set for the package, so that DEPEND can be trimmed
+				for ech in $mydep; do 
+					if echo $ech |grep '\?$' &>/dev/null; then 
+						echo $ech |sed -e 's/\?$//' >>/tmp/${dependitem}-fulluse
+					fi
+				done
+				# make grep match lines for the flags in USE
+				sed -e "s/ /\n/g" ${atom}/USE |sed -e 's/^/^/' >/tmp/${dependitem}-use
+				# add inversions of use flags to remove disabled matches
+				sed -e "s/ /\n/g" ${atom}/USE |sed -e 's/^/!/' >>/tmp/${dependitem}-fulluse
+				# add inversions to the use mask so that we don't strip !use deps when that flag is off
+				sed -e "s/ /\n/g" ${atom}/IUSE |sed -e 's/^[^a-z0-9]//' \
+					|grep -v -f /tmp/${dependitem}-use |sed -e 's/^/^!/' >>/tmp/${dependitem}-use
+
+				# trim the unset USE flag deps from the new DEPEND list
+				for ech in $(grep -v -f /tmp/${dependitem}-use /tmp/${dependitem}-fulluse); do 
+					mydep=$(echo " $mydep " |sed -e "s/ ${ech}? ([^()]*) / /" -e "s/ ${ech}? ([^()]*\(([^()]*)\)*[^()]*) / /" -e "s/ ${ech}? ([^()]*\(([^()]*\(([^()]*)\)*[^()]*)\)*[^()]*) / /")
+				done
+
+				# remove the use flag stuff from remaining mydeps as they are enabled
+				mydep=$(echo $mydep |sed -e 's/[^\?\ ]*? (\([^?()]*\(([^?()]*)\)*[^?()]*\))/\1/g' -e 's/[^\?\ ]*? (\([^?()]*\(([^?()]*)\)*[^?()]*\))/\1/g' -e 's/[^\?\ ]*? (\([^?()]*\(([^?()]*)\)*[^?()]*\))/\1/g' -e 's/[^\?\ ]*? (\([^?()]*\(([^?()]*)\)*[^?()]*\))/\1/g' |xargs echo)
+
+				# print old and new for debugging
+				echo ""
+				sed -e "s/ /\n/g" ${atom}/${dependitem} >/tmp/${dependitem}-old
+				echo $mydep |sed -e "s/ /\n/g" |diff -U 0 /tmp/${dependitem}-old - \
+					|grep -v -e '^---' -e '^+++' -e '^@@' |sed -e "s/^/        ${dependitem}: /"
+
+				echo $mydep >${atom}/${dependitem}
+				rm -f /tmp/${dependitem}-fulluse /tmp/${dependitem}-use
+			fi; done
+
+			echo " done."
+			didsomething=$(($didsomething + 1))
+			processedatoms="${processedatoms} ${atom}"
+			touch "${atom}"
+		fi
+	fi
+done
+if (( $didsomething > 0 )); then
+	echo "Substituting proper slot value for any dependencies with slot operators..."
+	# substitute the proper slot for := and :* deps when they exist in *DEPEND
+	for atom in $processedatoms ; do for dependitem in DEPEND RDEPEND PDEPEND; do 
+		if [ -e ${atom}/${dependitem} ]; then
+		for dep in $(sed -e "s/ /\n/g" ${atom}/${dependitem}); do
+			if echo $dep |grep ':[^ /=*]*[*=]' &>/dev/null; then
+				# get the base slot desired so we can find a match
+				pkg=$(echo $dep |sed -e 's/:.*$//')
+				if echo $pkg |grep '^[<>=!]' &>/dev/null; then
+					pkgfile=$(echo $pkg |sed -e 's/^[<>=!]*//' |xargs qatom |awk '{print $1 "/" $2 "-[0-9]"}')
+				else
+					pkgfile=$pkg
+				fi
+				pkguse=$(echo $dep |sed -e 's/^[^:]*:[^ /=*]*[=*]//')
+				baseslot=$(echo $dep |sed -e 's/^[^:]*:\([^ /=*]*\)[=*].*$/\1/')
+				slotop=$(echo $dep |sed -e 's/^[^:]*:[^ /=*]*\([=*]\).*$/\1/')
+				: ${baseslot:=0}
+				for matchdep in ${pkgfile}*/ ; do
+					if [[ $(cat ${matchdep}/SLOT |sed -e 's#/.*$##') == $baseslot ]]; then
+						mdepslot=$(cat ${matchdep}/SLOT)
+						# echo "...${atom} :  changing $dependitem $dep to $pkg:$mdepslot$slotop$pkguse "
+						echo "${pkg}:${mdepslot}${slotop}${pkguse}" >>/tmp/new-${dependitem}
+					fi
+				done
+			else
+				echo "$dep" >>/tmp/new-${dependitem}
+			fi
+		done
+		sed -e "s/ /\n/g" ${atom}/${dependitem} >/tmp/${dependitem}-old
+		diff -U 0 /tmp/${dependitem}-old /tmp/new-${dependitem} \
+			|grep -v -e '^---' -e '^+++' -e '^@@' |sed -e "s#^#  ${atom} ${dependitem}: #"
+
+		cat /tmp/new-${dependitem} |xargs echo >${atom}/${dependitem}
+		rm -f /tmp/new-${dependitem} /tmp/${dependitem}-old
+		fi
+	done; done
+	echo ""
+	echo "$didsomething packages processed."
+else
+	echo "Nothing to do"
+fi
+
+
+
+#
+# Depend stuff needs to have actual slot value instead of just the := shortcut
+# zmedico said this can help (in python):
+# settings = portage.config(clone=portage.settings) ; settings.setcpv('dev-perl/URI-1.590.0', mydb=portage.db['/']['vartree'].dbapi)
+#  evaluate_slot_abi_equal_deps() function for that in pym/portage/dep/_slot_abi.py

diff --git a/profiles/base/package.keywords b/profiles/base/package.keywords
deleted file mode 100644
index 70e1b67..0000000
--- a/profiles/base/package.keywords
+++ /dev/null
@@ -1 +0,0 @@
-=sys-apps/portage-9999 amd64 x86

diff --git a/profiles/updates/1Q-2099 b/profiles/updates/1Q-2099
deleted file mode 100644
index 418412e..0000000
--- a/profiles/updates/1Q-2099
+++ /dev/null
@@ -1,15 +0,0 @@
-dev-lang/perl-5.12.4 0 0/5.12
-dev-lang/perl-5.12.4-r1 0 0/5.12
-dev-lang/perl-5.12.4-r2 0 0/5.12
-dev-lang/perl-5.14.1 0 0/5.14
-dev-lang/perl-5.14.1-r1 0 0/5.14
-dev-lang/perl-5.14.2 0 0/5.14
-dev-lang/perl-5.16.0 0 0/5.16
-dev-lang/spidermonkey-1.8.5-r1 0 0/185
-dev-lang/spidermonkey-1.8.7 0 0/187
-dev-libs/libyaml-0.1.4 0 0/2.0
-x11-base/xorg-server-1.10.6-r1 0 0/1.10
-x11-base/xorg-server-1.11.4-r1 0 0/1.11
-x11-base/xorg-server-1.12.2 0 0/1.12
-x11-libs/xcb-util-0.3.8 0 0/0.0
-x11-libs/xcb-util-0.3.9 0 0/1.0



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-07-01 16:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-01 16:56 [gentoo-commits] dev/axs:master commit in: /, profiles/updates/, profiles/base/ Ian Stakenvicius

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox