Repository: spack/spack

Issue:
spack reindex : breaks information on explicit
Reproducible by : 

```
$ spack install m4
```

At this point the file `opt/spack/.spack-db/index.yaml` looks like : 

``` yaml
database:
  installs:
    ev7o3dbqvwzojhesg3bvv5rv4oy27nzk:
      explicit: false
      installed: true
      path: /home/mculpo/PycharmProjects/spack/opt/spack/linux-x86_64/gcc-4.8/libsigsegv-2.10-ev7o3dbqvwzojhesg3bvv5rv4oy27nzk
      ref_count: 1
      spec:
        libsigsegv:
          arch: linux-x86_64
          compiler:
            name: gcc
            version: '4.8'
          dependencies: {}
          namespace: builtin
          parameters:
            cflags: []
            cppflags: []
            cxxflags: []
            fflags: []
            ldflags: []
            ldlibs: []
          version: '2.10'
    iubkayqswvtjdvnzc2xgs7lphsuybetv:
      explicit: true
      installed: true
      path: /home/mculpo/PycharmProjects/spack/opt/spack/linux-x86_64/gcc-4.8/m4-1.4.17-iubkayqswvtjdvnzc2xgs7lphsuybetv
      ref_count: 0
      spec:
        m4:
          arch: linux-x86_64
          compiler:
            name: gcc
            version: '4.8'
          dependencies:
            libsigsegv: ev7o3dbqvwzojhesg3bvv5rv4oy27nzk
          namespace: builtin
          parameters:
            cflags: []
            cppflags: []
            cxxflags: []
            fflags: []
            ldflags: []
            ldlibs: []
            sigsegv: true
          version: 1.4.17
  version: 0.9.1
```

After giving : 

```
$ spack reindex
```

everything is set to `explicit=false` : 

``` yaml
database:
  installs:
    ev7o3dbqvwzojhesg3bvv5rv4oy27nzk:
      explicit: false
      installed: true
      path: /home/mculpo/PycharmProjects/spack/opt/spack/linux-x86_64/gcc-4.8/libsigsegv-2.10-ev7o3dbqvwzojhesg3bvv5rv4oy27nzk
      ref_count: 1
      spec:
        libsigsegv:
          arch: linux-x86_64
          compiler:
            name: gcc
            version: '4.8'
          dependencies: {}
          namespace: builtin
          parameters:
            cflags: &id001 []
            cppflags: &id002 []
            cxxflags: &id003 []
            fflags: &id004 []
            ldflags: &id005 []
            ldlibs: &id006 []
          version: '2.10'
    iubkayqswvtjdvnzc2xgs7lphsuybetv:
      explicit: false
      installed: true
      path: /home/mculpo/PycharmProjects/spack/opt/spack/linux-x86_64/gcc-4.8/m4-1.4.17-iubkayqswvtjdvnzc2xgs7lphsuybetv
      ref_count: 0
      spec:
        m4:
          arch: linux-x86_64
          compiler:
            name: gcc
            version: '4.8'
          dependencies:
            libsigsegv: ev7o3dbqvwzojhesg3bvv5rv4oy27nzk
          namespace: builtin
          parameters:
            cflags: *id001
            cppflags: *id002
            cxxflags: *id003
            fflags: *id004
            ldflags: *id005
            ldlibs: *id006
            sigsegv: true
          version: 1.4.17
  version: 0.9.1
```



Discussion:

Resolving patch:
diff --git a/lib/spack/spack/database.py b/lib/spack/spack/database.py
--- a/lib/spack/spack/database.py
+++ b/lib/spack/spack/database.py
@@ -309,7 +309,11 @@ def reindex(self, directory_layout):
                 for spec in directory_layout.all_specs():
                     # Create a spec for each known package and add it.
                     path = directory_layout.path_for_spec(spec)
-                    self._add(spec, path, directory_layout)
+                    old_info = old_data.get(spec.dag_hash())
+                    explicit = False
+                    if old_info is not None:
+                        explicit = old_info.explicit
+                    self._add(spec, path, directory_layout, explicit=explicit)
 
                 self._check_ref_counts()
 


Test patch: