How is a source RPM different from unpacking an RPM with rpm2cpio and cpio?

I am attempting to understand the use of a .srpm aka “source rpm” Red Hat Package Manager package. From what I understand so far, a .srpm is different from a standard .rpm in that it provides the source code and is commonly used during development. I am puzzled on why this is useful because if I run rpm2cpio ./myrpm-1.1-1.x86_64.rpm | cpio -idmv, I can still view the source code. As I understand, even standard RPMs pull down a .tar.gz/bz file which contains the source, and eventually builds this. Could you please clarify how source RPMs are different and why I would want to use one?

Go to Source
Author: the_endian

ANSWER

As I remember RPM files that end with extensions of .srpm or .src.rpm (I see this more often if I recall correctly) are copies of software source code including the build/compile scripts and instructions. Normally these are archived in tar format, before then being packaged further as RPM.

Because it is packaged as RPM, source RPMs can very well be installed the same way as any other RPM. The source files will go to a default folder on your Linux.

So there is the RPM mostly and mainly for binary or compiled software. Then the Source RPM that contains the source code of that software. These were distinctly packaged with the proper file extensions. Rightfully so people don’t get confused. Perhaps some RPM packagers also include the software’s source code in RPM, but I have not seen that yet.

On a side not, back in the days I used to build RPMs for myself a lot. It became sort of a hobby. This was circa 2006-2009.

There were a few reasons I did this.

  • Software I want to install on my Linux doesn’t have RPM, only tarballs.
  • I could install software via – .configure + make + make install – terminal kung fu, but it’s easier to track and manage via RPM.
  • Lastly. For fun, and wanted to think I’m cool. (j/k) On a serious note, for learning purposes.

My memory is a bit foggy on this now. But there was this really cool GUI utility tool that created RPMs for you. I just forgot the name of this little app. You just needed to supply it a copy of the tarball, some other info, then press the button. Magic. This was after I got tired doing it by hand on the Linux terminal, and as soon as I found out about this handy GUI tool, I mostly did it this way.

how to get specific character from a log file in linux

ANSWER

Assuming that (1) the log file looks as it is AND (2) it is multi-line, then a simple Linux grep command like below should work (even with multiple lines of that line you’re looking for in one log file):

INPUT | Tested it on dummy logs from sample

COMMAND | grep -Pn "^Id\s+:\s+(.*)$" *.log

OUTPUT |

log101.log:2:Id : UN123P

log102.log:2:Id : HELLO321

log103.log:2:Id : STUDE23P

log104.log:2:Id : Lorem

log104.log:7:Id : IPsum

log104.log:12:Id : Dolor

have a log file , having multiple contents inside the file like and example below is the content of U123.log . I have n number of logs..

Accepted password for hoover from 10.0.2.2 port 4792 ss

Id : UN123P 

ID_MTCH : UnixProduction

Accepted password for hoover from 10.0.2.2 port 4792 ss

Accepted password for hoover from 10.0.2.2 port 4792 ss

Is there any we can fetch “Id : UN123P” as an output of linux command. We have some 1000’s of logs and from all the logs , trying to fetch the value only starts with ID : and output as “Id : UN123P”

Pls suggest

Go to Source
Author: Arya