Gosh, I made a typo in my scratch org definition file, I misspelled "Disabled" as "disable"
"orgPreferences" : {
"enabled": ["AnalyticsSharingEnable","AsyncSaveEnabled","ChatterEnabled","DisableParallelApexTesting","EnhancedEmailEnabled","EventLogWaveIntegEnabled","LoginForensicsEnabled","NetworksEnabled","NotesReservedPref01","OfflineDraftsEnabled","PathAssistantsEnabled","S1DesktopEnabled","S1OfflinePref","SelfSetPasswordInApi","SendThroughGmailPref","SocialProfilesEnable","Translation","VoiceEnabled","IsAccountTeamsEnabled","ShowViewHierarchyLink","IsActivityRemindersEnabled","IsDragAndDropSchedulingEnabled","IsEmailTrackingEnabled","IsGroupTasksEnabled","IsMultidayEventsEnabled","IsRecurringEventsEnabled","IsRecurringTasksEnabled","IsSidebarCalendarShortcutEnabled","IsSimpleTaskCreateUIEnabled","ShowEventDetailsMultiUserCalendar","ShowHomePageHoverLinksForEvents","ShowMyTasksHoverLinks","AutoCalculateEndDate","IsContractHistoryTrackingEnabled","NotifyOwnersOnContractExpiration","AssetLookupLimitedToActiveEntitlementsOnAccount","AssetLookupLimitedToActiveEntitlementsOnContact","AssetLookupLimitedToSameAccount","AssetLookupLimitedToSameContact","IsEntitlementsEnabled","EntitlementLookupLimitedToActiveStatus","EntitlementLookupLimitedToSameAccount","EntitlementLookupLimitedToSameAsset","EntitlementLookupLimitedToSameContact","IsForecastsEnabled","IsChatterProfileEnabled","IsIdeaThemesEnabled","IsIdeasEnabled","IsIdeasReputationEnabled","IsCreateEditOnArticlesTabEnabled","IsExternalMediaContentEnabled","IsKnowledgeEnabled","ShowArticleSummariesCustomerPortal","ShowArticleSummariesInternalApp","ShowArticleSummariesPartnerPortal","ShowValidationStatusField","IsLiveAgentEnabled","IsMarketingActionEnabled","IsMiddleNameEnabled","IsNameSuffixEnabled","IsOpportunityTeamEnabled","IsNegativeQuantityEnabled","IsOrdersEnabled","IsReductionOrdersEnabled","IsExactTargetForSalesforceAppsEnabled","IsCascadeActivateToRelatedPricesEnabled","IsQuantityScheduleEnabled","IsRevenueScheduleEnabled","IsQuoteEnabled","DocumentContentSearchEnabled","OptimizeSearchForCjkEnabled","RecentlyViewedUsersForBlankLookupEnabled","SidebarAutoCompleteEnabled","SidebarDropDownListEnabled","SidebarLimitToItemsIownCheckboxEnabled","SingleSearchResultShortcutEnabled","SpellCorrectKnowledgeSearchEnabled"],
"disabled": ["S1EncryptedStoragePref2"]
}
}
Best Answer
So ... I finally created a sfdx plugin allowing to do that
https://github.com/nvuillam/sfdx_metadatas_filtering
Install it
sfdx plugins:install sfdx_metadatas_filtering
Use it
sfdx metadatafilter:execute -i mdapi_output_dir -p myPackage.xml -o md_api_filtered_output_dir
Full example
Warnings:
all cases are not taken in account yet, please read carefully the README and contribute if you are in a hurry :)
Windows users: sfdx plugin generator is bugged on windows (hardcode call of linux rm instruction) , so you may use Git Bash to run this code ( at least while it installs the plugin dependencies )
EDIT 26/06/2018
It seems that several plugins are necessary to survive in this cruel world, so I joined all the ones I needed to create (including metadata filtering) into https://github.com/nvuillam/sfdx-essentials
This is the only maintained plugin , please use it :)