From patchwork Fri Apr 21 18:09:40 2006 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Udo Richter X-Patchwork-Id: 12268 Received: from mail.gmx.net ([213.165.64.20]) by www.linuxtv.org with smtp (Exim 4.50) id 1FX067-0000Ii-Ai for vdr@linuxtv.org; Fri, 21 Apr 2006 20:11:15 +0200 Received: (qmail invoked by alias); 21 Apr 2006 18:10:44 -0000 Received: from p548A3FAB.dip0.t-ipconnect.de (EHLO [192.168.73.1]) [84.138.63.171] by mail.gmx.net (mp011) with SMTP; 21 Apr 2006 20:10:44 +0200 X-Authenticated: #1417946 Message-ID: <44491FE4.1030909@gmx.de> Date: Fri, 21 Apr 2006 20:09:40 +0200 From: Udo Richter User-Agent: Thunderbird 2.0a1 (Windows/20060420) MIME-Version: 1.0 To: VDR Mailing List X-Y-GMX-Trusted: 0 Subject: [vdr] [patch] Load plugins based on VDRVERSION and APIVERSION alternatively X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: VDR Mailing List List-Id: VDR Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Apr 2006 18:11:15 -0000 Status: O X-Status: X-Keywords: X-UID: 8968 Hi Klaus, The new APIVERSION of 1.3.47 will cause lots of trouble as soon as APIVERSION and VDRVERSION differ the first time, as this requires updated Makefiles for all plugins. In best case, VDR wont find a plugin because it has the wrong name, in worst case, an old version is used without noticing. On the other hand, its not too difficult to load plugins based on APIVERSION and VDRVERSION alternatively. That way, plugins that still use VDRVERSION continue to work. This even gives plugin authors the ability to ignore APIVERSION compatibility if the plugin depends on obscure differences between versions. The only drawback is that plugin authors will be lazy adapting to APIVERSION. The attached patch does the trick: It loads plugins using APIVERSION and VDRVERSION, and gives VDRVERSION the precedence. The patch also prefers VDRVERSION when loading "*". Feel free to use it if you want. Cheers, Udo --- vdr-1.3.47-orig/plugin.c 2006-04-21 19:08:02.000000000 +0200 +++ vdr-1.3.47/plugin.c 2006-04-21 19:53:32.709327912 +0200 @@ -294,11 +294,26 @@ if (p) { *p = 0; p += strlen(SO_INDICATOR); - if (strcmp(p, APIVERSION) == 0) { + if (strcmp(p, VDRVERSION) == 0) { + // VDRVERSION is always loaded char *name = e->d_name + strlen(LIBVDR_PREFIX); if (strcmp(name, "*") != 0) { // let's not get into a loop! - AddPlugin(e->d_name + strlen(LIBVDR_PREFIX)); + AddPlugin(name); + } + } + if (strcmp(p, APIVERSION) == 0) { + // APIVERSION found, check whether VDRVERSION exists too + char *name = e->d_name + strlen(LIBVDR_PREFIX); + char *buffer = NULL; + asprintf(&buffer, "%s/%s%s%s%s", directory, LIBVDR_PREFIX, name, SO_INDICATOR, VDRVERSION); + if (access(buffer,F_OK) != 0) { + // APIVERSION is the only existing one, use it + if (strcmp(name, "*") != 0) { // let's not get into a loop! + AddPlugin(name); + } } + // else: skip APIVERSION, the loop will load VDRVERSION instead + free(buffer); } } } @@ -310,7 +325,11 @@ if (p) *p = 0; char *buffer = NULL; - asprintf(&buffer, "%s/%s%s%s%s", directory, LIBVDR_PREFIX, s, SO_INDICATOR, APIVERSION); + asprintf(&buffer, "%s/%s%s%s%s", directory, LIBVDR_PREFIX, s, SO_INDICATOR, VDRVERSION); + if (access(buffer,F_OK) != 0) { // Plugin not found using VDRVERSION, try APIVERSION instead + free(buffer); + asprintf(&buffer, "%s/%s%s%s%s", directory, LIBVDR_PREFIX, s, SO_INDICATOR, APIVERSION); + } dlls.Add(new cDll(buffer, Args)); free(buffer); free(s);