The RPM C library allows you to perform all the operations of the. C or C++ programs. The reason is simple: The rpm command was created using the RPM. These same libraries are available for you to use in your. The rpm command itself is quick and, for the most part, simple.
So. why would you want to write RPM programs? Speed: If you need to perform a task on many RPM files such as. Custom options: If you need to do something the rpm command doesn't. Convenience: If you need to make many packages quickly, with custom. The classic US stereotype of attempted Iranian ideological indoctrination via chants of “Death to America” and such has been old hat for quite some time. As noted. Express Helpline- Get answer of your question fast from real experts. Before doing this, though, be sure to look into whether.You'll find. writing RPM shell scripts goes much faster than writing whole.Installation programs: The Windows world has standardized on. . Install. Shield or. Install. Anywhere. The RPM system, on the other hand, has focused on. You can combine the. RPM system. *Integration with environments: You may want to better integrate RPM. Linux desktop environment such as GNOME or KDE. Working with other languages: This book covers programming RPM with. C, the core language for the library, as well as the Python and Perl. You can use the RPM library, though, to help. Tcl, Ruby, or even C# (especially. C# implementations for Linux). This chapter and the next cover RPM programming. This chapter covers. ![]() RPM C programming library, which provides low- level access to. RPM functionality. The next chapter covers the RPM Python. If you are attempting to write a complex RPM program. Python API first. Even so, there is a. RPM C library. Programming with the C Library. RPM C programs are C programs that call on functions in the RPM. To use the rpmlib, you need to set. C programming environment and install the rpm- devel package. Setting Up a C Programming Environment. At the very least, you’ll need a C compiler, gcc, and a text. The easiest way to get the C compiler is to install the. Software Development with the Red Hat. Cross Reference. See Chapter 7, RPM Management Software for more on the Red Hat package management tool. The gcc package requires a number of capabilities. Make sure you. install all the necessary packages. Just about every Linux. C. programs, so this should not be a problem. For text editors, you can use the vi or emacs text editors, or. Cross Reference. Chapter 2. Linux Text Editors and Development Tools covers Linux text editors and development tools. Once you have a C programming environment set up, you next need. RPM library for an RPM development environment. Setting Up the RPM Programming Environment. To program with the RPM library, you need to install the. You must have a version of rpm- devel that. If you have Red Hat. Linux, your installation CDs will also have the version of the. RPM development package that corresponds to your system. Your program should link against the same libraries that are. In most cases, the best bet is to use. RPM programs and libraries that come with your version of. Cross Reference. You can also download the rpm packages from. This site includes versions of. RPM libraries going back to 1. Linux. The package you need is rpm- devel. If you installed Red Hat. Linux 8. 0, the package is rpm- devel- 4. This package. includes header files, documentation, and libraries. All C programs using the RPM library need to include the file. One thing you’ll quickly note is that the RPM C. RPM data at a very low level. This is one. reason why many developers are moving to Python for their RPM. Python RPM API presents a higher level of. Cross Reference. Chapter 1. Programming RPM with Python covers programming RPM with Python. In addition to rpmlib. API based on the command- line options to the rpm. The cli in rpmcli stands for command- line interface.). Table 1. 6- 1 lists other important RPM header files that make up. RPM system. Table 1. RPM sub- system header files. File. . Defines. . RPM database access. RPM input/output routines. Command- line option processing. In addition, a number of header files define the major data. RPM system and the functions that operate on. Table 1. 6- 2 lists these header files. Table 1. 6- 2 RPM data object header files. File. . Defines. . Transaction sets. Transaction elements (packages). Dependency sets. . File information. Package headers. . All the RPM include files are located in /usr/include/rpm on. Linux. You can use the rpm command and the queries introduced in. Chapter 4, Using the RPM Database to determine exactly where the header files are. Simply execute the following command. Examine the output of this command for include files. Compiling and Linking RPM Programs. RPM programs using the rpmlib C API are the same as C programs. You need to include the proper header files that. API calls you need, and link with the right set of.The rpm include files are located in /usr/include/rpm, so you.C. compiler looks in for include files with the –I command- line. Iw Setup Iw Set Up Email Account . For example. $ gcc –I/usr/include/rpm –c rpm.This also means that you can install the rpm header files in. Install Google Chrome In Ubuntu Using Terminal To Connect . I. command- line option.To help debug problems, you probably want to add the - Wall.For example. $ gcc - Wall - g –I/usr/include/rpm –c rpm.The main rpm library is librpm.To do most anything with RPM programming, you. Table. 1. 6- 3. Table 1. Required rpm libraries. Library. . Usage. Main RPM library. RPM database library. RPM input/output. Command- line option parsing library. If you are creating RPMs from your C programs, you also need. To compile and link a simple. RPM program, you need a command like the following. I/usr/include/rpm - o program program. On some versions of Linux or on other operating systems. I/usr/include/rpm - o program program. If you have installed the rpm libraries in a non- standard. L option to specify where. For example. gcc - I/usr/include/rpm - o program program. L/opt/lib/rpm \. - lrpmbuild - lrpm - lrpmdb - lrpmio –lpopt - lelf - lbz. The - L option tells the cc compiler to look in the. Starting with RPM 4. The other libraries will get pulled in automatically. Getting information on your RPM environment. A large part of the RPM system lies in system- specific. The RPM rc. and macro systems support hundreds of options tuned to the. Cross Reference. Chapter 2. Customizing RPM Behavior covers customizing RPM. Your C programs need to access these RPM system settings to. So, to start an RPM C program. To do this. call rpm. Read. Config. Files. Read. Config. Files(const char *files, const char *target). The files parameter holds a colon- delimited list of files that. The target parameter. You can pass NULL for both these. RPM defaults, which is generally what you. The rpm. Read. Config. Files function returns a 0 on success, or –1. Once you have read in the configuration files, you can access. Printing the Configuration. To print out the configuration, call rpm. Show. RC. int rpm. Show. RC(FILE* output). Pass in an output file to print the configuration to, such as. For example. rpm. Show. RC( stdout ). The rpm. Show. RC function always returns 0. To control some of the output from rpm. Show. RC, and other RPM. Set. Verbosity. void rpm. Set. Verbosity(int level). For example. rpm. Set. Verbosity(RPMMESS_NORMAL). Table 1. 6- 4 lists the verbosity levels from rpmio/rpmmessages. Table 1. 6- 4 Output verbosity levels. Level. . Usage. . RPMMESS_FATALERROR. Only critical error conditions and above. RPMMESS_ERROR. . Only error conditions and above. RPMMESS_WARNING. . Only warning conditions and above. RPMMESS_QUIET. . Same as RPMMESS_WARNING. RPMMESS_NORMAL. . Only significant messages. RPMMESS_VERBOSE. . Verbose informational messages. RPMMESS_DEBUG. . Debugging messages, and everything above. You can put together a simple RPM program such as the one. Listing 1. 6- 1. Listing 1. Show the rpmrc settings. Read. Config. Files( (const char*) NULL. NULL). if (status != 0) {. Error reading RC files.\n"). Read RC OK\n"). rpm. Set. Verbosity(RPMMESS_NORMAL). Show. RC( stdout ). Compile this program with a command like the following. I/usr/include/rpm - o rpm. When you run this program, you should see the contents of your. Expanding the Value of Macros. With all the rc and macro configuration files, the RPM system. The term macro is used because the. You can have one macro. The basic. macro syntax is. For example. %_target. Most of the internal RPM macros start with an underscore, _. You can expand a macro with the rpm - -eval command. You can also refer to a macro using the following syntax. For example. %{_target}. This syntax makes it easier to include a macro in combinations. Cross Reference. Chapter 2. Customizing RPM Behavior covers macros in depth. In your C programs, your. Expanding Macros in Your Code.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |