Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r12275 - main/trunk/pym/portage
Date: Mon, 22 Dec 2008 01:24:16
Message-Id: E1LEZWn-0007V1-Ii@stork.gentoo.org
1 Author: zmedico
2 Date: 2008-12-22 01:24:12 +0000 (Mon, 22 Dec 2008)
3 New Revision: 12275
4
5 Modified:
6 main/trunk/pym/portage/__init__.py
7 Log:
8 Remove code from unused config.load_infodir() method and issue a deprecation
9 warning if it's called.
10
11
12 Modified: main/trunk/pym/portage/__init__.py
13 ===================================================================
14 --- main/trunk/pym/portage/__init__.py 2008-12-21 23:07:29 UTC (rev 12274)
15 +++ main/trunk/pym/portage/__init__.py 2008-12-22 01:24:12 UTC (rev 12275)
16 @@ -1865,74 +1865,10 @@
17 self.regenerate(use_cache=use_cache)
18
19 def load_infodir(self,infodir):
20 - self.modifying()
21 - backup_pkg_metadata = dict(self.configdict["pkg"].iteritems())
22 - if "pkg" in self.configdict and \
23 - "CATEGORY" in self.configdict["pkg"]:
24 - self.configdict["pkg"].clear()
25 - self.configdict["pkg"]["CATEGORY"] = \
26 - backup_pkg_metadata["CATEGORY"]
27 - else:
28 - raise portage.exception.PortageException(
29 - "No pkg setup for settings instance?")
30 + warnings.warn("portage.config.load_infodir() is deprecated",
31 + DeprecationWarning)
32 + return 1
33
34 - retval = 0
35 - found_category_file = False
36 - if os.path.isdir(infodir):
37 - if os.path.exists(infodir+"/environment"):
38 - self.configdict["pkg"]["PORT_ENV_FILE"] = infodir+"/environment"
39 -
40 - myre = re.compile('^[A-Z]+$')
41 - null_byte = "\0"
42 - for filename in listdir(infodir,filesonly=1,EmptyOnError=1):
43 - if filename == "FEATURES":
44 - # FEATURES from the build host shouldn't be interpreted as
45 - # FEATURES on the client system.
46 - continue
47 - if filename == "CATEGORY":
48 - found_category_file = True
49 - continue
50 - if myre.match(filename):
51 - try:
52 - file_path = os.path.join(infodir, filename)
53 - mydata = open(file_path).read().strip()
54 - if len(mydata) < 2048 or filename == "USE":
55 - if null_byte in mydata:
56 - writemsg("!!! Null byte found in metadata " + \
57 - "file: '%s'\n" % file_path, noiselevel=-1)
58 - continue
59 - if filename == "USE":
60 - binpkg_flags = "-* " + mydata
61 - self.configdict["pkg"][filename] = binpkg_flags
62 - self.configdict["env"][filename] = mydata
63 - else:
64 - self.configdict["pkg"][filename] = mydata
65 - self.configdict["env"][filename] = mydata
66 - except (OSError, IOError):
67 - writemsg("!!! Unable to read file: %s\n" % infodir+"/"+filename,
68 - noiselevel=-1)
69 - pass
70 - retval = 1
71 -
72 - # Missing or corrupt CATEGORY will cause problems for
73 - # doebuild(), which uses it to infer the cpv. We already
74 - # know the category, so there's no need to trust this
75 - # file. Show a warning if the file is missing though,
76 - # because it's required (especially for binary packages).
77 - if not found_category_file:
78 - writemsg("!!! CATEGORY file is missing: %s\n" % \
79 - os.path.join(infodir, "CATEGORY"), noiselevel=-1)
80 - self.configdict["pkg"].update(backup_pkg_metadata)
81 - retval = 0
82 -
83 - # Always set known good values for these variables, since
84 - # corruption of these can cause problems:
85 - cat, pf = catsplit(self.mycpv)
86 - self.configdict["pkg"]["CATEGORY"] = cat
87 - self.configdict["pkg"]["PF"] = pf
88 -
89 - return retval
90 -
91 def setcpv(self, mycpv, use_cache=1, mydb=None):
92 """
93 Load a particular CPV into the config, this lets us see the