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