[csw-devel] SF.net SVN: gar:[13113] csw/mgar/gar/v2-uwatch2

wbonnet at users.sourceforge.net wbonnet at users.sourceforge.net
Sun Jan 30 00:12:49 CET 2011


Revision: 13113
          http://gar.svn.sourceforge.net/gar/?rev=13113&view=rev
Author:   wbonnet
Date:     2011-01-29 23:12:49 +0000 (Sat, 29 Jan 2011)

Log Message:
-----------
Many bug fixes

Modified Paths:
--------------
    csw/mgar/gar/v2-uwatch2/bin/uwatch
    csw/mgar/gar/v2-uwatch2/gar.lib.mk

Modified: csw/mgar/gar/v2-uwatch2/bin/uwatch
===================================================================
--- csw/mgar/gar/v2-uwatch2/bin/uwatch	2011-01-29 22:16:44 UTC (rev 13112)
+++ csw/mgar/gar/v2-uwatch2/bin/uwatch	2011-01-29 23:12:49 UTC (rev 13113)
@@ -184,31 +184,33 @@
         self.optionParser = OptionParser()
 
         # Add options to parser
-        self.optionParser.add_option("-V", "--verbose", help="Activate verbose mode", action="store_true", dest="verbose")
-        self.optionParser.add_option("-c", "--current-version", help="Current package version", action="store", dest="current_version")
-        self.optionParser.add_option("-d", "--target-location", help="Target location. This is the directory in which the branch will be created (parent of the branch directory). Default value is ../branches", action="store", dest="target_location")
-        self.optionParser.add_option("-r", "--regexp", help="Version matching regular expression", action="store", dest="regexp")
-        self.optionParser.add_option("-s", "--source-directory", help="Source directory (place from where the build is copied). Default value is current directory", action="store", dest="source_directory")
-        self.optionParser.add_option("-t", "--target-version", help="Package target version", action="store", dest="target_version")
-        self.optionParser.add_option("-u", "--upstream-url", help="Upstream version page url", action="store", dest="upstream_url")
+        self.optionParser.add_option("-V", "--verbose",     help="Activate verbose mode", action="store_true", dest="verbose")
+        self.optionParser.add_option("--current-version",    help="Current package version", action="store", dest="current_version")
+        self.optionParser.add_option("--target-location",    help="Target location. This is the directory in which the branch will be created (parent of the branch directory). Default value is ../branches", action="store", dest="target_location")
+        self.optionParser.add_option("--regexp",            help="Version matching regular expression", action="store", dest="regexp")
+        self.optionParser.add_option("--source-directory",  help="Source directory (place from where the build is copied). Default value is current directory", action="store", dest="source_directory")
+        self.optionParser.add_option("--target-version",    help="Package target version", action="store", dest="target_version")
+        self.optionParser.add_option("--upstream-url",      help="Upstream version page url", action="store", dest="upstream_url")
 
         # Option used for reporting uwatch result
-        self.optionParser.add_option("-E", "--uwatch-error", help="Flag used to report a uwatch error", action="store_true", dest="uwatch_error")
-        self.optionParser.add_option("-D", "--uwatch-deactivated", help="Flag used to report a uwatch error", action="store_true", dest="uwatch_deactivated")
-        self.optionParser.add_option("-R", "--uwatch-pkg-root", help="Defines the uwatch package root working directory", action="store", dest="uwatch_pkg_root")
+        self.optionParser.add_option("--uwatch-error",      help="Flag used to report a uwatch error", action="store_true", dest="uwatch_error")
+        self.optionParser.add_option("--uwatch-output",     help="Flag used to report the uwatch output", action="store", dest="uwatch_output")
+        self.optionParser.add_option("--uwatch-deactivated",help="Flag used to report a uwatch error", action="store_true", dest="uwatch_deactivated")
+        self.optionParser.add_option("--uwatch-pkg-root",   help="Defines the uwatch package root working directory", action="store", dest="uwatch_pkg_root")
 
         # Option used for storing version information in the database
-        self.optionParser.add_option("-g", "--gar-version", help="Gar version of the package", action="store", dest="gar_version")
-        self.optionParser.add_option("-w", "--upstream-version", help="Upstream version of the package", action="store", dest="upstream_version")
-        self.optionParser.add_option("-a", "--gar-path", help="Relative path in svn repository", action="store", dest="gar_path")
-        self.optionParser.add_option("-n", "--catalog-name", help="Catalog name", action="store", dest="catalog_name")
-        self.optionParser.add_option("-p", "--package-name", help="Package name", action="store", dest="package_name")
-        self.optionParser.add_option("-e", "--execution-date", help="Check date to be stored in the database", action="store", dest="execution_date")
+        self.optionParser.add_option("--gar-distfiles",     help="Gar version of the package", action="store", dest="gar_distfiles")
+        self.optionParser.add_option("--gar-version",       help="Gar version of the package", action="store", dest="gar_version")
+        self.optionParser.add_option("--upstream-version",  help="Upstream version of the package", action="store", dest="upstream_version")
+        self.optionParser.add_option("--gar-path",          help="Relative path in svn repository", action="store", dest="gar_path")
+        self.optionParser.add_option("--catalog-name",      help="Catalog name", action="store", dest="catalog_name")
+        self.optionParser.add_option("--package-name",      help="Package name", action="store", dest="package_name")
+        self.optionParser.add_option("--execution-date",    help="Check date to be stored in the database", action="store", dest="execution_date")
 
-        self.optionParser.add_option("-S", "--database-schema", help="Defines the database to use in the connection string", action="store", dest="database_schema")
-        self.optionParser.add_option("-H", "--database-host", help="Defines the database host to use in the connection string", action="store", dest="database_host")
-        self.optionParser.add_option("-U", "--database-user", help="Defines the database user to use in the connection string", action="store", dest="database_user")
-        self.optionParser.add_option("-P", "--database-password", help="Defines the database password to use in the connection string", action="store", dest="database_password")
+        self.optionParser.add_option("--database-schema",   help="Defines the database to use in the connection string", action="store", dest="database_schema")
+        self.optionParser.add_option("--database-host",     help="Defines the database host to use in the connection string", action="store", dest="database_host")
+        self.optionParser.add_option("--database-user",     help="Defines the database user to use in the connection string", action="store", dest="database_user")
+        self.optionParser.add_option("--database-password", help="Defines the database password to use in the connection string", action="store", dest="database_password")
 
     # -----------------------------------------------------------------------------------------------------------------
 
@@ -382,6 +384,14 @@
         if args.uwatch_pkg_root != None:
             self._uwatch_pkg_root = args.uwatch_pkg_root
 
+        # This member variable defines the uwatch last report output
+        if args.uwatch_output != None:
+            self._uwatch_output = args.uwatch_output
+
+        # This member variable defines the gar distfiles
+        if args.gar_distfiles != None:
+            self._gar_distfiles = args.gar_distfiles
+
     # -----------------------------------------------------------------------------------------------------------------
 
     def __init__(self):
@@ -408,6 +418,8 @@
         self._database_host = None
         self._database_user = None
         self._database_password = None
+        self._gar_distfiles = None
+        self._uwatch_output = None
 
     # -----------------------------------------------------------------------------------------------------------------
 
@@ -517,6 +529,17 @@
     def getUwatchPkgRoot(self):
         return self._uwatch_pkg_root
 
+    # -----------------------------------------------------------------------------------------------------------------
+
+    def getGarDistfiles(self):
+        return self._gar_distfiles
+
+    # -----------------------------------------------------------------------------------------------------------------
+
+    def getUwatchOutput(self):
+        return self._uwatch_output
+
+
 # ---------------------------------------------------------------------------------------------------------------------
 #
 #
@@ -1364,6 +1387,11 @@
                         print "Upgrading %(pkg)s gar version from %(current)s to %(next)s" % { 'pkg' : self.config.getCatalogName(), \
                                 'next' : self.config.getGarVersion() , 'current' : pkg["PKG_GAR_VERSION"] }
 
+            # Before closing the connection, there is a last thing to do... storing uwatch configuration into the database
+
+            # Yes, compare current gar version from commandline and database
+            cursor.execute("update UWATCH_PKG_VERSION set PKG_GAR_DISTFILES = %s, PKG_UFILES_REGEXP = %s, PKG_UPSTREAM_MASTER_SITES = %s, PKG_UWATCH_LAST_OUTPUT = %s where ID_PKG= %s" , ( self.config.getGarDistfiles(), self.config.getRegexp(), self.config.getUpstreamURL(), self.config.getUwatchOutput(), pkg["ID_PKG"] ) )
+
             # Close the cursor on the database
             cursor.close()
 
@@ -1384,6 +1412,16 @@
             print "Error : Gar path is not defined. Please use --gar-path flag, or --help to display help"
             argsValid = False
 
+        # Gar distfiles is mandatory
+        if self.config.getGarDistfiles() == None:
+            print "Error : Gar distfiles is not defined. Please use --gar-distfiles flag, or --help to display help"
+            argsValid = False
+
+        # Gar distfiles is mandatory
+        if self.config.getUwatchOutput() == None:
+            print "Error : uWatch output is not defined. Please use --uwatch-output flag, or --help to display help"
+            argsValid = False
+
         # Catalog name is mandatory
         if self.config.getCatalogName() == None:
             print "Error : Catalog name is not defined. Please use --catalog-name flag, or --help to display help"
@@ -1424,6 +1462,16 @@
         if self.config.getDatabasePassword() == None:
             print "Error : Database password is not defined. Please define the value in the ~/.uwatchrc file, use --database-password flag, or --help to display help"
             argsValid = False
+
+        # Regexp is mandatory
+        if self.config.getRegexp() == None:
+            print "Error : Regexp is not defined. Please use --regexp flag, or --help to display help"
+            argsValid = False
+
+        # UpstreamURL is mandatory
+        if self.config.getUpstreamURL() == None:
+            print "Error : Upstream version page URL is not defined. Please use --upstream-url flag, or --help to display help"
+            argsValid = False
     
         # If arguments are not valid raise an exception
         if argsValid == False:

Modified: csw/mgar/gar/v2-uwatch2/gar.lib.mk
===================================================================
--- csw/mgar/gar/v2-uwatch2/gar.lib.mk	2011-01-29 22:16:44 UTC (rev 13112)
+++ csw/mgar/gar/v2-uwatch2/gar.lib.mk	2011-01-29 23:12:49 UTC (rev 13113)
@@ -402,7 +402,7 @@
 			GARPATH=`echo $$line | awk '{ print $$1 }'` ; \
 			CATALOGNAME=`echo $$line | awk '{ print $$2 }'` ; \
 			PKGNAME=`echo $$line | awk '{ print $$3 }'` ; \
-			REPORTVERSION=`http_proxy=$(http_proxy) ftp_proxy=$(ftp_proxy) $(GARBIN)/uwatch update-package-version-database --catalog-name="$$CATALOGNAME" --package-name="$$PKGNAME" --execution-date="$$EXECUTIONDATE" --gar-path="$$GARPATH" --gar-version="$(VERSION)" --uwatch-deactivated` ; \
+			REPORTVERSION=`http_proxy=$(http_proxy) ftp_proxy=$(ftp_proxy) $(GARBIN)/uwatch update-package-version-database --catalog-name="$$CATALOGNAME" --package-name="$$PKGNAME" --execution-date="$$EXECUTIONDATE" --gar-path="$$GARPATH" --gar-version="$(VERSION)" --upstream-url="$(UPSTREAM_MASTER_SITES)" --regexp="$(UFILES_REGEX)" --gar-distfiles="$(DISTFILES)" --uwatch-output="Upstream Watch is disabled" --uwatch-deactivated` ; \
 			if [ "$$?" -ne "0" ] ; then \
 				echo "Error occured while executing uwatch update-package-version-database --uwatch-deactivated. Please check configuration with target get-uwatch-configuration. Here is the output of uwatch command :" ; \
 				echo "$$REPORTVERSION" ; \
@@ -431,7 +431,7 @@
 				GARPATH=`echo $$line | awk '{ print $$1 }'` ; \
 				CATALOGNAME=`echo $$line | awk '{ print $$2 }'` ; \
 				PKGNAME=`echo $$line | awk '{ print $$3 }'` ; \
-				REPORTVERSION=`http_proxy=$(http_proxy) ftp_proxy=$(ftp_proxy) $(GARBIN)/uwatch update-package-version-database --catalog-name="$$CATALOGNAME" --package-name="$$PKGNAME" --execution-date="$$EXECUTIONDATE" --gar-path="$$GARPATH" --gar-version="$(VERSION)" --uwatch-error` ; \
+				REPORTVERSION=`http_proxy=$(http_proxy) ftp_proxy=$(ftp_proxy) $(GARBIN)/uwatch update-package-version-database --catalog-name="$$CATALOGNAME" --package-name="$$PKGNAME" --execution-date="$$EXECUTIONDATE" --gar-path="$$GARPATH" --gar-version="$(VERSION)" --uwatch-error  --upstream-url="$(UPSTREAM_MASTER_SITES)" --regexp="$(UFILES_REGEX)" --gar-distfiles="$(DISTFILES)" --uwatch-output="Upstream Watch configuration error" ` ; \
 				if [ "$$?" -ne "0" ] ; then \
 					echo "Error occured while executing uwatch update-package-version-database --uwatch-error. Please check configuration with target get-uwatch-configuration. Here is the output of uwatch command :" ; \
 					echo "$$REPORTVERSION" ; \
@@ -448,7 +448,7 @@
 				GARPATH=`echo $$line | awk '{ print $$1 }'` ; \
 				CATALOGNAME=`echo $$line | awk '{ print $$2 }'` ; \
 				PKGNAME=`echo $$line | awk '{ print $$3 }'` ; \
-				REPORTVERSION=`http_proxy=$(http_proxy) ftp_proxy=$(ftp_proxy) $(GARBIN)/uwatch update-package-version-database --catalog-name="$$CATALOGNAME" --package-name="$$PKGNAME" --execution-date="$$EXECUTIONDATE" --gar-path="$$GARPATH" --gar-version="$(VERSION)" --uwatch-error` ; \
+				REPORTVERSION=`http_proxy=$(http_proxy) ftp_proxy=$(ftp_proxy) $(GARBIN)/uwatch update-package-version-database --catalog-name="$$CATALOGNAME" --package-name="$$PKGNAME" --execution-date="$$EXECUTIONDATE" --gar-path="$$GARPATH" --gar-version="$(VERSION)" --uwatch-error  --upstream-url="$(UPSTREAM_MASTER_SITES)" --regexp="$(UFILES_REGEX)" --gar-distfiles="$(DISTFILES)" --uwatch-output="$$LATEST" ` ; \
 				if [ "$$?" -ne "0" ] ; then \
 					echo "Error occured while executing uwatch update-package-version-database --uwatch-error. Please check configuration with target get-uwatch-configuration. Here is the output of uwatch command :" ; \
 					echo "$$REPORTVERSION" ; \
@@ -461,11 +461,11 @@
 			GARPATH=`echo $$line | awk '{ print $$1 }'` ; \
 			CATALOGNAME=`echo $$line | awk '{ print $$2 }'` ; \
 			PKGNAME=`echo $$line | awk '{ print $$3 }'` ; \
-			REPORTVERSION=`http_proxy=$(http_proxy) ftp_proxy=$(ftp_proxy) $(GARBIN)/uwatch update-package-version-database --catalog-name="$$CATALOGNAME" --package-name="$$PKGNAME" --execution-date="$$EXECUTIONDATE" --gar-path="$$GARPATH" --gar-version=$(VERSION) --upstream-version="$$LATEST"` ; \
+			REPORTVERSION=`http_proxy=$(http_proxy) ftp_proxy=$(ftp_proxy) $(GARBIN)/uwatch update-package-version-database --catalog-name="$$CATALOGNAME" --package-name="$$PKGNAME" --execution-date="$$EXECUTIONDATE" --gar-path="$$GARPATH" --gar-version=$(VERSION) --upstream-version="$$LATEST"  --upstream-url="$(UPSTREAM_MASTER_SITES)" --regexp="$(UFILES_REGEX)" --gar-distfiles="$(DISTFILES)" --uwatch-output="Successful" ` ; \
 			if [ "$$?" -ne "0" ] ; then \
 				echo "Error occured while executing uwatch update-package-version-database. Please check configuration with target get-uwatch-configuration. Here is the output of uwatch command :" ; \
 				echo "$$REPORTVERSION" ; \
-				REPORTVERSION=`http_proxy=$(http_proxy) ftp_proxy=$(ftp_proxy) $(GARBIN)/uwatch update-package-version-database --catalog-name="$$CATALOGNAME" --package-name="$$PKGNAME" --execution-date="$$EXECUTIONDATE" --gar-path="$$GARPATH" --gar-version="$(VERSION)" --uwatch-error` ; \
+				REPORTVERSION=`http_proxy=$(http_proxy) ftp_proxy=$(ftp_proxy) $(GARBIN)/uwatch update-package-version-database --catalog-name="$$CATALOGNAME" --package-name="$$PKGNAME" --execution-date="$$EXECUTIONDATE" --gar-path="$$GARPATH" --gar-version="$(VERSION)" --uwatch-error  --upstream-url="$(UPSTREAM_MASTER_SITES)" --regexp="$(UFILES_REGEX)" --gar-distfiles="$(DISTFILES)" --uwatch-output="$$REPORTVERSION" ` ; \
 				if [ "$$?" -ne "0" ] ; then \
 					echo "Error occured while executing uwatch update-package-version-database --uwatch-error. Please check configuration with target get-uwatch-configuration. Here is the output of uwatch command :" ; \
 					echo "$$REPORTVERSION" ; \


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