[Xperia Z1 Compact Original Android Development] derf elot:
Hi there,

I build the two separately, but it might just work in one go using the TWRP repo's. If it works, you should then have a CM with TWRP included. But I might be wrong and I miss something very obvious here. :P I do notice that you are using my modified recovery source. That was only needed for LOS14.1. For CM12.1 you can take it straight from the source.

Anyhow, to build CM12.1:

<?xml version="1.0" encoding="UTF-8"?>
<manifest>

<!-- common Sony stuff -->
<project name="derfelot/android_kernel_sony_msm8974" path="kernel/sony/msm8974" remote="github" revision="cm-12.1"/>
<project name="derfelot/android_device_sony_msm8974-common" path="device/sony/msm8974-common" remote="github" revision="cm-12.1"/>
<project name="LineageOS/android_device_qcom_common" path="device/qcom/common" remote="github" revision="cm-12.1"/>
<project name="LineageOS/android_device_sony_common" path="device/sony/common" remote="github" revision="cm-12.1"/>
<project name="LineageOS/android_hardware_qcom_fm" path="hardware/qcom/fm" remote="github" revision="cm-12.1"/>
<project name="LineageOS/android_hardware_sony_thermanager" path="hardware/sony/thermanager" remote="github" revision="cm-12.1"/>

<!-- blobs -->
<project path="vendor/sony" name="TheMuppets/proprietary_vendor_sony" remote="github" revision="cm-12.1"/>

<!-- z1c -->
<project name="derfelot/android_device_sony_amami" path="device/sony/amami" remote="github" revision="cm-12.1"/>
<project name="derfelot/android_device_sony_rhine-common" path="device/sony/rhine-common" remote="github" revision="cm-12.1"/>

<!-- z3c -->
<project name="derfelot/android_device_sony_z3c" path="device/sony/z3c" remote="github" revision="cm-12.1"/>
<project name="derfelot/android_device_sony_shinano-common" path="device/sony/shinano-common" remote="github" revision="cm-12.1"/>

</manifest>

and

<?xml version="1.0" encoding="UTF-8"?>
<manifest>

<!-- Remove the outdated CM stuff -->

<remove-project name="LineageOS/android_frameworks_av" />
<remove-project name="LineageOS/android_frameworks_base" />
<remove-project name="LineageOS/android_frameworks_ex" />
<remove-project name="LineageOS/android_frameworks_opt_net_wifi" />
<remove-project name="LineageOS/android_hardware_qcom_audio" />
<remove-project name="LineageOS/android_hardware_qcom_media" />
<remove-project name="LineageOS/android_packages_services_Telephony" />
<remove-project name="LineageOS/android_system_core" />
<remove-project name="platform/external/libnl" />
<remove-project name="LineageOS/android_frameworks_native" />
<remove-project name="LineageOS/android_external_tremolo" />
<remove-project name="platform/external/libhevc" />
<remove-project name="LineageOS/android_external_libvpx" />
<remove-project name="LineageOS/android_packages_apps_ContactsCommon" />
<remove-project name="platform/external/libopus" />
<remove-project name="LineageOS/android_build" />
<remove-project name="LineageOS/android_hardware_libhardware" />
<remove-project name="LineageOS/android_packages_apps_UnifiedEmail" />
<remove-project name="LineageOS/android_bionic" />
<remove-project name="LineageOS/android_packages_apps_Bluetooth" />

<!-- Add own repos -->

<project name="derfelot/android_build" path="build" remote="github" revision="cm-12.1" >
<copyfile src="core/root.mk" dest="Makefile" />
</project>

<project name="derfelot/android_frameworks_av" path="frameworks/av" remote="github" revision="cm-12.1"/>
<project name="derfelot/android_frameworks_base" path="frameworks/base" remote="github" revision="cm-12.1"/>
<project name="derfelot/android_frameworks_ex" path="frameworks/ex" remote="github" revision="cm-12.1"/>
<project name="derfelot/android_frameworks_opt_net_wifi" path="frameworks/opt/net/wifi" remote="github" revision="cm-12.1"/>
<project name="derfelot/android_hardware_qcom_audio" path="hardware/qcom/audio/default" remote="github" revision="cm-12.1"/>
<project name="derfelot/android_hardware_qcom_audio" path="hardware/qcom/audio-caf/msm8974" remote="github" revision="cm-12.1-caf-8974" />
<project name="derfelot/android_hardware_qcom_media" path="hardware/qcom/media/default" remote="github" revision="cm-12.1"/>
<project name="derfelot/android_hardware_qcom_media" path="hardware/qcom/media-caf/msm8974" remote="github" revision="cm-12.1-caf-8974" />
<project name="derfelot/android_packages_services_Telephony" path="packages/services/Telephony" remote="github" revision="cm-12.1"/>
<project name="derfelot/android_system_core" path="system/core" remote="github" revision="cm-12.1"/>
<project name="derfelot/android_platform_external_libnl" path="external/libnl" remote="github" revision="cm-12.1" />
<project name="derfelot/android_frameworks_native" path="frameworks/native" remote="github" revision="cm-12.1" />
<project name="derfelot/android_external_tremolo" path="external/tremolo" remote="github" revision="cm-12.1" />
<project name="derfelot/android_external_libhevc" path="external/libhevc" remote="github" revision="cm-12.1" />
<project name="derfelot/android_external_libvpx" path="external/libvpx" remote="github" revision="cm-12.1" />
<project name="derfelot/android_packages_apps_ContactsCommon" path="packages/apps/ContactsCommon" remote="github" revision="cm-12.1" />
<project name="derfelot/android_platform_external_libopus" path="external/libopus" remote="github" revision="cm-12.1" />
<project name="derfelot/android_hardware_libhardware" path="hardware/libhardware" remote="github" revision="cm-12.1" />
<project name="derfelot/android_packages_apps_UnifiedEmail" path="packages/apps/UnifiedEmail" remote="github" revision="cm-12.1" />
<project name="derfelot/android_bionic" path="bionic" remote="github" revision="cm-12.1" />
<project name="derfelot/android_packages_apps_Bluetooth" path="packages/apps/Bluetooth" remote="github" revision="cm-12.1" />

</manifest>

To build TWRP, you just indeed need to switch the repos you mentioned to cm-12.1-twrp and grab the recovery from omnirom:

<?xml version="1.0" encoding="UTF-8"?>
<manifest>

<!-- common Sony stuff -->
<project name="derfelot/android_kernel_sony_msm8974" path="kernel/sony/msm8974" remote="github" revision="cm-12.1"/>
<project name="derfelot/android_device_sony_msm8974-common" path="device/sony/msm8974-common" remote="github" revision="cm-12.1-twrp"/>
<project name="LineageOS/android_device_qcom_common" path="device/qcom/common" remote="github" revision="cm-12.1"/>
<project name="LineageOS/android_device_sony_common" path="device/sony/common" remote="github" revision="cm-12.1"/>
<project name="LineageOS/android_hardware_qcom_fm" path="hardware/qcom/fm" remote="github" revision="cm-12.1"/>
<project name="LineageOS/android_hardware_sony_thermanager" path="hardware/sony/thermanager" remote="github" revision="cm-12.1"/>

<!-- blobs -->
<project path="vendor/sony" name="TheMuppets/proprietary_vendor_sony" remote="github" revision="cm-12.1"/>

<!-- z1c -->
<project name="derfelot/android_device_sony_rhine-common" path="device/sony/rhine-common" remote="github" revision="cm-12.1-twrp"/>
<project name="derfelot/android_device_sony_amami" path="device/sony/amami" remote="github" revision="cm-12.1-twrp"/>

<!-- z3c -->
<project name="derfelot/android_device_sony_shinano-common" path="device/sony/shinano-common" remote="github" revision="cm-12.1-twrp"/>
<project name="derfelot/android_device_sony_z3c" path="device/sony/z3c" remote="github" revision="cm-12.1-twrp"/>

</manifest>

and

<?xml version="1.0" encoding="UTF-8"?>
<manifest>

<!-- Remove the outdated CM stuff -->

<remove-project name="LineageOS/android_frameworks_av" />
<remove-project name="LineageOS/android_frameworks_base" />
<remove-project name="LineageOS/android_frameworks_ex" />
<remove-project name="LineageOS/android_frameworks_opt_net_wifi" />
<remove-project name="LineageOS/android_hardware_qcom_audio" />
<remove-project name="LineageOS/android_hardware_qcom_media" />
<remove-project name="LineageOS/android_packages_services_Telephony" />
<remove-project name="LineageOS/android_system_core" />
<remove-project name="platform/external/libnl" />
<remove-project name="LineageOS/android_frameworks_native" />
<remove-project name="LineageOS/android_external_tremolo" />
<remove-project name="platform/external/libhevc" />
<remove-project name="LineageOS/android_external_libvpx" />
<remove-project name="LineageOS/android_packages_apps_ContactsCommon" />
<remove-project name="platform/external/libopus" />
<remove-project name="LineageOS/android_build" />
<remove-project name="LineageOS/android_hardware_libhardware" />
<remove-project name="LineageOS/android_packages_apps_UnifiedEmail" />
<remove-project name="LineageOS/android_bionic" />
<remove-project name="LineageOS/android_packages_apps_Bluetooth" />

<!-- Add own repos -->

<project name="derfelot/android_build" path="build" remote="github" revision="cm-12.1" >
<copyfile src="core/root.mk" dest="Makefile" />
</project>

<project name="derfelot/android_frameworks_av" path="frameworks/av" remote="github" revision="cm-12.1"/>
<project name="derfelot/android_frameworks_base" path="frameworks/base" remote="github" revision="cm-12.1"/>
<project name="derfelot/android_frameworks_ex" path="frameworks/ex" remote="github" revision="cm-12.1"/>
<project name="derfelot/android_frameworks_opt_net_wifi" path="frameworks/opt/net/wifi" remote="github" revision="cm-12.1"/>
<project name="derfelot/android_hardware_qcom_audio" path="hardware/qcom/audio/default" remote="github" revision="cm-12.1"/>
<project name="derfelot/android_hardware_qcom_audio" path="hardware/qcom/audio-caf/msm8974" remote="github" revision="cm-12.1-caf-8974" />
<project name="derfelot/android_hardware_qcom_media" path="hardware/qcom/media/default" remote="github" revision="cm-12.1"/>
<project name="derfelot/android_hardware_qcom_media" path="hardware/qcom/media-caf/msm8974" remote="github" revision="cm-12.1-caf-8974" />
<project name="derfelot/android_packages_services_Telephony" path="packages/services/Telephony" remote="github" revision="cm-12.1"/>
<project name="derfelot/android_system_core" path="system/core" remote="github" revision="cm-12.1"/>
<project name="derfelot/android_platform_external_libnl" path="external/libnl" remote="github" revision="cm-12.1" />
<project name="derfelot/android_frameworks_native" path="frameworks/native" remote="github" revision="cm-12.1" />
<project name="derfelot/android_external_tremolo" path="external/tremolo" remote="github" revision="cm-12.1" />
<project name="derfelot/android_external_libhevc" path="external/libhevc" remote="github" revision="cm-12.1" />
<project name="derfelot/android_external_libvpx" path="external/libvpx" remote="github" revision="cm-12.1" />
<project name="derfelot/android_packages_apps_ContactsCommon" path="packages/apps/ContactsCommon" remote="github" revision="cm-12.1" />
<project name="derfelot/android_platform_external_libopus" path="external/libopus" remote="github" revision="cm-12.1" />
<project name="derfelot/android_hardware_libhardware" path="hardware/libhardware" remote="github" revision="cm-12.1" />
<project name="derfelot/android_packages_apps_UnifiedEmail" path="packages/apps/UnifiedEmail" remote="github" revision="cm-12.1" />
<project name="derfelot/android_bionic" path="bionic" remote="github" revision="cm-12.1" />
<project name="derfelot/android_packages_apps_Bluetooth" path="packages/apps/Bluetooth" remote="github" revision="cm-12.1" />

</manifest>

and

<?xml version="1.0" encoding="UTF-8"?>
<manifest>

<remove-project name="LineageOS/android_bootable_recovery" />

<project name="omnirom/android_bootable_recovery" path="bootable/recovery" remote="github" revision="android-7.1"/>
</manifest>

Let me know how it goes :)

Cheers

---------- Post added at 09:56 PM ---------- Previous post was at 09:38 PM ----------

Actually, I see what's going on here. It's probably not going to work. You could just try to comment out

if len(pieces) != 5:
raise ValueError("malformed recovery.fstab line: \"%s\"" % (line,))

in build/tools/releasetools/common.py and see what happens. TWRP useds a different fstab layout than the built-in CM recovery. I don't know if anything else will need changing as well though (most probably yes).

I can have a more thorough look when I get the chance.