Index: gvspkg
===================================================================
--- gvspkg	(revision 42774)
+++ gvspkg	(revision 42775)
@@ -25,6 +25,29 @@
 
 #LINUX_EXEC_EXTENSION=".run" # antes ".bin"
 
+class Platform:
+  def __init__(self,os,arch,exe):
+    self.os = os
+    self.arch = arch
+    self.exe_extension = exe
+  
+  def getOS():
+    return self.os
+  
+  def getArch():
+    return self.arch
+  
+  def getExeExtension():
+    return self.exe_extension
+
+platforms = ( 
+  Platform("lin","x86",".run"),
+  Platform("lin","x86_64",".run"),
+  Platform("win","x86",".exe"),
+  Platform("win","x86_64",".exe")
+)
+
+
 def log(msg):
   f=open("/tmp/gvspkg.log","a")
   f.write(time.ctime())
@@ -547,15 +570,13 @@
 def mks(args):
     cmd = Command(args)
     try:
-        opts, args = getopt.getopt(cmd.getArgs("mks"), "ixscI:p:", ["index-only","include-default-selection", "clear-list", "exclude=", "excludepki=", "excludepkg=", "include=", "platform="])
+        opts, args = getopt.getopt(cmd.getArgs("mks"), "ixscI:", ["index-only","include-default-selection", "clear-list", "exclude=", "excludepki=", "excludepkg=", "include="])
     except getopt.GetoptError, err:
         # print help information and exit:
         print str(err) # will print something like "option -a not recognized"
         shorthelp(args)
         sys.exit(2)
 
-    platforms = ("x86", "x86_64")
-    oss = ("lin","win")
     default_selection = None
     index_only = False
     clear_list=False
@@ -567,13 +588,6 @@
             clear_list = True
         elif opt in ("-s", "--include-default-selection"):
             default_selection = "defaultPackages"
-        elif opt in ("-p", "--platform"):
-            if arg == "amd64":
-              arg = "x86_64"
-            if not platform in ( "x86", "x86_64", "all"):
-                msgerror("Unsuported platform value "+repr(platform)+". available values are x86, x86_64, amd64 or all")
-                sys.exit(3)
-            platforms = (arg,)
         elif opt in ("-x", "--exclude"):
             excludes_pki.append(arg)
             excludes_pkg.append(arg)
@@ -643,29 +657,28 @@
     mychmod(packages_gvspki+".md5",RWALL)
 
     if not index_only :
-      for cur_os in oss:
-        for cur_platform in platforms:
-          packages_gvspks = getDist() +"/packages-"+cur_os+"-"+cur_platform+".gvspks"
-          message( "Writing 'packages-"+cur_os+"-"+cur_platform+".gvspks' to '%s'" % packages_gvspks )
-          set = zipfile.ZipFile(packages_gvspks,"w",zipfile.ZIP_STORED)
-          for info in indexes:
-              if not ( info.code in excludes_pkg or info.getFullName() in excludes_pkg ):
-                  try:
-                      if info.hasPkg():
-                        if cur_os == "all" or info.getOS() in ("all", cur_os) :
-                          if cur_platform == "all" or info.getArch() in ("all", cur_platform) :
-                            set.write(info.getPkgFilename(), os.path.basename(info.getPkgFilename()))
-                  except Exception, ex:
-                      msgerror("Can't add package '%s', error %s" % (index, str(ex)))
-              else:
-                  debug("Exclude package '%s'" % info.getFullName())
-          if default_selection != None :
-              set.write(default_selection,default_selection)
-          set.close()
-          mychmod(packages_gvspks,RWALL)
+      for platform in platforms:
+        packages_gvspks = getDist() +"/packages-"+platform.getOS()+"-"+platform.getArch()+".gvspks"
+        message( "Writing 'packages-"+platform.getOS()+"-"+platform.getArch()+".gvspks' to '%s'" % packages_gvspks )
+        set = zipfile.ZipFile(packages_gvspks,"w",zipfile.ZIP_STORED)
+        for info in indexes:
+            if not ( info.code in excludes_pkg or info.getFullName() in excludes_pkg ):
+                try:
+                    if info.hasPkg():
+                      if info.getOS() in ("all", platform.getOS()) :
+                        if info.getArch() in ("all", platform.getArch()) :
+                          set.write(info.getPkgFilename(), os.path.basename(info.getPkgFilename()))
+                except Exception, ex:
+                    msgerror("Can't add package '%s', error %s" % (index, str(ex)))
+            else:
+                debug("Exclude package '%s'" % info.getFullName())
+        if default_selection != None :
+            set.write(default_selection,default_selection)
+        set.close()
+        mychmod(packages_gvspks,RWALL)
 
-          md5sum(packages_gvspks,packages_gvspks+".md5")
-          mychmod(packages_gvspks+".md5",RWALL)
+        md5sum(packages_gvspks,packages_gvspks+".md5")
+        mychmod(packages_gvspks+".md5",RWALL)
 
     message( "Createds package indexes.\n")
 
@@ -1041,16 +1054,15 @@
 """)
     f.close()
     fname_base = "gvSIG-desktop-%s-%s-%s" % (getVersion(),build,state)
-    for cur_os in ("lin","win") :
-      for arch in ("x86", "x86_64"):
-        linkfile(
-          join(build_folder,fname_base + "-" + cur_os + "-" + arch + "-online.zip"),
-          join(portable_folder,"standard",fname_base + "-" + cur_os + "-" + arch + "-online.zip")
-        )
-        linkfile(
-          join(build_folder,fname_base + "-" + cur_os + "-" + arch + ".gvspks"),
-          join(portable_folder,"standard",fname_base + "-" + cur_os + "-" + arch + ".gvspks")
-        )
+    for platform in platforms :
+      linkfile(
+        join(build_folder,fname_base + "-" + platform.getOS() + "-" + platform.getArch() + "-online.zip"),
+        join(portable_folder,"standard",fname_base + "-" + platform.getOS() + "-" + platform.getArch() + "-online.zip")
+      )
+      linkfile(
+        join(build_folder,fname_base + "-" + cur_os + "-" + platform.getArch() + ".gvspks"),
+        join(portable_folder,"standard",fname_base + "-" + platform.getOS() + "-" + platform.getArch() + ".gvspks")
+      )
     extract_make_portable(
       join(build_folder,fname_base + "-lin-x86_64-online.zip"),
       join(portable_folder)
@@ -1110,30 +1122,25 @@
     if not os.path.isdir(portable_folder) :
       do_prepare_portable(build,state)
     os.system('cd %s ; ./make-portable' % (portable_folder))
-    """
+    
     message("Removing previos portable zip files")
-    for cur_os in ("lin","win") :
-      for arch in ("x86", "x86_64"):
-        removefile(join(build_folder,"gvsig-desktop-%s-%s-%s-%s-%s.zip" %  (getVersion(),build,state,cur_os,arch)))
+    for platform in platforms :
+      removefile(join(build_folder,"gvSIG-desktop-%s-%s-%s-%s-%s.zip" %  (getVersion(),build,state,platform.getOS(),platform.getArch())))
 
     target_folder = join(getPackagesRoot(),"dists",getVersion(),"builds",build,"misc","portable","target")
-    os.chdir(target_folder)
-
-    for cur_os in ("lin","win") :
-      for arch in ("x86", "x86_64"):
-        message("Creating zip gvsig-desktop-%s-%s-%s-%s-%s.zip" % (getVersion(),build,state,cur_os,arch))
-        zipfolder(
-          "gvsig-desktop-%s-%s-%s-%s-%s" % (getVersion(),build,state,cur_os,arch),
-          join(build_folder,"gvsig-desktop-%s-%s-%s-%s-%s.zip" % (getVersion(),build,state,cur_os,arch))
-        )
-    """
+    for platform in platforms :
+      message("Moving zip gvSIG-desktop-%s-%s-%s-%s-%s.zip" % (getVersion(),build,state,platform.getOS(),platform.getArch()))
+      shutil.move(
+        join(portable_folder,"gvSIG-desktop-%s-%s-%s-%s-%s" % (getVersion(),build,state,platform.getOS(),platform.getArch())),
+        build_folder
+      )
     #message("Remove temporary folders")
     #shutil.rmtree(target_folder)
 
 def mkdist(args):
     cmd = Command(args)
     try:
-        opts, args = getopt.getopt(cmd.getArgs("mkdist"), "b:s:p:", [ "build=", "state=", "distribution_name=", "platform" ])
+        opts, args = getopt.getopt(cmd.getArgs("mkdist"), "b:s:", [ "build=", "state=", "distribution_name=" ])
     except getopt.GetoptError, err:
         # print help information and exit:
         print str(err) # will print something like "option -a not recognized"
@@ -1143,8 +1150,6 @@
     build=None
     state=None
     distribution_name = "standard"
-    platforms = ("x86", "x86_64")
-    oss = ("lin", "win")
 
     for opt, arg in opts:
         if opt in ("-b", "--build"):
@@ -1153,15 +1158,6 @@
             state=arg
         elif opt in ("-N", "--distrinution-name"):
             distribution_name = arg
-        elif opt in ("-p", "--platform"):
-          if args == "amd64":
-            # Aceptamos la plataforma amd64 como sinonimo de x86_64
-            args = "x86_64"
-          if not arg in ("x86","x86_64"):
-            print "Unsuported platform "+repr(platform)+", must be x86, x86_64 or amd64."
-            shorthelp(args)
-            sys.exit(2)
-          platforms = (arg,)
         else:
             assert False, "unhandled option %r" % opt
 
@@ -1190,25 +1186,18 @@
     shutil.copyfile("packages.gvspki", gvspki_filename)
     shutil.copyfile("packages.gvspki.md5", gvspki_filename +".md5")
 
-    #exec_extensions = {
-    #  "lin" : LINUX_EXEC_EXTENSION,
-    #  "win" : ".exe"
-    #}
+    for platform in platforms:
+        message( "Creating installers for platform "+cur_os+"/"+cur_arch+"...")
+        gvspks_filename = "builds/"+build+"/gvSIG-desktop-" + VERSION + "-" + build+ "-" + state + "-"+platform.getOS()+"-"+platform.getArch()+".gvspks"
+        online_filename = "builds/"+build+"/gvSIG-desktop-" + VERSION + "-" + build+ "-" + state + "-"+platform.getOS()+"-"+platform.getArch() + "-online.jar"
 
-    for cur_os in oss:
-      exec_extension = ".jar" #exec_extensions[cur_os]
-      for cur_platform in platforms:
-        message( "Creating installers for platform "+cur_os+"/"+cur_platform+"...")
-        gvspks_filename = "builds/"+build+"/gvSIG-desktop-" + VERSION + "-" + build+ "-" + state + "-"+cur_os+"-"+cur_platform+".gvspks"
-        online_filename = "builds/"+build+"/gvSIG-desktop-" + VERSION + "-" + build+ "-" + state + "-"+cur_os+"-"+cur_platform + "-online" + exec_extension
-
         if not os.path.isfile(online_filename):
-          msgwarn("Can't access the online installable for "+cur_os+"/"+cur_platform + " ("+online_filename+").")
+          msgwarn("Can't access the online installable for "+platform.getOS()+"/"+platform.getArch() + " ("+online_filename+").")
           continue
 
-        message( "Coping packages-"+cur_os+"-"+cur_platform+".gvspks to "+ gvspks_filename)
-        shutil.copyfile("packages-"+cur_os+"-"+cur_platform+".gvspks", gvspks_filename)
-        shutil.copyfile("packages-"+cur_os+"-"+cur_platform+".gvspks.md5", gvspks_filename +".md5")
+        message( "Coping packages-"+platform.getOS()+"-"+platform.getArch()+".gvspks to "+ gvspks_filename)
+        shutil.copyfile("packages-"+platform.getOS()+"-"+platform.getArch()+".gvspks", gvspks_filename)
+        shutil.copyfile("packages-"+platform.getOS()+"-"+platform.getArch()+".gvspks.md5", gvspks_filename +".md5")
 
         message( "Add execution permissions to online installables....")
         mychmod(online_filename,RWXALL)
@@ -1217,12 +1206,12 @@
         mychmod(online_filename+".md5",RWALL)
 
 
-        executeCommand("mkinstall" , "--addjre"+cur_os, online_filename, gvspks_filename)
+        executeCommand("mkinstall" , "--addjre"+platform.getOS(), online_filename, gvspks_filename)
 
         message( "Renaming files from custom to standard...")
-        target_filename = "builds/"+build+"/gvSIG-desktop-" + VERSION + "-" + build+ "-" + state + "-"+cur_os+"-"+cur_platform+"-"+distribution_name + exec_extension
+        target_filename = "builds/"+build+"/gvSIG-desktop-" + VERSION + "-" + build+ "-" + state + "-"+platform.getOS()+"-"+platform.getArch()+"-"+distribution_name + ".jar"
         shutil.move(
-            "builds/"+build+"/gvSIG-desktop-" + VERSION + "-" + build+ "-" + state + "-"+cur_os+"-"+cur_platform + "-custom" + exec_extension,
+            "builds/"+build+"/gvSIG-desktop-" + VERSION + "-" + build+ "-" + state + "-"+platform.getOS()+"-"+platform.getArch() + "-custom.jar",
             target_filename
         )
         mychmod(target_filename,RWXALL)
@@ -1230,7 +1219,7 @@
         md5sum(target_filename,target_filename+".md5")
         mychmod(target_filename+".md5",RWALL)
 
-        message( "Createds installers for platform "+cur_os+"/"+cur_platform+"\n")
+        message( "Createds installers for platform "+platform.getOS()+"/"+platform.getArch()+"\n")
 
     message( "Coping html index to browse paqueges of the distro.")
     shutil.rmtree("builds/"+build+"/web", ignore_errors=True)
@@ -1563,14 +1552,12 @@
      --excludepki pkgcode
      --exclude pkgcode
      -s, --include-default-selection
-     -p, --platform=name
      -i, --index-only
      -I full-path-to-package, --include full-path-to-package
 
 mkdist [OPTIONS]
      -s STATE, --state=STATE
      -b BUILD, --build=BUILD
-     -p, --platform=all|x86|x86_64|amd64
      -N, --distribution-name=name
 
 mkmirror [OPTIONS]
@@ -1691,19 +1678,6 @@
         directorio corriente, con los nombres de paquetes a seleccionar
         por defecto.
 
-     -p | --platform=name
-        Indica para que plataforma queremos generar el conjunto de paquetes.
-        Es un parametro opcional.
-        Sus valores pueden ser:
-        - all (Se incluiren los de todas las plataformas, no solo los multiplataforma)
-        - x86
-        - x86_64
-        - amd64 (sinonimo aceptado para x86_64)
-        Si no se indica plataforma se generara para "all".
-        El indice,"gvspki", siempre llevara los de todas las plataformas, esta opcion
-        solo afecta a la genracion del "gvspks".
-
-
      -i | --index-only
         No crea el fichero gvspks, solo crea el gvspki
 
@@ -1728,16 +1702,6 @@
         los ficheros en la carpeta builds de la distribucion y para saber donde debe
         dejar los ficheros generados.
 
-     -p | --platform=name
-        Indica para que plataforma queremos generar los instalables de gvSIG.
-        Es un parametro opcional.
-        Sus valores pueden ser:
-        - all (si se indica se generara para x86)
-        - x86
-        - x86_64
-        - amd64 (sinonimo aceptado para x86_64)
-        Si no se indica plataforma se generara para x86.
-
      -N | --distribution-name=name
         Nombre usado como sufijo del nuevo binario a generar. Por defecto si no se
         indica valdra "standard".
