[csw-devel] SF.net SVN: gar:[18223] csw/mgar/gar/v2/lib/python/integrate_catalogs.py

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Tue Jun 5 10:16:38 CEST 2012


Revision: 18223
          http://gar.svn.sourceforge.net/gar/?rev=18223&view=rev
Author:   wahwah
Date:     2012-06-05 08:16:38 +0000 (Tue, 05 Jun 2012)
Log Message:
-----------
integrate-catalogs: Add easy undo

Create undo_* functions that revert the actions. To be used to roll back
integrations in case of any trouble.

Modified Paths:
--------------
    csw/mgar/gar/v2/lib/python/integrate_catalogs.py

Modified: csw/mgar/gar/v2/lib/python/integrate_catalogs.py
===================================================================
--- csw/mgar/gar/v2/lib/python/integrate_catalogs.py	2012-06-05 08:16:07 UTC (rev 18222)
+++ csw/mgar/gar/v2/lib/python/integrate_catalogs.py	2012-06-05 08:16:38 UTC (rev 18223)
@@ -41,6 +41,12 @@
   \${PKGDB} add-to-cat $osrel $arch $catrel_to $new_pkg["md5_sum"]
 #end for
 }
+function undo_new_pkg_$catalogname {
+#for arch, osrel, new_pkg in $diffs_by_catalogname[$catalogname]["new_pkgs"]:
+  # adding $new_pkg["basename"]
+  \${PKGDB} del-from-cat $osrel $arch $catrel_to $new_pkg["md5_sum"]
+#end for
+}
 #end if
 #if "removed_pkgs" in $diffs_by_catalogname[$catalogname]:
 function remove_pkg_$catalogname {
@@ -49,6 +55,12 @@
   \${PKGDB} del-from-cat $osrel $arch $catrel_to $rem_pkg["md5_sum"]
 #end for
 }
+function undo_remove_pkg_$catalogname {
+#for arch, osrel, rem_pkg in $diffs_by_catalogname[$catalogname]["removed_pkgs"]:
+  # removing $rem_pkg["basename"]
+  \${PKGDB} add-to-cat $osrel $arch $catrel_to $rem_pkg["md5_sum"]
+#end for
+}
 #end if
 #if "updated_pkgs" in $diffs_by_catalogname[$catalogname]:
 function #
@@ -67,6 +79,13 @@
   \${PKGDB} add-to-cat $osrel $arch $catrel_to $up_pkg_pair["to"]["md5_sum"]
 #end for
 }
+function undo_upgrade_$catalogname {
+#for arch, osrel, up_pkg_pair in $diffs_by_catalogname[$catalogname]["updated_pkgs"]:
+  # UNDO of $catalogname $up_pkg_pair["direction"] from $up_pkg_pair["from"]["version"] to $up_pkg_pair["to"]["version"]
+  \${PKGDB} del-from-cat $osrel $arch $catrel_to $up_pkg_pair["to"]["md5_sum"]
+  \${PKGDB} add-to-cat $osrel $arch $catrel_to $up_pkg_pair["from"]["md5_sum"]
+#end for
+}
 #end if
 
 #end for

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list