← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~linuxdcpp-team/linuxdcpp/trunk] Rev 356: Added build and version information to terminal output

 

Merge authors:
  Razzloss (razzloss)
------------------------------------------------------------
revno: 356 [merge]
committer: Razzloss <razzloss@xxxxxxxxx>
branch nick: master
timestamp: Tue 2010-03-16 11:51:21 +0200
message:
  Added build and version information to terminal output
added:
  config.h.in
  linux/version.hh
modified:
  Changelog.txt
  SConstruct
  glade/mainwindow.glade
  linux/WulforUtil.cc
  linux/WulforUtil.hh
  linux/mainwindow.cc
  linux/wulfor.cc


--
lp:linuxdcpp
https://code.launchpad.net/~linuxdcpp-team/linuxdcpp/trunk

Your team LinuxDC++ Team is subscribed to branch lp:linuxdcpp.
To unsubscribe from this branch go to https://code.launchpad.net/~linuxdcpp-team/linuxdcpp/trunk/+edit-subscription.
=== modified file 'Changelog.txt'
--- Changelog.txt	2010-03-15 20:46:38 +0000
+++ Changelog.txt	2010-03-16 09:51:21 +0000
@@ -46,6 +46,7 @@
 [2010-02-28] Added a setting to disable fast hashing method. (Steven)
 [2010-03-11] lp#361735: Improved magnet link support. Support for passing commands to running LinuxDC++ client. (Razzloss)
 [2010-03-15] lp#494392: Search by TTH should open in a new tab. (Razzloss)
+[2010-03-16] Added build and version information to terminal output. (Razzloss)
 
 *** 1.0.3 2009-02-01 ***
 [2008-08-10] lp#256236: Fixed a crash on startup when using auto-open options.

=== modified file 'SConstruct'
--- SConstruct	2010-02-14 20:35:24 +0000
+++ SConstruct	2010-03-16 09:46:02 +0000
@@ -41,6 +41,30 @@
 	context.Result(retval)
 	return retval
 
+def CheckBZRRevision():
+	print "Checking tree revision...",
+	ret = commands.getoutput('bzr revno')
+	print ret
+	retval = 0
+	try:
+		if string.atoi(ret) > 0:
+			retval = string.atoi(ret)
+	except ValueError:
+		print "Error while getting revision number"
+
+	return retval
+
+def config_h_build(target, source, env):
+	config_h_defines = env.Dictionary()
+
+	for a_target, a_source in zip(target, source):
+		config_h = file(str(a_target), "w")
+		config_h_in = file(str(a_source), "r")
+		config_h.write(config_h_in.read() % config_h_defines)
+		config_h_in.close()
+		config_h.close()
+
+
 # Install app icons to share/icons and all others to share/linuxdcpp/icons
 def install_icons(icons_dir, env):
 	prefix = env['FAKE_ROOT'] + os.path.join(env['PREFIX'], 'share')
@@ -205,6 +229,13 @@
 	if conf.CheckHeader(['sys/types.h', 'sys/socket.h', 'ifaddrs.h', 'net/if.h']):
 		conf.env['HAVE_IFADDRS_H'] = True
 
+	rev = CheckBZRRevision()
+	if rev != 0: 	
+			conf.env['LDCPP_BZRREV'] = rev
+	else:
+		print 'Revision number will not be included'
+
+
 	env = conf.Finish()
 
 
@@ -260,7 +291,9 @@
 # Build
 # ----------------------------------------------------------------------
 
+
 	Export('env')
+	config_h = env.AlwaysBuild(env.Command('config.h','config.h.in', config_h_build))
 
 	# Build the dcpp library
 	libdcpp = SConscript(dirs = 'dcpp', variant_dir = BUILD_PATH + 'dcpp', duplicate = 0)

=== added file 'config.h.in'
--- config.h.in	1970-01-01 00:00:00 +0000
+++ config.h.in	2010-03-16 09:46:02 +0000
@@ -0,0 +1,14 @@
+/**
+ *
+ * Config.h will be re-generated by build script. Do not modify it.
+ * Make all modifications to config.h.in.
+ *
+ **/
+
+#if %(LDCPP_BZRREV)d != 0
+	#define LDCPP_BZRREV "%(LDCPP_BZRREV)d"
+#endif
+
+
+
+

=== modified file 'glade/mainwindow.glade'
--- glade/mainwindow.glade	2009-10-11 03:17:46 +0000
+++ glade/mainwindow.glade	2010-03-15 12:30:41 +0000
@@ -822,8 +822,8 @@
     <property name="copyright" translatable="yes">Copyright © 2004-2009 Jens Oknelid</property>
     <property name="comments" translatable="yes">A DC++ port for Linux
 
-LinuxDC++ version: 1.0.3+bzr
-Core version: 0.75</property>
+LinuxDC++ version: %s
+Core version: %s</property>
     <property name="license" translatable="yes">
 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
 

=== modified file 'linux/WulforUtil.cc'
--- linux/WulforUtil.cc	2010-03-13 10:34:37 +0000
+++ linux/WulforUtil.cc	2010-03-15 12:30:41 +0000
@@ -66,13 +66,14 @@
 bool WulforUtil::parseArguments(int *argc, char **argv[])
 {
 	gchar* magnet = NULL, *address = NULL;
-	gboolean show = FALSE, refresh = FALSE;
+	gboolean show = FALSE, refresh = FALSE, version = FALSE;
 
 	GOptionEntry entries[] = {
 		{ "magnet", 'm', 0, G_OPTION_ARG_STRING, &magnet, "Search magnet from connected hubs.", NULL },
 		{ "connect", 'c', 0, G_OPTION_ARG_STRING, &address, "Connect to given hub", NULL },
 		{ "show", 's', 0, G_OPTION_ARG_NONE, &show, "Show running instance (or start a new one)", NULL },
 		{ "refresh", 'r', 0, G_OPTION_ARG_NONE, &refresh, "Refresh filelist. LinuxDC++ has to be running for this to have an effect.", NULL },
+		{ "version", 'V', 0, G_OPTION_ARG_NONE, &version, "Print version information and exit.", NULL },
 		{ NULL }
 	};
 
@@ -89,13 +90,15 @@
 	else
 	{
 		if (show)
-			startArguments.show = true;
+			startArguments.show = TRUE;
 		if (refresh)
-			startArguments.refresh = true;
+			startArguments.refresh = TRUE;
 		if (magnet)
 			startArguments.magnets.push_back(std::string(magnet));
 		if (address)
 			startArguments.urls.push_back(std::string(address));
+		if (version)
+			startArguments.version = TRUE;
 
 		// Handle extra 'file' arguments passed to commandline
 		parseExtraArguments(*argc, *argv);

=== modified file 'linux/WulforUtil.hh'
--- linux/WulforUtil.hh	2010-03-13 10:34:37 +0000
+++ linux/WulforUtil.hh	2010-03-15 12:30:41 +0000
@@ -33,6 +33,7 @@
 	std::vector<std::string> urls;
 	bool show;
 	bool refresh;
+	bool version;
 };
 
 class WulforUtil

=== modified file 'linux/mainwindow.cc'
--- linux/mainwindow.cc	2010-03-13 10:34:37 +0000
+++ linux/mainwindow.cc	2010-03-15 12:30:41 +0000
@@ -36,6 +36,8 @@
 #include <dcpp/Upload.h>
 #include <dcpp/Download.h>
 #include <dcpp/ClientManager.h>
+#include <dcpp/version.h>
+#include "version.hh"
 #include "downloadqueue.hh"
 #include "favoritehubs.hh"
 #include "finishedtransfers.hh"
@@ -81,6 +83,13 @@
 
 	gtk_about_dialog_set_email_hook((GtkAboutDialogActivateLinkFunc)onAboutDialogActivateLink_gui, (gpointer)this, NULL);
 	gtk_about_dialog_set_url_hook((GtkAboutDialogActivateLinkFunc)onAboutDialogActivateLink_gui, (gpointer)this, NULL);
+	const char *aboutCommentsFormat = gtk_about_dialog_get_comments(GTK_ABOUT_DIALOG(getWidget("aboutDialog")));
+	int len = strlen(aboutCommentsFormat) + strlen(LINUXDCPP_VERSION_STRING) + strlen(VERSIONSTRING) + 1;
+	char* commentsStr = new char[len];
+	g_snprintf(commentsStr, len, aboutCommentsFormat, LINUXDCPP_VERSION_STRING, VERSIONSTRING);
+	gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(getWidget("aboutDialog")), commentsStr);
+	delete[] commentsStr;
+
 	// This has to be set in code in order to activate the link
 	gtk_about_dialog_set_website(GTK_ABOUT_DIALOG(getWidget("aboutDialog")), "https://launchpad.net/linuxdcpp";);
 	gtk_window_set_transient_for(GTK_WINDOW(getWidget("aboutDialog")), window);

=== added file 'linux/version.hh'
--- linux/version.hh	1970-01-01 00:00:00 +0000
+++ linux/version.hh	2010-03-15 15:10:36 +0000
@@ -0,0 +1,30 @@
+/*
+ * Copyright © 2004-2010 Jens Oknelid, paskharen@xxxxxxxxx
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * In addition, as a special exception, compiling, linking, and/or
+ * using OpenSSL with this program is allowed.
+ */
+
+#include "../config.h"
+
+#ifndef LDCPP_BZRREV
+	#define LINUXDCPP_VERSION_STRING	"1.1.0"
+#else
+	#define LINUXDCPP_VERSION_STRING	"1.1.0-r" LDCPP_BZRREV
+#endif
+
+

=== modified file 'linux/wulfor.cc'
--- linux/wulfor.cc	2010-03-13 10:34:37 +0000
+++ linux/wulfor.cc	2010-03-16 09:46:02 +0000
@@ -25,7 +25,9 @@
 
 #include <dcpp/stdinc.h>
 #include <dcpp/DCPlusPlus.h>
+#include <dcpp/version.h>
 
+#include "version.hh"
 #include "settingsmanager.hh"
 #include "wulformanager.hh"
 #include "WulforUtil.hh"
@@ -37,6 +39,21 @@
 	std::cout << "Loading: " << a << std::endl;
 }
 
+void printVersionInfo() 
+{
+	std::cout << "Version information: " << std::endl;
+	std::cout << "\t" <<  APPNAME << " version: " << LINUXDCPP_VERSION_STRING << std::endl;
+	std::cout << "\t" <<  "DC++ Core version: " << VERSIONSTRING << std::endl;
+	std::cout << "\t" <<  "GLIB header version: " << GLIB_MAJOR_VERSION << "." << 
+		GLIB_MINOR_VERSION << "." << GLIB_MICRO_VERSION << std::endl;
+	std::cout << "\t" <<  "GLIB version: " << glib_major_version << "." 
+		<< glib_minor_version << "." << glib_micro_version << std::endl;
+	std::cout << "\t" <<  "GTK header version: " << GTK_MAJOR_VERSION << "." 
+		<< GTK_MINOR_VERSION << "." << GTK_MICRO_VERSION << std::endl;
+	std::cout << "\t" <<  "GTK version: " << gtk_major_version << "." 
+		<< gtk_minor_version << "." << gtk_micro_version << std::endl;
+}
+
 int main(int argc, char *argv[])
 {
 	// Initialize i18n support
@@ -44,11 +61,18 @@
 	textdomain("linuxdcpp");
 	bind_textdomain_codeset("linuxdcpp", "UTF-8");
 
+	printVersionInfo();
+
 	if (!WulforUtil::parseArguments(&argc, &argv))
 	{
 		return -1;
 	}
 
+	if (WulforUtil::startArguments.version)
+	{
+		return 0;
+	}
+
 	// Check if profile is locked
 	if (WulforUtil::profileIsLocked())
 	{