[gigolo] Use system waf to get around configure hang.

Kevin Fenzi kevin at fedoraproject.org
Sat Jan 21 18:48:08 UTC 2012


commit 316bd598f07a250534fb04dd024a70ddd1278aab
Author: Kevin Fenzi <kevin at scrye.com>
Date:   Sat Jan 21 11:48:05 2012 -0700

    Use system waf to get around configure hang.

 gigolo-0.4.1.wafupdate.patch |  438 ++++++++++++++++++++++++++++++++++++++++++
 gigolo.spec                  |   16 ++-
 2 files changed, 450 insertions(+), 4 deletions(-)
---
diff --git a/gigolo-0.4.1.wafupdate.patch b/gigolo-0.4.1.wafupdate.patch
new file mode 100644
index 0000000..8174ac0
--- /dev/null
+++ b/gigolo-0.4.1.wafupdate.patch
@@ -0,0 +1,438 @@
+diff -Nur gigolo-0.4.1.orig/wscript gigolo-0.4.1/wscript
+--- gigolo-0.4.1.orig/wscript	2010-07-31 07:48:28.000000000 -0600
++++ gigolo-0.4.1/wscript	2012-01-21 11:42:38.047413574 -0700
+@@ -3,7 +3,7 @@
+ #
+ # WAF build script
+ #
+-# Copyright 2008-2010 Enrico Tröger <enrico(at)xfce(dot)org>
++# Copyright 2008-2011 Enrico Tröger <enrico(at)xfce(dot)org>
+ #
+ # 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
+@@ -20,238 +20,217 @@
+ 
+ 
+ 
+-from TaskGen import taskgen, feature
+-import Build, Configure, Options, Utils, UnitTest
+-import sys, os, shutil
++import os
++from waflib import Logs, Options, Scripting
++from waflib.TaskGen import feature
+ 
+ 
+ APPNAME = 'gigolo'
+ VERSION = '0.4.1'
++LINGUAS_FILE = 'po/LINGUAS'
+ 
+-srcdir = '.'
+-blddir = '_build_'
++top = '.'
++out = '_build_'
+ 
+ 
+-sources = [ 'src/compat.c', 'src/window.c', 'src/bookmark.c', 'src/settings.c',
+-			'src/menubuttonaction.c', 'src/mountoperation.c', 'src/bookmarkdialog.c',
+-			'src/bookmarkeditdialog.c', 'src/preferencesdialog.c', 'src/backendgvfs.c',
+-			'src/common.c', 'src/mountdialog.c', 'src/browsenetworkpanel.c',
+-			'src/singleinstance.c', 'src/bookmarkpanel.c' ]
++sources = ['src/compat.c', 'src/window.c', 'src/bookmark.c', 'src/settings.c',
++           'src/menubuttonaction.c', 'src/mountoperation.c', 'src/bookmarkdialog.c',
++           'src/bookmarkeditdialog.c', 'src/preferencesdialog.c', 'src/backendgvfs.c',
++           'src/common.c', 'src/mountdialog.c', 'src/browsenetworkpanel.c',
++           'src/singleinstance.c', 'src/bookmarkpanel.c']
+ 
+ 
+ 
+ def configure(conf):
+-	conf.check_tool('compiler_cc intltool misc gnu_dirs')
++    conf.load('compiler_c intltool gnu_dirs waf_unit_test')
+ 
+-	conf.check_cfg(package='gtk+-2.0', atleast_version='2.12.0', uselib_store='GTK',
+-		mandatory=True, args='--cflags --libs')
+-	conf.check_cfg(package='gio-2.0', atleast_version='2.16.0', uselib_store='GIO',
+-		mandatory=True, args='--cflags --libs')
+-	conf.check_cfg(package='x11', uselib_store='X11', mandatory=True, args='--libs')
++    conf.check_cfg(package='gtk+-2.0', atleast_version='2.12.0', uselib_store='GTK',
++        mandatory=True, args='--cflags --libs')
++    conf.check_cfg(package='gio-2.0', atleast_version='2.16.0', uselib_store='GIO',
++        mandatory=True, args='--cflags --libs')
++    conf.check_cfg(package='x11', uselib_store='X11', mandatory=True, args='--libs')
+ 
+-	gtk_version = conf.check_cfg(modversion='gtk+-2.0', uselib_store='GTK')
+-	gio_version = conf.check_cfg(modversion='gio-2.0', uselib_store='GIO')
++    gtk_version = conf.check_cfg(modversion='gtk+-2.0', uselib_store='GTK')
++    gio_version = conf.check_cfg(modversion='gio-2.0', uselib_store='GIO')
+ 
+-	conf.define('GETTEXT_PACKAGE', APPNAME, 1)
+-	conf.define('PACKAGE', APPNAME, 1)
+-	conf.define('VERSION', VERSION, 1)
++    conf.define('GETTEXT_PACKAGE', APPNAME, 1)
++    conf.define('PACKAGE', APPNAME, 1)
++    conf.define('VERSION', VERSION, 1)
+ 
+-	conf.write_config_header('config.h')
++    conf.write_config_header('config.h', remove=False)
+ 
+-	if 'LINGUAS' in os.environ:
+-		conf.env['LINGUAS'] = os.environ['LINGUAS']
++    if 'LINGUAS' in os.environ:
++        conf.env['LINGUAS'] = os.environ['LINGUAS']
+ 
+-	# debug flags
+-	if Options.options.debug:
+-		conf.env.append_value('CCFLAGS', '-g -O0 -DDEBUG '.split())
++    # debug flags
++    if conf.options.debug:
++        conf.env.append_value('CCFLAGS', '-g -O0 -DDEBUG '.split())
+ 
+-	Utils.pprint('BLUE', 'Summary:')
+-	print_message(conf, 'Install Gigolo ' + VERSION + ' in', conf.env['PREFIX'])
+-	print_message(conf, 'Using GTK version', gtk_version or 'Unknown')
+-	print_message(conf, 'Using GIO version', gio_version or 'Unknown')
+-	print_message(conf, 'Compiling with debugging support', Options.options.debug and 'yes' or 'no')
++    Logs.pprint('BLUE', 'Summary:')
++    conf.msg('Install Gigolo ' + VERSION + ' in', conf.env['PREFIX'])
++    conf.msg('Using GTK version', gtk_version or 'Unknown')
++    conf.msg('Using GIO version', gio_version or 'Unknown')
++    conf.msg('Compiling with debugging support', conf.options.debug and 'yes' or 'no')
+ 
+ 
+-def set_options(opt):
+-	opt.tool_options('compiler_cc')
+-	opt.tool_options('intltool')
+-	opt.tool_options('gnu_dirs')
++def options(opt):
++    opt.load('compiler_cc intltool gnu_dirs waf_unit_test')
+ 
+-	# Features
+-	opt.add_option('--enable-debug', action='store_true', default=False,
+-		help='enable debug mode [default: No]', dest='debug')
+-	opt.add_option('--update-po', action='store_true', default=False,
+-		help='update the message catalogs for translation', dest='update_po')
++    opt.add_option('--enable-debug', action='store_true', default=False,
++        help='enable debug mode [default: No]', dest='debug')
+ 
+ 
+- at taskgen
+- at feature('intltool_po')
++def _remove_linguas_file():
++    try:
++        os.unlink(LINGUAS_FILE)
++    except OSError:
++        pass
++
++
++ at feature('linguas')
+ def write_linguas_file(self):
+-	linguas = ''
+-	if 'LINGUAS' in Build.bld.env:
+-		files = Build.bld.env['LINGUAS']
+-		for po_filename in files.split(' '):
+-			if os.path.exists('po/%s.po' % po_filename):
+-				linguas += '%s ' % po_filename
+-	else:
+-		files = os.listdir('%s/po' % self.path.abspath())
+-		files.sort()
+-		for f in files:
+-			if f.endswith('.po'):
+-				linguas += '%s ' % f[:-3]
+-	f = open("po/LINGUAS", "w")
+-	f.write('# This file is autogenerated. Do not edit.\n%s\n' % linguas)
+-	f.close()
++    if os.path.exists(LINGUAS_FILE):
++        return
++    linguas = ''
++    if 'LINGUAS' in self.env:
++        files = self.env['LINGUAS']
++        for po_filename in files.split(' '):
++            if os.path.exists ('po/%s.po' % po_filename):
++                linguas += '%s ' % po_filename
++    else:
++        files = os.listdir('%s/po' % self.path.abspath())
++        files.sort()
++        for filename in files:
++            if filename.endswith('.po'):
++                linguas += '%s ' % filename[:-3]
++    file_h = open(LINGUAS_FILE, 'w')
++    file_h.write('# This file is autogenerated. Do not edit.\n%s\n' % linguas)
++    file_h.close()
++
++
++def distclean(ctx):
++    Scripting.distclean(ctx)
++    _remove_linguas_file()
+ 
+ 
+ def build(bld):
+-	def add_tests(bld):
+-		tests = os.listdir('tests')
+-		for test in tests:
+-			if test[-2:] != '.c':
+-				continue
+-			target = test[:-2]
+-			source = os.path.join("tests", test)
+-
+-		bld.new_task_gen(
+-			features		= 'cc cprogram',
+-			target			= 'test-' + target,
+-			source			= source,
+-			includes		= '. src',
+-			uselib			= 'GTK GIO',
+-			uselib_local	= 'gigolo_lib',
+-			unit_test		= 1,
+-			install_path	= None
+-		)
+-
+-
+-	bld.new_task_gen(
+-		features		= 'cc cstaticlib',
+-		name			= 'gigolo_lib',
+-		target			= 'gigolo_lib',
+-		source			= sources,
+-		includes		= '.',
+-		uselib			= 'GTK GIO',
+-		install_path	= None
+-	)
+-
+-	bld.new_task_gen(
+-		features		= 'cc cprogram',
+-		name			= 'gigolo',
+-		target			= 'gigolo',
+-		source			= 'src/main.c',
+-		includes		= '.',
+-		uselib			= 'GTK GIO X11',
+-		uselib_local	= 'gigolo_lib',
+-	)
+-
+-	if Options.commands['check']:
+-		add_tests(bld)
+-
+-	# Translations
+-	bld.new_task_gen(
+-		features		= 'intltool_po',
+-		podir			= 'po',
+-		appname			= 'gigolo'
+-	)
+-
+-	# gigolo.desktop
+-	bld.new_task_gen(
+-		features		= 'intltool_in',
+-		source			= 'gigolo.desktop.in',
+-		flags			= [ '-d', '-q', '-u', '-c' ],
+-		install_path	= '${DATADIR}/applications'
+-	)
+-
+-	# gigolo.1
+-	bld.new_task_gen(
+-		features		= 'subst',
+-		source			= 'gigolo.1.in',
+-		target			= 'gigolo.1',
+-		dict			= { 'VERSION' : VERSION },
+-		install_path	= '${MANDIR}/man1'
+-	)
+-
+-	# Docs
+-	bld.install_files('${DOCDIR}', 'AUTHORS ChangeLog COPYING README NEWS TODO')
+-
+-
+-def dist():
+-	import md5
+-	from Scripting import dist, excludes
+-	excludes.append('gigolo-%s.tar.bz2.sig' % VERSION)
+-	filename = dist(APPNAME, VERSION)
+-	f = file(filename,'rb')
+-	m = md5.md5()
+-	readBytes = 100000
+-	while (readBytes):
+-		readString = f.read(readBytes)
+-		m.update(readString)
+-		readBytes = len(readString)
+-	f.close()
+-	launch('gpg --detach-sign --digest-algo SHA512 %s' % filename, 'Signing %s' % filename)
+-	print 'MD5 sum:', filename, m.hexdigest()
+-	sys.exit(0)
+-
+-
+-def shutdown():
+-	# the following code was taken from midori's WAF script, thanks
+-	# (disabled because we don't need it at all as long as we don't have an own icon :( )
+-	#~ if Options.commands['install'] or Options.commands['uninstall']:
+-		#~ dir = Build.bld.get_install_path('${DATADIR}/icons/hicolor')
+-		#~ icon_cache_updated = False
+-		#~ if not Options.options.destdir:
+-			#~ try:
+-				#~ if not Utils.exec_command('gtk-update-icon-cache -q -f -t %s' % dir):
+-					#~ Utils.pprint('YELLOW', "Updated Gtk icon cache.")
+-					#~ icon_cache_updated = True
+-			#~ except:
+-				#~ Utils.pprint('RED', "Failed to update icon cache.")
+-		#~ if not icon_cache_updated:
+-			#~ Utils.pprint('YELLOW', "Icon cache not updated. After install, run this:")
+-			#~ Utils.pprint('YELLOW', "gtk-update-icon-cache -q -f -t %s" % dir)
+-	if Options.options.update_po:
+-		os.chdir(os.path.join(srcdir, 'po'))
+-		try:
+-			try:
+-				size_old = os.stat('gigolo.pot').st_size
+-			except:
+-				size_old = 0
+-			Utils.exec_command(['intltool-update', '--pot', '-g', APPNAME])
+-			size_new = os.stat('gigolo.pot').st_size
+-			if size_new != size_old:
+-				Utils.pprint('CYAN', 'Updated POT file.')
+-				launch('intltool-update -r %s' % APPNAME, 'Updating translations', 'CYAN')
+-			else:
+-				Utils.pprint('CYAN', 'POT file is up to date.')
+-		except:
+-			Utils.pprint('RED', 'Failed to generate pot file.')
+-		os.chdir('..')
+-
+-
+-def check(ch):
+-	test = UnitTest.unit_test()
+-	test.change_to_testfile_dir = False
+-	test.want_to_see_test_output = True
+-	test.want_to_see_test_error = True
+-	test.run()
+-	test.print_results()
+-
+-
+-# Simple function to execute a command and print its exit status
+-def launch(command, status, success_color='GREEN'):
+-	ret = 0
+-	Utils.pprint(success_color, status)
+-	try:
+-		ret = Utils.exec_command(command.split())
+-	except:
+-		ret = 1
+-
+-	if ret != 0:
+-		Utils.pprint('RED', status + ' failed')
+-
+-	return ret
+-
+-def print_message(conf, msg, result, color = 'GREEN'):
+-	conf.check_message_1(msg)
+-	conf.check_message_2(result, color)
++    if bld.cmd == 'clean':
++        _remove_linguas_file()
++
++    bld.new_task_gen(
++        features        = 'c cstlib',
++        name            = 'gigolo_lib',
++        target          = 'gigolo_lib',
++        source          = sources,
++        includes        = '.',
++        uselib          = ['GTK', 'GIO'],
++        install_path    = None)
++
++    bld.new_task_gen(
++        features        = 'c cprogram',
++        name            = 'gigolo',
++        target          = 'gigolo',
++        source          = 'src/main.c',
++        includes        = '.',
++        use             = ['GTK', 'GIO', 'X11', 'gigolo_lib'])
++
++    # tests
++    bld(
++        features        = 'c cprogram test',
++        source          = 'tests/uri_parsing.c',
++        target          = 'test-uri-parsing',
++        includes        = ['.', 'src'],
++        use             = ['GTK', 'GIO', 'X11', 'gigolo_lib'],
++        install_path    = None)
++    bld.add_post_fun(_unit_test_summary)
++
++    # Translations
++    bld.new_task_gen(
++        features        = ['linguas', 'intltool_po'],
++        podir           = 'po',
++        install_path    = '${LOCALEDIR}',
++        appname         = 'gigolo')
++
++    # gigolo.desktop
++    bld.new_task_gen(
++        features        = 'intltool_in',
++        source          = 'gigolo.desktop.in',
++        flags           = ['-d', '-q', '-u', '-c'],
++        install_path    = '${DATADIR}/applications',
++        after           = 'intltool_po')
++
++    # gigolo.1
++    bld.new_task_gen(
++        features        = 'subst',
++        source          = 'gigolo.1.in',
++        target          = 'gigolo.1',
++        dct            = {'VERSION' : VERSION},
++        install_path    = '${MANDIR}/man1')
++
++    # Docs
++    bld.install_files('${DOCDIR}', 'AUTHORS ChangeLog COPYING README NEWS TODO')
++
++
++def _unit_test_summary(ctx):
++    lst = getattr(ctx, 'utest_results', [])
++    if lst:
++        Logs.pprint('CYAN', 'Execution summary:')
++
++        total = len(lst)
++        tfail = len([x for x in lst if x[1]])
++
++        Logs.pprint('CYAN', '  Passed tests: %d/%d' % (total-tfail, total))
++        for (filename, code, stdout, stderr) in lst:
++            if not code:
++                Logs.pprint('CYAN', '    %s' % filename)
++
++        Logs.pprint('CYAN', '  Failed tests: %d/%d' % (tfail, total))
++        for (filename, code, stdout, stderr) in lst:
++            if code:
++                Logs.pprint('CYAN', '%s:' % filename)
++                Logs.pprint('RED', '%s' % stdout)
++
++
++def updatepo(ctx):
++    """update the message catalogs for internationalization"""
++    potfile = '%s.pot' % APPNAME
++    os.chdir('%s/po' % top)
++    try:
++        try:
++            old_size = os.stat(potfile).st_size
++        except OSError:
++            old_size = 0
++        ctx.exec_command('intltool-update --pot -g %s' % APPNAME)
++        size_new = os.stat(potfile).st_size
++        if size_new != old_size:
++            Logs.pprint('CYAN', 'Updated POT file.')
++            Logs.pprint('CYAN', 'Updating translations')
++            ret = ctx.exec_command('intltool-update -r -g %s' % APPNAME)
++            if ret != 0:
++                Logs.pprint('RED', 'Updating translations failed')
++        else:
++            Logs.pprint('CYAN', 'POT file is up to date.')
++    except OSError:
++        Logs.pprint('RED', 'Failed to generate pot file.')
++
++
++def dist(ctx):
++    ctx.base_path = ctx.path
++    ctx.excl = ctx.get_excl() + 'gigolo-%s.tar.bz2.sig module.xml RUN .gitignore .intlcache' % VERSION
++
++
++def sign(ctx):
++    """sign the source tarball for distribution"""
++    from hashlib import md5
++    filename = '%s-%s.tar.bz2' % (APPNAME, VERSION)
++    md5_hash = md5()
++    read_bytes = 100000
++    archive_file = file(filename,'rb')
++    while read_bytes:
++        read_string = archive_file.read(read_bytes)
++        md5_hash.update(read_string)
++        read_bytes = len(read_string)
++    archive_file.close()
++
++    ctx.cmd_and_log('gpg --detach-sign --digest-algo SHA512 %s' % filename)
++    Logs.pprint('GREEN', 'MD5 sum: %s %s' % (filename, md5_hash.hexdigest()))
diff --git a/gigolo.spec b/gigolo.spec
index 6de061a..f76c6ae 100644
--- a/gigolo.spec
+++ b/gigolo.spec
@@ -1,6 +1,6 @@
 Name:           gigolo
 Version:        0.4.1
-Release:        5%{?dist}
+Release:        6%{?dist}
 Summary:        GIO/GVFS management application
 
 Group:          User Interface/Desktops
@@ -12,6 +12,8 @@ Patch0:         gigolo-0.4.1-update-de.po.patch
 # https://bugzilla.redhat.com/show_bug.cgi?id=748228
 # patch from http://git.xfce.org/apps/gigolo/commit/?id=0e53ec5c
 Patch1:         gigolo-0.4.1-fix-crash-748228.patch
+# Update wscript to handle waf 1.6 (already upstream)
+Patch2:         gigolo-0.4.1.wafupdate.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires:  python
@@ -19,6 +21,7 @@ BuildRequires:  gettext
 BuildRequires:  intltool
 BuildRequires:  gtk2-devel
 BuildRequires:  desktop-file-utils
+BuildRequires:  waf
 
 Requires: %{_bindir}/gvfs-open
 Requires: %{_bindir}/fusermount
@@ -34,10 +37,12 @@ bookmarks of such.
 %setup -q
 %patch0 -p1 -b .updat
 %patch1 -p1 -b .fix
+%patch2 -p1 -b .wafupdate
 
 %build
+rm -f waf
 export CFLAGS="%{optflags}"
-./waf configure --prefix=%{_prefix} \
+waf configure --prefix=%{_prefix} \
               --exec-prefix=%{_exec_prefix} \
               --bindir=%{_bindir} \
               --sbindir=%{_sbindir} \
@@ -50,11 +55,11 @@ export CFLAGS="%{optflags}"
               --sharedstatedir=%{_sharedstatedir} \
               --mandir=%{_mandir} --infodir=%{_infodir} --enable-debug
 
-./waf build -v
+waf build -v
 
 %install
 rm -rf $RPM_BUILD_ROOT
-DESTDIR=$RPM_BUILD_ROOT ./waf install 
+DESTDIR=$RPM_BUILD_ROOT waf install 
 
 # remove docs that waf installs in the wrong place
 rm -rf $RPM_BUILD_ROOT/%{_datadir}/doc/gigolo
@@ -74,6 +79,9 @@ rm -rf $RPM_BUILD_ROOT
 %{_mandir}/man1/gigolo.1.gz
 
 %changelog
+* Sat Jan 21 2012 Kevin Fenzi <kevin at scrye.com> - 0.4.1-6
+- Use system waf to get around configure hang.
+
 * Fri Jan 13 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.4.1-5
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
 


More information about the scm-commits mailing list