Product SiteDocumentation Site

9.3.3. Naming source files

Most packages have one or more bundles of source code, which you need to name in the spec file. In most cases, you will have a compressed tar archive of source files. These may be files developed by your organization or downloaded from an Internet site. You can define one or more source tags, counting from 0. For example:
Source0: telnet-client.tar.gz
Source1: telnet-xinetd
Source2: telnet.wmconfig
In this example, Source0: refers to a compressed tar archive. The rpmbuild program will extract the files into the buildroot directory. The Source1: and Source2: directives name individual source files. You can name compressed tar archives or individual files as needed.
If you just have one Source directive, you can skip the 0. For example:
Source: telnet-client.tar.gz
You can also use FTP or HTTP URLs to name sources. For example:
Source0: ftp://ftp.somesite.yow/pub/linux/%{telnet_version}.tar.gz
The URLs listed in source directives are for convenience and future reference only. RPM will not download these files.
The files named by the Source directives will get included into the source RPM. Sometimes you need to keep some sources out of the source RPM. This could be for proprietary sources you cannot ship, or simply due to size. The Nosource: directive tells RPM to skip a source file from the source RPM. For example:
NoSource: 0
This example means that the first source item should not be included in the package.
NoSource: 3
This example means that the third source item should not be included in the package. The NoPatch directive works similarly. In addition, do not place more than one number on any given NoSource or NoPatch directive.
Using the Nosource: or NoPatch: directives, covered following, mean you are creating a source RPM that cannot be rebuilt unless you also have the sources or patches, respectively, that were used to create the original RPM.
If the package contains a Nosource: or Nopatch: directive, rpmbuild will use a file-name extension of .nosrc.rpm instead of .src.rpm.