Ajout script de completion du manifeste via metadonnées Git
This commit is contained in:
32
lib/build.sh
32
lib/build.sh
@ -62,7 +62,7 @@ function create_debian_control_file {
|
||||
echo "Version: ${package_version:-0.0.0}" >> "${control_file}"
|
||||
|
||||
package_section=$(get_project_opt .section)
|
||||
echo "Section: ${package_section:-extra}" >> "${control_file}"
|
||||
echo "Section: ${package_section:-unknown}" >> "${control_file}"
|
||||
|
||||
package_priority=$(get_project_opt .priority)
|
||||
echo "Priority: ${package_priority:-optional}" >> "${control_file}"
|
||||
@ -72,7 +72,7 @@ function create_debian_control_file {
|
||||
|
||||
dependencies=$( get_project_opt ".dependencies | .[\"${DISTRIB}\"] | @sh" | sed "s/' '/, /g" | sed "s/'//g" )
|
||||
|
||||
debug "Package dependencies: $dependencies"
|
||||
debug "Package dependencies: ${dependencies:-None}"
|
||||
|
||||
echo "Depends: ${dependencies}" >> "${control_file}"
|
||||
|
||||
@ -114,6 +114,29 @@ function create_debian_hooks {
|
||||
|
||||
}
|
||||
|
||||
function create_debian_changelog {
|
||||
|
||||
debian_dir="${1}"
|
||||
changelog="${debian_dir}/changelog"
|
||||
|
||||
logs="$(get_project_opt '.changelog | map(.+"\n") | add')"
|
||||
package_name=$(get_project_opt .name)
|
||||
package_version=$(get_project_opt .version)
|
||||
maintainer=$(get_project_opt .maintainer)
|
||||
|
||||
echo "${package_name} (${package_version:-0.0.0}), ${DISTRIB}; urgency=low" > "${changelog}"
|
||||
echo >> "${changelog}"
|
||||
|
||||
while read -r entry; do
|
||||
echo " * ${entry}" >> "${changelog}"
|
||||
done <<< "$(echo -e "${logs}" | sed 's/^"//')"
|
||||
|
||||
echo >> "${changelog}"
|
||||
|
||||
echo "-- ${maintainer} $(date -R)" >> "${changelog}"
|
||||
|
||||
}
|
||||
|
||||
function create_debian_metadata {
|
||||
|
||||
build_dir="${1}"
|
||||
@ -124,6 +147,7 @@ function create_debian_metadata {
|
||||
|
||||
create_debian_control_file "${debian_dir}"
|
||||
create_debian_hooks "${debian_dir}"
|
||||
create_debian_changelog "${debian_dir}"
|
||||
|
||||
}
|
||||
|
||||
@ -170,8 +194,8 @@ function main {
|
||||
|
||||
manifest_path=${SRC_DIR}/tamarin.json
|
||||
|
||||
if [ ! -f "${manifest_path}" ]; then
|
||||
fatal "There is no 'tamarin.json' file found in the project directory !"
|
||||
if [ ! -f "${manifest_path}" ] && [ ! -d "${SRC_DIR}/debian" ] && [ ! -d "${SRC_DIR}/DEBIAN" ]; then
|
||||
fatal "There is no 'tamarin.json' nor debian packaging files in the project directory !"
|
||||
fi
|
||||
|
||||
build_project
|
||||
|
@ -9,10 +9,10 @@ function debug {
|
||||
}
|
||||
|
||||
function error {
|
||||
echo "[${HOSTNAME}] [ERROR] $@"
|
||||
echo "[${HOSTNAME}] [ERROR] $@" >&2
|
||||
}
|
||||
|
||||
function fatal {
|
||||
echo "[${HOSTNAME}] [FATAL] $@"
|
||||
echo "[${HOSTNAME}] [FATAL] $@" >&2
|
||||
exit 1
|
||||
}
|
||||
|
Reference in New Issue
Block a user