# -*- coding: utf-8 -*-
#
# namcap rules - kdeprograms
# Copyright (C) 2011 Rémy Oudompheng <remy@archlinux.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
#   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., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
# 

class package:
	def short_name(self):
		return "kdeprograms"
	def long_name(self):
		return "Checks that KDE programs have kdebase-runtime as a dependency"
	def prereq(self):
		return "tar"
	def analyze(self, pkginfo, tar):
		ret = [ [], [], [] ]
		if hasattr(pkginfo, "depends") and 'kdelibs' in pkginfo.depends:
			binaries = [ f.name for f in tar
					if f.name.startswith("usr/bin") and f.isfile() ]
			if len(binaries) > 0:
				ret[1].append(("kdebase-runtime-missing-dep %s", binaries))
		return ret
	def type(self):
		return "tarball"
# vim: set ts=4 sw=4 noet:
