Solaris package upgrade - solaris

I'm having a lot of trouble wrapping my head around how Solaris 11 does packaging. I understand that there is a yum type packaging approach, but I would expect there to be a rpm -i and rpm -U approach that allows a package to be delivered and then installed or upgrade.
For now I have tracked down how to make a package, ie pkgmk and pkgtrans. Given this I can create a "foo_1.0.pkg" file that can be installed like this:
pkgadd -d foo_1.0.pkg
However I can not figure out how to upgrade this package with "foo_2.0.pkg":
root#hostname # pkgadd -d foo_2.0.pkg
The following packages are available:
1 foo foo
(x86) private_build
Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]: all
Processing package instance <foo> from </root/foo_2.0.pkg>
foo(x86) private_build
Current administration requires that a unique instance of the <foo>
package be created. However, the maximum number of instances of the
package which may be supported at one time on the same system has
already been met.
No changes were made to the system.
What am I doing wrong? It would appear that i should use pkg update, but this seems to imply that I need to release my pkg in a repo.

First, you aren't using Solaris 11 packaging (IPS) but the legacy SVR4 packaging.
With the latter, you cannot upgrade a custom package. The only way is then simply to remove the old package and install the newer one, which is what rpm -U is doing under the hood anyway.
pkgrm foo
pkgadd -d foo_2.0.pkg foo

I had the same problem, but I was able to workaround it by passing a config file into the cmd. This is especially useful in a script when used with the "echo |" as it bypasses the confirmation prompt as well. The config file overwrites the default install properties which are located in a file here: /var/sadm/install/admin/default. The key is the instance=overwrite line. I changed some of the others as well, to avoid any other prompts that may come up. As an alternate solution you can change the default file directly and not have to reference the additional config file.
with myprog1.0 (or 2.0) already installed run the following command.
echo | pkgadd -a /opt/myprog/install.conf -d myprog2.0
contents of /opt/myprog/install.conf file:
mail=
instance=overwrite
partial=nocheck
runlevel=nocheck
idepend=nocheck
rdepend=nocheck
space=ask
setuid=ask
conflict=nocheck
action=nocheck
networktimeout=60
networkretries=3
authentication=quit
keystore=/var/sadm/security
proxy=

$UPDATE
This variable does not exist under most installation environments. If it does exist (with the value yes), it means that a PKG with the same name, version and architecture is already installed on the system or that the installing PKG will overwrite an installed PKG. The original BASEDIR is then used.
So, this variable you can use in preinstall or postinstall script for any updation.

Related

What is the best practice for installing external dependencies in a Coq project?

I understand what I believe is the essence of the official utilties doc https://coq.inria.fr/refman/practical-tools/utilities.html#building-a-coq-project:
one creates a _CoqProject with arguments to coqc and the file names to compile (hopefully in an order that takes into account dependencies)
then one make an automatic CoqMakefile with coq_makefile -f _CoqProject -o CoqMakefile
Then you use their recommended Makefile to run the automatically generated make file.
But then if we need other dependencies, it doesn't say how to install them (or uninstall) them. What is the standard way to do that?
My guess is that one likely adds a target to your Makefile at the end of it and do some sort of opam install?
e.g.
# KNOWNTARGETS will not be passed along to CoqMakefile
KNOWNTARGETS := CoqMakefile
# KNOWNFILES will not get implicit targets from the final rule, and so
# depending on them won't invoke the submake. TODO: Not sure what this means
# Warning: These files get declared as PHONY, so any targets depending
# on them always get rebuilt -- or better said, any rules which those names will have their cmds be re-ran (which is
# usually rebuilding functions since that is what make files are for)
KNOWNFILES := Makefile _CoqProject
# Runs invoke-coqmakefile rule if you do run make by itself. Sets the default goal to be used if no targets were specified on the command line.
.DEFAULT_GOAL := invoke-coqmakefile
# Depends on two files to run this, itself and our _CoqProject
CoqMakefile: Makefile _CoqProject
$(COQBIN)coq_makefile -f _CoqProject -o CoqMakefile
# Note make knows what is the make file in this case thanks to -f CoqMakefile
invoke-coqmakefile: CoqMakefile install_external_dependencies
$(MAKE) --no-print-directory -f CoqMakefile $(filter-out $(KNOWNTARGETS),$(MAKECMDGOALS))
#
.PHONY: invoke-coqmakefile $(KNOWNFILES)
####################################################################
## Your targets here ##
####################################################################
# This should be the last rule, to handle any targets not declared above
%: invoke-coqmakefile
#true
# I know this is not a good coq dependency example but just to make it concrete wrote some opam command
install_external_dependencies:
opam install coq-serapi
I think I wrote the install_external_dependencies in the right place but I'm not sure. Is that correct? Anyone has a real example?
For all the code see: https://github.com/brando90/ultimate-utils/tree/master/tutorials_for_myself/my_makefile_playground/beginner_coq_project_with_makefiles/debug_proj
related: question on official tutorial for building coq projects https://coq.discourse.group/t/official-place-to-learn-how-to-setup-coq-make-files-for-beginner/1682
Btw,
I don't understand the last like in the makefile yet.
# This should be the last rule, to handle any targets not declared above
%: invoke-coqmakefile
#true
i.e.
%true in the make file template coq gave us.
% in the name of the rule.
What does that line do?
Update
I'm seeking an end-to-end small demo of how to install all dependencies with whatever the recommended approach when using _CoqProject and coq_makefile as shown in the utilities doc https://coq.inria.fr/refman/practical-tools/utilities.html. The ideal answer would contain a single script to install and compile everything in one go -- say in a install_project_name.sh. Including opam switches etc.
Related:
How does one install a new version of Coq when it cannot find the repositories in a new Mac M1 machine?
Installing packages for Coq using OPAM
https://coq.discourse.group/t/official-place-to-learn-how-to-setup-coq-make-files-for-beginner/1682
The simplest setup is to install external dependencies manually with opam.
opam install packages-needed-by-my-project
Then they will be immediately available to build your own project.
The next level of organization is to package up your project. Refer to the following Coq community resources:
Coq community templates
Recommended Project Structure
The main thing immediately relevant to your question is to have a *.opam file at the root of your project which lists its dependencies (possibly with version requirements). Then you can install them using opam install . --deps-only.
The Makefile part of your question is about a bit of overengineering for passing options seamlessly to CoqMakefile. I'm not sure how it works off-hand, but it's not important anyway, especially because Dune is superseding make as the recommended build system for Coq project.

cpanspec option --filter-requires fails to remove :MODULE_COMPAT

I would like to make a rpm which can install on RHEL5,6 and 7.
[p4474668#rhel7dev source]$ cpanspec webmin-ajax-0.00.tar.gz -d '' --force --filter-requires 'perl(:MODULE_COMPAT_5.16.3)' -b
(... lots of infos here ...)
[p4474668#rhel7dev source]$ rpm -qpR noarch/perl-webmin-ajax-0.00-1.noarch.rpm
perl(:MODULE_COMPAT_5.16.3)
perl(DST::System)
perl(WebminCore)
perl(lib)
perl(strict)
perl(warnings)
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1useless
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(PayloadIsXz) <= 5.2-1
Since the dependancy is not removed, it cannot be installed on a RHEL5.
How to remove the perl(:MODULE_COMPAT_5.16.3) not required dependency?
This feature is under-documented, and doesn't (IMHO) do all of what its name implies.
What it does is:
along with the .spec file it creates a filter script file (some sed in a .sh script), this is referenced in the .spec file and is required during rpmbuild. The dependencies written to the .spec file are not affected by filtering.
that sed filter script is rewritten by sed during rpmbuild to invoke the correct perl.req.
the filter script is applied only to the output of perl.req (which is normally only invoked by find-requires)
(As far as I can tell, perl.req predates explicitly listed dependencies in Makefile.PL and/or the META files. What it does is look for likely use and require directives in perl code with some logic and regex's, the implementation of which is exactly as attractive as you'd expect).
To be honest I'm not entirely sure in what circumstances perl.req and find-requires are or are not invoked (cursory testing by setting AutoReq didn't have an effect for me), but cpanspec reads and processes META.yml directly if found in any case. The only other dependency-related functionality is (rudimentary) processing of Makefile.PL to extract modules references in PREREQ_PM and add those as BuildRequires
Normally you can patch up your .spec file to add something like
%filter_from_requires /XSLoader/d
%filter_setup
However, :MODULE_COMPAT_xxx is a special-case dependency in cpanspec, you can turn it off with the -o option to create "compatible" RPMs that work on older systems. This has other effects too, so it might be less problematic to build in discrete steps so that you can tweak the build:
cpanspec [...] yourmodule
sed -i'.bak' '/^Requires.*:MODULE_COMPAT.*/d' yourmodule.spec
rpmbuild -ba yourmodule.spec
(especially since cpanspec warns that -b is not guaranteed to work always).
Of course the final package may not work as expected, cpanspec is being cautious, but there might be a real API requirement for this constraint (in your case the "noarch" build may limit the scope for problems, I think). The rule of thumb is that API/ABI's try to be backward compatible, not forward compatible (a related problem occurs if you try to build binaries to work with a glibc older than the one you compile against).
You may have better luck building on a CentOS 5 system (or investigate Mock for a more complete solution).

How to fix No package 'atk-bridge-2.0' found error even though atk is installed and PKG_CONIG_PATH and LD_LIBRARY_PATH is set?

First I have installed all the dependent packages including atk 2.18.
Then, I have added them to path.
# echo $LD_LIBRARY_PATH
/opt/gtk_+3.12-RHEL6/dependencies/at-spi2-atk/lib:/opt/gtk_+3.12-RHEL6/dependencies/gobject-introspection/lib:/opt/gtk_+3.12-RHEL6/dependencies/pango/lib:/opt/gtk_+3.12-RHEL6/dependencies/harfbuzz/lib:/opt/gtk_+3.12-RHEL6/dependencies/freetype/lib:/opt/gtk_+3.12-RHEL6/dependencies/icu4c/lib:/opt/gtk_+3.12-RHEL6/dependencies/cairo/lib:/opt/gtk_+3.12-RHEL6/dependencies/fontconfig/lib:/opt/gtk_+3.12-RHEL6/dependencies/libpng/lib:/opt/gtk_+3.12-RHEL6/dependencies/pixman/lib:/opt/gtk_+3.12-RHEL6/dependencies/atk/lib:/opt/gtk_+3.12-RHEL6/dependencies/gdk-pixbuf/lib:/opt/gtk_+3.12-RHEL6/dependencies/GLib/lib:
# echo $PATH
/opt/gtk_+3.12-RHEL6/dependencies/gobject-introspection/bin:/opt/gtk_+3.12-RHEL6/dependencies/pango/bin:/opt/gtk_+3.12-RHEL6/dependencies/harfbuzz/bin:/opt/gtk_+3.12-RHEL6/dependencies/freetype/bin:/opt/gtk_+3.12-RHEL6/dependencies/which/bin:/opt/gtk_+3.12-RHEL6/dependencies/icu4c/sbin:/opt/gtk_+3.12-RHEL6/dependencies/icu4c/bin:/opt/gtk_+3.12-RHEL6/dependencies/cairo/bin:/opt/gtk_+3.12-RHEL6/dependencies/fontconfig/bin:/opt/gtk_+3.12-RHEL6/dependencies/libpng/bin:/opt/gtk_+3.12-RHEL6/dependencies/gdk-pixbuf/bin:/opt/gtk_+3.12-RHEL6/dependencies/GLib/bin:/opt/python_2_7_11/bin:/usr/lib64/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
# echo $PKG_CONFIG_PATH
/opt/gtk_+3.12-RHEL6/dependencies/at-spi2-atk/lib/pkgconfig:/opt/gtk_+3.12-RHEL6/dependencies/gobject-introspection/lib/pkgconfig:/opt/gtk_+3.12-RHEL6/dependencies/pango/lib/pkgconfig:/opt/gtk_+3.12-RHEL6/dependencies/harfbuzz/lib/pkgconfig:/opt/gtk_+3.12-RHEL6/dependencies/freetype/lib/pkgconfig:/opt/gtk_+3.12-RHEL6/dependencies/icu4c/lib/pkgconfig:/opt/gtk_+3.12-RHEL6/dependencies/cairo/lib/pkgconfig:/opt/gtk_+3.12-RHEL6/dependencies/fontconfig/lib/pkgconfig:/opt/gtk_+3.12-RHEL6/dependencies/libpng/lib/pkgconfig:/opt/gtk_+3.12-RHEL6/dependencies/pixman/lib/pkgconfig:/opt/gtk_+3.12-RHEL6/dependencies/atk/lib/pkgconfig:/opt/gtk_+3.12-RHEL6/dependencies/gdk-pixbuf/lib/pkgconfig:/opt/gtk_+3.12-RHEL6/dependencies/GLib/lib/pkgconfig:/opt/gtk_+3.12-RHEL6/dependencies
But, when I try to run ./configure, I am getting the following error:
checking for ATK... no
configure: error: Package requirements (atk atk-bridge-2.0) were not met:
No package 'atk-bridge-2.0' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables ATK_CFLAGS
and ATK_LIBS to avoid the need to call pkg-config.
atk 2.18 is cleary added in the PKG_CONFIG_PATH and also LD_LIBRARY_PATH.
So, I though atk-bridge-2.0 is separate and found the packag: at-spi2-atk and at-spi2-core. But, no atk-bridge-2.0 is installed.
Please help.
The atk-bridge-2.0 API is provided by at-spi2-atk, not by ATK.
Your build environment is fairly broken, and it seems you're installing each component into its own prefix. You shouldn't. Create a temporary build root, and add that to $PATH, $PKG_CONFIG_PATH, $LD_LIBRARY_PATH, and $XDG_DATA_DIRS. Then, use the same prefix for every component.
You should look at how jhbuild works.

Installing Cairo, Helm on Windows

How do I install Helm (https://hackage.haskell.org/package/helm) on Windows 7 (64-bit)?
(Update: I had posted a lot of error messages here, but I've moved them to my answer to not clutter up the question.)
Installation for Windows 64-bit:
I'm including error messages, for if you follow all the steps up to that point and then just try to install directly. This is a conglomeration of a bunch of ad-hoc steps from following many different posts. Any simplification would be appreciated!
Note: Do all work in directories without spaces. I'm doing all work in C:/PF; modify this to your directory.
Download MSYS2-x86_64 from https://msys2.github.io/ and install it. Cabal install cairo (or helm) will give something like:
Configuring cairo-0.13.1.0...
setup.exe: Missing dependencies on foreign libraries:
Missing C libraries: z, cairo, z, gobject-2.0, ffi, pixman-1, fontconfig,
expat, freetype, iconv, expat, freetype, z, bz2, harfbuzz, glib-2.0, intl,
ws2_32, ole32, winmm, shlwapi, intl, png16, z
Download C libraries. In MINGW64 (NOT MSYS2 - I had trouble with MSYS2 at random stages in the process), use the package manager:
pacman -Ss cairo
to search for the Cairo package. You'll find "mingw64/mingw-w64-x86_64-cairo", so install that:
pacman -S mingw64/mingw-w64-x86_64-cairo
*.pc files should have been added to C:\PF\msys64\mingw64\lib\pkgconfig and C:\PF\msys64\usr\lib\pkgconfig. (pkg-config needs to be able to find these files. It looks in PKG_CONFIG_PATH, which by default should have the lib/pkgconfig folder above. Moving the file here is easiest. See Can't install sdl2 via cabal) If you get
The pkg-config package ... version ... cannot be found
errors then check your *.pc files.
Repeat with other required libraries, like atk
pacman -S mingw64/mingw-w64-x86_64-atk
(I don't know the complete list, but error messages later on will let you know what to get.)
Get the development files for these libraries (as suggested by How to install cairo on Windows). Most of them are bundled up at http://ftp.gnome.org/pub/gnome/binaries/win64/gtk+/2.22/. Unzip.
Copy files (.a, .dll.a) in lib to C:\PF\msys64\mingw64\lib. Copy the pkgconfig folder, which contains the .pc files.
Copy files in include to C:\PF\msys64\mingw64\include.
Add C:\PF\gtk+-2.22.1\bin to the path.
(2) and (3) might be redundant. I don't know - I did them both.
At this point you can probably do "cabal install cairo". (Warning: if your end goal is something else, you may not want to "cabal install" intermediate packages, see https://wiki.haskell.org/Cabal/Survival#Issue_.232_--_Not_installing_all_the_packages_in_one_go.)
See (4) for the syntax in specifying extra-include-dirs and extra-lib-dirs (but if you copied the files above this shouldn't be necessary),
Any time you get
Missing (or bad) header file
check to see you copied the *.h files to mingw64\include and/or add the include folder to the PATH. Use cabal install -v3 to get verbose error messages if the problem persists.
If you get something like
cairo-0.13.1.0: include-dirs: /mingw64/include/freetype2 is a relative path
which makes no sense (as there is nothing for it to be relative to). You can
make paths relative to the package database itself by using ${pkgroot}. (use
--force to override)
try --ghc-pkg-options="--force" (as mentioned at https://github.com/gtk2hs/gtk2hs/issues/139).
Get SDL. Otherwise you'll get
configure: error: *** SDL not found! Get SDL from www.libsdl.org.
If you already installed it, check it's in the path. If problem remains,
please send a mail to the address that appears in ./configure --version
indicating your platform, the version of configure script and the problem.
Failed to install SDL-0.6.5.1
Follow the instructions in (2) to get sdl/sdl2 libraries. (See instructions here Installing SDL on Windows for Haskell (GHC).)
The new version helm-0.7.1 requires sdl2, but there are other dependency issues with helm-0.7.1 as of writing. Download SDL from http://sourceforge.net/projects/msys2/files/REPOS/MINGW/x86_64/ (direct download link to newest version as of writing http://sourceforge.net/projects/msys2/files/REPOS/MINGW/x86_64/mingw-w64-x86_64-SDL-1.2.15-7-any.pkg.tar.xz.sig/download), unzip. "cabal install sdl" gives
* Missing (or bad) header file: SDL/SDL.h
* Missing C library: SDL
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.
so we specify where the dirs are (change the name depending on where you extracted sdl to)
cabal install sdl --extra-include-dirs=C:/PF/sdl\include --extra-lib-dirs=C:/sdl/lib
If you got SDL2 (http://libsdl.org/download-2.0.php) (for a newer version of Helm): there is a fatal bug that hasn't been fixed in the release version. (If you don't fix it, cabal install -v3 things which depends on it will give error
winapifamily.h: No such file or directory
("winapifamily.h: No such file or directory" when compiling SDL in Code::Blocks) Download https://hg.libsdl.org/SDL/raw-file/e217ed463f25/include/SDL_platform.h, replace the file in the include folder and in C:/PF/msys64/mingw64/include/SDL2.
Download gtk2hs from http://code.haskell.org/gtk2hs and run
the following
cd gtk2hs/tools
cabal install
cd ../glib
cabal install
cd ../gio
cabal install
cd ../pango
cabal install --ghc-pkg-options="--force"
(Maybe you have already installed glib and gio from before? I did this step because normal install of Pango caused an error for me (https://github.com/gtk2hs/gtk2hs/issues/110)
pango-0.13.1.0: include-dirs: /mingw64/include/freetype2 is a relative path
which makes no sense (as there is nothing for it to be relative to). You can
make paths relative to the package database itself by using ${pkgroot}. (use
--force to override)
Once the Helm developers get things updated you should be able to do "cabal install helm" but right now there seem to be dependency issues. For me, cabal automatically tries to install helm-0.4 (probably because 0.4 didn't give upper bounds on dependencies, while newer versions do. You could try "cabal unpack"ing and deleting the upper bounds...). Then
cabal unpack helm-0.4
Installing gives an error because "pure" got moved to Prelude. Open helm-0.4\src\FRP\Helm\Automaton.hs and change line 17:
import Prelude hiding (id, (.), pure)
Now
cabal install
Try to compile and run a program using Helm
(This is 0.4 - look on the website for a newer sample if you tried a newer Helm)
import FRP.Helm
import qualified FRP.Helm.Window as Window
render :: (Int, Int) -> Element
render (w, h) = collage w h [filled red $ rect (fromIntegral w) (fromIntegral h)]
main :: IO ()
main = run $ fmap (fmap render) Window.dimensions
If you get an error about a missing .dll (sdl.dll), find it in a bin/ folder and add the folder to your PATH (or copy it to somewhere on your path).

rpm name gets changed after installation

I have created rpm with following name:
[root#buildbtl ship-rpms]# ls
cdd-pcts-5.1.1.el6.x86_64.rpm
I installed rpm with the command
rpm -ivh cdd-pcts-5.1.1.el6.x86_64.rpm
After querying the installed package the name gets changed to
cdd-pcts-5.1.1-.el6.x86_64
[root#buildbtl ship-rpms]# rpm -qa | grep cdd-p
cdd-pcts-5.1.1-.el6.x86_64
I cannot understand why extra - is added after version 5.1.1
How can I maintain the name of the created rpm and installed rpm as same.
In the spec file I have overridden the MACRO _build_name_fmt for naming the rpm
using the command below:
%define _build_name_fmt %{NAME}-%{_VERSION}%{Release}.%{ARCH}.rpm
Thanks in advance for guidance
It doesn't matter how would you rename rpm package file (in your case via changing definition of _build_name_fmt), it's actual package name (which rpm database actually cares about) is always stored inside the package along other rpm metadata. This means that the easiest way to ensure that name of rpm package is the same both in rpm database and in rpm build filename is to not change the _build_name_fmt.
The RPM database always stores four "metadata" fields which identify the package: name, version, release and arch (architecture). It gets this information by reading the contents of the RPM file; its filename is irrelevant. There are additional metadata fields for RPMs which you can see using the rpm -qipackage command (see The Parts of an RPM Query for more information).
In your example, it appears that
name is "cdd-pcts",
version is "5.1.1",
release is ".el6', and
arch is "x86_64"
The default format for displaying this information is name-version-release.arch, which puts a "-" immediately before the release ".el6". Perhaps %{Release} is built up from two symbols, and in modifying the spec-file you made one of those symbols empty.
Before installing, you can also inspect your package to check if the metadata is set correctly, e.g.,
rpm -qip cdd-pcts-5.1.1.el6.x86_64.rpm