Repository: conda/conda

Issue:
Another clone bug
```
kfranz@0283:~/continuum/conda *master ❯ conda create --clone root -n rootclone
Source:      '/conda'
Destination: '/conda/envs/rootclone'
The following packages cannot be cloned out of the root environment:
 - conda-team::conda-4.1.0rc2-py27_0
 - conda-build-1.20.1-py27_0
Error: no URL found for package: <unknown>::gcc-4.8.5-3
```

But /conda/conda-meta/gcc-4.8.5-3.json has, in part,

```
 "channel": "https://repo.continuum.io/pkgs/free/osx-64/",
```

so the information is there.  The logic here is located around line 273 of `conda/misc.py`.



Discussion:

Resolving patch:
diff --git a/conda/install.py b/conda/install.py
--- a/conda/install.py
+++ b/conda/install.py
@@ -825,9 +825,11 @@ def load_linked_data(prefix, dist, rec=None):
     else:
         linked_data(prefix)
     url = rec.get('url')
-    channel, schannel = url_channel(url)
     if 'fn' not in rec:
         rec['fn'] = url.rsplit('/', 1)[-1] if url else dname + '.tar.bz2'
+    if not url and 'channel' in rec:
+        url = rec['url'] = rec['channel'] + rec['fn']
+    channel, schannel = url_channel(url)
     rec['channel'] = channel
     rec['schannel'] = schannel
     cprefix = '' if schannel == 'defaults' else schannel + '::'
diff --git a/conda/misc.py b/conda/misc.py
--- a/conda/misc.py
+++ b/conda/misc.py
@@ -93,11 +93,9 @@ def explicit(specs, prefix, verbose=False, force_extract=True, fetch_args=None):
                 _, conflict = install.find_new_location(dist)
                 if conflict:
                     actions[RM_FETCHED].append(conflict)
+                channels[url_p + '/'] = (schannel, 0)
                 actions[FETCH].append(dist)
-                if md5:
-                    # Need to verify against the package index
-                    verifies.append((dist + '.tar.bz2', md5))
-                    channels[url_p + '/'] = (schannel, 0)
+                verifies.append((dist + '.tar.bz2', md5))
             actions[EXTRACT].append(dist)
 
         # unlink any installed package with that name
@@ -106,19 +104,21 @@ def explicit(specs, prefix, verbose=False, force_extract=True, fetch_args=None):
             actions[UNLINK].append(linked[name])
         actions[LINK].append(dist)
 
+    # Pull the repodata for channels we are using
+    if channels:
+        index.update(fetch_index(channels, **fetch_args))
+
     # Finish the MD5 verification
-    if verifies:
-        index = fetch_index(channels, **fetch_args)
-        for fn, md5 in verifies:
-            info = index.get(fn)
-            if info is None:
-                sys.exit("Error: no package '%s' in index" % fn)
-            if 'md5' not in info:
-                sys.stderr.write('Warning: cannot lookup MD5 of: %s' % fn)
-            if info['md5'] != md5:
-                sys.exit(
-                    'MD5 mismatch for: %s\n   spec: %s\n   repo: %s'
-                    % (fn, md5, info['md5']))
+    for fn, md5 in verifies:
+        info = index.get(fn)
+        if info is None:
+            sys.exit("Error: no package '%s' in index" % fn)
+        if md5 and 'md5' not in info:
+            sys.stderr.write('Warning: cannot lookup MD5 of: %s' % fn)
+        if md5 and info['md5'] != md5:
+            sys.exit(
+                'MD5 mismatch for: %s\n   spec: %s\n   repo: %s'
+                % (fn, md5, info['md5']))
 
     execute_actions(actions, index=index, verbose=verbose)
     return actions


Test patch: