Danek Duvall wrote:
Saurabh Vyas wrote:

And I modified TarBundle.py to raise EnvironmentError (rather than
just returning False), then the error trickle downs to gen_action &
finally caught in trans_import() & trans_generate()

just for ref : http://cr.opensolaris.org/~saurabhv/fix-15646-rev-3/

does this approach seems right now ?

Thanks again Danek, more inline comments............
You're getting there, I think.  But you don't need to be as explicit about
catching and re-raising exceptions.

For instance, your change to TarBundle.test() could simply have removed the
try/except statements, and simply run the is_tarfile() function -- it would
have identical functionality, and be much simpler.  (Indeed, is_tarfile()
wouldn't ever raise TypeError -- that's something that make_bundle() does,
one level up -- so catching that isn't at all useful.)

Similarly, in gen_actions(), you don't need to try/except just to re-raise.

In trans_import(), you refer to "generate" in the except clauses.
I had reworked on this & modified the way test() in :
- DirectoryBundle
- SolarisPackageDatastreamBundle
- TarBundle

are done.
New webrev : http://cr.opensolaris.org/~saurabhv/fix-15646-rev-4/

Here we want not to raise an error & continue in make_bundle() to check for the next bundle type also.
Thus I am not able to differentiate between the case where :

v...@opensolaris:~# pkgsend generate hello/MyDir
pkgsend: generate: Unknown Error

as in MyDir is a SolarisPackageDir or regular directory.

Apart some test runs for this fix :

v...@opensolaris:~# ls hello/
bar.txt file1 file1.tar foo.txt MyDir MyDir.pkg

v...@opensolaris:~# pkgsend generate hello/MyDir2.pkg
pkgsend: generate: File not found ['hello/MyDir2.pkg']

v...@opensolaris:~# pkgsend generate hello/MyDir
pkgsend: generate: Unknown Error

v...@opensolaris:~# pkgsend generate hello/MyDir2
pkgsend: generate: File not found ['hello/MyDir2']

v...@opensolaris:~# pkgsend generate hello/MyDir.pkg
unknown path=pkginfo
unknown path=pkgmap
unknown path=install
unknown path=reloc
unknown path=reloc/mytest
pkgsend: generate: Unknown Error

This is where I need more inputs / ideas about how to handle other cases

The cases you need to cover are:

  - pathname is a tarfile
  - pathname is a generic directory
  - pathname is an SVr4 package in directory format
  - pathname is an SVr4 package in datastream format
  - pathname is something else
  - pathname doesn't exist
I tried to cover these cases, please let me know if this attempt looks good (or need further improvement / modification)
That is, handle everything that the code already handled, and add the case
at the end.  Other cases could (and likely should) be handled by other
bugs.  For instance, you could have a case to handle selected other I/O
errors (other than ENOENT) without printing a stack trace, but for the
purposes of fixing this bug, you don't have to.
Yes sure, it would be good to have another bug for these cases (I would like to give that a try too, please if you raise the bug with inputs needed).

Thanks,
~Saurabh
Danek

_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss

Reply via email to