Cabal build-depends and transitive dependencies - cabal

Where can I find information about semantics of build-depends field in .cabal file?
My interpretation is that it is misleading and quite bad for the user experience:
cabal will figure out what are dependencies for a package to install when asked
cabal will find a plan along with matching versions
cabal will require you to manually enter all transitive dependencies in a .cabal file (with version ranges) to build a project
If a library has a "convenience" wrapper, does my cabal file have to look like this?
build-depends: base >= 4.7 && < 5
, diagrams >= 1.0
, diagrams-core >= 1.0
, diagrams-lib >= 1.0
, diagrams-contrib >= 1.0
, diagrams-svg >= 1.0

Related

Cannot install tmap

When I try to install tmap:
install.packages("tmap")
I have the following mistake:
also installing the dependencies ‘tmaptools’, ‘sf’
There are binary versions available but the source versions are later:
binary source needs_compilation
sf 0.9-0 0.9-2 TRUE
tmap 2.3-2 3.0 FALSE
Binaries will be installed
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/tmaptools_3.0.zip'
Content type 'application/zip' length 178880 bytes (174 KB)
downloaded 174 KB
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/sf_0.9-0.zip'
Content type 'application/zip' length 39675549 bytes (37.8 MB)
downloaded 37.8 MB
package ‘tmaptools’ successfully unpacked and MD5 sums checked
package ‘sf’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\Marine\AppData\Local\Temp\RtmpSQF9EP\downloaded_packages
installing the source package ‘tmap’
trying URL 'https://cran.rstudio.com/src/contrib/tmap_3.0.tar.gz'
Content type 'application/x-gzip' length 2936348 bytes (2.8 MB)
downloaded 2.8 MB
* installing *source* package 'tmap' ...
** package 'tmap' correctement décompressé et sommes MD5 vérifiées
** using staged installation
** R
** data
** inst
** byte-compile and prepare package for lazy loading
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
namespace 'sf' 0.9-0 is being loaded, but = 0.9.1 is required
Calls: <Anonymous ... withCallingHandlers - loadNamespace - namespaceImport - loadNamespace
Exécution arrêtée
ERROR: lazy loading failed for package 'tmap'
* removing 'C:/Program Files/R/R-3.6.3/library/tmap'
Warning in install.packages :
installation of package ‘tmap’ had non-zero exit status
So I guess this is a problem with the sf version, but when I try to install sf independently, it is the version 0.9-0. that I install, and I cannot install 0.9.1 or more as required.
Any tip to overcome this issue?
Thanks!
PS: I use R version 3.6.3

libuuid not linking in ubuntu 16.04

The above problem is not resolved in ubuntu 16.04 .
I tried it but still not working . here are the results of steps I followed :
~$ apt-cache search libuuid
libuuid-perl - Perl extension for using UUID interfaces as defined in e2fsprogs libuuid1 - Universally Unique ID library uuid-dev - Universally Unique ID library - headers and static libraries uuid-runtime - runtime components for the Universally Unique ID library libdata-uuid-libuuid-perl - uuid.h based UUID generation module libuuid-tiny-perl - pure Perl module to generate v1, v3, v4, and v5 UUIDs libuuidm-ocaml-dev - Universally unique identifiers for OCaml php-uuid - PHP UUID extension
~$ sudo apt-get install uuid-runtime
Reading package lists... Done Building dependency tree
Reading state information... Done uuid-runtime is already the newest version (2.27.1-6ubuntu3.6). The following packages were automatically installed and are no longer required: linux-headers-4.15.0-29 linux-headers-4.15.0-29-generic linux-headers-4.15.0-43 linux-headers-4.15.0-43-generic linux-image-4.15.0-29-generic linux-image-4.15.0-43-generic linux-modules-4.15.0-29-generic linux-modules-4.15.0-43-generic linux-modules-extra-4.15.0-29-generic linux-modules-extra-4.15.0-43-generic Use 'sudo apt autoremove' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 77 not upgraded.
~$ sudo apt-get install libuuid1
Reading package lists... Done Building dependency tree
Reading state information... Done libuuid1 is already the newest version (2.27.1-6ubuntu3.6). The following packages were automatically installed and are no longer required: linux-headers-4.15.0-29 linux-headers-4.15.0-29-generic linux-headers-4.15.0-43 linux-headers-4.15.0-43-generic linux-image-4.15.0-29-generic linux-image-4.15.0-43-generic linux-modules-4.15.0-29-generic linux-modules-4.15.0-43-generic linux-modules-extra-4.15.0-29-generic linux-modules-extra-4.15.0-43-generic Use 'sudo apt autoremove' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 77 not upgraded.
~$ sudo apt-get install uuid-dev
Reading package lists... Done Building dependency tree
Reading state information... Done uuid-dev is already the newest version (2.27.1-6ubuntu3.6). The following packages were automatically installed and are no longer required: linux-headers-4.15.0-29 linux-headers-4.15.0-29-generic linux-headers-4.15.0-43 linux-headers-4.15.0-43-generic linux-image-4.15.0-29-generic linux-image-4.15.0-43-generic linux-modules-4.15.0-29-generic linux-modules-4.15.0-43-generic linux-modules-extra-4.15.0-29-generic linux-modules-extra-4.15.0-43-generic Use 'sudo apt autoremove' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 77 not upgraded.
Following is the code in my test.c file
#include <stdio.h>
#include <uuid/uuid.h>
int get_uuid();
int main()
{
get_uuid();
return 1;
}
int get_uuid()
{
uuid_t uuid;
uuid_generate(uuid);
return 1;
}
Error: /tmp/cchyLkZt.o: In function get_uuid':
test5.c:(.text+0x34): undefined reference touuid_generate' collect2: error: ld returned 1 exit status
Compilation Command -
cc -luuid test.c

Installing multiples packages with chef

When I try to install multiples packages with a wildcard naming I got the following error:
* yum_package[mysql-server] action install (up to date)
* yum_package[mysql*] action install
* No candidate version available for mysql*
============================================================================ ====
Error executing action `install` on resource 'yum_package[mysql*]'
============================================================================ ====
Recipe code is:
package 'mysql-server' do
action :install
end
package 'mysql*' do
action :install
end
You have to use the exact package name. The chef package resource does no magic to find matching packages.
The name of the resource (the part just after package) is used as the package name and given to the underlying system (yum on RH like systems, apt on debian like systems)
If you have multiples packages to install and a common configuration you can loop over them in your recipe instead:
['mysql-server','mysql-common','mysql-client'].each do |p|
package p do
action :install
end
end
The array creation could be simplified with some ruby syntax as the words builder %w:
%w(mysql-server mysql-common mysql-client).each [...]
Since chef 12.1 the package resource accept an array of packages directly like this:
package %w(mysql-server mysql-common mysql-client)
This can be resolved using chef cases. Please see below
add the following to your attributes file:
packages = []
case node[:platform_family]
when 'rhel' #based on your OS
packages = [
"package1",
"package2",
"package3",
"package4",
"package5",
"package6",
"package7" ## Last line without comma
]
end
default[:cookbookname][:packages] = packages
Then, add the following to your recipe file (recipes/default.rb):
node[:cookbookname][:packages].each do |pkg|
package pkg do
action :install
retries 3
retry_delay 5
end
end

rpm and Yum don't believe a package is installed after Chef installs

Running chef-solo (Installing Chef Omnibus (12.3)) on centos6.6
My recipe has the following simple code:
package 'cloud-init' do
action :install
end
log 'rpm-qi' do
message `rpm -qi cloud-init`
level :warn
end
log 'yum list' do
message `yum list cloud-init`
level :warn
end
But it outputs the following:
- install version 0.7.5-10.el6.centos.2 of package cloud-init
* log[rpm-qi] action write[2015-07-16T16:46:35+00:00] WARN: package cloud-init is not installed
[2015-07-16T16:46:35+00:00] WARN: Loaded plugins: fastestmirror, presto
Available Packages
cloud-init.x86_64 0.7.5-10.el6.centos.2 extras
I am at a loss as to why rpm/yum and actually rpmquery don't see the package as installed.
EDIT: To clarify I am specifically looking for the following string post package install to then apply a change to the file (I understand this is not a very chef way to do something I am happy to accept suggestions):
rpmquery -l cloud-init | grep 'distros/__init__.py$'
I have found that by using the following:
install_report = shell_out('yum install -y cloud-init').stdout
cloudinit_source = shell_out("rpmquery -l cloud-init | grep 'distros/__init__.py$'").stdout
I can then get the file I am looking for and perform
Chef::Util::FileEdit.new(cloudinit_source.chomp(''))
The file moves based on the distribution but I need to edit that file specifically with in place changes.
Untested code, just to give the idea:
package 'cloud-init' do
action :install
notifies :run,"ruby_block[update_cloud_init]"
end
ruby_block 'update_cloud_init' do
block do
cloudinit_source = shell_out("rpmquery -l cloud-init | grep 'distros/__init__.py$'").stdout
rc = Chef::Util::FileEdit.new(cloudinit_source.chomp(''))
rc.search_file_replace_line(/^what to find$/,
"replacement datas for the line")
rc.write_file
end
end
ruby_block example taken and adapted from here
I would better go using a template to manage the whole file, what I don't understand is why you don't know where it will be at first...
Previous answer
I assume it's a compile vs converge problem. at the time the message is stored (and so your command is executed) the package is not already installed.
Chef run in two phase, compile then converge.
At compile time it build a collection of resources and at converge time it execute code for the resource to get them in the described state.
When your log resource is compiled, the ugly back-ticks are evaluated, at this time there's a package resource in the collection but the resource has not been executed, so the output is correct.
I don't understand what you want to achieve with those log resources at all.
If you want to test your node state after chef-run use a handler maybe calling ServerSpec as in Test-Kitchen.

How to install TPC-E EGen using gcc 4.8 (or above)?

I am stuck with the installation of TPC-E EGen on Mac OS X (or Linux). I have downloaded the workload generator from TPC website : www.tpc.org/tpce/egen-download-request.asp but I failed to build it.
When using the following command for building the utilities:
cd Utilities/prj/GNUMake/
make
I receive the following error:
../../prj/GNUMake/Makefile.EGenUtilities:136: ../../obj/DateTime.d: No such file or directory
../../prj/GNUMake/Makefile.EGenUtilities:136: ../../obj/EGenVersion.d: No such file or directory
../../prj/GNUMake/Makefile.EGenUtilities:136: ../../obj/error.d: No such file or directory
../../obj/locking.d:3: *** missing separator. Stop.
which is not a meaningful error and does not help in how to resolve the issue.
Any help or hint would be appreciated.
I found the problems:
1- in EGenStandardTypes.h, I had to replace
\#if defined (__unix) || (_AIX)
by
\#if defined(unix) || defined(\__unix__) || defined(\__unix) || defined(\__APPLE__) && defined(\__MACH__) || (_AIX)
in order to make this part of code work for Mac OS X as well.
2- in DateTime.cpp and error.cpp
I had to comment out #error directive usages, as my current version of GCC did not support it.

Resources