Categories
Python VSCP

#VSCP #Python libs.

I have released updated versions of the Python libs. They are still in alpha so structural changes can still happen. Be aware. Docs are also sparse at the moment but there are some simple samples available in the repositories for each lib. pyvscphelper is documented alongside the standard vscphelper library.

You find the libs here Install with

pip install <lib>

Update with

pip install --upgrade <lib>

For more information about VSCP go to the VSCP main site.

/Ake

Categories
Programming Raspberry Pi

Building #ARM #Raspbian packages on your #Intel PC

If you are a maintainer of a software project as I am, you probably spend a lot of time testing and deploying code. The more platforms you add the harder this gets and at some point you need to think carefully what you can do to minimize manual work.

I build things for Ubuntu/Debian/Raspian and Windows. In the beginning a lot of the deployment here was done on each platform. Hours spent on this for each release. Frustrating. I decided to do some scripts that would make it possible to do the first tree automatically. Saving time if I could get it to work.

I found Stein Magnus Jodal‘s excellent article Building ARM Debian packages with pbuilder and he is the only one that should take credit for the things I describe here. I am just a copy cat in this case, well more or less, just adding some vital things.

I had no major problem to get buildings for Ubuntu and Debian to work with pbuilder following Stein Magnis Jodal’s document. The ARM builds was another thing. What I got was this

...
 qemu:handle_cpu_signal received signal outside vCPU context @ pc=0x60184bcc
 qemu:handle_cpu_signal received signal outside vCPU context @ pc=0x600019f9
...

qemu (or rather pbuilder-satisfydepends) fails when checking dependencies. After a long struggle I found that replacing pbuilder-satisfydepends with pbuilder-satisfydepends-apt was a solution to this problem.

I repeat the steps from Stein Magnis Jodal’s document here with my changes and updates and comments to get things working. Again credit is to Stein Magnis Jodal.

Setup pbuilder environment

Add a file .pbuilderrc to your root acount with the following content

!/bin/sh
 set -e
 if [ "$OS" == "debian" ]; then
     MIRRORSITE="http://ftp.se.debian.org/debian/"
     COMPONENTS="main contrib non-free"
     DEBOOTSTRAPOPTS=("${DEBOOTSTRAPOPTS[@]}"
         "--keyring=/usr/share/keyrings/debian-archive-keyring.gpg")
     : ${DIST:="stretch"}
     : ${ARCH:="amd64"}
     if [ "$DIST" == "jessie" ]; then
         #EXTRAPACKAGES="$EXTRAPACKAGES debian-backports-keyring"
         OTHERMIRROR="$OTHERMIRROR | deb $MIRRORSITE jessie-backports $COMPONENTS"
     fi
 elif [ "$OS" == "raspbian" ]; then
     MIRRORSITE="http://ftp.acc.umu.se/mirror/raspbian/raspbian/"
     COMPONENTS="main contrib non-free"
     PBUILDERSATISFYDEPENDSCMD="/usr/lib/pbuilder/pbuilder-satisfydepends-apt"
     DEBOOTSTRAPOPTS=("${DEBOOTSTRAPOPTS[@]}"
         "--keyring=/usr/share/keyrings/raspbian-archive-keyring.gpg")
     : ${DIST:="stretch"}
     : ${ARCH:="armhf"}
 elif [ "$OS" == "ubuntu" ]; then
     MIRRORSITE="http://se.archive.ubuntu.com/ubuntu/"
     COMPONENTS="main restricted universe multiverse"
     DEBOOTSTRAPOPTS=("${DEBOOTSTRAPOPTS[@]}"
         "--keyring=/usr/share/keyrings/ubuntu-archive-keyring.gpg")
 else
     echo "Unknown OS: $OS"
     exit 1
 fi
 if [ "$DIST" == "" ]; then
     echo "DIST is not set"
     exit 1
 fi

Note the PBUILDERSATISFYDEPENDSCMD under the Raspbian section.

Now pbuilder will require three environment variables (in upper case) for it’s use

OS

The os you build for.It can be set to ubuntu, debian or raspbian

ARCH

The arcitecture you are builing for. It can be any of amd64, i386, armel, or armhf. Yes som eother supported arcitecure also of course.

DIST

Distribution of the os. For Debian/Raspbian buster, stretch, jessie. For Ubuntu eoan, disco, bionic, xenial, trusty. Well others shoudl work to.

If you are on a PC qemu-debootstrap is used for the ARM builds. So you have to install it with

sudo apt install pbuilder qemu-user-static

We also need the keyrings. For Ubuntu and Debian install them with

sudo apt install ubuntu-keyring debian-archive-keyring

If that for some reason does not work you can fetch the keyring fro Debian at https://packages.debian.org/sid/all/ubuntu-keyring/download and for Ubuntu keyring can be fetched here https://launchpad.net/ubuntu/+source/ubuntu-keyring

The keyring for Raspbian you can get here

 wget http://archive.raspbian.org/raspbian/pool/main/r/raspbian-archive-keyring/raspbian-archive-keyring_20120528.2_all.deb  
sudo dpkg -i raspbian-archive-keyring_20120528.2_all.deb

Now you need to build the chroots. You do this with steps like

sudo mkdir -p /var/cache/pbuilder/debian-stretch-amd64/aptcache/  
sudo OS=debian DIST=stretch ARCH=amd64 pbuilder --create

Replace OS/DIST/ARCH for your needs.

All you need now is the Debian source package for the code you want to work with. Go to the folder where it is and issue

sudo OS=debian DIST=stretch ARCH=armhf pbuilder build *.dsc

Replace OS/DIST/ARCH for your needs.

If all goes well you find the resulting package in

/var/cache/pbuilder//var/cache/pbuilder/debian-stretch-amd64/result/

replace ‘stretch’, ‘amd64’ and ‘debian’ as to you settings for DIST, ARCH and OS.

If you rather want you can go into an unpacked source folder and issu

tar xvf ../src-pkg.debian.tar.xz
tar xvf ../src-pkg.orig.tar.gz
sudo OS=debian DIST=stretch ARCH=amd64 pdebuild

Again replace OS/DIST/ARCH for your needs.

Thats it really.

I experienced situation when dh-autoreconf was not available in the chroot and when it did not get installed. This was for Ubuntu. If this happens you can instll it manually with

sudo OS=ubuntu DIST=xenial ARCH=amd64 pbuilder --login --save-after-exec 
apt install dh-autoreconf 
exit

Hope this can save some time for someone. And again thanks to Stein Magnis Jodal for his work.

Lazy section

Below is some code you can use if you think typing on a keyboard is tiresome…

Ubuntu

sudo mkdir -p /var/cache/pbuilder/ubuntu-trusty-amd64/aptcache/
sudo OS=ubuntu DIST=trusty ARCH=amd64 pbuilder --create
sudo OS=ubuntu DIST=trusty ARCH=amd64 pbuilder build vscpl2drv-automation1_1.1.0-1.dsc

sudo mkdir -p /var/cache/pbuilder/ubuntu-xenial-amd64/aptcache/
sudo OS=ubuntu DIST=xenial ARCH=amd64 pbuilder --create
sudo OS=ubuntu DIST=xenial ARCH=amd64 pbuilder build vscpl2drv-automation1_1.1.0-1.dsc

sudo mkdir -p /var/cache/pbuilder/ubuntu-bionic-amd64/aptcache/
sudo OS=ubuntu DIST=bionic ARCH=amd64 pbuilder --create
sudo OS=ubuntu DIST=bionic ARCH=amd64 pbuilder build vscpl2drv-automation1_1.1.0-1.dsc

sudo mkdir -p /var/cache/pbuilder/ubuntu-disco-amd64/aptcache/
sudo OS=ubuntu DIST=disco ARCH=amd64 pbuilder --create
sudo OS=ubuntu DIST=disco ARCH=amd64 pbuilder build vscpl2drv-automation1_1.1.0-1.dsc

sudo mkdir -p /var/cache/pbuilder/ubuntu-eoan-amd64/aptcache/
sudo OS=ubuntu DIST=eoan ARCH=amd64 pbuilder --create
sudo OS=ubuntu DIST=eoan ARCH=amd64 pbuilder build vscpl2drv-automation1_1.1.0-1.dsc

Debian

For the arm builds you may need to add the line

PBUILDERSATISFYDEPENDSCMD="/usr/lib/pbuilder/pbuilder-satisfydepends-apt"

to your pbuilder configuration (.pbuilderrc) file.

sudo mkdir -p /var/cache/pbuilder/raspbian-jessie-amd64/aptcache/
sudo OS=raspbian DIST=jessie ARCH=amd64 pbuilder --create
sudo OS=raspbian DIST=jessie ARCH=amd64 pbuilder build *.dsc

sudo mkdir -p /var/cache/pbuilder/raspbian-stretch-amd64/aptcache/
sudo OS=raspbian DIST=stretch ARCH=amd64 pbuilder --create
sudo OS=raspbian DIST=stretch ARCH=amd64 pbuilder build *.dsc

sudo mkdir -p /var/cache/pbuilder/raspbian-buster-amd64/aptcache/
sudo OS=raspbian DIST=buster ARCH=amd64 pbuilder --create
sudo OS=raspbian DIST=buster ARCH=amd64 pbuilder build *.dsc


sudo mkdir -p /var/cache/pbuilder/raspbian-jessie-i385/aptcache/
sudo OS=raspbian DIST=jessie ARCH=i385 pbuilder --create
sudo OS=raspbian DIST=jessie ARCH=i385 pbuilder build *.dsc

sudo mkdir -p /var/cache/pbuilder/raspbian-stretch-i385/aptcache/
sudo OS=raspbian DIST=stretch ARCH=i385 pbuilder --create
sudo OS=raspbian DIST=stretch ARCH=i385 pbuilder build *.dsc

sudo mkdir -p /var/cache/pbuilder/raspbian-buster-i385/aptcache/
sudo OS=raspbian DIST=buster ARCH=i385 pbuilder --create
sudo OS=raspbian DIST=buster ARCH=i385 pbuilder build *.dsc


sudo mkdir -p /var/cache/pbuilder/raspbian-jessie-armle/aptcache/
sudo OS=raspbian DIST=jessie ARCH=armle pbuilder --create
sudo OS=raspbian DIST=jessie ARCH=armle pbuilder build *.dsc

sudo mkdir -p /var/cache/pbuilder/raspbian-stretch-armle/aptcache/
sudo OS=raspbian DIST=stretch ARCH=armle pbuilder --create
sudo OS=raspbian DIST=stretch ARCH=armle pbuilder build *.dsc

sudo mkdir -p /var/cache/pbuilder/raspbian-buster-armle/aptcache/
sudo OS=raspbian DIST=buster ARCH=armle pbuilder --create
sudo OS=raspbian DIST=buster ARCH=armle pbuilder build *.dsc


sudo mkdir -p /var/cache/pbuilder/raspbian-jessie-armhf/aptcache/
sudo OS=raspbian DIST=jessie ARCH=armhf pbuilder --create
sudo OS=raspbian DIST=jessie ARCH=armhf pbuilder build *.dsc

sudo mkdir -p /var/cache/pbuilder/raspbian-stretch-armhf/aptcache/
sudo OS=raspbian DIST=stretch ARCH=armhf pbuilder --create
sudo OS=raspbian DIST=stretch ARCH=armhf pbuilder build *.dsc

sudo mkdir -p /var/cache/pbuilder/raspbian-buster-armhf/aptcache/
sudo OS=raspbian DIST=buster ARCH=armhf pbuilder --create
sudo OS=raspbian DIST=buster ARCH=armhf pbuilder build *.dsc

Raspbian

Use armle for Raspberry Pi 1

sudo mkdir -p /var/cache/pbuilder/raspbian-jessie-armhf/aptcache/
sudo OS=raspbian DIST=jessie ARCH=armhf pbuilder --create
sudo OS=raspbian DIST=jessie ARCH=armhf pbuilder build *.dsc

sudo mkdir -p /var/cache/pbuilder/raspbian-stretch-armhf/aptcache/
sudo OS=raspbian DIST=stretch ARCH=armhf pbuilder --create
sudo OS=raspbian DIST=stretch ARCH=armhf pbuilder build *.dsc

sudo mkdir -p /var/cache/pbuilder/raspbian-buster-armhf/aptcache/
sudo OS=raspbian DIST=buster ARCH=armhf pbuilder --create
sudo OS=raspbian DIST=buster ARCH=armhf pbuilder build *.dsc

This info is current when this is written but may not be when you read it.

Categories
Linux Programming Raspberry Pi

dh_autoreconf problem

If you want to make a debian package on a Raspberry Pi with Stretch installed or another machine with an older debian version installed the debhelper build process may complain about multiple runs of dh_autoreconf and abort. This is due to a bug in dh_autoreconf which just warns for this in later versions.

Solution

Get the latest version of dh_autoreconf

wget http://sourcearchive.raspbian.org/main/d/dh-autoreconf/dh-autoreconf_19.tar.xz

Unpack

tar xvf dh-autoreconf_19.tar.xz

Save a copy of the old sh_autoreconf

sudo mv /usr/bin/dh_autoreconf /usr/bin/dh_autoreconf.save

Copy the new file

copy dh_autoreconf to /usr/bin

Problem should be solved.

Categories
Programming

OverAPI.com | Collecting all the cheat sheets

OverAPI.com is a site collecting all the cheatsheets,all!

Source: OverAPI.com | Collecting all the cheat sheets

Categories
Programming

Introducing GitHub Pull Requests for Visual Studio Code

Introducing GitHub Pull Requests for Visual Studio Code

Source: Introducing GitHub Pull Requests for Visual Studio Code

Categories
Open Source Programming

Why we never thank open source maintainers

https://windsooon.github.io/2017/11/23/Why%20we%20never%20thank%20open%20source%20maintainers/

 

Categories
CAN4VSCP Programming Python VSCP

python-can #VSCP #m2m #IoT #CAN

In a support question today I got to know the python-can package which I was not aware of. This is a package for Python developers python-can wanting to work with CAN. The package supports CANAL but unfortunately the CANAL interface is named “USB2CAN“, which disappoints me a bit,  but at least it’s there.

So all drivers here should work with Python now.

Interesting for VSCP‘ers can the remote interface of the package be. Here you can set up a lightweight connection to a CAN4VSCP bus (CAN bus) and feed it over TCP/IP to a VSCP daemon or some other thing. Perfect for use on small Linux boards where the full  VSCP daemon is too much.

Categories
Programming

Crazy #netbeans #mplabx #java memory usage

The picture below is Mplabx a Netbeans derivative.  Well mostly just an editor for programming development, not even compiling at this stage.  Have I said before that I hate Java.  Yes I probably have but that fact has not changed…

java

Categories
Programming

10 Years of Git: An Interview with Git Creator Linus Torvalds | Linux.com

10 Years of Git: An Interview with Git Creator Linus Torvalds | Linux.com.

Categories
Programming

Browser as a platform for your PhoneGap/Cordova apps

Browser as a platform for your PhoneGap/Cordova apps.