Linux rpm relocate package to multiple prefixes - rpm-spec

Let us suppose the package installs files under different folders i.e under /opt, /etc, etc. Is it possible to create relocatable package which installs files to different prefixes for each partition like /opt to /abc/opt and /etc to /abc/etc or /xyz/etc.

if your spec file prefix looks like this
Prefix: /usr
Prefix: /etc
you can relocate files to different prefixes using command
rpm ... --relocate /opt=/abc/opt --relocate /etc=/xyz/etc ...

Related

python setup.py install won't keep data_files

I am currently so confused about installation of my own Python packages... Between setup.pys, sdists and wheels, no matter what I do, I can't seem to achieve what I want - which is to have a bunch of non-.py data files installed and kept in the virtual environment with the same structure I have in my project folder after the installation.
I've read all kinds of documentations, and created a setup.py file that has a data_files field that contains all the data files I need in my installation.
I have the following structure:
.
|__ requirements.txt
setup.py
hr_datapool
|__ __init__.py
|__ data_needed
|__ needed_folder
|__ needed_file.notpy
|__ one_module
|__ __init__.py
|__ misc_tools.py
|__tests
|__ test_tools.py
|__ other_module
...
And data_needed contains non-.py data files that are needed for misc_tools.py (and thus tests.py) to run.
Because of this, I added a data_files into my setup.py that contains all the folders and files I need. This I confirmed, everything is there what should be.
And yet, if I do any variation of pip install ., python setup.py install or the likes, the data_files are completely ignored, and/or placed in the wrong directory and don't appear anywhere in the created build or dist folders. And because of this, obviously all my tests fail, since they can't load files that are not there. Neither are they stored in the installation folder on the venv when I sometimes do succeed in copying them, but rather in the root of the venv.
The funny thing is, the files are handled while installing, I keep getting console output when installing with python setup.py install like:
copying data_needed/needed_folder/needed_file.notpy-> /Users/.../venv/hr_datapool/data_needed/needed_folder/
but only if I use python setup.py install, (not when using pip install .).
According to the documentation:
The directory should be a relative path. It is interpreted relative to the installation prefix (Python’s sys.prefix for system
installations; site.USER_BASE for user installations). Distutils
allows directory to be an absolute installation path, but this is
discouraged since it is incompatible with the wheel packaging format.
No directory information from files is used to determine the final
location of the installed file; only the name of the file is used.
Notice the highlights. However, in my example, it doesn't install relative to the directory containing the package, but it installs into its own folder in the root of the virtual environment, making it practically unreachable from within my code. I made sure I se relative paths in my setup.py, but still this happens.
How can I make sure the required data_files install within the target directory of the module, and not separately into the root of the virtual environment?

Error: found in Chart.yaml, but missing in charts/ directory: mysql

I have added mysql in requirements.yaml. Helm dependency downloads the mysql chart
helm dependency update
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "nginx" chart repository
...Successfully got an update from the "stable" chart repository
Update Complete. ⎈Happy Helming!⎈
Saving 1 charts
Downloading mysql from repo <our private repository>
Deleting outdated charts
But when I do helm install my_app_chart ../my_app_chart
It gives error
Error: found in Chart.yaml, but missing in charts/ directory: mysql
You don't have to add it to the control version system, you just download them again if for some reason you have lost them (for example when you clone the repository). To do this, execute the command:
helm dependency update
The above command will download the dependencies you've defined in the requirements.yaml file or dependencies entry in Chart.yaml to the charts folder. This way, requirements are updated and you'll have the correct dependencies without worrying about if you updated them also in the control version system.
I updated .helmignore
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
charts/
It contained charts/ I removed the entry and it worked
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
I have encountred the same error message when I first started learning how to use libcharts, I used chart.yaml to specify the dependency of the libchart like so:
chart.yaml
...
dependencies:
- name: mylibchart
version: 0.1.0
repository: file://path/to/libchart
and in that libchart chart.yaml data was like this:
apiVersion: v2
name: lib <-- this was causing the error to occur (should be mylibchart instead)
description: A Helm chart for Kubernetes
type: library
version: 0.1.0
appVersion: "1.16.0"
so as you can see the name specified in the dependencies has to be the same name of the chart/libchart.

qbs - install to specific dir

I am trying to modify the install dir in qbs. I tried every possibility, which came in my mind.
I would like to install to the location of an env var...
but qbs always installs into a subdir in the dir where it was stated in (e.g. qtc_Desktop__0e446cd2-debug)
I tried combinations of:
qbs.install: true
qbs.installDir: project.defaultLibInstallDir
qbs.installPrefix: project.defaultLibInstallPrefix
qbs.installRoot: project.defaultInstallRoot
I really like qbs, but can't figure out how the install should be used correctly.
I would appreciate an example, how an install to different system paths work (e.g. /usr/local/bin and /usr/local/include)
Update:
DynamicLibrary {
name: "software"
files: ["src/*.cpp", "src/*.hpp"]
Depends { name: "cpp" }
Group {
fileTagsFilter: product.type
qbs.install: true
qbs.installDir: "lib"
qbs.installPrefix: "/home/userName/someDir"
}
}
The install properties in qbs are documented here:
I'll also give a few examples of each and how you might use it:
qbs.installDir: Relative to qbs.installPrefix. This might typically be something like "bin" or "lib" or "share" in your install Groups, depending on the content that Group is installing.
qbs.installPrefix: The prefix on the target system at which your tree is installed. This might be something like "/usr" or "/usr/local".
qbs.installRoot: This is an external property which is prepended to all installation paths in your project. You do not set it within your project, only on the qbs command line. It defaults to a temporary location within your build directory. For example, if you set qbs.installPrefix to "/usr" and actually want your file tree to get installed there, you'll set qbs.installRoot to "/". Otherwise, your entire installation tree gets rooted within the qbs.installRoot. For example, if you were using qbs to build a Debian or RPM package, you'd set qbs.installRoot to the location of the temporary root used by the build process.

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

How to install local tar file dependencies together with dependencies from CPAN?

Let's assume there is a distribution "Example" that is packed in example-1.0.tar.gz which contains a Makefile.PL that points to all dependencies. After extracting, "Example" could be easily installed (including all its dependencies) by calling cpanm . if all its dependencies were available on CPAN.
How do I install a simialar file (let's call it example-2.0.tar.gz) if I am given a folder "deps" containing most of the distribution's dependencies
dependency-1.tar.gz
dependency-2.tar.gz
...
dependency-N.tar.gz
where N is a huge number?
Further assumptions are:
dependency-*tar.gz files have to be preferred over the available CPAN modules
some dependencies are not available on CPAN but only in this "deps" folder
the folder "deps" is incomplete and further dependencies have to be installed from CPAN.
Is there a simple way to install example-2.0.tar.gz?
I would like to know if there is some command line like cpanm --use-local-deps=~/deps example-2.0.tar.gz which does not need further workarounds.
You could use this tool http://search.cpan.org/~bingos/CPANPLUS-0.9152/bin/cpan2dist . It lets you specify filters to define what modules are loaded locally and what is fetched from CPAN. It's part of the CPANPLUS module, which should cone with newer versions of Perl I think.