1
  "   ˆl–Ü4ý( ©³( 	Å€fàD¦-ÿ¿892ÂÁ |    # SPDX-License-Identifier: GPL-2.0
#
# Phy drivers for Realtek platforms
#

if ARCH_REALTEK || COMPILE_TEST

config PHY_RTK_RTD_USB2PHY
	tristate "Realtek RTD USB2 PHY Transceiver Driver"
	depends on USB_SUPPORT
	select GENERIC_PHY
	select USB_PHY
	select USB_COMMON
	help
	  Enable this to support Realtek SoC USB2 phy transceiver.
	  The DHC (digital home center) RTD series SoCs used the Synopsys
	  DWC3 USB IP. This driver will do the PHY initialization
	  of the parameters.

config PHY_RTK_RTD_USB3PHY
	tristate "Realtek RTD USB3 PHY Transceiver Driver"
	depends on USB_SUPPORT
	select GENERIC_PHY
	select USB_PHY
	select USB_COMMON
	help
	  Enable this to support Realtek SoC USB3 phy transceiver.
	  The DHC (digital home center) RTD series SoCs used the Synopsys
	  DWC3 USB IP. This driver will do the PHY initialization
	  of the parameters.

endif # ARCH_REALTEK || COMPILE_TEST
  	   ˆÀ¿0ÂÁ  "   	ˆl–ßi~”ÊhŠm@†ã`¸)‹FÿÀƒ|AÃÂ #û    	#!/usr/bin/python3 -E


from __future__ import print_function
import os
import errno
import shutil
import sys
from optparse import OptionParser


try:
    import selinux
    import semanage
except ImportError:
    print("You must install libselinux-python and libsemanage-python before running this tool", file=sys.stderr)
    exit(1)


def copy_file(src, dst):
    if DEBUG:
        print("copying %s to %s" % (src, dst))
    try:
        shutil.copy(src, dst)
    except OSError as the_err:
        (err, strerr) = the_err.args
        print("Could not copy %s to %s, %s" % (src, dst, strerr), file=sys.stderr)
        exit(1)


def create_dir(dst, mode):
    if DEBUG:
        print("Making directory %s" % dst)
    try:
        os.makedirs(dst, mode)
    except OSError as the_err:
        (err, stderr) = the_err.args
        if err == errno.EEXIST:
            pass
        else:
            print("Error creating %s" % dst, file=sys.stderr)
            exit(1)


def create_file(dst):
    if DEBUG:
        print("Making file %s" % dst)
    try:
        open(dst, 'a').close()
    except OSError as the_err:
        (err, stderr) = the_err.args
        print("Error creating %s" % dst, file=sys.stderr)
        exit(1)


def copy_module(store, name, base):
    if DEBUG:
        print("Install module %s" % name)
    (file, ext) = os.path.splitext(name)
    if ext != ".pp":
        # Stray non-pp file in modules directory, skip
        print("warning: %s has invalid extension, skipping" % name, file=sys.stderr)
        return
    try:
        if base:
            root = oldstore_path(store)
        else:
            root = oldmodules_path(store)

        bottomdir = bottomdir_path(store)

        os.mkdir("%s/%s" % (bottomdir, file))

        copy_file(os.path.join(root, name), "%s/%s/hll" % (bottomdir, file))

        # This is the ext file that will eventually be used to choose a compiler
        efile = open("%s/%s/lang_ext" % (bottomdir, file), "w+", 0o600)
        efile.write("pp")
        efile.close()

    except (IOError, OSError):
        print("Error installing module %s" % name, file=sys.stderr)
        exit(1)


def disable_module(file, name, disabledmodules):
    if DEBUG:
        print("Disabling %s" % name)
    (disabledname, disabledext) = os.path.splitext(file)
    create_file("%s/%s" % (disabledmodules, disabledname))


def migrate_store(store):
    oldstore = oldstore_path(store)
    oldmodules = oldmodules_path(store)
    disabledmodules = disabledmodules_path(store)
    newstore = newstore_path(store)
    newmodules = newmodules_path(store)
    bottomdir = bottomdir_path(store)

    print("Migrating from %s to %s" % (oldstore, newstore))

    # Build up new directory structure
    create_dir("%s/%s" % (newroot_path(), store), 0o755)
    create_dir(newstore, 0o700)
    create_dir(newmodules, 0o700)
    create_dir(bottomdir, 0o700)
    create_dir(disabledmodules, 0o700)

    # Special case for base since it was in a different location
    copy_module(store, "base.pp", 1)

    # Dir structure built, start copying files
  