From 741bf9754acbd6b2da68cdc8e6e18f880b722d8d Mon Sep 17 00:00:00 2001
From: Dan Callaghan <dcallagh@redhat.com>
Date: May 01 2018 03:06:55 +0000
Subject: [PATCH 1/3] fix ~1.2 dependencies


---

diff --git a/nodejs.req b/nodejs.req
index f09dd87..72824db 100755
--- a/nodejs.req
+++ b/nodejs.req
@@ -183,7 +183,7 @@ def convert_dep(req, operator, version):
         # ~1.2
         elif operator == '~':
             deps.append('{0} >= {1}'.format(req, version))
-            deps.append('{0} < {1}'.format(req, parts[0]+1))
+            deps.append('{0} < {1}.{2}'.format(req, parts[0], parts[1]+1))
 
         #^1.2
         elif operator == '^':
diff --git a/test_nodejs_req.py b/test_nodejs_req.py
index c5b1f75..9c7024d 100644
--- a/test_nodejs_req.py
+++ b/test_nodejs_req.py
@@ -74,7 +74,7 @@ def test_process_dep():
     # Tilde ranges
     assert process_dep('npm(a)', '~1.2.3')  == '(npm(a) >= 1.2.3 with npm(a) < 1.3)'
     assert process_dep('npm(a)', '~1.2.x')  == '(npm(a) >= 1.2 with npm(a) < 1.3)'
-    #assert process_dep('npm(a)', '~1.2')    == '(npm(a) >= 1.2 with npm(a) < 1.3)'
+    assert process_dep('npm(a)', '~1.2')    == '(npm(a) >= 1.2 with npm(a) < 1.3)'
     assert process_dep('npm(a)', '~1.x')    == '(npm(a) >= 1 with npm(a) < 2)'
     assert process_dep('npm(a)', '~1')      == '(npm(a) >= 1 with npm(a) < 2)'
 

From 3647701e21558ec4eda79ada514c0c2587f14115 Mon Sep 17 00:00:00 2001
From: Dan Callaghan <dcallagh@redhat.com>
Date: May 01 2018 03:06:55 +0000
Subject: [PATCH 2/3] fix ^0.0.3 caret dependencies


---

diff --git a/nodejs.req b/nodejs.req
index 72824db..ab4d657 100755
--- a/nodejs.req
+++ b/nodejs.req
@@ -173,7 +173,7 @@ def convert_dep(req, operator, version):
                 deps.append('{0} >= {1}'.format(req, version))
                 deps.append('{0} < {1}.{2}'.format(req, parts[0], parts[1]+1))
             #^1.2.3
-            elif operator == '^' and parts[0:1] != [0,0]:
+            elif operator == '^' and parts[0:2] != [0,0]:
                 deps.append('{0} >= {1}'.format(req, version))
                 deps.append('{0} < {1}'.format(req, parts[0]+1))
             # 1.2.3 or 1.2.3-4 or ^0.0.3
diff --git a/test_nodejs_req.py b/test_nodejs_req.py
index 9c7024d..8a87b4a 100644
--- a/test_nodejs_req.py
+++ b/test_nodejs_req.py
@@ -81,7 +81,7 @@ def test_process_dep():
     # Caret ranges
     assert process_dep('npm(a)', '^1.2.3')  == '(npm(a) >= 1.2.3 with npm(a) < 2)'
     assert process_dep('npm(a)', '^0.2.3')  == '(npm(a) >= 0.2.3 with npm(a) < 0.3)'
-    #assert process_dep('npm(a)', '^0.0.3')  == '(npm(a) >= 0.0.3 with npm(a) < 0.0.4)'
+    assert process_dep('npm(a)', '^0.0.3')  == 'npm(a) = 0.0.3'
     #assert process_dep('npm(a)', '^1.2.x')  == '(npm(a) >= 1.2 with npm(a) < 2)'
     assert process_dep('npm(a)', '^1.2')    == '(npm(a) >= 1.2 with npm(a) < 2)'
     assert process_dep('npm(a)', '^0.1.x')  == '(npm(a) >= 0.1 with npm(a) < 0.2)'

From 2dc191eadaef8df595f4d12961f1a5f0be641497 Mon Sep 17 00:00:00 2001
From: Dan Callaghan <dcallagh@redhat.com>
Date: May 01 2018 03:06:55 +0000
Subject: [PATCH 3/3] fix ^0.1 caret dependencies


---

diff --git a/nodejs.req b/nodejs.req
index ab4d657..3c3dd1f 100755
--- a/nodejs.req
+++ b/nodejs.req
@@ -188,7 +188,10 @@ def convert_dep(req, operator, version):
         #^1.2
         elif operator == '^':
             deps.append('{0} >= {1}'.format(req, version))
-            deps.append('{0} < {1}'.format(req, parts[0]+1))
+            if len(parts) == 2 and parts[0] == 0:
+                deps.append('{0} < 0.{1}'.format(req, parts[1] + 1))
+            else:
+                deps.append('{0} < {1}'.format(req, parts[0] + 1))
 
 
     return deps
diff --git a/test_nodejs_req.py b/test_nodejs_req.py
index 8a87b4a..bfb50fd 100644
--- a/test_nodejs_req.py
+++ b/test_nodejs_req.py
@@ -85,11 +85,11 @@ def test_process_dep():
     #assert process_dep('npm(a)', '^1.2.x')  == '(npm(a) >= 1.2 with npm(a) < 2)'
     assert process_dep('npm(a)', '^1.2')    == '(npm(a) >= 1.2 with npm(a) < 2)'
     assert process_dep('npm(a)', '^0.1.x')  == '(npm(a) >= 0.1 with npm(a) < 0.2)'
-    #assert process_dep('npm(a)', '^0.1')    == '(npm(a) >= 0.1 with npm(a) < 0.2)'
+    assert process_dep('npm(a)', '^0.1')    == '(npm(a) >= 0.1 with npm(a) < 0.2)'
     assert process_dep('npm(a)', '^1.x')    == '(npm(a) >= 1 with npm(a) < 2)'
     assert process_dep('npm(a)', '^1')      == '(npm(a) >= 1 with npm(a) < 2)'
     assert process_dep('npm(a)', '^0.0.x')  == '(npm(a) >= 0.0 with npm(a) < 0.1)'
-    #assert process_dep('npm(a)', '^0.0')    == '(npm(a) >= 0.0 with npm(a) < 0.1)'
+    assert process_dep('npm(a)', '^0.0')    == '(npm(a) >= 0.0 with npm(a) < 0.1)'
     assert process_dep('npm(a)', '^0.x')    == 'npm(a) < 1'
     assert process_dep('npm(a)', '^0')      == 'npm(a) < 1'
 

