diff --git a/.gitignore b/.gitignore
index 67d4496..d2e36c9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1 @@
-SOURCES/librhsm-9bd5080.tar.gz
+SOURCES/librhsm-0.0.1.tar.gz
diff --git a/.librhsm.metadata b/.librhsm.metadata
index 7c3c50f..d7755a1 100644
--- a/.librhsm.metadata
+++ b/.librhsm.metadata
@@ -1 +1 @@
-10ebeb7f2f543c4220befd12719a54229175f626 SOURCES/librhsm-9bd5080.tar.gz
+e770961abccfeebb5c8f6383274d1b695ba68c2b SOURCES/librhsm-0.0.1.tar.gz
diff --git a/SOURCES/0001-fix-building-with-json-glib-1.2.0.patch b/SOURCES/0001-fix-building-with-json-glib-1.2.0.patch
new file mode 100644
index 0000000..e2477ef
--- /dev/null
+++ b/SOURCES/0001-fix-building-with-json-glib-1.2.0.patch
@@ -0,0 +1,70 @@
+From 9bd50802ae027422720b358eaea3c01f2a55ecab Mon Sep 17 00:00:00 2001
+From: Igor Gnatenko <ignatenko@redhat.com>
+Date: Thu, 5 Jan 2017 11:25:02 +0100
+Subject: [PATCH] fix building with json-glib < 1.2.0
+
+Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
+---
+ CMakeLists.txt                      | 2 +-
+ rhsm/rhsm-entitlement-certificate.c | 8 ++++++++
+ rhsm/rhsm-utils.c                   | 4 ++++
+ 3 files changed, 13 insertions(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 2eff0df..887cce2 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -20,7 +20,7 @@ find_package (PkgConfig REQUIRED)
+ pkg_check_modules (GLIB REQUIRED glib-2.0>=2.44)
+ pkg_check_modules (GOBJECT REQUIRED gobject-2.0>=2.44)
+ pkg_check_modules (GIO REQUIRED gio-2.0>=2.44)
+-pkg_check_modules (JSON_GLIB REQUIRED json-glib-1.0>=1.2)
++pkg_check_modules (JSON_GLIB REQUIRED json-glib-1.0)
+ pkg_check_modules (OPENSSL REQUIRED openssl)
+ 
+ add_subdirectory (rhsm)
+diff --git a/rhsm/rhsm-entitlement-certificate.c b/rhsm/rhsm-entitlement-certificate.c
+index 5d37732..23b3b2c 100644
+--- a/rhsm/rhsm-entitlement-certificate.c
++++ b/rhsm/rhsm-entitlement-certificate.c
+@@ -20,6 +20,10 @@
+ 
+ #include <string.h>
+ 
++#if !JSON_CHECK_VERSION (1, 2, 0)
++G_DEFINE_AUTOPTR_CLEANUP_FUNC (JsonParser, g_object_unref)
++#endif
++
+ /**
+  * SECTION:rhsm-entitlement-certificate
+  * @short_description: the entitlement certificate
+@@ -147,7 +151,11 @@ parse_entitlement_data (const gchar  *data,
+   g_autoptr(GInputStream) zstream = g_memory_input_stream_new_from_data (zdata, zlen, g_free);
+   g_autoptr(GZlibDecompressor) decompressor = g_zlib_decompressor_new (G_ZLIB_COMPRESSOR_FORMAT_ZLIB);
+   g_autoptr(GInputStream) cstream = g_converter_input_stream_new (zstream, G_CONVERTER (decompressor));
++#if JSON_CHECK_VERSION (1, 2, 0)
+   g_autoptr(JsonParser) parser = json_parser_new_immutable ();
++#else
++  g_autoptr(JsonParser) parser = json_parser_new ();
++#endif
+   if (!json_parser_load_from_stream (parser, cstream, NULL, error))
+     return NULL;
+ 
+diff --git a/rhsm/rhsm-utils.c b/rhsm/rhsm-utils.c
+index d9bb4a2..956633d 100644
+--- a/rhsm/rhsm-utils.c
++++ b/rhsm/rhsm-utils.c
+@@ -27,6 +27,10 @@
+ #include <gio/gio.h>
+ #include <json-glib/json-glib.h>
+ 
++#if !JSON_CHECK_VERSION (1, 2, 0)
++G_DEFINE_AUTOPTR_CLEANUP_FUNC (JsonNode, json_node_free)
++#endif
++
+ /*
+  * rhsm_utils_str_replace:
+  * @haystack: (inout): pointer to a nul-terminated string.
+-- 
+2.12.1
+
diff --git a/SOURCES/0001-utils-add-support-for-multiple-entitlement-certifica.patch b/SOURCES/0001-utils-add-support-for-multiple-entitlement-certifica.patch
new file mode 100644
index 0000000..47d9dea
--- /dev/null
+++ b/SOURCES/0001-utils-add-support-for-multiple-entitlement-certifica.patch
@@ -0,0 +1,75 @@
+From 702a47c067d5c1cd27b0c815514746dc39afb85e Mon Sep 17 00:00:00 2001
+From: Igor Gnatenko <ignatenko@redhat.com>
+Date: Thu, 30 Mar 2017 18:45:19 +0200
+Subject: [PATCH] utils: add support for multiple entitlement certificates
+
+..for generation of yum repo.
+
+We just need to go through list and find all possible repositories.
+If there are duplicates, silently skip it (as sub-man does).
+
+Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
+---
+ rhsm/rhsm-utils.c | 33 ++++++++++++++++++++-------------
+ 1 file changed, 20 insertions(+), 13 deletions(-)
+
+diff --git a/rhsm/rhsm-utils.c b/rhsm/rhsm-utils.c
+index d9bb4a2..7b6a26b 100644
+--- a/rhsm/rhsm-utils.c
++++ b/rhsm/rhsm-utils.c
+@@ -195,25 +195,24 @@ rhsm_utils_yum_repo_from_context (RHSMContext *ctx)
+   g_autoptr(GPtrArray) entitlements = rhsm_context_get_entitlement_certificates (ctx);
+   g_autoptr(GPtrArray) products = rhsm_context_get_product_certificates (ctx);
+ 
+-  if (entitlements->len > 0)
++  /* Get all available tags from each of the products */
++  g_autoptr(GHashTable) available_tags = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
++  for (guint i = 0; i < products->len; i++)
+     {
+-      g_autoptr(GError) error = NULL;
+-      RHSMEntitlementCertificate *entitlement = g_ptr_array_index (entitlements, 0);
++      RHSMProductCertificate *product = g_ptr_array_index (products, i);
++      g_auto(GStrv) tags = g_strsplit (rhsm_product_certificate_get_tags (product), ",", -1);
++      for (GStrv tag = tags; *tag != NULL; tag++)
++        g_hash_table_add (available_tags, g_strdup (*tag));
++    }
++
++  for (guint i = 0; i < entitlements->len; i++)
++    {
++      RHSMEntitlementCertificate *entitlement = g_ptr_array_index (entitlements, i);
+       JsonNode *ent = rhsm_entitlement_certificate_get_entitlement (entitlement);
+       g_autoptr(JsonNode) contents = json_path_query ("$.products[*].content[*]", ent, NULL);
+       /* Even there is non-matching JsonPath, node will be empty array */
+       g_assert_nonnull (contents);
+ 
+-      /* Get all available tags from each of the products */
+-      g_autoptr(GHashTable) available_tags = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
+-      for (guint i = 0; i < products->len; i++)
+-        {
+-          RHSMProductCertificate *product = g_ptr_array_index (products, i);
+-          g_auto(GStrv) tags = g_strsplit (rhsm_product_certificate_get_tags (product), ",", -1);
+-          for (GStrv tag = tags; *tag != NULL; tag++)
+-            g_hash_table_add (available_tags, g_strdup (*tag));
+-        }
+-
+       g_autoptr(GList) elements = json_array_get_elements (json_node_get_array (contents));
+       const gchar *ctx_arch = rhsm_context_get_arch (ctx);
+       const gchar *ctx_baseurl = rhsm_context_get_baseurl (ctx);
+@@ -252,6 +251,14 @@ rhsm_utils_yum_repo_from_context (RHSMContext *ctx)
+             enabled = json_object_get_boolean_member (repo, "enabled");
+           if (id == NULL || name == NULL || path == NULL)
+             continue; /* TODO: make some error reporting here */
++
++          /* Clashing repositories */
++          if (g_key_file_has_group (repofile, id))
++            {
++              g_debug ("Repository '%s' has been already added, skipping", id);
++              continue;
++            }
++
+           g_autofree gchar *baseurl = g_strconcat (ctx_baseurl, path, NULL);
+           g_key_file_set_string (repofile, id, "name", name);
+           g_key_file_set_string (repofile, id, "baseurl", baseurl);
+-- 
+2.12.1
+
diff --git a/SPECS/librhsm.spec b/SPECS/librhsm.spec
index d3af647..8b14108 100644
--- a/SPECS/librhsm.spec
+++ b/SPECS/librhsm.spec
@@ -1,16 +1,19 @@
 %global libname rhsm
 
-%global commit 9bd50802ae027422720b358eaea3c01f2a55ecab
-%global shortcommit %(c=%{commit}; echo ${c:0:7})
-
 Name:           lib%{libname}
 Version:        0.0.1
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        Red Hat Subscription Manager library
 
 License:        LGPLv2+
 URL:            https://github.com/rpm-software-management/librhsm
-Source:         %{url}/archive/%{commit}/%{name}-%{shortcommit}.tar.gz
+Source:         %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
+
+# https://bugzilla.redhat.com/show_bug.cgi?id=1435653
+Patch0001:      0001-utils-add-support-for-multiple-entitlement-certifica.patch
+
+# Ugly workaround, drop in 7.4
+Patch1001:      0001-fix-building-with-json-glib-1.2.0.patch
 
 BuildRequires:  gcc
 BuildRequires:  cmake >= 2.8.5
@@ -18,6 +21,7 @@ BuildRequires:  make
 BuildRequires:  pkgconfig(glib-2.0) >= 2.44
 BuildRequires:  pkgconfig(gobject-2.0) >= 2.44
 BuildRequires:  pkgconfig(gio-2.0) >= 2.44
+# 1.2 is required, but we have Patch1001
 BuildRequires:  pkgconfig(json-glib-1.0)
 BuildRequires:  pkgconfig(openssl)
 
@@ -32,7 +36,7 @@ Requires:       %{name}%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
 %{summary}.
 
 %prep
-%autosetup -n %{name}-%{commit}
+%autosetup -p1
 
 %build
 mkdir %{_target_platform}
@@ -55,3 +59,8 @@ popd
 %{_libdir}/pkgconfig/%{name}.pc
 
 %changelog
+* Thu Mar 30 2017 Igor Gnatenko <ignatenko@redhat.com> - 0.0.1-2
+- Backport patch to support multiple entitlement certificates
+
+* Mon Jan 23 2017 Igor Gnatenko <ignatenko@redhat.com> - 0.0.1-1
+- Initial package