From owner-p4-projects@FreeBSD.ORG Sun Aug 5 02:36:42 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 1EB7916A41A; Sun, 5 Aug 2007 02:36:42 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A8F0916A419 for ; Sun, 5 Aug 2007 02:36:41 +0000 (UTC) (envelope-from andrew@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id AB9E813C46A for ; Sun, 5 Aug 2007 02:36:41 +0000 (UTC) (envelope-from andrew@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id l752afab015282 for ; Sun, 5 Aug 2007 02:36:41 GMT (envelope-from andrew@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id l752afkj015279 for perforce@freebsd.org; Sun, 5 Aug 2007 02:36:41 GMT (envelope-from andrew@freebsd.org) Date: Sun, 5 Aug 2007 02:36:41 GMT Message-Id: <200708050236.l752afkj015279@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to andrew@freebsd.org using -f From: Andrew Turner To: Perforce Change Reviews Cc: Subject: PERFORCE change 124703 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Aug 2007 02:36:42 -0000 http://perforce.freebsd.org/chv.cgi?CH=124703 Change 124703 by andrew@andrew_hermies on 2007/08/05 02:36:37 Add the get_directories call. It returns an array of directories the backend can update Use get_directories from the front end to build the list of directories to display Affected files ... .. //depot/projects/soc2007/andrew-update/backend/facund-be.c#21 edit .. //depot/projects/soc2007/andrew-update/frontend/facund.py#9 edit .. //depot/projects/soc2007/andrew-update/frontend/facund/computer.py#9 edit Differences ... ==== //depot/projects/soc2007/andrew-update/backend/facund-be.c#21 (text+ko) ==== @@ -73,6 +73,8 @@ static struct facund_response *facund_call_ping(const char *, struct facund_object *); +static struct facund_response *facund_get_directories(const char *, + struct facund_object *); static struct facund_response *facund_call_list_updates(const char *, struct facund_object *); static struct facund_response *facund_call_list_installed(const char *, @@ -515,6 +517,21 @@ return resp; } +static struct facund_response * +facund_get_directories(const char *id, struct facund_object *obj __unused) +{ + struct facund_object *dirs, *item; + unsigned int pos; + + dirs = facund_object_new_array(); + for (pos = 0; pos < watched_db_count; pos++) { + item = facund_object_new_string(); + facund_object_set_string(item, watched_db[pos].db_base); + facund_object_array_append(dirs, item); + } + return facund_response_new(id, 0, "No Error", dirs); +} + /* * Takes either a facund array or a facund string and sets base * or ports to true if they are contained in the object @@ -1013,6 +1030,7 @@ /* Add the callbacks for each call */ facund_server_add_call("ping", facund_call_ping); + facund_server_add_call("get_directories", facund_get_directories); facund_server_add_call("list_updates", facund_call_list_updates); facund_server_add_call("list_installed", facund_call_list_installed); facund_server_add_call("install_patches", facund_call_install_patches); ==== //depot/projects/soc2007/andrew-update/frontend/facund.py#9 (text+ko) ==== @@ -40,7 +40,6 @@ if __name__ == "__main__": computerModel = facund.gui.ComputerTreeModel() localComputer = facund.Computer("Local computer", '/tmp/facund') - localComputer.addDir('/') computerModel.addComputer(localComputer) updateModel = facund.gui.UpdateListModel() ==== //depot/projects/soc2007/andrew-update/frontend/facund/computer.py#9 (text+ko) ==== @@ -160,6 +160,15 @@ # Start the communication thread self.start() + + # Get a list of directories the server offers + call = facund.Call("get_directories", None) + self.__connection.doCall(call) + call.acquireLock() + call.releaseLock() + dirs = call.getResponse().getData().getData() + for dir in dirs: + self.addDir(dir.getData()) except socket.error: print "Couldn't connect to " + self.__host del self.__connection