Production now using chroot

Earlier today I run cvsup on the main website and pulled down the code for running make -V in a ‘jailed’ environment. It’s not actually a jail; it’s more of a chroot. You can read up on previous jail posts first, but the idea came from Ryan Steinmetz (zi@). I found the idea incredibly simple but yielded very good results. We’ll have to see how this affects things in the long term, with regards to accuracy and suitability of results. But for now, it’s in production after running for about 80 days in dev and beta.

Also accomplished today was the removal of links to CVSWeb on production. Along the way, I discovered (or perhaps rediscovered) [and hopefully fixed] a bug in the ports table. The last_commit_id field was empty for new ports.

The right field was being set in the ports structure, it was just never being saved. I updated the code:

$ cvs di -u
RCS file: /home/repositories/freshports-1/scripts/,v
retrieving revision 1.71
diff -u -r1.71
---	23 Mar 2013 14:14:28 -0000	1.71
+++	23 Mar 2013 20:34:23 -0000
@@ -247,10 +247,23 @@
 		$this->{id} = FreshPorts::Database::GetNextValue($FreshPorts::Constants::ports_seq, $dbh);
-		$sql = "insert into ports (id, element_id, category_id) values ( \
+		$sql = "insert into ports (id, element_id, category_id";
+        # really, this should always be supplied, but we are retrofiting this, so be cautious		
+		if (defined($this->{last_commit_id})) {
+		    $sql .= ', last_commit_id';
+		}
+        $sql .= ") values ( \
 				$this->{id}, \
 				$this->{element_id}, \ 
-				$this->{category_id})";
+				$this->{category_id}";
+		if (defined($this->{last_commit_id})) {
+			$sql .= ', ' . $this->{last_commit_id};
+		}
+        $sql .= ")";
 		print "sql is $sql\n";

The last_commit_id field was always being set, but never being saved, when a port was first created.

The fix to production was a next SQL statement:

UPDATE ports P
  SET last_commit_id = (
   SELECT CLP.commit_log_id
     FROM commit_log_ports CLP
    WHERE CLP.port_id =
   WHERE P.last_commit_id is null;

This works only because I knew that each port with a null entry for last_commit_id has exactly one commit against that port; the commit which created it. If there was more than one such commit, the nested query would have had more than one result, and I’d need to sort the data, and use the newest such commit.

Website Pin Facebook Twitter Myspace Friendfeed Technorati Digg Google StumbleUpon Premium Responsive

Leave a Comment

Scroll to Top