[EMAIL PROTECTED] wrote:
> Bart,
> 
> This looks good.  I have one nit.
> 
>> http://cr.opensolaris.org/~barts/fixes-11/
> 
> hardlink.py: 61, 66, 81 - You look up the path from the attributes
> in get_target_path().  Path also gets looked it up in install() and
> verify() right before calling get_target_path().  Would it make sense to
> supply path as an argument to get_target_path()?
> 
> 
> -j

But in get_link_actions() in image.py, the code looks like this:

  301         def get_link_actions(self):
  302                 """ return a dictionary of hardlink action lists 
indexed by
  303                 target """
  304                 if self.link_actions:
  305                         return self.link_actions
  306
  307                 d = {}
  308                 for act in self.gen_installed_actions():
  309                         if act.name == "hardlink":
  310                                 t = act.get_target_path()
  311                                 if t in d:
  312                                         d[t].append(act)
  313                                 else:
  314                                         d[t] = [act]
  315                 self.link_actions = d
  316                 return d

It looks cleaner my way, I think....

I am willing to tweak this as follows if it helps:

        def get_target_path(self):
              """ return a path for target that is relative to image""" 

               target = self.attrs["target"]
               # paths are either relative to path or absolute
               # both need to be passed through os.path.normpath to isure
               # that all ".." are removed to constrain target to image
               if target[0] != "/":
                       path = self.attrs["path"]
                       target = os.path.normpath 

                       os.path.join(os.path.split(path)[0], target))
               else:
                       target = os.path.normpath(target)[1:]
               return target


- Bart

-- 
Bart Smaalders                  Solaris Kernel Performance
[EMAIL PROTECTED]               http://blogs.sun.com/barts
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss

Reply via email to