GNU Octave: Build a package from a directory instead of a tarball - installation

I currently developing an interface for a library as a GNU Octave package. Normally packages in GNU Octave are installed via
pkg install tarball_of_the_package.tar.gz
But compressing the package for each test is more or less time consuming. Now my question is if it is possible to call somehow the pkg install mechanism from a directory which has a valid package structure like in the tarball? Running
pkg install .
from inside this directory yields an error:
unpack: FILETYPE must be "gunzip" for a directory
Even specifying the whole path as
pkg install /path/to/the/package/source
results in the same problem.
At the moment I am using GNU Octave 4.0.0 for my developments.

What most packages have is a Makefile at the root of the package with targets such as install that will handle that for you. See for example the Makefile for the statistics package which allow you to do:
$ hg clone http://hg.code.sf.net/p/octave/statistics
destination directory: statistics
requesting all changes
adding changesets
adding manifests
adding file changes
added 401 changesets with 996 changes to 172 files
updating to branch default
133 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ cd statistics/
$ make install
Creating package version 1.2.4 release ...
rm -rf "statistics-1.2.4"
hg archive --exclude ".hg*" --exclude "Makefile" --type files "statistics-1.2.4"
chmod -R a+rX,u+w,go-w "statistics-1.2.4"
tar cf - --posix "statistics-1.2.4" | gzip -9n > "statistics-1.2.4.tar.gz"
Installing package locally ...
octave --silent --eval 'pkg ("install", "statistics-1.2.4.tar.gz")'
For information about changes from previous versions of the statistics package, run 'news statistics'.
And of course, there's nothing stopping you from calling make install from the Octave session itself. The statistics package example is nicer because it only has m files. If your package also has code to be compiled, the image package has a more complex, but not by much, Makefile for that.

Related

Install pg_trgm on postgres 9.4.24

I'm trying to use the similarity function on a Greemplum system using postgres 9.4.24 version.
The Greenplum System is running on a CentOS 7 cluster (CentOS Linux release 7.9.2009 (Core))
I've managed to install the postgresql-contrib package by running this:
sudo yum install postgresql-contrib.x86_64
However, when I run this command on a DB:
create extension pg_trgm();
I get the following:;
SQL Error [58P01]: ERROR: could not open extension control file "/usr/local/greenplum-db-6.13.0/share/postgresql/extension/pg_trgm.control": No such file or directory
I looked in the directory and the pg_trgm.control wasn't there but I was expecting it since I installed the contrib package.
Is there anything I missed?
I found the contrib repository for Greenplum and downloaded the code here:
https://github.com/greenplum-db/gpdb/tree/master
which includes the contrib directory with all the extensions..
however, when I try to make && make install, I get an error:
[gpadmin#mdw pg_trgm]$ sudo make
Makefile:22: ../../src/Makefile.global: No such file or directory
Makefile:23: /contrib/contrib-global.mk: No such file or directory
make: *** No rule to make target `/contrib/contrib-global.mk'. Stop.
Looking at the directory structure and files, Makefile.global doesn't exists and contrib-global.mk does but not sure if the path is correct, I can try changing the path in the Makefile but not sure.
These are the contents of the Makefile file:
# contrib/pg_trgm/Makefile
MODULE_big = pg_trgm
OBJS = trgm_op.o trgm_gist.o trgm_gin.o trgm_regexp.o $(WIN32RES)
EXTENSION = pg_trgm
DATA = pg_trgm--1.3--1.4.sql \
pg_trgm--1.3.sql pg_trgm--1.2--1.3.sql pg_trgm--1.1--1.2.sql \
pg_trgm--1.0--1.1.sql pg_trgm--unpackaged--1.0.sql
PGFILEDESC = "pg_trgm - trigram matching"
REGRESS = pg_trgm pg_word_trgm pg_strict_word_trgm
REGRESS_OPTS += --init-file=$(top_srcdir)/src/test/regress/init_file
ifdef USE_PGXS
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
else
subdir = contrib/pg_trgm
top_builddir = ../..
include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/contrib/contrib-global.mk
endif
I have checked out the code in my /tmp folder and it created the structure under /tmp/gpdb
UPDATE:
I did follow Bradford suggestions and was able to compile and install, however, I'm getting this when I run:
create extension pg_trgm;
ERROR: could not open extension control file "/usr/local/greenplum-db-6.13.0/share/postgresql/extension/pg_trgm.control": No such file or directory (seg57 172.28.8.8:6001 pid=146663)
I did run manually once I ran the make and make install:
/usr/bin/install -c -m 755 pg_trgm.so '/usr/local/greenplum-db-6.13.0/lib/postgresql/pg_trgm.so'
/usr/bin/install -c -m 644 pg_trgm.control '/usr/local/greenplum-db-6.13.0/share/postgresql/extension/'
/usr/bin/install -c -m 644 pg_trgm--1.1.sql pg_trgm--1.0--1.1.sql pg_trgm--unpackaged--1.0.sql '/usr/local/greenplum-db-6.13.0/share/postgresql/extension/'
I can see the .control file in there so not sure what's going on, it seems it was copied only to the master but not the segment hosts, would that be an issue? Do I need to compile this on every segment host?
UPDATE:
I did install on each segment and now I'm getting this:
SQL Error [0A000]: ERROR: query plan with multiple segworker groups is not supported
Hint: likely caused by a function that reads or modifies data in a distributed table
would this extension not be supported by greenplum?
At a high level, you will want to download the source for the release of GPDB that you are running. You can do this either by downloading the tarball from the GitHub release page or cloning the repository and checking-out the release tag.
Once you have done that, source greenplum_path.sh from your installation of GPDB, change into the the contrib/pg_trgm directory and run
USE_PGXS=true make
USE_PGXS=true make install
Setting USE_PGXS will pull in the missing Makefiles from the installation of GPDB.
If the install location of GPDB is not owned by gpadmin user, then the make install will fail for permission issues; using sudo make install will most likely fail because pg_config won't be found on the path. In that case, I just run make -n install and then manually run the commands prefixed with sudo.
Here are all the steps in a psuedo-shell session:
git clone https://github.com/greenplum-db/gpdb.git
cd gpdb
# use git checkout 6.13.0 for older versions of git
git switch --detach 6.13.0
git submodule update --init --recursive
source /usr/local/greenplum-db-6.13.0/greenplum_path.sh
cd contrib/pg_trgm
USE_PGXS=true make
USE_PGXS=true make -n install
Edit: I should clarify that I haven't tested if pg_trgm works with GPDB, only that it builds and compiles.

config.status: error: cannot find input file: `po/Makefile.in.in'

I hit this error message while trying to build gnote using GNU Autotools.
I had first run:
$ git clean -xf # to clean the tree of untracked files, then
$ autoreconf # to create the script named `configure`, and finally
$ ./configure # to check my system, and create Makefiles from their templates
Neither po/Makefile.in.in nor po/Makefile.in exist in the source tree that I downloaded.
Yet configure needs to make this po/Makefile, as called for in the root Makefile.am in this line:
SUBDIRS = data src po help
Where do I get, or how do I make, po/Makefile.in.in?
Like all Gnome related packages, gnote uses many steps of buildsystem setup beyond just running autoreconf.
The autogen.sh script gnote comes with should run all the required steps to set up the buildsystem.
As usual, run the autogen.sh script with the --help parameter if you want to call configure separately.
po/Makefile.in.in is created by running intltoolize from the intltool package. It needs to be run from the project tree's root directory.
There isn't much documentation on intltoolize that I could find except for the brief man page, but it's source code says that that it's a fork of an older utility called libtoolize, and it's a relatively short script.
(BTW, if you don't already have intltoolize installed, you can figure out which package installs it, with this: sudo apt-file find intltoolize.)
*.in files are templates used by AutoMake to create a Makefile.
.in.in is a soft link to /usr/share/intltool/Makefile.in.in.

How do I install Mendeley to use Anaconda python

I've freshly installed Ubuntu 18.04 and have decided to try Anaconda. However, when I then try to install Mendeley, I get the following error:
mendeleydesktop depends on python; however:
Package python is not installed.
I assume the issue here is that python is now in ~\anaconda2\bin, instead of \usr\bin. I'm not certain what I should do. As I see it, I have 3 options:
Install a system python into \usr\bin, but this seems sloppy/messy
Put a softlink in \usr\bin along the lines of ln -s python ~\anaconda2\bin\python, but I'm worried that there might be implications to that, which I don't understand
Somehow tell the mendeley.deb file where the python I'm using is, but I don't know how to do this.
Are either 1 or 2 reasonable options? If not how do I implement my 3rd option, or what else should I do?
Empirically found option 2 does not work. dpkg is still looking for the installation of the python package
You can use the method given here to remove the system python dependency in the .deb file; I tried this and mendeley seems to install as normal. Assuming your conda environment is set up correctly, it will work. I had to modify the instructions on that page slightly:
Unpack deb: $ ar x mendeleydesktop_1.19.4-stable_amd64.deb (will create i.e. three files: debian-binary control.tar.gz data.tar.gz)
Unpack control archive: $ tar xzf control.tar.gz (will create: postinst control)
Fix dependencies in control (use a text editor)
Repack control.tar.gz: $ tar c postinst control | gzip -c > control.tar.gz
Repack deb: $ ar rcs mendeleydesktop_1.19.4-stable_amd64_nopythondep.deb debian-binary control.tar.gz data.tar.gz (order important! dpkg wouldn't be able to read the metadata of a package quickly if it had to search for where the data section ended!)

Compiling a specific version of a freeBSD utility

I want to compile and run a specific version of a FreeBSD utility from the source code.
For example, I downloaded the repo for the following utility: https://svnweb.freebsd.org/base/stable/9/sbin/routed/
However, when I run the make command, I get the following error:
"../Makefile.inc", line 3: Cannot open ../Makefile.inc
make: fatal errors encountered -- cannot continue
*** [all] Error code 1
Can someone point me in the right direction?
You will need to download the whole source tree. The build system depends on pieces from different locations in the tree. Then;
Unpack the source in /usr/src
cd /usr/src/sbin/routed
make && make install
It looks like you want the 9-stable branch? If you have subversion available, you can do:
rm -rf /usr/src/
svn co svn://svn.freebsd.org/base/stable/9 /usr/src
(Depending on your FreeBSD version, svn may also be called svnlite) Also see the handbook.
On my machine, the complete /usr/src tree is 2445 MiB, including the .svn directory.
Edit: Note that it a program relies on system calls, library functions or other features that were introduced in a certain branch/version of FreeBSD, it will not work on older branches/versions.

Error when opening .tar.gz via Shell to install Apache Maven

Machine:
Mac OSX 10.5.8 32-bit.
Goal:
To install apache maven per its websites instructions, in order to install the JUNG package according to its install instructions, so I can use the JUNG classes in various Java GUIs.
What I Did:
Downloaded a .tar.gz file, and using the shell, moved it to a directory (using mv) I created for it (using mkdir), usr/local/apache-maven per the website directions
I downloaded the file apache-maven-3.0.4-bin.tar.gz. Next I tried extracting the file using tar -zxvf apache-maven-3.0.4-bin.tar.gz.
Error:
I get an error message when I try to extract the apache-maven .gz (install?) file in shell.
tar: apache-maven-3.0.4/direcoryandfile: Cannot open: No such file or directory
...
apache-maven-3.0.4/lib/ext: Cannot mkdir: No such file or directory apache-maven-3.0.4/lib/ext/README.txt
tar: apache-maven-3.0.4/lib/ext/README.txt: Cannot open: No such file or directory tar:
Error exit delayed from previous errors
Instructions:
For the maven building
Extract the distribution archive, i.e. apache-maven-3.0.4-bin.tar.gz to the directory you wish to install Maven 3.0.4... The subdirectory apache-maven-3.0.4 will be created from the archive.
...
for the JUNG installation
Appendix: How to Build JUNG
Get Maven
Download and install maven2 from maven.apache.org: http://maven.apache.org/download.html. At time of writing (early June 2012), the latest version was maven-3.0.4. Install the downloaded maven2 (there are installation instructions on the Maven website).
Follow the installation instructions and confirm a successful installation by typing 'mvn --version' in a command terminal window.
Self-Rectification Attempts
From what I can tell the archive file is missing some directories or something. I tried deleting the file, redownloading the .tar.gz file from a different mirror and repeating the process. Same result. Thanks again for the help
Background:
I'm trying to install the JUNG package to my system's Java, so I can write object-oriented code using various GUIs (Ecliplse, Dr. Java) using the classes in JUNG. I don't understand how the building/installing process works, and how I can get what I build/install to work on various GUIs and the command line. I'm new to shell and the command line, and mostly have experience using a simple IDE (DrJava, Python IDLE, R GUI) to write and compile object-oriented code.
To unpack a tar.gz archive you need to do it either in two steps:
gunzip apache-maven-3.0.4.tar.gz
tar -xf apache-maven-3.0.4.tar
or you might try to do it in a single step:
tar -zxf apache-maven-3.0.4.tar.gz
Two Step Process:
1. Extract the .tar from the .tar.gz using gunzip, and -v for having gunzip print what its doing. gunzip -v apache-maven-3.0.4.tar.gz
2. Extract the .tar file using tar, -x for telling the program to do an extraction, -v for having tar print what its doing, and -f for tar to know that the following file is the archive and appending with sudo so tar has permission to create directories. sudo tar -xvf apache-maven-3.0.4.tar

Resources