2010-02-23 13:20:05 +00:00
|
|
|
#
|
|
|
|
# constants.py
|
|
|
|
#
|
|
|
|
# Copyright (C) 2009 Red Hat, Inc.
|
|
|
|
#
|
|
|
|
# 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, see <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
|
|
# Red Hat Author(s): Martin Gracik <mgracik@redhat.com>
|
|
|
|
#
|
|
|
|
|
2010-11-09 08:37:49 +00:00
|
|
|
import logging
|
|
|
|
logger = logging.getLogger("pylorax")
|
|
|
|
|
2010-10-12 16:23:29 +00:00
|
|
|
import os
|
2010-02-23 13:20:05 +00:00
|
|
|
|
2010-10-12 16:23:29 +00:00
|
|
|
from sysutils import joinpaths
|
2010-02-23 13:20:05 +00:00
|
|
|
|
|
|
|
|
2010-10-12 16:23:29 +00:00
|
|
|
class LoraxRequiredCommands(dict):
|
2010-02-23 13:20:05 +00:00
|
|
|
|
|
|
|
def __init__(self):
|
2010-10-12 16:23:29 +00:00
|
|
|
self.__path = os.environ["PATH"].split(":")
|
2010-11-09 08:37:49 +00:00
|
|
|
logger.debug("PATH: {0}".format(self.__path))
|
2010-10-12 16:23:29 +00:00
|
|
|
|
|
|
|
self["AWK"] = "awk"
|
|
|
|
self["BUILD_LOCALE_ARCHIVE"] = "build-locale-archive"
|
|
|
|
self["CPIO"] = "cpio"
|
|
|
|
self["DEPMOD"] = "depmod"
|
|
|
|
self["DMSETUP"] = "dmsetup"
|
|
|
|
self["FIND"] = "find"
|
2010-10-19 15:35:50 +00:00
|
|
|
self["GCONFTOOL"] = "gconftool-2"
|
2010-11-08 15:50:59 +00:00
|
|
|
self["IMPLANTISOMD5"] = "implantisomd5"
|
2010-10-12 16:23:29 +00:00
|
|
|
self["ISOHYBRID"] = "isohybrid"
|
|
|
|
self["LDCONFIG"] = "ldconfig"
|
|
|
|
self["LOCALEDEF"] = "localedef"
|
|
|
|
self["LOSETUP"] = "losetup"
|
|
|
|
self["MKDOSFS"] = "mkdosfs"
|
|
|
|
self["MKISOFS"] = "mkisofs"
|
|
|
|
self["MKSQUASHFS"] = "mksquashfs"
|
|
|
|
self["MODINFO"] = "modinfo"
|
|
|
|
self["MOUNT"] = "mount"
|
|
|
|
self["PARTED"] = "parted"
|
|
|
|
self["UMOUNT"] = "umount"
|
2010-02-23 13:20:05 +00:00
|
|
|
|
|
|
|
def __getattr__(self, attr):
|
|
|
|
return self[attr]
|
2010-10-12 16:23:29 +00:00
|
|
|
|
|
|
|
def get_missing(self):
|
|
|
|
missing = []
|
|
|
|
for cmd in self.values():
|
|
|
|
found = [joinpaths(path, cmd) for path in self.__path
|
|
|
|
if os.path.exists(joinpaths(path, cmd))]
|
|
|
|
|
|
|
|
if not found:
|
|
|
|
missing.append(cmd)
|
|
|
|
|
|
|
|
return missing
|