# Path: pyanaconda/flags.py
# class Flags(object):
# class BootArgs(OrderedDict):
#     def __setattr__(self, attr, val):
#     def get(self, attr, val=None):
#     def set_cmdline_bool(self, flag):
#     def __init__(self, read_cmdline=True):
#     def read_cmdline(self):
#     def __init__(self, cmdline=None, files=None):
#     def read(self, filenames):
#     def readstr(self, cmdline):
#     def getbool(self, arg, default=False):
# def can_touch_runtime_system(msg, touch_live=False):
# 
# Path: pyanaconda/constants.py
# DRACUT_SHUTDOWN_EJECT = "/run/initramfs/usr/lib/dracut/hooks/shutdown/99anaconda-eject.sh"
# 
# ROOT_PATH = "/mnt/sysimage"
# 
# TRANSLATIONS_UPDATE_DIR="/tmp/updates/po"
# 
# UNSUPPORTED_HW = 1 << 28
# 
# Path: pyanaconda/anaconda_log.py
# DEFAULT_TTY_LEVEL = logging.INFO
# ENTRY_FORMAT = "%(asctime)s,%(msecs)03d %(levelname)s %(name)s: %(message)s"
# TTY_FORMAT = "%(levelname)s %(name)s: %(message)s"
# STDOUT_FORMAT = "%(asctime)s %(message)s"
# DATE_FORMAT = "%H:%M:%S"
# MAIN_LOG_FILE = "/tmp/anaconda.log"
# MAIN_LOG_TTY = "/dev/tty3"
# PROGRAM_LOG_FILE = "/tmp/program.log"
# PROGRAM_LOG_TTY = "/dev/tty5"
# STORAGE_LOG_FILE = "/tmp/storage.log"
# PACKAGING_LOG_FILE = "/tmp/packaging.log"
# SENSITIVE_INFO_LOG_FILE = "/tmp/sensitive-info.log"
# ANACONDA_SYSLOG_FACILITY = SysLogHandler.LOG_LOCAL1
#     SYSLOG_CFGFILE  = "/etc/rsyslog.conf"
#     VIRTIO_PORT = "/dev/virtio-ports/org.fedoraproject.anaconda.log.0"
#         TEMPLATE = "*.* @@%s\n"
#         TEMPLATE = "*.* %s;anaconda_syslog\n"
# def autoSetLevel(handler, value):
# def setHandlersLevel(logr, level):
#     def __init__(self,
#                  address=('localhost', SYSLOG_UDP_PORT),
#                  facility=SysLogHandler.LOG_USER,
#                  tag=''):
#     def emit(self, record):
#     def __init__ (self):
#     def addFileHandler (self, dest, addToLogger, minLevel=DEFAULT_TTY_LEVEL,
#                         fmtStr=ENTRY_FORMAT,
#                         autoLevel=False):
#     def forwardToSyslog(self, logr):
#     def showwarning(self, message, category, filename, lineno,
#                       file=sys.stderr, line=None):
#     def restartSyslog(self):
#     def updateRemote(self, remote_syslog):
#     def setupVirtio(self):
# def init():
# class AnacondaSyslogHandler(SysLogHandler):
# class AnacondaLog:


import glob
import os
import stat
import os.path
import errno
import subprocess
import unicodedata
import string
import types
import logging
from threading import Thread
from Queue import Queue, Empty
from pyanaconda.flags import flags
from pyanaconda.constants import DRACUT_SHUTDOWN_EJECT, ROOT_PATH, TRANSLATIONS_UPDATE_DIR, UNSUPPORTED_HW
from pyanaconda.regexes import PROXY_URL_PARSE
from pyanaconda.anaconda_log import program_log_lock
def strip_markup(text):
    if text.find("<") == -1:
        return text
    r = ""
    inTag = False
    for c in text:
        if c == ">" and inTag:
            inTag = False
            continue
        elif c == "<" and not inTag:
            inTag = True
            continue
        elif not inTag:
            r += c
    return r.encode("utf-8")

def reIPL(ipldev):
    try:
        rc = execWithRedirect("chreipl", ["node", "/dev/" + ipldev])
    except RuntimeError as e:
        rc = True
        log.info("Unable to set reIPL device to %s: %s",
                 ipldev, e)

    if rc:
        log.info("reIPL configuration failed")
    else:
        log.info("reIPL configuration successful")

def resetRpmDb():

# Path: pyanaconda/flags.py
# class Flags(object):
# class BootArgs(OrderedDict):
#     def __setattr__(self, attr, val):
#     def get(self, attr, val=None):
#     def set_cmdline_bool(self, flag):
#     def __init__(self, read_cmdline=True):
#     def read_cmdline(self):
#     def __init__(self, cmdline=None, files=None):
#     def read(self, filenames):
#     def readstr(self, cmdline):
#     def getbool(self, arg, default=False):
# def can_touch_runtime_system(msg, touch_live=False):
# 
# Path: pyanaconda/constants.py
# DRACUT_SHUTDOWN_EJECT = "/run/initramfs/usr/lib/dracut/hooks/shutdown/99anaconda-eject.sh"
# 
# ROOT_PATH = "/mnt/sysimage"
# 
# TRANSLATIONS_UPDATE_DIR="/tmp/updates/po"
# 
# UNSUPPORTED_HW = 1 << 28
# 
# Path: pyanaconda/anaconda_log.py
# DEFAULT_TTY_LEVEL = logging.INFO
# ENTRY_FORMAT = "%(asctime)s,%(msecs)03d %(levelname)s %(name)s: %(message)s"
# TTY_FORMAT = "%(levelname)s %(name)s: %(message)s"
# STDOUT_FORMAT = "%(asctime)s %(message)s"
# DATE_FORMAT = "%H:%M:%S"
# MAIN_LOG_FILE = "/tmp/anaconda.log"
# MAIN_LOG_TTY = "/dev/tty3"
# PROGRAM_LOG_FILE = "/tmp/program.log"
# PROGRAM_LOG_TTY = "/dev/tty5"
# STORAGE_LOG_FILE = "/tmp/storage.log"
# PACKAGING_LOG_FILE = "/tmp/packaging.log"
# SENSITIVE_INFO_LOG_FILE = "/tmp/sensitive-info.log"
# ANACONDA_SYSLOG_FACILITY = SysLogHandler.LOG_LOCAL1
#     SYSLOG_CFGFILE  = "/etc/rsyslog.conf"
#     VIRTIO_PORT = "/dev/virtio-ports/org.fedoraproject.anaconda.log.0"
#         TEMPLATE = "*.* @@%s\n"
#         TEMPLATE = "*.* %s;anaconda_syslog\n"
# def autoSetLevel(handler, value):
# def setHandlersLevel(logr, level):
#     def __init__(self,
#                  address=('localhost', SYSLOG_UDP_PORT),
#                  facility=SysLogHandler.LOG_USER,
#                  tag=''):
#     def emit(self, record):
#     def __init__ (self):
#     def addFileHandler (self, dest, addToLogger, minLevel=DEFAULT_TTY_LEVEL,
#                         fmtStr=ENTRY_FORMAT,
#                         autoLevel=False):
#     def forwardToSyslog(self, logr):
#     def showwarning(self, message, category, filename, lineno,
#                       file=sys.stderr, line=None):
#     def restartSyslog(self):
#     def updateRemote(self, remote_syslog):
#     def setupVirtio(self):
# def init():
# class AnacondaSyslogHandler(SysLogHandler):
# class AnacondaLog:


# Path: pyanaconda/iutil.py
import glob
import os
import stat
import os.path
import errno
import subprocess
import unicodedata
import string
import types
import logging
from threading import Thread
from Queue import Queue, Empty
from pyanaconda.flags import flags
from pyanaconda.constants import DRACUT_SHUTDOWN_EJECT, ROOT_PATH, TRANSLATIONS_UPDATE_DIR, UNSUPPORTED_HW
from pyanaconda.regexes import PROXY_URL_PARSE
from pyanaconda.anaconda_log import program_log_lock

def strip_markup(text):
    if text.find("<") == -1:
        return text
    r = ""
    inTag = False
    for c in text:
        if c == ">" and inTag:
            inTag = False
            continue
        elif c == "<" and not inTag:
            inTag = True
            continue
        elif not inTag:
            r += c
    return r.encode("utf-8")

def reIPL(ipldev):
    try:
        rc = execWithRedirect("chreipl", ["node", "/dev/" + ipldev])
    except RuntimeError as e:
        rc = True
        log.info("Unable to set reIPL device to %s: %s",
                 ipldev, e)

    if rc:
        log.info("reIPL configuration failed")
    else:
        log.info("reIPL configuration successful")

def resetRpmDb():

    for rpmfile in glob.glob("%s/var/lib/rpm/__db.*" % ROOT_PATH):