Bug 474427 - When building AUR git package, and staying on non-existing remote branch, getting fatal error message
Summary: When building AUR git package, and staying on non-existing remote branch, get...
Status: REPORTED
Alias: None
Product: extra-cmake-modules
Classification: Frameworks and Libraries
Component: general (other bugs)
Version First Reported In: 5.109.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: ecm-bugs-null@kde.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-09-11 21:17 UTC by Andrew Shark
Modified: 2023-09-12 17:56 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Shark 2023-09-11 21:17:04 UTC
When trying to build some software that uses ECM, while staying at that git branch that is not existing in remote, the message is shown:
`fatal: no upstream configured for branch 'makepkg'` 

This happens when building an AUR package, because it checkouts to the `makepkg` branch.

STEPS TO REPRODUCE
1. Be on Arch Linux environment
2. Clone the https://aur.archlinux.org/plasma5-runners-jetbrains-runner-git.git repo
3. Run makepkg
4. Observe output after `==> Starting build()...`. (The `build()` is a function in PKGBUILD).

OBSERVED RESULT
There is a message in output:
```
==> Starting build()...
-- Found KF5: success (found suitable version "5.109.0", minimum required is "5.72.0") found components: I18n Service Runner TextWidgets ConfigWidgets PlasmaQuick KIO 
fatal: no upstream configured for branch 'makepkg'
-- Found KF5: success (found version "5.109.0") found components: Config
...
```

EXPECTED RESULT
There should be no errors

ADDITIONAL INFORMATION
Here is the context (got with `cmake ... --trace`):
```
/usr/share/ECM/kde-modules/KDECMakeSettings.cmake(345):  set(_reponame  )
/usr/share/ECM/kde-modules/KDECMakeSettings.cmake(346):  _repository_name(_reponame ${CMAKE_SOURCE_DIR} )
/usr/share/ECM/kde-modules/KDECMakeSettings.cmake(304):  execute_process(COMMAND git rev-parse --symbolic-full-name @{u} OUTPUT_VARIABLE upstream_ref RESULT_VARIABLE exitCode WORKING_DIRECTORY ${dir} )
fatal: no upstream configured for branch 'makepkg'
/usr/share/ECM/kde-modules/KDECMakeSettings.cmake(308):  if(exitCode EQUAL 0 )
/usr/share/ECM/kde-modules/KDECMakeSettings.cmake(311):  else()
```

This is the line with the git command in cmake module: https://invent.kde.org/frameworks/extra-cmake-modules/-/blob/ed9b7b7eb95bb66e92f2eff39ad8cf3b36cb1b76/kde-modules/KDECMakeSettings.cmake#L306

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 5.27.7
KDE Frameworks Version: 5.109.0
Qt Version: 5.15.10
extra-cmake-modules 5.109.0-1