Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 37537 Details for
Bug 46096
fixdbentries breaks vardb and binaries
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
The fixed script
fixvardbentries (text/plain), 2.85 KB, created by
Sascha Silbe
on 2004-08-16 09:13:25 UTC
(
hide
)
Description:
The fixed script
Filename:
MIME Type:
Creator:
Sascha Silbe
Created:
2004-08-16 09:13:25 UTC
Size:
2.85 KB
patch
obsolete
>#!/usr/bin/python -O ># arch-tag: c2d62f90-d585-4f81-b92b-8588b9238e58 > >import os >import sys > >def fix_entries(path): > path += "/" > > # Find the ebuild > contents = os.listdir(path) > ebuild = None > for fn in contents: > if fn[-7:] == ".ebuild": > ebuild = fn > break > if ebuild is None: > print "missing ebuild in",path > return > > # Read it > ebuildfile = open(path+ebuild) > orig = ebuildfile.readlines() > ebuildfile.close() > > # Quickly check it > if "\1" not in " ".join(orig): > return > > # Read the original environment > os.system("bunzip2 -k "+path+"environment.bz2") > envfile = open(path+"environment") > lines = envfile.readlines() > envfile.close() > os.remove(path+"environment") > > # Parse it > env = {} > for line in lines: > line = " ".join(line.split()) > values = line.split("=") > if len(values) == 1: > break > key = values[0] > value = "=".join(values[1:]) > if value and value[0] == "$": > value = value[1:] > if value and value[0] == "'": > value = value[1:-1] > value = value.replace("\\n","\n") > value = value.replace("\\t","\t") > env[key] = value > > # Revert the *DEPEND files to their originals > for key in ["DEPEND","RDEPEND","PDEPEND"]: > if not env.has_key(key): > env[key] = "" > f = open(path+key, "w") > f.write(env[key]) > f.close() > > # Check and fix unbalanced quotes > quotecount = 0 > for l in orig: > quotecount += l.count('"') > if (quotecount % 2): > for x in range(len(orig)-1,-1,-1): > if "\1" in orig[x]: > for y in range(len(orig[x])-1,-1,-1): > if orig[x][y]=="\1": > orig[x] = orig[x][:y] + '"' + orig[x][y+1:] > break > break > > # Replace *DEPEND in the ebuild with their originals > fixed = [] > x=0 > while x != len(orig): > for key in ["DEPEND","RDEPEND","PDEPEND"]: > if orig[x].startswith(key): > quotes = 0 > while quotes != 2: > if x > len(orig): > print "Definate bug" > print orig > return > if not orig[x]: > print "Possible bug - if the original ebuild you see both DEPEND and RDEPEND" > print "in the following but the 'fixed' ebuild doesn't have both then please" > print "report this." > print orig > continue > quotes += orig[x].count('"') > if quotes == 2: > break > if quotes > 2: > print "Unfixable ebuild",ebuild > print "Please attach it to bug 46906" > return > x += 1 > fixed += [key+'="'+env[key]+'"\n'] > x += 1 > break > if x != len(orig): > fixed += orig[x] > x += 1 > ebuildfile = open(path+ebuild,"w") > ebuildfile.writelines(fixed) > ebuildfile.close() > > > >vardb = "/var/db/pkg/" >for cat in os.listdir(vardb): > if os.path.isdir(vardb+cat): > for pkg in os.listdir(vardb+cat): > if pkg[0] != "-" and os.path.isdir(vardb+cat+"/"+pkg) and \ > os.access(vardb+cat+"/"+pkg+"/environment.bz2",os.F_OK): > fix_entries(vardb+cat+"/"+pkg) > >import portage >if portage.mtimedb.has_key("updates"): > del portage.mtimedb["updates"]
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 46096
:
28274
|
28275
|
28929
|
29014
|
29020
|
36556
|
37209
|
37526
|
37536
|
37537
|
37541
|
37591