don't install prompt.h - use zypper --promptids instead (bnc#637352)
authorDominik Heidler <dheidler@suse.de>
Thu, 19 May 2011 12:48:34 +0000 (14:48 +0200)
committerDominik Heidler <dheidler@suse.de>
Thu, 19 May 2011 12:48:34 +0000 (14:48 +0200)
src/Zypper.cc
src/output/prompt.h
zypper.spec.cmake

index d9b95b6..11ca86a 100644 (file)
@@ -154,6 +154,7 @@ void print_main_help(Zypper & zypper)
   static string help_global_options = _("  Global Options:\n"
     "\t--help, -h\t\tHelp.\n"
     "\t--version, -V\t\tOutput the version number.\n"
+    "\t--promptids\t\tOutput a list of zypper's user prompts.\n"
     "\t--config, -c <file>\tUse specified config file instead of the default.\n"
     "\t--quiet, -q\t\tSuppress normal output, print only error\n"
     "\t\t\t\tmessages.\n"
@@ -320,6 +321,7 @@ void Zypper::processGlobalOptions()
     {"verbose",                    no_argument,       0, 'v'},
     {"quiet",                      no_argument,       0, 'q'},
     {"version",                    no_argument,       0, 'V'},
+    {"promptids",                  no_argument,       0,  0 },
     // rug compatibility alias for -vv
     {"debug",                      no_argument,       0,  0 },
     // rug compatibility alias for the default output level => ignored
@@ -595,7 +597,7 @@ void Zypper::processGlobalOptions()
       }
     }
   }
-  else if (!gopts.count("version"))
+  else if (!(gopts.count("version") || gopts.count("promptids")))
     setRunningHelp();
 
   if (command() == ZypperCommand::HELP)
@@ -641,6 +643,13 @@ void Zypper::processGlobalOptions()
       out().info(PACKAGE " " VERSION, Out::QUIET);
       ZYPP_THROW(ExitRequestException("version shown"));
     }
+    else if (gopts.count("promptids"))
+    {
+      #define PR_ENUML(nam, val) out().info(#nam "=" #val, Out::QUIET);
+      #define PR_ENUM(nam, val) PR_ENUML(nam, val)
+      #include "output/prompt.h"
+      ZYPP_THROW(ExitRequestException("promptids shown"));
+    }
     else
     {
       print_unknown_command_hint(*this);
index 460afdd..8254dae 100644 (file)
@@ -1,5 +1,23 @@
 #ifndef PROMPT_H_
-#define PROMPT_H_
+  #ifndef PR_ENUML
+    #define PR_ENUML(nam, val) nam = val
+  #else
+    #define PR_MAN
+  #endif
+  #ifndef PR_ENUM
+    #define PR_ENUM(nam, val) PR_ENUML(nam, val),
+  #endif
+#else
+  #ifndef PR_ENUML
+    #define PR_ENUML(nam, val)
+    #define PR_ENUM(nam, val)
+  #else
+    #define PR_MAN
+    #ifndef PR_ENUM
+      #define PR_ENUM(nam, val) PR_ENUML(nam, val),
+    #endif
+  #endif
+#endif
 
 /**
  * Defines identifiers of zypper's user prompts. Used in machine-readable output
  * </table>
  * \todo add the description of the rest
  */
+#ifndef PROMPT_H_
+#ifndef PR_MAN
 typedef enum
 {
-  PROMPT_YN_INST_REMOVE_CONTINUE         =  0,
-  PROMPT_DEP_RESOLVE                     =  1,
-  PROMPT_AUTH_USERNAME                   =  2,
-  PROMPT_AUTH_PASSWORD                   =  3,
-  PROMPT_ARI_RPM_DOWNLOAD_PROBLEM        =  4,
-  PROMPT_ARI_REPO_PROBLEM                =  5,
-  PROMPT_ARI_RPM_REMOVE_PROBLEM          =  6,
-  PROMPT_ARI_RPM_INSTALL_PROBLEM         =  7,
-  PROMPT_ARI_MEDIA_PROBLEM               =  8,
-  PROMPT_YN_MEDIA_CHANGE                 =  9,
-  PROMPT_YN_LICENSE_AGREE                = 10,
-  PROMPT_YN_GPG_UNSIGNED_FILE_ACCEPT     = 11,
-//  PROMPT_YN_GPG_KEY_IMPORT_TRUSTED       = 12,
-  PROMPT_YN_GPG_UNKNOWN_KEY_ACCEPT       = 13,
-  PROMPT_YN_GPG_KEY_TRUST                = 14,
-  PROMPT_YN_GPG_CHECK_FAILED_IGNORE      = 15,
-  PROMPT_GPG_NO_DIGEST_ACCEPT            = 16,
-  PROMPT_GPG_UNKNOWN_DIGEST_ACCEPT       = 17,
-  PROMPT_GPG_WRONG_DIGEST_ACCEPT         = 18,
-  PROMPT_YN_REMOVE_LOCK                  = 19,
-  PROMPT_PATCH_MESSAGE_CONTINUE          = 20,
-  PROMPT_ARI_PATCH_SCRIPT_PROBLEM        = 21,
-  PROMPT_MEDIA_EJECT                     = 22,
-  PROMPT_PACKAGEKIT_QUIT                 = 23
+#endif
+#endif
+  PR_ENUM(PROMPT_YN_INST_REMOVE_CONTINUE, 0)
+  PR_ENUM(PROMPT_DEP_RESOLVE, 1)
+  PR_ENUM(PROMPT_AUTH_USERNAME, 2)
+  PR_ENUM(PROMPT_AUTH_PASSWORD, 3)
+  PR_ENUM(PROMPT_ARI_RPM_DOWNLOAD_PROBLEM, 4)
+  PR_ENUM(PROMPT_ARI_REPO_PROBLEM, 5)
+  PR_ENUM(PROMPT_ARI_RPM_REMOVE_PROBLEM, 6)
+  PR_ENUM(PROMPT_ARI_RPM_INSTALL_PROBLEM, 7)
+  PR_ENUM(PROMPT_ARI_MEDIA_PROBLEM, 8)
+  PR_ENUM(PROMPT_YN_MEDIA_CHANGE, 9)
+  PR_ENUM(PROMPT_YN_LICENSE_AGREE, 10)
+  PR_ENUM(PROMPT_YN_GPG_UNSIGNED_FILE_ACCEPT, 11)
+//  PR_ENUM(PROMPT_YN_GPG_KEY_IMPORT_TRUSTED, 12)
+  PR_ENUM(PROMPT_YN_GPG_UNKNOWN_KEY_ACCEPT, 13)
+  PR_ENUM(PROMPT_YN_GPG_KEY_TRUST, 14)
+  PR_ENUM(PROMPT_YN_GPG_CHECK_FAILED_IGNORE, 15)
+  PR_ENUM(PROMPT_GPG_NO_DIGEST_ACCEPT, 16)
+  PR_ENUM(PROMPT_GPG_UNKNOWN_DIGEST_ACCEPT, 17)
+  PR_ENUM(PROMPT_GPG_WRONG_DIGEST_ACCEPT, 18)
+  PR_ENUM(PROMPT_YN_REMOVE_LOCK, 19)
+  PR_ENUM(PROMPT_PATCH_MESSAGE_CONTINUE, 20)
+  PR_ENUM(PROMPT_ARI_PATCH_SCRIPT_PROBLEM, 21)
+  PR_ENUM(PROMPT_MEDIA_EJECT, 22)
+  PR_ENUML(PROMPT_PACKAGEKIT_QUIT, 23)
+#ifndef PROMPT_H_
+#define PROMPT_H_
+#ifndef PR_MAN
 } PromptId;
 
+#endif
 #endif /*PROMPT_H_*/
+
+#undef PR_ENUM
+#undef PR_ENUML
+#undef PR_MAN
index 133a18c..d848f2f 100644 (file)
@@ -116,8 +116,6 @@ rm -rf "$RPM_BUILD_ROOT"
 %{_datadir}/zypper/zypper.aug
 %dir %{_datadir}/zypper/xml
 %{_datadir}/zypper/xml/xmlout.rnc
-%dir %{_includedir}/zypper
-%{_includedir}/zypper/prompt.h
 %doc %{_mandir}/*/*
 %doc %dir %{_datadir}/doc/packages/zypper
 %doc %{_datadir}/doc/packages/zypper/TODO