From f171e31a3ca156e2252d5d6dedf5522506d57def Mon Sep 17 00:00:00 2001 From: William Petit Date: Wed, 22 Mar 2017 09:19:58 +0100 Subject: [PATCH] =?UTF-8?q?Correction=20automatique=20du=20nom=20de=20proj?= =?UTF-8?q?et=20si=20celui=20ci=20diff=C3=A8re=20du=20nom=20de=20paquet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hooks/01-fix-project-name-prebuild | 16 ---------------- hooks/prebuild/debian/complete-project-db | 19 +++++++++++-------- 2 files changed, 11 insertions(+), 24 deletions(-) delete mode 100755 hooks/01-fix-project-name-prebuild diff --git a/hooks/01-fix-project-name-prebuild b/hooks/01-fix-project-name-prebuild deleted file mode 100755 index ff7411d..0000000 --- a/hooks/01-fix-project-name-prebuild +++ /dev/null @@ -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 diff --git a/hooks/prebuild/debian/complete-project-db b/hooks/prebuild/debian/complete-project-db index c86ef37..64e9e2f 100755 --- a/hooks/prebuild/debian/complete-project-db +++ b/hooks/prebuild/debian/complete-project-db @@ -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 !" - 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}" +if [ ! -f debian/control ]; then + tamarin_error "No debian/control file found !" + exit 1 +fi + +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