Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
PizzaG committed Nov 21, 2023
1 parent a0f4c95 commit 6cca17a
Show file tree
Hide file tree
Showing 389 changed files with 91,343 additions and 1 deletion.
7 changes: 7 additions & 0 deletions Changelog/Changelog.txt.Amogus
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#####################

A-Team Custom ChangeLog

#####################

🍬 October-13-2023 - v0.01 🍬: Initial Android 14 Rom Release...
7 changes: 7 additions & 0 deletions Changelog/Changelog.txt.Borneo
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#####################

A-Team Custom ChangeLog

#####################

🍬 October-13-2023 - v0.01 🍬: Initial Android 14 Rom Release...
7 changes: 7 additions & 0 deletions Changelog/Changelog.txt.Guamna
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#####################

A-Team Custom ChangeLog

#####################

🍬 October-13-2023 - v0.01 🍬: Initial Android 14 Rom Release...
7 changes: 7 additions & 0 deletions Changelog/Changelog.txt.Milanf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#####################

A-Team Custom ChangeLog

#####################

🍬 October-13-2023 - v0.01 🍬: Initial Android 14 Rom Release...
7 changes: 7 additions & 0 deletions Changelog/Changelog.txt.Osaka
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#####################

A-Team Custom ChangeLog

#####################

🍬 October-13-2023 - v0.01 🍬: Initial Android 14 Rom Release...
39 changes: 39 additions & 0 deletions Changelog/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/sh

#
# Copyright 2019-Present A-Team Digital Solutions
#

export PATH=/bin:$BIN:$PATH
set -e

usage() {
cat <<EOM
Usage: $(basename $0) <Path to output directory, typically \$OUT variable>
EOM
exit 1
}

# Set Path To $OUT Directory, Typical $OUT Variable
[ $# -ne 1 ] && usage
OUT="$1"

# Check For $OUT Directory
if [ ! -d "$OUT" ];then
echo "Specified OUT-Directory: $OUT Does Not Exist!"
exit 1
fi

# Store Changelog In $OUT & Copy Changelog To Target system/etc
changelog="$OUT/Changelog.txt"
system_changelog="$OUT/system/etc/Changelog.txt"

# Print Something To Build Output
echo ${bldppl}"Generating A-Team Custom Changelog..."${txtrst}

# Copy Changelog To Target
mkdir -p $(dirname "$system_changelog")
cp -r Changelog.txt $OUT
cp "$changelog" "$system_changelog"

exit 0
23 changes: 23 additions & 0 deletions Changelog/changelog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

#
# Copyright 2019-Present A-Team Digital Solutions
#

# Exports
out=$OUT_DIR/target/product/$DEVICE
if [ -f $out ]; # The path does not exist
then
echo "The path to create changelog does not exist, exiting..."
exit
fi

export Changelog=Changelog.txt

touch $Changelog

# Print something to build output
echo "Generating A-Team Custom Changelog..."

cp $Changelog $OUT_DIR/target/product/$DEVICE/system/etc/$Changelog
cp $Changelog $OUT_DIR/target/product/$DEVICE/
145 changes: 145 additions & 0 deletions Moto-Common-Tools/Repo_Manifest_Creator_A13/A-Team/RMC.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
import argparse
import xml.etree.ElementTree as ET

def indent(elem, level=0):
i = "\n" + level*" "
if len(elem):
if not elem.text or not elem.text.strip():
elem.text = i + " "
if not elem.tail or not elem.tail.strip():
elem.tail = i
for elem in elem:
indent(elem, level+1)
if not elem.tail or not elem.tail.strip():
elem.tail = i
else:
if level and (not elem.tail or not elem.tail.strip()):
elem.tail = i

# parse arguments
parser = argparse.ArgumentParser(description='Remove duplicates from a repo manifest file')
parser.add_argument('input_manifest_files', metavar='default.xml', help='Path to input ROM manifest XML files', nargs='+')
parser.add_argument('moto_common_xml', metavar='moto_common.xml', help='Path to Moto-Common manifest XML')
parser.add_argument('output', metavar='output', help='Path to output manifest file')
parser.add_argument('--removal-keywords', metavar='keyword', nargs='+', default=["st-hal"],
help='Keywords to match for removal of duplicates')
parser.add_argument('--replacement-keywords', metavar='keyword', nargs='+', default=["qcom-caf/common"],
help='Keywords to match for replacement of duplicates')
parser.add_argument('--remote-name', metavar='name', default='moto-common',
help='Name of the remote to be added at the beginning of the output manifest')
parser.add_argument('--remote-url', metavar='url', default='https://github.com/moto-common/',
help='URL of the remote to be added at the beginning of the output manifest')
args = parser.parse_args()

root = ET.Element('manifest')

# Parse input XML files
for manifest_file in args.input_manifest_files:
try:
tree = ET.parse(manifest_file)
manifest_root = tree.getroot()
for child in manifest_root:
root.append(child)
except ET.ParseError:
print(f"Failed to parse {manifest_file}, skipped!")

tree1 = ET.ElementTree(root)
root1 = tree1.getroot()

# Parse Moto-Common XML file
tree2 = ET.parse(args.moto_common_xml)
root2 = tree2.getroot()

# Get the list of paths in the second manifest
paths2 = [project.get('path') for project in root2.findall('project')]

# Define the list of keywords for replacements and removals
replacements_keywords = {'qcom-caf/common': {
"name": "platform_hardware_qcom-caf_common",
"revision": "master"
}}
removals_keywords = [
'st-hal',
'data-ipa-cfg-mgr',
'qcom-caf/thermal',
'opensource/thermal',
'opensource/audio-hal',
'timekeep',
'fm-commonsys'
] + list(replacements_keywords.keys())

# Create the new_root, manifest
new_root = ET.Element('manifest')

# Define the moto-common remote
remote = ET.Element('remote', {'name': 'moto-common', 'fetch': 'https://github.com/moto-common/'})
new_root.append(remote)

# Find duplicates and replacements in the first manifest
duplicates = {}
replacements = {}
# Track removals for deduplication
removals = []
for project in root1.findall('project'):
path = project.get('path')
name = project.get('name')
linkfile_elems = [x for x in project.findall('linkfile') if not "sepolicy" in x.get("src")]
if path in paths2:
if path not in duplicates:
duplicates[path] = [name]
else:
duplicates[path].append(name)
else:
for keyword in replacements_keywords:
if keyword in path:
if path not in replacements:
replacements[path] = {
'name': replacements_keywords[keyword]['name'],
'linkfiles': linkfile_elems,
'revision': replacements_keywords[keyword]['revision']
}
else:
# Only replace with the shortest path match
if len(path) < len(replacements[path]['path']):
replacements[path] = {
'name': replacements_keywords[keyword]['name'],
'linkfiles': linkfile_elems,
'revision': replacements_keywords[keyword]['revision']
}
for keyword in removals_keywords:
if keyword in path:
remove = ET.Element('remove-project')
remove.set('name', name)
if name not in removals:
new_root.append(remove)
removals.append(name)
break

# Create a new manifest with remove-project and project elements
projects = []
for project in root1.findall('project'):
path = project.get('path')
name = project.get('name')
if path in duplicates and name in duplicates[path]:
remove = ET.Element('remove-project')
remove.set('name', name)
if name not in removals:
new_root.append(remove)
removals.append(name)
elif path in replacements:
new_project = ET.Element('project')
new_project.set('path', path)
new_project.set('name', replacements[path]['name'])
new_project.set('remote', "moto-common")
new_project.set('revision', replacements[path]['revision'])
for linkfile_elem in replacements[path]['linkfiles']:
new_project.append(linkfile_elem)
projects.append(new_project)

# Add the remove-project elements at the end of the new manifest
for project in projects:
new_root.append(project)

indent(new_root)
# Write the new manifest to a file
ET.ElementTree(new_root).write(args.output, xml_declaration=True, encoding='UTF-8', method='xml', short_empty_elements=True)
Loading

0 comments on commit 6cca17a

Please sign in to comment.