public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Geert Bevin <gbevin@uwyn.com>
To: gentoo-dev@gentoo.org
Subject: [gentoo-dev] updated slot conversion scripts for those that have been using portage 1.8.9_prex
Date: 18 Feb 2002 17:26:50 +0100	[thread overview]
Message-ID: <1014049610.1556.2.camel@oak.uwyn.office> (raw)

[-- Attachment #1: Type: text/plain, Size: 457 bytes --]

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

[-- Attachment #2: convertslot.sh --]
[-- Type: text/x-sh, Size: 409 bytes --]

#!/bin/sh
# converts old changed dirnames to the previous format again
# where slots aren't reflected in the dir path name
slots=$(find /var/db/pkg -name SLOT)
for slot in $slots;
do
	dir=${slot%SLOT}
	pf=$(cat $dir/PF)
	newdir=$(dirname $dir)
	newdir="$newdir/$pf"
	if [ ! -d $newdir ]
	then
		mv $dir $newdir
		echo "$dir has been converted"
	else
		echo "$newdir already exists"
	fi
done

[-- Attachment #3: convertslots2.py --]
[-- Type: text/x-python, Size: 778 bytes --]

#!/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=portage.vartree()
for node in localtree.getallnodes():
	for package in localtree.dep_match(node):
		slotpath=portage.root+"var/db/pkg/"+package+"/SLOT"
		if os.path.exists(slotpath):
			package_parts=portage.catpkgsplit(package)
			slotfile=open(slotpath,'r+')
			actualslot=slotfile.readline().strip()
			if actualslot==package_parts[2]:
				slotfile.truncate(0)
				print slotpath,"has been set to null"
			else:
				print slotpath,"has slot '"+actualslot+"'"
			slotfile.close()


                 reply	other threads:[~2002-02-18 16:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1014049610.1556.2.camel@oak.uwyn.office \
    --to=gbevin@uwyn.com \
    --cc=gentoo-dev@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox