Mailinglist Archive: yast-commit (687 mails)
| < Previous | Next > |
[yast-commit] r43536 - in /trunk/pkg-bindings: package/yast2-pkg-bindings.changes src/Keyring.cc src/PkgFunctions.h
- From: lslezak@xxxxxxxxxxxxxxxx
- Date: Thu, 10 Jan 2008 15:04:00 -0000
- Message-id: <20080110150401.1E41612E1B4@xxxxxxxxxxxxxxxx>
Author: lslezak
Date: Thu Jan 10 16:04:00 2008
New Revision: 43536
URL: http://svn.opensuse.org/viewcvs/yast?rev=43536&view=rev
Log:
- added Pkg::CheckGPGKeyFile() function - check whether the file
contains a valid GPG key
Modified:
trunk/pkg-bindings/package/yast2-pkg-bindings.changes
trunk/pkg-bindings/src/Keyring.cc
trunk/pkg-bindings/src/PkgFunctions.h
Modified: trunk/pkg-bindings/package/yast2-pkg-bindings.changes
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/package/yast2-pkg-bindings.changes?rev=43536&r1=43535&r2=43536&view=diff
==============================================================================
--- trunk/pkg-bindings/package/yast2-pkg-bindings.changes (original)
+++ trunk/pkg-bindings/package/yast2-pkg-bindings.changes Thu Jan 10 16:04:00
2008
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Thu Jan 10 16:02:50 CET 2008 - lslezak@xxxxxxx
+
+- added Pkg::CheckGPGKeyFile() function - check whether the file
+ contains a valid GPG key
+
+-------------------------------------------------------------------
Mon Jan 7 16:40:35 CET 2008 - lslezak@xxxxxxx
- added missing "log.h" file in Makefile.am
Modified: trunk/pkg-bindings/src/Keyring.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/src/Keyring.cc?rev=43536&r1=43535&r2=43536&view=diff
==============================================================================
--- trunk/pkg-bindings/src/Keyring.cc (original)
+++ trunk/pkg-bindings/src/Keyring.cc Thu Jan 10 16:04:00 2008
@@ -67,6 +67,30 @@
return YCPVoid();
}
+class GPGMap
+{
+ public:
+
+ GPGMap(const zypp::PublicKey &key, bool trusted)
+ {
+ gpg_map->add(YCPString("id"), YCPString(key.id()));
+ gpg_map->add(YCPString("name"), YCPString(key.name()));
+ gpg_map->add(YCPString("fingerprint"),
YCPString(key.fingerprint()));
+
+ // is the key trusted?
+ gpg_map->add(YCPString("trusted"), YCPBoolean(trusted));
+ }
+
+ YCPMap getMap() const
+ {
+ return gpg_map;
+ }
+
+ private:
+
+ YCPMap gpg_map;
+};
+
// A helper class
// converts PublicKey to YCPMap and adds it to an YCPList
class PublicKeyAdder : public std::unary_function<const zypp::PublicKey &,
void>
@@ -81,16 +105,9 @@
void operator() (const zypp::PublicKey &key)
{
- YCPMap ret;
-
- ret->add(YCPString("id"), YCPString(key.id()));
- ret->add(YCPString("name"), YCPString(key.name()));
- ret->add(YCPString("fingerprint"), YCPString(key.fingerprint()));
+ GPGMap gpgmap(key, trusted);
- // is the key trusted?
- ret->add(YCPString("trusted"), YCPBoolean(trusted));
-
- return list->add(ret);
+ return list->add(gpgmap.getMap());
}
private:
@@ -169,3 +186,26 @@
return YCPBoolean(ret);
}
+
+/****************************************************************************************
+ * @builtin CheckGPGKeyFile
+ * @short Check whether the file contains a valid GPG key
+ *
+ * @param keyfile path to the file
+ * @return true if the GPG key is valid
+ **/
+YCPValue PkgFunctions::CheckGPGKeyFile(const YCPString& keyfile)
+{
+ try
+ {
+ zypp::PublicKey key(keyfile->value());
+
+ GPGMap gpgmap(key, false);
+ return gpgmap.getMap();
+ }
+ catch(...)
+ {}
+
+ return YCPVoid();
+}
+
Modified: trunk/pkg-bindings/src/PkgFunctions.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/src/PkgFunctions.h?rev=43536&r1=43535&r2=43536&view=diff
==============================================================================
--- trunk/pkg-bindings/src/PkgFunctions.h (original)
+++ trunk/pkg-bindings/src/PkgFunctions.h Thu Jan 10 16:04:00 2008
@@ -693,6 +693,8 @@
YCPValue GPGKeys(const YCPBoolean& trusted);
/* TYPEINFO: boolean(string,boolean)*/
YCPValue DeleteGPGKey(const YCPString&, const YCPBoolean&);
+ /* TYPEINFO: map<string,any>(string)*/
+ YCPValue CheckGPGKeyFile(const YCPString&);
/* TYPEINFO: boolean()*/
YCPValue SourceReleaseAll ();
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx
Date: Thu Jan 10 16:04:00 2008
New Revision: 43536
URL: http://svn.opensuse.org/viewcvs/yast?rev=43536&view=rev
Log:
- added Pkg::CheckGPGKeyFile() function - check whether the file
contains a valid GPG key
Modified:
trunk/pkg-bindings/package/yast2-pkg-bindings.changes
trunk/pkg-bindings/src/Keyring.cc
trunk/pkg-bindings/src/PkgFunctions.h
Modified: trunk/pkg-bindings/package/yast2-pkg-bindings.changes
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/package/yast2-pkg-bindings.changes?rev=43536&r1=43535&r2=43536&view=diff
==============================================================================
--- trunk/pkg-bindings/package/yast2-pkg-bindings.changes (original)
+++ trunk/pkg-bindings/package/yast2-pkg-bindings.changes Thu Jan 10 16:04:00
2008
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Thu Jan 10 16:02:50 CET 2008 - lslezak@xxxxxxx
+
+- added Pkg::CheckGPGKeyFile() function - check whether the file
+ contains a valid GPG key
+
+-------------------------------------------------------------------
Mon Jan 7 16:40:35 CET 2008 - lslezak@xxxxxxx
- added missing "log.h" file in Makefile.am
Modified: trunk/pkg-bindings/src/Keyring.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/src/Keyring.cc?rev=43536&r1=43535&r2=43536&view=diff
==============================================================================
--- trunk/pkg-bindings/src/Keyring.cc (original)
+++ trunk/pkg-bindings/src/Keyring.cc Thu Jan 10 16:04:00 2008
@@ -67,6 +67,30 @@
return YCPVoid();
}
+class GPGMap
+{
+ public:
+
+ GPGMap(const zypp::PublicKey &key, bool trusted)
+ {
+ gpg_map->add(YCPString("id"), YCPString(key.id()));
+ gpg_map->add(YCPString("name"), YCPString(key.name()));
+ gpg_map->add(YCPString("fingerprint"),
YCPString(key.fingerprint()));
+
+ // is the key trusted?
+ gpg_map->add(YCPString("trusted"), YCPBoolean(trusted));
+ }
+
+ YCPMap getMap() const
+ {
+ return gpg_map;
+ }
+
+ private:
+
+ YCPMap gpg_map;
+};
+
// A helper class
// converts PublicKey to YCPMap and adds it to an YCPList
class PublicKeyAdder : public std::unary_function<const zypp::PublicKey &,
void>
@@ -81,16 +105,9 @@
void operator() (const zypp::PublicKey &key)
{
- YCPMap ret;
-
- ret->add(YCPString("id"), YCPString(key.id()));
- ret->add(YCPString("name"), YCPString(key.name()));
- ret->add(YCPString("fingerprint"), YCPString(key.fingerprint()));
+ GPGMap gpgmap(key, trusted);
- // is the key trusted?
- ret->add(YCPString("trusted"), YCPBoolean(trusted));
-
- return list->add(ret);
+ return list->add(gpgmap.getMap());
}
private:
@@ -169,3 +186,26 @@
return YCPBoolean(ret);
}
+
+/****************************************************************************************
+ * @builtin CheckGPGKeyFile
+ * @short Check whether the file contains a valid GPG key
+ *
+ * @param keyfile path to the file
+ * @return true if the GPG key is valid
+ **/
+YCPValue PkgFunctions::CheckGPGKeyFile(const YCPString& keyfile)
+{
+ try
+ {
+ zypp::PublicKey key(keyfile->value());
+
+ GPGMap gpgmap(key, false);
+ return gpgmap.getMap();
+ }
+ catch(...)
+ {}
+
+ return YCPVoid();
+}
+
Modified: trunk/pkg-bindings/src/PkgFunctions.h
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/pkg-bindings/src/PkgFunctions.h?rev=43536&r1=43535&r2=43536&view=diff
==============================================================================
--- trunk/pkg-bindings/src/PkgFunctions.h (original)
+++ trunk/pkg-bindings/src/PkgFunctions.h Thu Jan 10 16:04:00 2008
@@ -693,6 +693,8 @@
YCPValue GPGKeys(const YCPBoolean& trusted);
/* TYPEINFO: boolean(string,boolean)*/
YCPValue DeleteGPGKey(const YCPString&, const YCPBoolean&);
+ /* TYPEINFO: map<string,any>(string)*/
+ YCPValue CheckGPGKeyFile(const YCPString&);
/* TYPEINFO: boolean()*/
YCPValue SourceReleaseAll ();
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx
| < Previous | Next > |