Correction automatique du nom de projet si celui ci diffère du nom de paquet

This commit is contained in:
wpetit 2017-03-22 09:19:58 +01:00
parent 8d1a760093
commit f171e31a3c
2 changed files with 11 additions and 24 deletions

View File

@ -1,16 +0,0 @@
#!/usr/bin/env bash
source "${TAMARIN_UTIL}"
if [ ! -f debian/control ]; then
fatal "No debian/control file found !"
fi
package_name=$(grep -E '^Package:' debian/control | awk '{ print $2 }')
project_name=$(get_opt project_name)
if [ "${package_name}" != "${project_name}" ]; then
warn "The project's name '${project_name}' differs from the package one ('${package_name}'). Using package's one..."
set_opt project_name "${package_name}"
exit
fi

View File

@ -2,12 +2,15 @@
cd src
if [ -z "$(tamarin_db get project_name)" ]; then
if [ ! -d ".git" ]; then
tamarin_error "This project is not managed with Git ! Cannot extract the project's name without it !"
if [ ! -f debian/control ]; then
tamarin_error "No debian/control file found !"
exit 1
fi
project_name=$(basename $(git config --get remote.origin.url) | sed 's/.git$//' | tr '[:upper:]' '[:lower:]')
tamarin_info "Extracted project name from Git metadata: \"${project_name}\""
tamarin_db set project_name "${project_name}"
package_name=$(grep -E '^Source:' debian/control | awk '{ print $2 }')
project_name=$(tamarin_db get project_name)
if [ "${package_name}" != "${project_name}" ]; then
tamarin_warn "The project's name \"${project_name}\" differs from the package one (\"${package_name}\"). Using package's one..."
tamarin_db set project_name "${package_name}"
fi