Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 920828
Collapse All | Expand All

(-)a/lib/portage/tests/update/test_move_ent.py (+91 lines)
Lines 13-18 from portage.util import ensure_dirs Link Here
13
from portage._global_updates import _do_global_updates
13
from portage._global_updates import _do_global_updates
14
from portage.output import colorize
14
from portage.output import colorize
15
15
16
from portage.tests import TestCase
17
16
18
17
class MoveEntTestCase(TestCase):
19
class MoveEntTestCase(TestCase):
18
    def testMoveEnt(self):
20
    def testMoveEnt(self):
Lines 230-232 class MoveEntTestCase(TestCase): Link Here
230
232
231
                finally:
233
                finally:
232
                    playground.cleanup()
234
                    playground.cleanup()
235
236
    def testMoveEntWithCorruptIndex(self):
237
        ebuilds = {
238
            "dev-libs/A-moved-1::test_repo": {
239
                "EAPI": "4",
240
                "SLOT": "2",
241
            },
242
            "dev-libs/B-1::test_repo": {"EAPI": "4", "RDEPEND": "dev-libs/A-moved"},
243
        }
244
245
        installed = {
246
            "dev-libs/A-1::test_repo": {
247
                "EAPI": "4",
248
            },
249
            "dev-libs/B-1::test_repo": {"EAPI": "4", "RDEPEND": "dev-libs/A"},
250
        }
251
252
        binpkgs = {
253
            "dev-libs/A-1::test_repo": {
254
                "EAPI": "4",
255
                "BUILD_ID": "1",
256
            },
257
            "dev-libs/B-1::test_repo": {
258
                "EAPI": "4",
259
                "BUILD_ID": "1",
260
                "RDEPEND": "dev-libs/A",
261
            },
262
        }
263
264
        updates = textwrap.dedent(
265
            """
266
			move dev-libs/A dev-libs/A-moved
267
		"""
268
        )
269
270
        for binpkg_format in ("gpkg",):
271
            with self.subTest(binpkg_format=binpkg_format):
272
                print(colorize("HILITE", binpkg_format), end=" ... ")
273
                sys.stdout.flush()
274
                playground = ResolverPlayground(
275
                    binpkgs=binpkgs,
276
                    ebuilds=ebuilds,
277
                    installed=installed,
278
                    user_config={
279
                        "make.conf": (
280
                            f'BINPKG_FORMAT="{binpkg_format}"',
281
                            f'FEATURES="binpkg-multi-instance pkgdir-index-trusted"',
282
                        ),
283
                    },
284
                    debug=True,
285
                )
286
287
                settings = playground.settings
288
                trees = playground.trees
289
                eroot = settings["EROOT"]
290
                test_repo_location = settings.repositories["test_repo"].location
291
                portdb = trees[eroot]["porttree"].dbapi
292
                vardb = trees[eroot]["vartree"].dbapi
293
                bindb = trees[eroot]["bintree"].dbapi
294
295
                updates_dir = os.path.join(test_repo_location, "profiles", "updates")
296
297
                try:
298
                    ensure_dirs(updates_dir)
299
                    with open(os.path.join(updates_dir, "1Q-2010"), "w") as f:
300
                        f.write(updates)
301
302
                    # Make the Packages index out-of-date
303
                    os.remove(
304
                        os.path.join(
305
                            bindb.bintree.pkgdir, "dev-libs", "A", "A-1-1.gpkg.tar"
306
                        )
307
                    )
308
309
                    global_noiselimit = portage.util.noiselimit
310
                    portage.util.noiselimit = -2
311
                    try:
312
                        _do_global_updates(trees, {})
313
                    finally:
314
                        portage.util.noiselimit = global_noiselimit
315
316
                    # Workaround for cache validation not working
317
                    # correctly when filesystem has timestamp precision
318
                    # of 1 second.
319
                    vardb._clear_cache()
320
321
                    # ...
322
                finally:
323
                    playground.cleanup()

Return to bug 920828