[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commit-womb] gnumaint gnufsd-psql
From: |
Kaloian Doganov |
Subject: |
[commit-womb] gnumaint gnufsd-psql |
Date: |
Sun, 19 Apr 2009 07:14:47 +0000 |
CVSROOT: /sources/womb
Module name: gnumaint
Changes by: Kaloian Doganov <kaloian> 09/04/19 07:14:47
Modified files:
. : gnufsd-psql
Log message:
Export category slugs in addition to category names.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnumaint/gnufsd-psql?cvsroot=womb&r1=1.3&r2=1.4
Patches:
Index: gnufsd-psql
===================================================================
RCS file: /sources/womb/gnumaint/gnufsd-psql,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- gnufsd-psql 18 Apr 2009 12:26:35 -0000 1.3
+++ gnufsd-psql 19 Apr 2009 07:14:46 -0000 1.4
@@ -1,5 +1,5 @@
#!/usr/bin/env perl
-# $Id: gnufsd-psql,v 1.3 2009/04/18 12:26:35 kaloian Exp $
+# $Id: gnufsd-psql,v 1.4 2009/04/19 07:14:46 kaloian Exp $
# Extract information about GNU packages from the Free Software
# Directory's PostgreSQL database.
#
@@ -238,16 +238,20 @@
sub format_category($)
{
my ($id) = @_;
- my @chain;
+ my @name_chain;
+ my @slug_chain;
do {
$sth_category->bind_param (1, $id);
my $cat = row ($sth_category);
my $name = $cat->{"name"};
my $slug = $cat->{"slug"};
- push (@chain, $name);
+ push (@name_chain, $name);
+ push (@slug_chain, $slug);
$id = $cat->{"parent_category_id"};
} until ($id == 1);
- return "/" . join ("/", reverse (@chain));
+ my $names = join ("/", reverse (@name_chain));
+ my $slugs = join ("/", reverse (@slug_chain));
+ return "/$names (/$slugs)"
}
# Fetch categories for a project.
@@ -263,7 +267,7 @@
my $category_id = $category->{"category_id"};
push (@result, format_category ($category_id));
}
- return sort(@result);
+ return sort (@result);
}
# Dump a project to STDOUT.