rpmbuild -rp option is not supported? - linux

I've got a shell script with some rpmbuild workflow from a previous project and there is one command which is failing with an error unsupported option.
The command is this:
rpmbuild --nodeps --define '_builddir /tmp/build' --define '_sourcedir /tmp/source' -rp package_source.src.rpm
As per the documentation this -rp option is supported but I'm unable to run the rpmbuild command with this option.
Here's the man-pages link: https://man7.org/linux/man-pages/man8/rpmbuild.8.html#SYNOPSIS
The error message I'm getting is this:
rpmbuild: arguments to --root (-r) must begin with a /
Update1: my rpm version is 4.11.3 on CentOS7 and the man-page mentioned above is the latest version.
With the current version I've rpmbuild --help output is not listing this -rp or any other -r options.
So how do I get the same result using the rpm version which doesn't have this option?
TIA

The -rp option has to be on the first position.

Related

Error while trying to install Kops on Ubuntu 20 EC2 Instance

I went through the steps listed here: https://kubernetes.io/docs/setup/production-environment/tools/kops/
After moving the kops file to /usr/local/bin/ and renaming to kops, I tried to confirm if it was in fact installed and executable by trying 'kops --help' and 'kops --version'/'kops version' and neither command worked. Any idea what the issue might be?
Edit: Here's what I did step by step
curl -LO https://github.com/kubernetes/kops/releases/download/$(curl -s https://api.github.com/repos/kubernetes/kops/releases/latest | grep tag_name | cut -d '"' -f 4)/kops-darwin-amd64
sudo chmod +x kops-darwin-amd64
sudo mv kops-darwin-amd64 /usr/local/bin/kops
It's a t2.micro Ubuntu 20.04 EC2 Instance.
Tried to confirm if kops was properly installed and executable by entering 'kops --help' and 'kops --version' and also 'kops version' but they all return this error:
-bash: /usr/local/bin/kops: cannot execute binary file: Exec format error
I think its because you are using kops-darwin-amd64. This is for mac. I think you should be using kops-linux-amd64 instead for linux.

Error while creating rpm package using rpmbuild from spec file

I want to build a rpm package from a spec file(hello-world.spec).The command and error output are given below
Command1:
rpmbuild -ba hello-world.spec
ErrorOutput1:
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.z4GoQn
+ umask 022
+ cd /root/rpmbuild/BUILD
+
: not foundm-tmp.z4GoQn: 28: /var/tmp/rpm-tmp.z4GoQn:
error: Bad exit status from /var/tmp/rpm-tmp.z4GoQn (%prep)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.z4GoQn (%prep)
Content of my spec file is
Name: hello-world
Version: 1
Release: 1
Summary: Most simple RPM package
License: FIXME
%description
This is my first RPM package, which does nothing.
%prep
# we have no source, so nothing here
%build
cat > hello-world.sh <<EOF
#!/usr/bin/bash
echo Hello world
EOF
%install
mkdir -p %{buildroot}/usr/bin/
install -m 755 hello-world.sh %{buildroot}/usr/bin/hello-world.sh
%files
/usr/bin/hello-world.sh
%changelog
# let's skip this for now
My System/software details are
OS: Ubuntu 16.04
RPM version:4.12.0.1
The list of contents in rpmbuild folder is
Command2:
:~/rpmbuild# ls
Output2:
BUILD BUILDROOT RPMS SOURCES SPECS SRPMS
Can anybody help on this issue?
Check how your files is being generated. If you are passing files from windows to Linux, usually, there are different EOL for the files. We had a similar issue, I recommend you to change all the files to Unix format. I'm sharing with you how to reproduce your issue, if you edit that file in a Linux environment, like "nano", the problem disappears.

can't find curl-config on NixOS

I'm trying to install vim-now-haskell on NixOS 17.09.
The installation fails with the exception
*** Installer requires 'curl-config'. Please install and try again.
*** Aborting...
Unfortunately Search NixOS packages doesn't list any package for curl-config. It also isn't in installed curl-7.56.1.
I can hardly believe NixOS doesn't provide curl-config. Therefore I'm looking here for help to find it.
It's in the curl.dev output.
$ ls $(nix-build --no-out-link '<nixpkgs>' -A curl.dev)/bin
curl-config
The reason for this is to keep the closure size of anything the uses curl small. Normally Nixpkgs' stdenv.mkDerivation takes care of those details when processing the buildInputs attribute, but if you're not using Nixpkgs to build something you may have to do a bit more manual work.
Another way to get the curl-config command is nix-shell -p curl, which launches a shell that has the command in its environment.
[user#feb:~]$ nix-shell -p curl
[nix-shell:~]$ curl-config --version
libcurl 7.65.3
[nix-shell:~]$ exit
[user#feb:~]$
NixPkgs also has a curlFull package which has more features enabled, as can be seen by the number of packages in the closure of the runtime library output:
$ nix-store -q --requisites $(nix-build --no-out-link '<nixpkgs>' -A curl.out) | wc -l
6
$ nix-store -q --requisites $(nix-build --no-out-link '<nixpkgs>' -A curlFull.out) | wc -l
29
So for a more capable build of curl, use curlFull.dev.

Installation of Cron in cygwin

When I run the following command in cygwin,
$ cygrunsrv -I cron -p C:\cygwin64\bin --args -n
I get the following error
cygrunsrv: Given path doesn't point to a valid executable
Why am I getting this error?
You only gave a folder and not a path to the executable. Besides this I wouldn't recommend to use windows paths in cygwin, this can cause errors. You should write /cygdrive/c/cygwin64/bin/something instead of C:\cygwin64\bin\something.exe
Perhaps you are looking for an
installation guide, and you would like to do something like this:
Install cron as a windows service, using cygrunsrv:
cygrunsrv -I cron -p /usr/sbin/cron -a -D
net start cron

Cannot build Mercurial from sources in CentOS

I'm trying to build Mercurial on CentOS 6, so here is what I've done so far:
I got mercurial's latest sources, file is named mercurial-2.4.1.tar.gz
I try running rpmbuild on it and I get the following:
# rpmbuild -tb mercurial-2.4.1.tar.gz
error: File /home/someuser/rpms/mercurial/mercurial-snapshot.tar.gz: No such file or directory
So I try creating the file that it wants by copying from the other guy:
# cp mercurial-2.4.1.tar.gz mercurial-snapshot.tar.gz
I try again, appears to pass the previous error:
# rpmbuild -tb mercurial-2.4.1.tar.gz
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.vV9ZXc
+ umask 022
+ cd /root/rpmbuild/BUILD
+ cd /root/rpmbuild/BUILD
+ rm -rf mercurial-snapshot
+ /usr/bin/gzip -dc /home/someuser/rpms/mercurial/mercurial-snapshot.tar.gz
+ /bin/tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd mercurial-snapshot
/var/tmp/rpm-tmp.vV9ZXc: line 34: cd: mercurial-snapshot: No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.vV9ZXc (%prep)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.vV9ZXc (%prep)
I'm not sure what is happening, my guess is that rpmbuild is not being able to create files... any ideas?
The easiest way I have found to build an RPM for CentOS that isn't already available is to find a source RPM from Fedora and do rpmbuild --rebuild on it. CentOS documents it here but seems to be down right now.
Here is a src RPM you can give a try to start with.
You don't have a /var/tmp/ directory or can't write to it. Try creating it: mkdir /var/tmp - you may have to use "sudo" for this to work, depending on the setup of your system.
I think that creating tarball by cp command is not good.
You should rename the mercurial-[version]/ directory generated after extracting the official tarball to mercuial-snapshot/ and then create zipped tar archive of the directory named mercurial-snapshot.tar.gz.
$ tar zxvf mercurial-2.4.1.tar.gz
$ mv mercurial-2.4.1 mercurial-snapshot
$ tar zcvf mercurial-snapshot.tar.gz mercurial-snapshot
The issue is that the bundled spec file has a version default of "snapshot", so it's going to look for a tar file named "mercurial-snapshot.tar.gz", and also expects the extracted directory to be "mercurial-snapshot" (so you can't just rename the tar file).
The best way (or at least, a way) to handle this is to extract the spec file, update it with the correct version and release number, then build the rpm from that.
Here's the process:
tar fxz mercurial-X.Y.tar.gz --strip-components=2 mercurial-X.Y/contrib/mercurial.spec
Place the spec file in rpmbuild/SPECS and edit it. Replace the "Version: snapshot" line with "Version: X.Y", and replace the "Release: 0" line with "Release: 1.xyz" where xyz is a custom tag so you know that you built the package yourself.
Then run rpmbuild:
rpmbuild -bb --target=i686 SPECS/mercurial.spec
Use --target=x86_64 if you're on and building for a 64-bit system.
You should then have a correctly built and named rpm file in the RPMS/$target directory.

Resources