Bug 432375

Summary: Fails to fetch translations (regexp produces incorrect repository name)
Product: [Frameworks and Libraries] extra-cmake-modules Reporter: Jean-Baptiste Mardelle <jb>
Component: generalAssignee: ecm-bugs-null <ecm-bugs-null>
Status: RESOLVED NOT A BUG    
Severity: normal CC: sitter
Priority: NOR    
Version First Reported In: 5.78.0   
Target Milestone: ---   
Platform: Other   
OS: Other   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Jean-Baptiste Mardelle 2021-02-01 11:06:19 UTC
SUMMARY
The current releasescript fails to fetch translations for Kdenlive.

STEPS TO REPRODUCE
1. Configure Kdenlive using the cmake param: -DKDE_L10N_SYNC_TRANSLATIONS=ON
2. On terminal it prints: found 0 elements for kdenlive


OBSERVED RESULT
No translations are downloaded/installed.


EXPECTED RESULT
Translations working

Problem is that our invent repository is:
multimedia/kdenlive

But the ecm regexp filters out '/', so we end up with reponame=kdenlive.
Changing the regexp in KDECMakeSettings.cmake line 310:

string(REGEX MATCHALL ".+kde\\.org[:\\/]([-A-Za-z0-9\\/]+)(.git)?\\s*" "" ${giturl})

to (remove the "/" filter):

string(REGEX MATCHALL ".+kde\\.org[:]([-A-Za-z0-9\\/]+)(.git)?\\s*" "" ${giturl})

Produces a correct repo name (multimedia/kdenlive) and translations are then correctly installed.

If it helps, the command:
git remote get-url --all origin
produces this output:
git@invent.kde.org:multimedia/kdenlive.git



SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Jean-Baptiste Mardelle 2021-02-01 11:14:02 UTC
This is linked to this commit: https://invent.kde.org/frameworks/extra-cmake-modules/-/commit/693781d22e98057d83eac2b2c85d04063202f26f
Comment 2 Harald Sitter 2021-02-01 12:32:58 UTC
I don't understand this.
If we removed the leading slash option we'd no longer parse https urls correctly.

That said I also can't reproduce your problem.

λ ajax /tmp → cat test.cmake
function(foo giturl)
    string(REGEX MATCHALL ".+kde\\.org[:\\/]([-A-Za-z0-9\\/]+)(.git)?\\s*" "" ${giturl})
    message("${CMAKE_MATCH_1}")
endfunction()

foo("https://invent.kde.org/multimedia/kdenlive")
foo("git@invent.kde.org:multimedia/kdenlive")


λ ajax /tmp → cmake -P test.cmake
multimedia/kdenlive
multimedia/kdenlive
Comment 3 Jean-Baptiste Mardelle 2021-02-01 12:52:10 UTC
Oh... sorry for the noise. The problem actually is that I was trying to fetch translations using an older version of KDE Frameworks (5.68). This version contains a different REGEXP :

string(REGEX MATCHALL ".+[:\\/]([-A-Za-z0-9]+)(.git)?\\s*" "" ${giturl})

https://invent.kde.org/frameworks/extra-cmake-modules/-/blob/v5.68.0/kde-modules/KDECMakeSettings.cmake#L324

Which breaks as described in my report. You are right, the REGEXP is now correct and the bug is fixed. It's just that we cannot build with translations on previous Frameworks versions older than 5.76...

And there doesn't seem to be a way to override the project name extracted by the regexp..

But I guess nothing can be done...
Comment 4 Harald Sitter 2021-02-01 13:18:39 UTC
Well, the problem here is that along with the invent migration the community somehow decided that repo names will be non-unique moving forward which is why the original regex is actually no longer working. Because of the non-uniqueness policy releaseme cannot assume that 'phone', the output of the old regex, is indeed the same as 'maui/phone' as there may have been a completely unrelated repo 'plasma/phone' at some time in the past or future or current.

If you feel strongly about this you could get a discussion started on changing this policy so repo names must be unique again. I know there are others that have gotten annoyed by it and I also know that I have had to write extra code at various places just to deal with this theoretical non-uniqueness. Having to know that kdenlive is in multimedia/ isn't convenient on any level really.

I'm closing this bug as ECM is working correctly (technically anyway :S)