Index: drupalorg_project/drupalorg_project.install
===================================================================
RCS file: /Users/wright/drupal/local_repo/contributions/modules/drupalorg/drupalorg_project/drupalorg_project.install,v
retrieving revision 1.2
diff -u -p -r1.2 drupalorg_project.install
--- drupalorg_project/drupalorg_project.install	26 Oct 2010 21:51:44 -0000	1.2
+++ drupalorg_project/drupalorg_project.install	24 Dec 2010 00:08:34 -0000
@@ -35,3 +35,32 @@ function drupalorg_project_update_6000()
   return $ret;
 }
 
+/**
+ * Properly initialize the {project_release_file}.weight column.
+ *
+ * On drupal.org, for installation profiles with multiple files per
+ * release (fully packaged distributions), we want the full profile
+ * (including core and all required projects) to have the lightest
+ * weight and float to the top. We want the projects + profile
+ * versions to be heavier and sink a bit, and the profile-only
+ * versions to sink to the bottom.
+ */
+function drupalorg_project_update_6001() {
+  $ret = array();
+
+  // Due to how the filenames work, we have to run 3 queries here, each one
+  // being more restrictive, and each one over-writing some of the results
+  // from the previous one.
+
+  // First, set all files for install profiles to weight 10.
+  $ret[] = update_sql("UPDATE {project_release_file} prf SET weight = 10 WHERE nid IN (SELECT prn.nid FROM {project_release_nodes} prn INNER JOIN {term_node} tn ON prn.pid = tn.nid WHERE tn.tid = 96)");
+
+  // Then, anything that includes "-core.tar" should be 0. This will include
+  // the "-no-core.tar" files, too, but we'll fix those next.
+  $ret[] = update_sql("UPDATE {project_release_file} prf SET weight = 0 WHERE fid IN (SELECT prf.fid FROM {project_release_file} prf INNER JOIN {files} f ON prf.fid = f.fid INNER JOIN {project_release_nodes} prn ON prf.nid = prn.nid INNER JOIN {term_node} tn ON prn.pid = tn.nid WHERE tn.tid = 96 and f.filename RLIKE '-core.tar')");
+
+  // Finally, set all the "-no-core.tar" files to 6.
+  $ret[] = update_sql("UPDATE {project_release_file} prf SET weight = 6 WHERE fid IN (SELECT prf.fid FROM {project_release_file} prf INNER JOIN {files} f ON prf.fid = f.fid INNER JOIN {project_release_nodes} prn ON prf.nid = prn.nid INNER JOIN {term_node} tn ON prn.pid = tn.nid WHERE tn.tid = 96 and f.filename RLIKE '-no-core.tar')");
+
+  return $ret;
+}
