Changeset pkgcore,3263

Show
Ignore:
Timestamp:
06/26/08 13:17:28 (8 weeks ago)
Author:
Brian Harring <ferringb@…>
Message:

set of fixups; add cmp to all FsBase?, fix ticket 204, and mangle binpkg unpacking to use new_cset instead of install

Location:
pkgcore
Files:
8 modified

Legend:

Unmodified
Added
Removed
  • pkgcore/NEWS

    r3262 r3263  
    44See ChangeLog for full commit logs; this is summarized/major changes. 
    55 
     6 
     7* make contentsSet.map_directory_structure go recursive- 
     8  this fixes ticket #204, invalid removal of files previously just merged. 
    69 
    710* make --newuse work with atoms/sets 
  • pkgcore/pkgcore/binpkg/repository.py

    r~3253 r~3260  
    4242class force_unpacking(triggers.base): 
    4343 
    44     required_csets = ('install',) 
     44    required_csets = ('new_cset',) 
    4545    priority = 5 
    4646    _hooks = ('sanity_check',) 
  • pkgcore/pkgcore/ebuild/portage_conf.py

    r~3253 r~3260  
    460460            if oe.errno != errno.ENOENT: 
    461461                raise 
     462            if set(features).intersection( 
     463                ('buildpkg', 'pristine-buildpkg', 'buildsyspkg', 'unmerge-backup')): 
     464                logger.warn("disabling buildpkg related features since PKGDIR doesn't exist") 
    462465            pkgdir = None 
     466    else: 
     467       if set(features).intersection( 
     468           ('buildpkg', 'pristine-buildpkg', 'buildsyspkg', 'unmerge-backup')): 
     469           logger.warn("disabling buildpkg related features since PKGDIR is unset") 
     470 
     471 
     472    # yes, round two; may be disabled from above and massive else block sucks 
     473    if pkgdir is not None: 
    463474        # If we are not using the native bzip2 then the Tarfile.bz2open 
    464475        # the binpkg repository uses will fail. 
  • pkgcore/pkgcore/fs/contents.py

    r~3253 r~3260  
    318318        conflicts = sorted(contentsSet(self.iterdirs()).intersection(conflicts_d)) 
    319319        obj = self.clone() 
    320         for conflict in conflicts: 
    321             # punt the conflict first, since we don't want it getting rewritten 
    322             obj.remove(conflict) 
    323             subset = self.child_nodes(conflict.location) 
    324             obj.difference_update(subset) 
    325             subset = subset.change_offset(conflict.location, conflict.resolved_target) 
    326             obj.update(subset) 
    327             if add_conflicting_sym: 
    328                 obj.add(other[conflicts_d[conflict]]) 
     320        while conflicts: 
     321            for conflict in conflicts: 
     322                # punt the conflict first, since we don't want it getting rewritten 
     323                obj.remove(conflict) 
     324                subset = obj.child_nodes(conflict.location) 
     325                obj.difference_update(subset) 
     326                subset = subset.change_offset(conflict.location, conflict.resolved_target) 
     327                obj.update(subset) 
     328                if add_conflicting_sym: 
     329                    obj.add(other[conflicts_d[conflict]]) 
     330 
     331            # rebuild the targets first; sorted due to the fact that we want to 
     332            # rewrite each node (resolving down the filepath chain) 
     333            conflicts = sorted(contentsSet(obj.iterdirs()).intersection(conflicts_d)) 
    329334        return obj 
    330335 
  • pkgcore/pkgcore/fs/fs.py

    r~3251 r~3260  
    128128        return dirname(self.location) 
    129129 
     130    def __cmp__(self, other): 
     131        return cmp(self.location, other.location) 
    130132 
    131133 
     
    192194    def __repr__(self): 
    193195        return "dir:%s" % self.location 
    194  
    195     def __cmp__(self, other): 
    196         return cmp( 
    197             self.location.split(path_seperator), 
    198             other.location.split(path_seperator)) 
    199196 
    200197 
     
    232229            return self.target 
    233230        return normpath(pjoin(self.location, '../', self.target)) 
     231 
     232    def __cmp__(self, other): 
     233        c = cmp(self.location, other.location) 
     234        if c: 
     235            return c 
     236        if isinstance(other, self.__class__): 
     237            return cmp(self.target, other.target) 
     238        return 0 
    234239 
    235240    def __repr__(self): 
  • pkgcore/pkgcore/merge/engine.py

    r~3253 r~3260  
    3535        realpath=True)) 
    3636    livefs.recursively_fill_syms(ondisk) 
    37     ret = initial.map_directory_structure(ondisk, add_conflicting_sym=False) 
     37    ret = initial.map_directory_structure(ondisk, add_conflicting_sym=True) 
    3838    return ret 
    3939 
  • pkgcore/pkgcore/test/fs/test_contents.py

    r~3251 r~3260  
    197197 
    198198    def test_map_directory_structure(self): 
    199         old = contents.contentsSet([self.mk_file("/dir/a"), 
    200             self.mk_dir("/dir"), self.mk_link("/sym", "dir")]) 
     199        old = contents.contentsSet([self.mk_dir("/dir"), 
     200            self.mk_link("/sym", "dir")]) 
    201201        new = contents.contentsSet([self.mk_file("/sym/a"), 
    202202            self.mk_dir("/sym")]) 
    203203        # verify the machinery is working as expected. 
    204         self.assertNotEqual(list(old.difference(new)), [self.mk_dir("/dir")]) 
    205204        ret = new.map_directory_structure(old) 
    206205        self.assertEqual(sorted(ret), sorted([self.mk_dir("/dir"), 
    207206            self.mk_file("/dir/a")])) 
     207 
     208        # test recursion next. 
     209        old.add(self.mk_link("/dir/sym", "dir2")) 
     210        old.add(self.mk_dir("/dir/dir2")) 
     211        new.add(self.mk_file("/dir/sym/b")) 
     212        new.add(self.mk_dir("/sym/sym")) 
     213 
     214        ret = new.map_directory_structure(old) 
     215        self.assertEqual(sorted(ret), sorted([self.mk_dir("/dir"), 
     216            self.mk_file("/dir/a"), self.mk_dir("/dir/dir2"), 
     217            self.mk_file("/dir/dir2/b")])) 
     218 
    208219 
    209220    def test_add_missing_directories(self): 
  • pkgcore/pkgcore/test/fs/test_fs.py

    r~3251 r~3260  
    157157            "/dar") 
    158158 
     159    def test_cmp(self): 
     160        obj1 = self.make_obj( 
     161            location='/usr/lib64/opengl/nvidia/lib/libnvidia-tls.so.1', 
     162            target='../tls/libnvidia-tls.so.1') 
     163        obj2 = self.make_obj( 
     164            location='/usr/lib32/opengl/nvidia/lib/libGL.s', 
     165            target='libGL.so.173.14.09') 
     166        self.assertTrue(obj1 > obj2) 
     167        self.assertTrue(obj2 < obj1) 
     168 
     169 
    159170class Test_fsDev(TestCase, base): 
    160171    kls = fs.fsDev