From eb0761e9c4e25eb49d2d0e676a98f72b1abcb728 Mon Sep 17 00:00:00 2001 From: ashish-jabble Date: Wed, 29 May 2019 13:45:19 +0530 Subject: [PATCH] FOGL-2772 Centralised DEB packaging fixes --- .gitignore | 10 +- Package | 24 +++-- make_deb | 131 -------------------------- packages/Debian/armhf/DEBIAN/control | 10 -- packages/Debian/armhf/DEBIAN/postinst | 41 -------- 5 files changed, 19 insertions(+), 197 deletions(-) delete mode 100755 make_deb delete mode 100644 packages/Debian/armhf/DEBIAN/control delete mode 100755 packages/Debian/armhf/DEBIAN/postinst diff --git a/.gitignore b/.gitignore index b75b7ef..44a363d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,9 @@ -# Package Build -packages/build +# vi +*.swp +# MacOS Finder +.DS_Store +._* + +# IDE +*.idea diff --git a/Package b/Package index d827b7e..bee5c36 100644 --- a/Package +++ b/Package @@ -12,21 +12,19 @@ requirements="foglamp,python3-envirophat" case "$arch" in x86_64) - ;; - armhf) - ;; + echo "${plugin_name} is not supported on Intel architectures as it requires ARM GPIO support" + exit 1 + ;; + armv7l) + ;; aarch64) - ;; + ;; esac case "$package_manager" in - deb) - if [ "$arch" != "armhf" ]; then - echo "Deb Package building for ${plugin_name} is only supported on armhf architecture!!" - exit 0 - fi + deb) + ;; + rpm) + echo "RPM Package building for ${plugin_name} is not supported on $arch architecture!!" + exit 0 ;; - rpm) - echo "RPM Package building for ${plugin_name} is not supported on $arch architecture!!" - exit 0 - ;; esac diff --git a/make_deb b/make_deb deleted file mode 100755 index 72924a0..0000000 --- a/make_deb +++ /dev/null @@ -1,131 +0,0 @@ -#!/bin/bash - -##-------------------------------------------------------------------- -## Copyright (c) 2018 Dianomic Systems -## -## Licensed under the Apache License, Version 2.0 (the "License"); -## you may not use this file except in compliance with the License. -## You may obtain a copy of the License at -## -## http://www.apache.org/licenses/LICENSE-2.0 -## -## Unless required by applicable law or agreed to in writing, software -## distributed under the License is distributed on an "AS IS" BASIS, -## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -## See the License for the specific language governing permissions and -## limitations under the License. -##-------------------------------------------------------------------- -## -## Author: Ivan Zoratti, Vaibhav Singhal -## - - -set -e - -GIT_ROOT=`pwd` # The script must be executed from the root git directory - -usage="$(basename "$0") [clean|cleanall] -This script is used to create the Debian package of FogLAMP -Arguments: - clean - Remove all the old versions saved in format .XXXX - cleanall - Remove all the versions, including the last one" - -for i in "$@" -do - case "$i" in - clean) - echo -n "Cleaning the build folder from older versions..." - find "${GIT_ROOT}/packages/build" -maxdepth 1 | grep '.*\.[0-9][0-9][0-9][0-9]' | xargs rm -rf - echo "Done." - exit 0 - ;; - cleanall) - if [ -d "${GIT_ROOT}/packages/build" ]; then - echo -n "Cleaning the build folder..." - rm -rf ${GIT_ROOT}/packages/build/* - echo "Done." - else - echo "No build folder, skipping cleanall" - fi - exit 0 - ;; - *) - echo "${usage}" - exit 1 - ;; - esac -done - -if [ "$(dpkg --print-architecture)" != "armhf" ]; then - echo "Package building is only supported on armhf architecture!!" - exit 0 -fi - -architecture="armhf" -version=`cat ${GIT_ROOT}/VERSION.south.envirophat | tr -d ' ' | grep 'foglamp_south_envirophat_version=' | head -1 | sed -e 's/\(.*\)=\(.*\)/\2/g'` -foglamp_version=`cat ${GIT_ROOT}/VERSION.south.envirophat | tr -d ' ' | grep 'foglamp_version' | head -1 | sed -e 's/\(.*\)version\(.*\)/\2/g'` -BUILD_ROOT="${GIT_ROOT}/packages/build" - -# Final package name -package_name="foglamp-south-envirophat-${version}-${architecture}" - -# Print the summary of findings -echo "The package root directory is : ${GIT_ROOT}" -echo "The FogLAMP version is : ${version}" -echo "The Package will be built in : ${BUILD_ROOT}" -echo "The architecture is set as : ${architecture}" -echo "The package name is : ${package_name}" -echo - -# Create the package directory. If a directory with the same name exists, -# it is copied with a version number. - -# First, create the BUILD_ROOT folder, if necessary -if [ ! -L "${BUILD_ROOT}" -a ! -d "${BUILD_ROOT}" ]; then - mkdir -p "${BUILD_ROOT}" -fi - -cd "${BUILD_ROOT}" -existing_pkgs=`find . -maxdepth 1 -name "${package_name}.????" | wc -l` -existing_pkgs=$((existing_pkgs+1)) -new_stored_pkg=$(printf "${package_name}.%04d" "${existing_pkgs}") -if [ -d "${package_name}" ]; then - echo "Saving the old working environment as ${new_stored_pkg}" - mv "${package_name}" "${new_stored_pkg}" -fi -mkdir "${package_name}" - -# Populate the package directory with Debian files -# First with files common to all pla -echo -n "Populating the package and updating version file..." -cd "${package_name}" -cp -R ${GIT_ROOT}/packages/Debian/${architecture}/* . -sed -i "s/Version: 0.0/Version: $version/g" DEBIAN/control -sed -i "s/Depends: foglamp/Depends: foglamp (${foglamp_version})/g" DEBIAN/control - -mkdir -p usr/local/foglamp -cd usr/local/foglamp -cp -R ${GIT_ROOT}/python . -cp -R ${GIT_ROOT}/VERSION.south.envirophat . -echo "Done." - -# Build the package -cd "${BUILD_ROOT}" - -# Save the old versions -existing_pkgs=`find . -maxdepth 1 -name "${package_name}.deb.????" | wc -l` -existing_pkgs=$((existing_pkgs+1)) -new_stored_pkg=$(printf "${package_name}.deb.%04d" "${existing_pkgs}") - -if [ -e "${package_name}.deb" ]; then - echo "Saving the old package as ${new_stored_pkg}" - mv "${package_name}.deb" "${new_stored_pkg}" -fi - -echo "Building the new package..." -dpkg-deb --build ${package_name} -echo "Building Complete." - - -exit 0 - diff --git a/packages/Debian/armhf/DEBIAN/control b/packages/Debian/armhf/DEBIAN/control deleted file mode 100644 index c52510f..0000000 --- a/packages/Debian/armhf/DEBIAN/control +++ /dev/null @@ -1,10 +0,0 @@ -Package: foglamp-south-envirophat -Version: 0.0 -Section: devel -Priority: optional -Architecture: armhf -Depends: foglamp,python3-envirophat -Conflicts: -Maintainer: Dianomic Systems, Inc. -Homepage: http://www.dianomic.com -Description: South plugin for the Enviro pHAT board on a Raspberry PI diff --git a/packages/Debian/armhf/DEBIAN/postinst b/packages/Debian/armhf/DEBIAN/postinst deleted file mode 100755 index be76911..0000000 --- a/packages/Debian/armhf/DEBIAN/postinst +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh - -##-------------------------------------------------------------------- -## Copyright (c) 2018 Dianomic Systems -## -## Licensed under the Apache License, Version 2.0 (the "License"); -## you may not use this file except in compliance with the License. -## You may obtain a copy of the License at -## -## http://www.apache.org/licenses/LICENSE-2.0 -## -## Unless required by applicable law or agreed to in writing, software -## distributed under the License is distributed on an "AS IS" BASIS, -## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -## See the License for the specific language governing permissions and -## limitations under the License. -##-------------------------------------------------------------------- - -##-------------------------------------------------------------------- -## -## @postinst DEBIAN/postinst -## This script is used to execute post installation tasks. -## -## Author: Ivan Zoratti -## -##-------------------------------------------------------------------- - -set -e - -set_files_ownership () { - chown -R root:root /usr/local/foglamp/python/foglamp/plugins/south/envirophat -} - -set_files_ownership -echo "Enviro pHAT plugin is installed." -echo "IMPORTANT NOTE: To use this plugin, it is required to enable i2C on the Pi, please do the following steps: -1) sudo raspi-config -2) Choose advanced options -3) Choose I2C Enable/Disable automatic loading -4) Follow the prompts to set this to load this automatically -5) Reboot the Pi (optional)"