340 likes | 470 Views
제 18 강 : Distributing Open Software RPM Command. Distributing Open Software RPM Command. “Computer” “layers” “network of objects”. ed. mail. lib. DB. middleware operating system high level language assembler language machine language. L5. OS. L4. C. MW. L3. ASM. L2. CPU.
E N D
제18강 : Distributing Open Software RPM Command Distributing Open Software RPM Command
“Computer” “layers” “network of objects” ed mail lib DB middleware operating system high level language assembler language machine language L5 OS L4 C MW L3 ASM L2 CPU L1
Each Object Provides / Requires “ Provides “ Object “ Requires “
example “provides / requires” Provides High level language Object Compiler lib Assember Preprocessor Requires
node: object edge: provide/require OS Function & Commands Provides Operating System Object High level language Compiler Asm Language lib Preprocessor Requires Assembler machine instruction
as gcc libc.a kernel include … Each object: object descriptor (HW object, SW object, Data object) Object descriptor: capabilities this object provides capabilities this object requires info about object itself, install, … System stores object descriptors in object DB Whenever a new object is added system checks whether required capabilities exist ed mail lib DB OS C MW ASM stores object descriptors in system DB D B CPU clock gate bus
Requires: libg.so.1.2 • Provides: gamex • Program: gamex-tar.gz • Files • Script: Makefile Files install etc Standard formatObject Descriptor gamex Information Program Files Script Files
Distribute Open Software? • Open software runs on many different platforms • Open Software presents a New Challenge • HW • chip: Intel, Motorolla, MIPS, • architecture: PC, SMP, • devices: many different kind of devices • OS: • Kernel: vendor, version • Library: vendor, version • Compiler, utilities vendor, version • RPM Red Hat’s solution to software distribution
Challenges – Open Software Distribution • Send binary • Depends on {DLL library, manual, …} (binary file requires them to run) • Send source • If different platform, needs compile & build • Depends on {header files, gcc, …} (source file requires them to compile & run)
Action at target platform … (1) Copy Files (man install 3 formats, -m –o) • Create directories, Copy files -- Install command • Set protection modes, Set owner id, … (2) Requires other objects? • eg compiler, library, header files, … • Check dependency information • Pre-Install other objects, if necessary, in preparation for this object (3) Prepare for build - Edit makefilescript(customize for this platform) • Which compiler? depends on the host, adjust pathnames • Which header files, lib? adjust pathnames • Which gcc options? depends on the compiler • Which part of the source? (adjust pathnames) or (gcc option) eg gcc src/arch/SUN/* or gcc src/arch/IBM/* #ifdef SUN -- source code may contain conditionals gcc –DSUN --- then gcc may have to define MACRO (4) Build. • Run the make (Makefile script). Build executable binary
A lee B bob Install command “ginstall” command (try “man install”) create directories -- name, owner, protection mode copy files -- name, owner, protection mode (eg source, library, header files, binary, ..) eg install -m 644 –o koh $(Source) $(Destination) Directory (exist?/create) Set protection mode Set owner
Definition of “ package” {3 type of files} scripts program files information I provide ooo I require xxx Who I am {vendor version …..…} install (install) build (makefile) adapt (configure**) src include lib *.c *.h *.so ** We will explain this in UNIX kernel code section
Example of package {collection of files} information files program files script files Package: game OO Program files: java-src tar Media: USB flash ….. Package: OS kernel Program files: C-src tar Media: CD-ROM ….. Package: math lib Program files: binary Media: ftp server ….. Package: MS Office Program files: *.EXE
package {archive 3 type of files} information files package tar program files script files
“package” • Archive file created by tar (or cpio) command • programfiles source, lib, man, • script files to install, build this package • information in spec file (see next page) • Package name convention <package-name>-<package-version>-<release>.architecture.rpm eg sql-3.4.1-15.i386.rpm /* binary */ eg sql-3.4.1-15.src.rpm /* source – SRPM */
Dependency between packages • “package (A) depends on package (B) • eg C-program-package depend on C-library-package • Document-package depend on reader-program-package • Each source package have a specfile • eg gamex . spec :Name: gamex Vendor: IBM Version: 1.3 Summary: New internet game Requires: libg.so.1.2 Provides: gamex Source: gamex-1.1.tar.gz Scripts builds/installs this Info Src Script
sample list of spec files find / -name “*.spec” –print > list
rpm • rpm (RedHat Package Manager) • Linux command for managing “packages” • 3 modes of operation • query mode • install & upgrade mode • build mode • maintains DB of packages • ls –l /var/lib/rpm/*
Using rpm command Try following : rpm –q –a rpm –q –l any rpm –q –f /bin/ls rpm –q –i any • All installed packages ? • eg $ rpm –q –a package_a-11.12.1-7 package_b-7.14.6-12 package_c-14.32.3-5 • What files are inpackage_a • eg $ rpm –q –l package_a-11.12.1-7 /* We usually discard source files after build CD-ROM or ftp site */ • file X is from which package? • eg $ rpm –q –f /bin/ls • Remove this package • eg $ rpm –e package_b
Using rpm command Try following : rpm –q –a rpm –q –l any rpm –q –f /bin/ls rpm –q –i any • All installed packages ? • eg $ rpm –q –a package_a-11.12.1-7 package_b-7.14.6-12 package_c-14.32.3-5 • What files are inpackage_a • eg $ rpm –q –l package_a-11.12.1-7 /* We usually discard source files after build CD-ROM or ftp site */ • file X is from which package? • eg $ rpm –q –f /bin/ls • Remove this package • eg $ rpm –e package_b
List files inpackage_x /* We usually discard source files after build CD-ROM or ftp site */
Using rpm command Try following : rpm –q –a rpm –q –l any rpm –q –f /bin/ls rpm –q –i any • All installed packages ? • eg $ rpm –q –a package_a-11.12.1-7 package_b-7.14.6-12 package_c-14.32.3-5 • What files are inpackage_a • eg $ rpm –q –l package_a-11.12.1-7 /* We usually discard source files after build CD-ROM or ftp site */ • file X is from which package? • eg $ rpm –q –f /bin/ls • Remove this package • eg $ rpm –e package_b
rpm and capability • /* display the information of ‘glibc’ package */ rpm –q –i glibc rpm –q --provides glibc ibc.so.6 • /* which package provides this capability? */ rpm –q - - whatprovides libc.so.6 glibc-x.x.x-x • /* which package require this capability? */ rpm –q - - whatrequires glibc authconfig-x.x.x-x gcc --------------- provided capabilities C compiler package as libc.a os …. ------- required capabilities
rpm and capability • /* display the information of ‘glibc’ package */ rpm –q –i glibc rpm –q --provides glibc ibc.so.6 • /* which package provides this capability? */ rpm –q - - whatprovides libc.so.6 glibc-x.x.x-x • /* which package require this capability? */ rpm –q - - whatrequires glibc authconfig-x.x.x-x gcc --------------- provided capabilities C compiler package as libc.a os …. ------- required capabilities
installing package from CD % mount /cdrom /* mount the distribution CD */ % cd /cdrom/suse/fun /* cd to mounted CD file system*/ % ls /* list packages in CD */ a.rpm b.rpm c.rpm d.rpm … % rpm –i b.rpm c.rpm /* install packages */ % rpm –U b.rpm c.rpm /* upgrade, b & c already exist */
rpm summary • What rpm command does : • Looks for spec file • take source tar file • unpack it (if patch files order of patches) • install it, i.e. • make directories if necessary • copy files from CD (or ftp) to destination directories • chmod files & directories • change owner of files & directories • configure ** • examine target platform (hardware & software type) • edits makefile & install command for this specific platform (eg set compile options, library pathname …) • build the software (make) • spec file & source files remain in CD by default. ** We will explain this in UNIX kernel code section
RPM - Summary Package is an archive • Different platform may need different source files, gcc options, lib need to edit makefile script file that handles source files (sometimes patch) edits makefile installs binary, directory • Package & platform need to know each other • Platform is a layer of software (package) • Each package describes itself by spec file Program Files: source binary ----------- Information Spec file ------------- Scripts make install