コード例 #1
0
    def trigger(self, engine, cset):
        op = self.format_op
        op = getattr(op, 'install_op', op)
        op.setup_workdir()
        merge_contents = get_plugin("fs_ops.merge_contents")
        merge_cset = cset
        if engine.offset != '/':
            merge_cset = cset.change_offset(engine.offset, '/')
        merge_contents(merge_cset, offset=op.env["D"])

        # ok.  they're on disk.
        # now to avoid going back to the binpkg, we rewrite
        # the data_source for files to the on disk location.
        # we can update in place also, since we're not changing the mapping.

        # this rewrites the data_source to the ${D} loc.
        d = op.env["D"]
        fi = (x.change_attributes(
            data=local_source(pjoin(d, x.location.lstrip('/'))))
              for x in merge_cset.iterfiles())

        if engine.offset:
            # we're using merge_cset above, which has the final offset loc
            # pruned; this is required for the merge, however, we're updating
            # the cset so we have to insert the final offset back in.
            # wrap the iter, iow.
            fi = offset_rewriter(engine.offset, fi)

        cset.update(contentsSet(fi))

        # we *probably* should change the csets class at some point
        # since it no longer needs to be tar, but that's for another day.
        engine.replace_cset('new_cset', cset)
コード例 #2
0
ファイル: test_ops.py プロジェクト: chutz/pkgcore
 def test_callback(self):
     for attr in dir(self):
         if not attr.startswith('entries') or 'fail' in attr:
             continue
         e = getattr(self, attr)
         if not isinstance(e, dict):
             continue
         img, cset = self.generic_unmerge_bits(e)
         s = set(contents.offset_rewriter(img, cset))
         ops.unmerge_contents(cset, offset=img, callback=s.remove)
         self.assertFalse(s, s)
コード例 #3
0
ファイル: test_ops.py プロジェクト: chutz/pkgcore
 def test_callback(self):
     for attr in dir(self):
         if not attr.startswith('entries') or 'fail' in attr:
             continue
         e = getattr(self, attr)
         if not isinstance(e, dict):
             continue
         src, dest, cset = self.generic_merge_bits(e)
         new_cset = contents.contentsSet(contents.offset_rewriter(dest, cset))
         s = set(new_cset)
         ops.merge_contents(cset, offset=dest, callback=s.remove)
         self.assertFalse(s)