Prep line in rpm spec causes duplicate directory inside rpm - rpmbuild

I have this spec file for my open source shell scripting sdk https://github.com/icasimpan/shcf/blob/packagebuilds/packagebuilds/rpm/shcf.spec
I build it as follows:
rpmbuild --target noarch -bb shcf.spec
Now, this builds fine, however, the output rpm's content has duplicated path "shcf/shcf", like:
/opt/icasimpan/shcf/shcf/***
This is the prep area
%prep
echo "BUILDROOT = $RPM_BUILD_ROOT"
mkdir -p $RPM_BUILD_ROOT/opt/icasimpan/shcf
cd $RPM_BUILD_ROOT/opt/icasimpan/shcf
git clone --branch 0.3.1 https://github.com/icasimpan/shcf.git
exit
At first sight, it's obviously due to the clone done to "$RPM_BUILD_ROOT/opt/icasimpan/shcf". However, if I modify the clone line to say
git clone --branch 0.3.1 https://github.com/icasimpan/shcf.git .
rpm build will fail due to unpackaged files.
Is there anything I'm missing?
Thanks in advance.

Related

Creating a portable version of R for Mac (and installing package from source for this version)

I am trying to create a completely portable version of R for Mac that I can send to users with no R on their system and they can essentially double click a command file and it launches a Shiny application. I'll need to be able to install packages including some built from source (and some from GitHub).
I am using the script from this GitHub repository (https://github.com/dirkschumacher/r-shiny-electron/blob/master/get-r-mac.sh) as a starting point (it's also pasted below), creating a version of R, but (A) I find that when I try to launch R it gives me an error not finding etc/ldpaths and (B) when I try to launch Rscript it runs my system version -- I run `Rscript -e 'print(R.version)' and it prints out 4.0 which is my system version of R rather than the version 3.5.1 which the shell script has downloaded and processed.
I've experimented with editing the "R" executable and altering R_HOME and R_HOME_DIR but it still runs into issues when I try to install packages to the 3.5.1 directory.
Can anyone provide some guidance?
(By the way docker is not an option, this needs to be as simple as possible end-users with limited technical skills. So having them install docker etc won't be an option)
#!/usr/bin/env bash
set -e
# Download and extract the main Mac Resources directory
# Requires xar and cpio, both installed in the Dockerfile
mkdir -p r-mac
curl -o r-mac/latest_r.pkg \
https://cloud.r-project.org/bin/macosx/R-3.5.1.pkg
cd r-mac
xar -xf latest_r.pkg
rm -r r-1.pkg Resources tcltk8.pkg texinfo5.pkg Distribution latest_r.pkg
cat r.pkg/Payload | gunzip -dc | cpio -i
mv R.framework/Versions/Current/Resources/* .
rm -r r.pkg R.framework
# Patch the main R script
sed -i.bak '/^R_HOME_DIR=/d' bin/R
sed -i.bak 's;/Library/Frameworks/R.framework/Resources;${R_HOME};g' \
bin/R
chmod +x bin/R
rm -f bin/R.bak
# Remove unneccessary files TODO: What else
rm -r doc tests
rm -r lib/*.dSYM
Happy to help you get this working for your shiny app. You can use this github repo for Electron wrapping R/Shiny... just clone, and replace the app.R (for your other packages you need to install them in the local R folder after cloning and then running R from the command line out of the R-Portable-Mac/bin folder...
Try it with the Hello World app.R that is included first
https://github.com/ColumbusCollaboratory/electron-quick-start
And, then installing your packages in the local R-Portable-Mac folder runtime. Included packages by default...
https://github.com/ColumbusCollaboratory/electron-quick-start/tree/master/R-Portable-Mac/library
Your packages will show up here after install.packages() from the command line using the local R-Mac-Portable runtime.
We have been working on a R Addin for this also...
https://github.com/ColumbusCollaboratory/photon
But, note the add-in is still a work in progress and doesn't work with compiled R packages; still have to go into the local R folder and runtime on the command line and install the packages directly into the local R folder libpath as discussed above.
Give it a try and let us know through Github issues if you have any questions and issues. And, if you've already posted out there, sorry we haven't responded as of yet. Would love to communicate through the photon Add-In for this to get it working with compiling packages (into the libPath)--if you have the time to help. Thanks!

rpmbuild | specfile | %post | to execute a command or script as part of rpm install

How to execute some commands or scripts immediately after rpm installed and has to be run as part rpm install command.
I wrote a spec file to take back up of some files within directory and tar them.
When I install rpm tar would be copied on file system how ever I had to untar the ball manually to desired location.
RPM spec %post doesn't execute in rpmbuild
The above lost helped me understand we can include %post steps in spec file itself which would do that job and commands get execute as part of rpm install command itself.
The %post section runs when you install an RPM
Note that echo command included for test purpose are not executed.
For more information on %post in spec file please refer http://ftp.rpm.org/max-rpm/s1-rpm-inside-scripts.html#S2-RPM-INSIDE-BUILD-TIME-SCRIPTS

makefile into debian package, copy files and directories recursively

I realized that with debian/rules
override_dh_auto_install:
dh_auto_install -- prefix=/usr
it's impossible to get a file copied into the directory structure of the debian package with the cp command, but with install yes. So I understood, or interpreted that only the install command is interpreted by the dpkg-buildpackage -us -uc -ui -i command to copy temporarilly the files into the .deb file before installing them during any dpkg -i process.
The problem is that when I want to copy many files and an entire directory structure, I'm unable to do it as mentionned in various places on the web with tricks like find command for ex.
So the problems I have now is how from a Makefile do I specify that I want that to be converted into real world of debian package??!!!
cp -r some/src/dir/from/current_dir /to/opt/myCompany/for/example/bin
ln -s /to/opt/myCompany/for/example/bin/ /usr/local/bin
Both are misinterpreted by the dpkg-buildpackage

How to find if file has changed using git2r

Say I have a repository repo:
library(git2r)
repo <- repository(".")
In this repository is a subdirectory R, with files a.txt, b.txt and other files that I'm not interested in. How can I use git2r to work out if there are unstaged changes in these files? I've looked at summary(diff()), but that works on the level of the whole repo.
Essentially, what I'm trying to do is replicate the effects of the git command:
! git diff-index --quiet HEAD -- file
Where if there are changes in the file, then return false. While I could use a system command, there's no guarantee the user has git in their path and so the command would fail.
Is there a way to replicate the git functionality I'm looking for?
This issue is solved in the latest development release of git2r.
There is now an all_unstaged option to status:
> status(repo, all_untracked = TRUE)
Untracked files:
Untracked: untracked/a.txt
Untracked: untracked/b.txt

how to set an appropriate version for a lib when i'm building it from sources

As an example of my problem let's use libqb (https://github.com/ClusterLabs/libqb).
To install it from the sources I do the next:
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install
The problem is that the version in "/usr/lib/pkgconfig/libqb.pc" is UNDEFINED.
I suspect that I have to pass a parameter to ./configure but I don't know which one.
I do it on Debian.
There are two ways to get sources:
use git ($ git clone)
download sources in an archive
In case of using git, you won't see this problem, because it uses git to get correct version of sources during build.
In case of archive you have to create .tarball-version file in the top dir and put there version you want. For example: $ echo "0.17.0" > .tarball-version.
P.S.: there will be created .version file during build. So, if you did any changes to .tarball-version then you have to remove .version file.

Resources