[SQUASH]vendor: bliss: Initial envsetup
change how device combos are added
device names are now added to bliss.devices.
A custom device list file can be used by calling:
bliss_device_combos "path/custom.devices"
A custom variant can be used by calling:
bliss_device_combos "eng"
Both can be used by calling:
bliss_device_combos "path/custom.devices" "eng"
setting either of these overwrites the default values
This also introduces the start of our vendor envsetup
Change-Id: I12ddf088a1377233640c359dc2f4fb305018052e
bliss: envsetup: force all variables to be local
Change-Id: Iae29d0c8f5e116a102f2942d198ed9c036fb8068
bliss: envsetup: add an append method for hmm
We know these entries won't be in, so directly append them
Change-Id: Ia37364e4ea92559e2c83aa2feb6d6b314906d309
bliss: envsetup: add new entries for hmm
Change-Id: I6e0f8f7704add80473bb2ec8638486035aa50fed
bliss: envsetup: extend hmm
display vendor specific functions
Change-Id: I3c0a4590ccff2cc88d45fa6abe7275b94167f021
bliss: envsetup: force variable in device_combos to be local
'read' is causing the device variable to become global, which
is messing with people's scripts. force it to be local
Change-Id: If9a15cb51c353d8c8297fca43baf3735dc7804d7
bliss: envsetup: add bliss_push command
This assumes you have an ssh entry called 'bliss_review'
You can also enter the path relative to build_top
Change-Id: I4f7243f72f4a2c9474b77bb9597c3cbb2ebf392d
bliss: envsetup: update the remote functions
general cleanups, better git detection
Change-Id: Ib2567c1c863661e716569fad4bbbb47f94d40311
bliss: envsetup: move remotes to vendor
Change-Id: Ifc72ab35059be184661b139ec3accb72447de728
bliss: envsetup: add method for extending hmm descriptions
This will replace or add an entry in the hmm descriptions,
allowing us to cleanly extend hmm
Change-Id: I6f79b83e95382cd839bcc587d022b81084febf9b
bliss: envsetup: add rename function
this will rename a previously declare function so we
can override the original name in envsetup, while still
being able to use the original function
Change-Id: I0846a4129eb373d67c7f2861017b340c39e64c63
diff --git a/build/envsetup.sh b/build/envsetup.sh
new file mode 100644
index 0000000..d424a68
--- /dev/null
+++ b/build/envsetup.sh
@@ -0,0 +1,192 @@
+# bliss functions that extend build/envsetup.sh
+
+function bliss_device_combos()
+{
+ local T list_file variant device
+
+ T="$(gettop)"
+ list_file="${T}/vendor/bliss/bliss.devices"
+ variant="userdebug"
+
+ if [[ $1 ]]
+ then
+ if [[ $2 ]]
+ then
+ list_file="$1"
+ variant="$2"
+ else
+ if [[ ${VARIANT_CHOICES[@]} =~ (^| )$1($| ) ]]
+ then
+ variant="$1"
+ else
+ list_file="$1"
+ fi
+ fi
+ fi
+
+ if [[ ! -f "${list_file}" ]]
+ then
+ echo "unable to find device list: ${list_file}"
+ list_file="${T}/vendor/bliss/bliss.devices"
+ echo "defaulting device list file to: ${list_file}"
+ fi
+
+ while IFS= read -r device
+ do
+ add_lunch_combo "bliss_${device}-${variant}"
+ done < "${list_file}"
+}
+
+function bliss_rename_function()
+{
+ eval "original_bliss_$(declare -f ${1})"
+}
+
+function _bliss_build_hmm() #hidden
+{
+ printf "%-8s %s" "${1}:" "${2}"
+}
+
+function bliss_append_hmm()
+{
+ HMM_DESCRIPTIVE=("${HMM_DESCRIPTIVE[@]}" "$(_bliss_build_hmm "$1" "$2")")
+}
+
+function bliss_add_hmm_entry()
+{
+ for c in ${!HMM_DESCRIPTIVE[*]}
+ do
+ if [[ "${1}" == $(echo "${HMM_DESCRIPTIVE[$c]}" | cut -f1 -d":") ]]
+ then
+ HMM_DESCRIPTIVE[${c}]="$(_bliss_build_hmm "$1" "$2")"
+ return
+ fi
+ done
+ bliss_append_hmm "$1" "$2"
+}
+
+function blissremote()
+{
+ local proj pfx project
+
+ if ! git rev-parse &> /dev/null
+ then
+ echo "Not in a git directory. Please run this from an Android repository you wish to set up."
+ return
+ fi
+ git remote rm bliss 2> /dev/null
+
+ proj="$(pwd -P | sed "s#$ANDROID_BUILD_TOP/##g")"
+
+ if (echo "$proj" | egrep -q 'external|system|build|bionic|art|libcore|prebuilt|dalvik') ; then
+ pfx="android_"
+ fi
+
+ project="${proj//\//_}"
+
+ git remote add bliss "git@github.com:BlissRoms/$pfx$project"
+ echo "Remote 'bliss' created"
+}
+
+function losremote()
+{
+ local proj pfx project
+
+ if ! git rev-parse &> /dev/null
+ then
+ echo "Not in a git directory. Please run this from an Android repository you wish to set up."
+ return
+ fi
+ git remote rm cm 2> /dev/null
+
+ proj="$(pwd -P | sed "s#$ANDROID_BUILD_TOP/##g")"
+ pfx="android_"
+ project="${proj//\//_}"
+ git remote add los "git@github.com:LineageOS/$pfx$project"
+ echo "Remote 'los' created"
+}
+
+function aospremote()
+{
+ local pfx project
+
+ if ! git rev-parse &> /dev/null
+ then
+ echo "Not in a git directory. Please run this from an Android repository you wish to set up."
+ return
+ fi
+ git remote rm aosp 2> /dev/null
+
+ project="$(pwd -P | sed "s#$ANDROID_BUILD_TOP/##g")"
+ if [[ "$project" != device* ]]
+ then
+ pfx="platform/"
+ fi
+ git remote add aosp "https://android.googlesource.com/$pfx$project"
+ echo "Remote 'aosp' created"
+}
+
+function cafremote()
+{
+ local pfx project
+
+ if ! git rev-parse &> /dev/null
+ then
+ echo "Not in a git directory. Please run this from an Android repository you wish to set up."
+ fi
+ git remote rm caf 2> /dev/null
+
+ project="$(pwd -P | sed "s#$ANDROID_BUILD_TOP/##g")"
+ if [[ "$project" != device* ]]
+ then
+ pfx="platform/"
+ fi
+ git remote add caf "git://codeaurora.org/$pfx$project"
+ echo "Remote 'caf' created"
+}
+
+function bliss_push()
+{
+ local branch ssh_name path_opt proj
+ branch="lp5.1"
+ ssh_name="bliss_review"
+ path_opt=
+
+ if [[ "$1" ]]
+ then
+ proj="$ANDROID_BUILD_TOP/$(echo "$1" | sed "s#$ANDROID_BUILD_TOP/##g")"
+ path_opt="--git-dir=$(printf "%q/.git" "${proj}")"
+ else
+ proj="$(pwd -P)"
+ fi
+ proj="$(echo "$proj" | sed "s#$ANDROID_BUILD_TOP/##g")"
+ proj="$(echo "$proj" | sed 's#/$##')"
+ proj="${proj//\//_}"
+
+ if (echo "$proj" | egrep -q 'external|system|build|bionic|art|libcore|prebuilt|dalvik') ; then
+ proj="android_$proj"
+ fi
+
+ git $path_opt push "ssh://${ssh_name}/BlissRoms/$proj" "HEAD:refs/for/$branch"
+}
+
+
+bliss_rename_function hmm
+function hmm() #hidden
+{
+ local i T
+ T="$(gettop)"
+ original_bliss_hmm
+ echo
+
+ echo "vendor/bliss extended functions. The complete list is:"
+ for i in $(grep -P '^function .*$' "$T/vendor/bliss/build/envsetup.sh" | grep -v "#hidden" | sed 's/function \([a-z_]*\).*/\1/' | sort | uniq); do
+ echo "$i"
+ done |column
+}
+
+bliss_append_hmm "blissremote" "Add a git remote for matching BlissRoms repository"
+bliss_append_hmm "losremote" "Add a git remote for matching LineageOS repository"
+bliss_append_hmm "aospremote" "Add git remote for matching AOSP repository"
+bliss_append_hmm "cafremote" "Add git remote for matching CodeAurora repository."
+