From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-14) on finch.gentoo.org X-Spam-Level: ** X-Spam-Status: No, score=2.1 required=5.0 tests=DMARC_REJECT, MAILING_LIST_MULTI,RDNS_NONE autolearn=no autolearn_force=no version=4.0.0 Received: from bigglesworth.mail.be.easynet.net (unknown [212.100.160.67]) by chiba.3jane.net (Postfix) with ESMTP id 2A4BB200A98B for ; Mon, 18 Feb 2002 10:30:42 -0600 (CST) Received: from 213-193-176-124.adsl.easynet.be ([213.193.176.124]) by bigglesworth.mail.be.easynet.net with esmtp (Exim 3.16 #1) id 16cqed-0001D0-00 for gentoo-dev@gentoo.org; Mon, 18 Feb 2002 17:28:40 +0100 From: Geert Bevin To: gentoo-dev@gentoo.org Content-Type: multipart/mixed; boundary="=-MS3++p17YzrKIzjtFEBi" X-Mailer: Evolution/1.0.2 Date: 18 Feb 2002 17:26:50 +0100 Message-Id: <1014049610.1556.2.camel@oak.uwyn.office> Mime-Version: 1.0 Subject: [gentoo-dev] updated slot conversion scripts for those that have been using portage 1.8.9_prex Sender: gentoo-dev-admin@gentoo.org Errors-To: gentoo-dev-admin@gentoo.org X-BeenThere: gentoo-dev@gentoo.org X-Mailman-Version: 2.0.6 Precedence: bulk Reply-To: gentoo-dev@gentoo.org List-Help: List-Post: List-Subscribe: , List-Id: Gentoo Linux developer list List-Unsubscribe: , List-Archive: X-Archives-Salt: ff020866-a5a0-4c52-b18c-f7c2e740d514 X-Archives-Hash: e718d2af095898bf76c684488a7fba94 --=-MS3++p17YzrKIzjtFEBi Content-Type: text/plain Content-Transfer-Encoding: 7bit Hi, I mistakenly relied on the cvs version of portage to write the second python script. So this was not gonna work for a lot of people. Now both files ran one after the other (convertslots.sh and then convertslot2.py) should put your /var/db/pkg back into a stable state. Have fun ! Geert -- Geert Bevin Uwyn "Use what you need" Lambermontlaan 148 http://www.uwyn.com 1030 Brussels gbevin@uwyn.com Tel & Fax +32 2 245 41 06 --=-MS3++p17YzrKIzjtFEBi Content-Disposition: attachment; filename=convertslot.sh Content-Transfer-Encoding: quoted-printable Content-Type: text/x-sh; charset=ISO-8859-1 #!/bin/sh # converts old changed dirnames to the previous format again # where slots aren't reflected in the dir path name slots=3D$(find /var/db/pkg -name SLOT) for slot in $slots; do dir=3D${slot%SLOT} pf=3D$(cat $dir/PF) newdir=3D$(dirname $dir) newdir=3D"$newdir/$pf" if [ ! -d $newdir ] then mv $dir $newdir echo "$dir has been converted" else echo "$newdir already exists" fi done --=-MS3++p17YzrKIzjtFEBi Content-Disposition: attachment; filename=convertslots2.py Content-Transfer-Encoding: quoted-printable Content-Type: text/x-python; charset=ISO-8859-1 #!/usr/bin/env spython import os from os.path import walk, splitext, exists, basename, dirname import sys import output from output import * import portage import string from string import strip, find, replace, split """converts $PV slots to null slots""" localtree=3Dportage.vartree() for node in localtree.getallnodes(): for package in localtree.dep_match(node): slotpath=3Dportage.root+"var/db/pkg/"+package+"/SLOT" if os.path.exists(slotpath): package_parts=3Dportage.catpkgsplit(package) slotfile=3Dopen(slotpath,'r+') actualslot=3Dslotfile.readline().strip() if actualslot=3D=3Dpackage_parts[2]: slotfile.truncate(0) print slotpath,"has been set to null" else: print slotpath,"has slot '"+actualslot+"'" slotfile.close() --=-MS3++p17YzrKIzjtFEBi--