[Pkg-zope-developers] dzhandle patches

martin f krafft madduck@debian.org
Wed, 23 Mar 2005 12:59:42 +0100


--Md/poaVZ8hnGTzuv
Content-Type: multipart/mixed; boundary="U+BazGySraz5kW0T"
Content-Disposition: inline


--U+BazGySraz5kW0T
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

A couple of small patches required to make dzhandle work in the
current situation:

  dzhandle_is_purged-fix.diff
    I think is_purged is assigned the wrong value. It should be true
    if either of Data.fs or Data.fs.index are missing. This patch
    fixes it.

  dzhandle_less-strict-for-now.diff
    Not all products in /usr/share/zope/Products are .dzproducts
    yet (e.g. Epoz, Extfile). For now, let's be less strict on the
    requirements. Note that this somehow breaks removal of products
    that are not yet dz-enabled. I will look at this some time soon.
 =20
  dzhandle_purge-no-comma.diff
    Small cosmetic change.
 =20
  dzhandle_usage-zope-version-fix.diff
    I am not sure about __doc__ anyway since it seems to be replaced
    by the registration of argument handlers, but anwyay... for
    consistency.

  dzhandle_no-assert.diff
    Not sure why this is assert is needed, and it gets in the way of
    adding non-dz-enabled products.

PS: could someone add me to the pkg-zope project? Username is
'madduck'. Thanks.

--=20
 .''`.     martin f. krafft <madduck@debian.org>
: :'  :    proud Debian developer, admin, user, and author
`. `'`
  `-  Debian - when you have better things to do than fixing a system
=20
Invalid/expired PGP subkeys? Use subkeys.pgp.net as keyserver!
=20
beware of bugs in the above code;
i have only proved it correct, not tried it.
                                                    -- donald e. knuth

--U+BazGySraz5kW0T
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="dzhandle_is_purged-fix.diff"

--- /tmp/dzhandle	Wed Mar 23 12:30:43 2005
+++ /usr/sbin/dzhandle	Wed Mar 23 12:30:55 2005
@@ -1463,8 +1463,9 @@
         self.addon_mode = None
         self.excluded_addons = []
         self.new_layout = os.path.exists(os.path.join(home, 'bin', 'runzope'))
-        self.is_purged = os.path.exists(os.path.join(home, 'var', 'Data.fs')) or \
-                         os.path.exists(os.path.join(home, 'var', 'Data.fs.index'))
+        self.is_purged = False
+        self.is_purged |= not os.path.exists(os.path.join(home, 'var', 'Data.fs'))
+        self.is_purged |= not os.path.exists(os.path.join(home, 'var', 'Data.fs.index'))
         if os.path.isfile(os.path.join(home, 'inituser')):
             self.userfile = 'inituser'
         elif os.path.isfile(os.path.join(home, 'access')):

--U+BazGySraz5kW0T
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="dzhandle_less-strict-for-now.diff"
Content-Transfer-Encoding: quoted-printable

--- /tmp/dzhandle	Wed Mar 23 12:52:59 2005
+++ /usr/sbin/dzhandle	Wed Mar 23 12:51:16 2005
@@ -931,10 +929,10 @@
                            % (self.options.atechnique, instance.addon_tech=
nique))
=20
         candidates =3D [addon for addon in locate_addons(self.addonClass)
-                      if addon.name in self.args[1:] or addon.directory in=
 self.args[1:]]
+                      if addon.name in self.args[1:] or getattr(addon, 'di=
rectory', None) in self.args[1:]]
         self.addons =3D []
         for arg in self.args[1:]:
-            matching =3D [addon for addon in candidates if addon.directory=
 =3D=3D arg]
+            matching =3D [addon for addon in candidates if addon.name =3D=
=3D arg]
             if matching:
                 self.addons.append(matching[0])
             else:
@@ -982,7 +980,7 @@
         for addon in self.addons:
             self.instance.add_addon(addon, global_options, self.options.at=
echnique)
             self.info("added %s `%s' to instance `%s' (%s)"
-                      % (self.kind, addon.directory, self.instance.name, s=
elf.instance.version))
+                      % (self.kind, addon.name, self.instance.name, self.i=
nstance.version))
=20
=20
 class DZAddProduct(ProductAttributes, DZAddAddon):
@@ -1590,12 +1588,12 @@
             if global_options.verbose:
                 print "copied: %s -> %s" % (addon.path, target_path)
=20
-        added_addon =3D addon.addonClass(target_path)
+        added_addon =3D addon.addonClass(target_path, False)
         self._installed_addons.append(added_addon)
         logging.info("added %s `%s'", added_addon.kind, added_addon.path)
=20
     def remove_addon(self, addon, global_options):
-        installed =3D [a for a in self.installed_addons() if addon.name =
=3D=3D a.name]
+        installed =3D [a for a in self.installed_addons() if getattr(addon=
, 'name', None) =3D=3D a.name]
         if len(installed) !=3D 1:
             raise DZError, "%s `%s' not installed in instance `%s'" \
                   % (a.kind, a.name, self.name)
@@ -1802,7 +1800,7 @@
                     addonClass =3D Product
                 else:
                     addonClass =3D Extension
-            addon =3D addonClass(path)
+            addon =3D addonClass(path, False)
             addons.append(addon)
     return addons
=20

--U+BazGySraz5kW0T
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="dzhandle_purge-no-comma.diff"

--- /tmp/dzhandle	Wed Mar 23 11:40:34 2005
+++ /usr/sbin/dzhandle	Wed Mar 23 12:11:57 2005
@@ -1659,7 +1661,7 @@
         if not self.new_layout:
             s += ' layout=(2.5 and before)'
         if self.is_purged:
-            s += ', purged'
+            s += ' purged'
         if verbose:
             pass
         return s

--U+BazGySraz5kW0T
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="dzhandle_usage-zope-version-fix.diff"
Content-Transfer-Encoding: quoted-printable

--- /tmp/dzhandle	Wed Mar 23 12:14:36 2005
+++ /usr/sbin/dzhandle	Wed Mar 23 12:21:10 2005
@@ -8,7 +8,7 @@
   -h/--help          -- print this help text
   -f/--force         -- force all kind of things, dont use it by default .=
=2E.
   -v/--verbose       -- be more verbose
-  -Z/--zope-version  -- comma separate list of zope version to act on.
+  -z/--zope-version  -- comma separate list of zope version to act on.
                         (default is act on all: 2.6, 2.7, 2.8, x3)
=20
 Instance Handling:

--U+BazGySraz5kW0T
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="dzhandle_no-assert.diff"
Content-Transfer-Encoding: quoted-printable

--- /tmp/dzhandle	Wed Mar 23 12:52:59 2005
+++ /usr/sbin/dzhandle	Wed Mar 23 12:51:16 2005
@@ -303,8 +303,6 @@
     def installed_by(self, master):
         """checks if the installed addon was installed by the `master' add=
on
         """
-        assert self.type !=3D ADDON_MASTER and master.type =3D=3D ADDON_MA=
STER
-       =20
         if self.name !=3D master.name or self.package !=3D master.package:
             # other addon, or same addon installed by other package
             return False

--U+BazGySraz5kW0T--

--Md/poaVZ8hnGTzuv
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)

iD8DBQFCQVouIgvIgzMMSnURAgttAJsF+OvrIx6zmBlZ9YToRErsCuevRQCgnj+l
nEEFE+dwPMMiWpS9SlYi0gQ=
=iTHM
-----END PGP SIGNATURE-----

--Md/poaVZ8hnGTzuv--