Macro expansion in rpm spec files and ltib - packaging

I am pulling my hair out over an issue I am having with building rpms through LTIB. I am trying to write my own spec file and for some reason It seems as though simple macros I have defined will not expand within the %Files section.
For example, at the top of my spec file I have the following:
%define myfilepath %{pfx}/lib/python%{pyver}/site-packages/wx-2.8-gtk2-unicode/
and my %Files section looks like this:
%Files
%defattr(-,root,root)
%{myfilepath}
Yet when I run ./ltib -m scdeploy -p I get the following error
RPM build errors:
File must begin with "/": %{myfilepath}
Build time for wxPython: 0 seconds
Is there something I'm missing? Nowhere in the documentation do I see that macros are dissallowed in the %Files section. predefined macros seem to expand fine within the %files section but any macro I have defined with %define in the header of my spec file acts as though its undefined when I am running ltib with the scdeploy option. Macros all work as expected when executing ltib withprep, scbuild and scinstall modes.
Edit: Using ltib version 9.1.1, rpmbuild version 4.0.4

Managed to figure it out after looking at the ltib source. It turns out ltib fabricates a spec file when running in scdeploy mode. This fabricated spec file only preserves the contents of the %files section in the spec file you wrote so the header and all of the macros you defined there are lost.
Not sure why LTIB behaves this way for scdeploy and not sbuild, scinstall, etc. I have a question out to the LTIB mailing list.

Related

How to make erlang application?

i'm trying to build the example to run an erlang websocket server.
I created all that files and put them into one folder, add the rebar file and ran
./rebar get-deps
inside the folder direction.
But there is no
make
make runconsole
and nothing's happening.
Is there also a possibility to create that websocket server using IntelliJ? I tried to put that 3 .erl files into IntelliJ and want to Build the project but I receive
erlc: 2: Warning: behaviour cowboy_http_handler undefined
The make command reads something called a Makefile, which is a file written in a certain format, which tells the make command what it is supposed to do, e.g. compile some files with the listed names using the listed commands. Because there is no Makefile listed in that tutorial, you should have gotten an error something like this:
No targets specified and no makefile found.
You can contact the author of the tutorial at his github account and ask him where the Makefile is. Actually, the Makefile for the tutorial is here:
https://github.com/marcelog/erws
I created all that files and put them into one folder
The instructions in the Makefile depend on the exact directory structure that the author has here:
https://github.com/marcelog/erws
I tried using rebar3 and changing some stuff in the Makefile, but I still got errors. The problem is that rel directory: I don't know how to create all the stuff in there. You need to use rebar and reltool for that:
https://gist.github.com/FabioBatSilva/f1d1c4ea250302fed8c2
Here is a cowboy websockets example that I came up with last year, see if it helps:
How to Connect Cowboy (Erlang) websocket to webflow.io generated webpage
It uses the Erlang.mk build system as described in the cowboy docs here:
https://ninenines.eu/docs/en/cowboy/2.5/guide/getting_started/

Copying folder not working anymore in Singularity 3

I have a Singularity recipe in which I want to copy some folders inside the container, written like
%files
backend/
This worked just fine in the past.
But recently I upgraded from Singularity 2 to Singularity 3, and now trying to build this starts with giving me the warning
WARNING: backend/ : [backend/]
and nothing is copied.
Do I need to adjust my syntax?
Edit: I tried to do the same with a single file, doesn't work either.
I finally figured it out. The syntax changed. The correct new syntax is:
%files
backend/* backend/
Apparently, it won't simply copy folders anymore and instead you have to use the wild card. As those are files, the target folder has to be provided.
The warning message still persists, though.

ROS Kinetic 'catkin_make' Fails because PROJECT_NAME is set to Project

I have been using ROS Kinetic for a while, and today when I went to make a new catkin workspace following the ROS tutorials page (http://wiki.ros.org/catkin/Tutorials/create_a_workspace) I get a CMake Error stating that PROJECT_NAME is set to Project, which is invalid. I have never run into this issue with any of my other work spaces I have created.
I do not want to mess with toplevel.cmake out of fear of screwing up my other work spaces.
Any ideas why this is happening?
CMake Error at /opt/ros/kinetic/share/catkin/cmake/catkin_package.cmake:91 (message):
catkin_package() PROJECT_NAME is set to 'Project', which is not a valid
project name. You must call project() before calling catkin_package().
Thank you.
I was able to reproduce the above error you are getting. For that what I did is opened my CMakeLists.txt and commented the second line which defines the package Name, i.e., project(package_name). After that, I tried to build my package via catkin_make, but got below error(see the error inside yellow box):
Then, I tried to build the same package after uncommenting the above line. This time I was able to build my package(test, in my case) successfully, without any error.
CMakeLists.txt file contains project() as well as catkin_package() and the former function should be called before catkin_package() inside the file. So, project(package_name) is either missing from your CMakeLists.txt file or is commented.
If it is missing, then manually add it. If it is there, but commented then uncomment it.
Read more about the correct format of CMakeLists.txt file from here.
ironically, you'll be running : sudo apt-get install ros-<distro_name>-catkin to reinstall catkin because even if u clear your entire workspace the problem will persist due to some symbolic link or something broken in the package which will always result in the same error, upon reinstalling catkin it worked for me, knowing that I had the exact same issue.
Had to come answer this because I think I did the same thing OP did. Here's what happened: There are supposed to be TWO CMakeLists.txt in your project folder. One lives at ProjectName/src and should be read-only and should actually be a link to your /opt/ros/your-ros-distro/share/catkin/cmake/toplevel.cmake folder.
If you do like I did, and I'm assuming like OP did, and edit that file, and then use your superuser to overwrite that file, then you are (1) breaking all of your catkin projects, because ALL of the catkin projects link to this one file, AND you're misconfiguring this project because the CMakeLists.txt file you're supposed to modify actually exists a folder deeper, at ProjectName/src/ProjectName/. THIS is where you're supposed to put the CMakeLists.txt file that names your project, where your package.xml file is supposed to go, etc.
If you use superuser to force-overwrite the read-only CMakeLists.txt file then you're going to have a bad day. Fortunately you can fix that file by fixing the toplevel.cmake folder, which you can do by reinstalling the catkin package: sudo apt-get install --reinstall ros-indigo-catkin
And, to put this in terms of OP's question specifically - the project() needs to get named at the inner file, the ProjectName/src/ProjectName/CMakeLists.txt, because again the root file is read-only and should never be modified.

one file fails to execute pyinstaller

I have been using pyisnataller to create executable applications of my python 3.6.5 scripts. The scripts are GUI interfaces. I have used a recipe from a previous stackoverflow post: link
It has been effective but am running into a slight snafu trying one file a simple GUI.
Why does the executable fail to run? The temporary folder created has the two files added within about.spec?
Any help would be appreciated!
I would have placed the code, and the spec file here but stackoverflow didnt seem to perform the formatting well enough to send the message. I tried backticks four spaces, a missing line followed by eight space, and
Yes, this is an ill posed question. So, turns out the pyinstaller creates a warn_yourscript_.txt file and the post warnings in the creation of the executable. The file is located in the working directory/build/yourscript/warn_yourscript_.txt. Having looked into the file, there was a warning about not being able to load or missing the TKinter module. The myscript.py was running smoothly under python 3.6.5, but I may have started my script from a starter on the internet and may have been from an earlier python. I have several pythons loaded on my machine, python could find it but pyinstaller could not? I changed out myscript to reflect earlier success with tkinter instead.

How do you open a module in Ocaml?

I'm running Ubuntu, installed Ocaml, and wrote the following script, as I found it in a set of instructions (course notes):
;; open Assert
;; print_int 1
saved this file as test.ml. Then in a terminal I navigated to the folder containing the file and executed
$ ocaml test.ml
The containing folder has the assert.ml file and assert.mli. I looked at some documentation in these course notes and on Ocaml's website, and can't find any official statement about how to open a module other than trying the above. When I run this, I get the error message
File "test.ml", line 1, characters 8-14:
Error: Unbound module Assert
Can anyone describe how this is supposed to work?
If you have just assert.ml and assert.mli, then you need to compile them first before they can be used in other code.
You can use the ocaml compiler directly like this:
$ ocamlc -c assert.mli
$ ocamlc -c assert.ml
This will create files named assert.cmi (the compiled version of assert.ml) and assert.cmo (the compiled version of assert.ml).
After that, your test.ml file should work OK if you run it like this:
$ ocaml assert.cmo test.ml
(Thanks #camlspotter.)
The open construct in OCaml doesn't cause a module to become available if it wasn't available before. What it does is make the names in the module available directly. Without open, you need to prefix the names with the name of the module: Module.name. In my opinion (shared by some others) it is best to limit the use of open, to avoid introducing too many names into the scope of your code.
As a side comment, it is stylistically very strange to begin your lines with ;;. This token is used to tell the OCaml toplevel (the interpreter) that it should evaluate what you've typed so far. So it usually comes after some interesting expression.
I personally don't use ;; at all in source files. I only use it when typing expressions into the toplevel.