I am trying to build a package(RPM) for SLES and RHEL, And the content of the RPM is a python script.
I am trying to execute “source.py -setup” in the post section of spec file i.e. after successful placement of script file to respective directory.
I have already formatted the python script(source) using dos2unix before uploading to OBS,
and even in spec file I have used “tr” command to remove any return characters in the source,
I am getting an error as “bad interpreter” when OBS tries to install the built RPM’s for SLES,
So accordingly RPM build is getting failed with the same error mentioned above and no RPM’s.
But RHEL its successful, because for RHEL package, it just builds the RPM and returns success.
I have tried to execute “tr” command from post section as well as install section, and i tried to modify the first line i.e. /usr/bin/env python also…it didn’t work
Please let me know if you have any inputs on this…
The files section has all the files, the packge contains, But still I am getting that error,
So lets not get into that loop,
Let me explain my requirement first,
I have Python script, of which i need to create the package i.e. RPM, and the package(RPM) should execute the following 3-4 steps when we install the RPM.
The script has to be placed in the /usr/sbin/ i.e. /usr/sbin/source.py,
After that it has to renamed to sourcepython, i.e. /usr/sbin/source.py to /usr/sbin/sourcepython
now it has execute the setup, i.e. /usr/sbin/sourcepython -setup.
On un-installation of the RPM, it has to execute, /usr/sbin/sourcepython -uninstall
You can access the below link, So that you can have a look on logs and spec both.
I have created a sample python script, which takes command line params and on installation of RPM it echoes those parameters, back to screen.
Ex : “sourcepython -setup” line echoes “-setup” on installation.
Thanks a lot for your inputs and Now I am stuck up with some other issue,
Can you please, let me know, is there a difference in RHEL and SLES build procedure on OBS…?
Because as I can see RHEL RPM’s are getting built successfully, and when I install the same RPM on RHEL and SLES it works perfectly fine,
Still SLES build gets failed for my original code, and error will be something as below,
Preparing packages for installation…
sourcepython-1.0-65.1
Traceback (most recent call last):
File “/usr/sbin/sourcepython”, line 30, in <module>
import xml-------
ImportError: No module named xml------
As per my understanding, It is because it tries to install the RPM’s, as a part of build procedure, and it fails.
Somehow can we avoid this postinstall or installation procedure on OBS…?
Adding one more query to the last mail,
Can you please throw some light on the uninstallation part, when we remove the RPM from the system.
If I try execute “sourcepython -uninstall” in clean section, again its throwing error(On OBS).
But if i execute the same with bare python script (on console)it works fine, my suspect is…something to do with the packaging itself, which I am not aware.
Can you please throw some light on uninstallation section, as already mentioned in my previous mail.
I am getting “global NameError” if I try to uninstall the script.
Hi
Normally there would be some sort of check (if using the normal python
setup tools), else you would need to specify any missing modules as
Requires. I guess on RH, they install by default additional ones that
meet your requirements.
–
Cheers Malcolm °¿° (Linux Counter #276890)
SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 3.0.13-0.27-default
up 2 days 19:32, 2 users, load average: 0.01, 0.03, 0.05
CPU Intel i5 CPU M520@2.40GHz | Intel Arrandale GPU
The RPM building is successful, when I install the rpm it goes smoothly.
But when I uninstall the RPM, I am getting similar error, what I was getting while building the RPM.
So uninstallation fails.
Now I have moved to debian packaging, again as usual I am getting some issues here also.
What I have tried till now.
Created the debian package on standalone system using dh_make and dpkg_buildpackage
I have modified the rule file accordingly which has got created from dh_make command
So the package is getting built successfully and package contains the python script
If try using the same rule,control,source,changelog file on OBS, the build is successful but the package is empty i.e.
the package doesn’t contain anything.
I need some inputs on postinstall i.e. setup in my case and uninstall sections as well. please let me know where should I execute these commands I mean in which section…?