Package: npm2deb
Version: 0.2.4-1
Severity: whishlist
Tags: patch
thanks

Hi Leo,

I am bit lazy with ITPs, so maybe npm2deb should also query NEW whether something has been already uploaded.

The attached patch works at least for me ...

Thanks!
 Thorsten
diff --git a/npm2deb/helper.py b/npm2deb/helper.py
index 5e8c1c3..c51a3a5 100644
--- a/npm2deb/helper.py
+++ b/npm2deb/helper.py
@@ -78,6 +78,31 @@ def search_for_bug(module):
                     continue
         return result
 
+def search_in_new(module):
+    if isinstance(module, _Npm2Deb):
+        module = module.name
+    my_print('Looking for packages in NEW:')
+    _debug(1, "calling new-check")
+    found = False
+    formatted = "  {0:20} {1:>3}"
+    url = "https://api.ftp-master.debian.org/sources_in_suite/new";
+    _debug(1, "opening url %s" % url)
+    data = _urlopen(url).read().decode('utf-8')
+    data = _parseJSON(data)
+    result = []
+    for package in data:
+        name = package['source']
+        version = package['version']
+        if not module in name:
+            continue
+        found = True
+        result.append(package)
+        my_print(formatted.format(package['source'],
+                                  package['version']
+                                 ))
+    if not found:
+        my_print("  None")
+    return result
 
 def search_for_reverse_dependencies(module):
     if isinstance(module, _Npm2Deb):
diff --git a/npm2deb/scripts.py b/npm2deb/scripts.py
index b908216..673d144 100644
--- a/npm2deb/scripts.py
+++ b/npm2deb/scripts.py
@@ -100,6 +100,9 @@ def main(argv=None):
         '-d', '--debian', action="store_true",
         default=False, help='search for existing package in debian')
     parser_search.add_argument(
+        '-n', '--new', action="store_true",
+        default=False, help='search for existing package in NEW queue')
+    parser_search.add_argument(
         '-r', '--repository', action="store_true",
         default=False, help='search for existing repository in alioth')
     parser_search.add_argument(
@@ -139,10 +142,11 @@ def main(argv=None):
 def search_for_module(args):
     _helper.DO_PRINT = True
     # enable all by default
-    if not args.bug and not args.debian and not args.repository:
+    if not args.bug and not args.debian and not args.repository and not args.new:
         args.bug = True
         args.debian = True
         args.repository = True
+        args.new = True
     node_module = get_npm2deb_instance(args).name
     if args.debian:
         print("\nLooking for similiar package:")
@@ -154,6 +158,9 @@ def search_for_module(args):
     if args.bug:
         print("")
         _helper.search_for_bug(node_module)
+    if args.new:
+        print("")
+        _helper.search_in_new(node_module)
     print("")
 
     _show_mapper_warnings()
_______________________________________________
Pkg-javascript-devel mailing list
Pkg-javascript-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-javascript-devel

Reply via email to