5.3. Creating a source code archive for distribution
An archive file is a file with the .tar.gz or .tgz suffix. Putting source code into the archive is a common way to release the software to be later packaged for distribution.
The bello project is a Hello World file in Bash.
The following example contains only the bello shell script. Therefore, the resulting tar.gz archive has only one file in addition to the LICENSE file.
The patch file is not distributed in the archive with the program. The RPM package manager applies the patch when the RPM is built. The patch will be placed into the ~/rpmbuild/SOURCES/ directory together with the tar.gz archive.
Prerequisites
-
Assume that the
0.1version of thebelloprogram is used. -
You created a
LICENSEfile. For instructions, see Creating a LICENSE file.
Procedure
Move all required files into a single directory:
$ mkdir bello-0.1 $ mv ~/bello bello-0.1/ $ mv LICENSE bello-0.1/Create the archive for distribution:
$ tar -cvzf bello-0.1.tar.gz bello-0.1 bello-0.1/ bello-0.1/LICENSE bello-0.1/belloMove the created archive to the
~/rpmbuild/SOURCES/directory, which is the default directory where therpmbuildcommand stores the files for building packages:$ mv bello-0.1.tar.gz ~/rpmbuild/SOURCES/
The pello project is a Hello World file in Python.
The following example contains only the pello.py program. Therefore, the resulting tar.gz archive has only one file in addition to the LICENSE file.
The patch file is not distributed in the archive with the program. The RPM package manager applies the patch when the RPM is built. The patch will be placed into the ~/rpmbuild/SOURCES/ directory together with the tar.gz archive.
Prerequisites
-
Assume that the
0.1.1version of thepelloprogram is used. -
You created a
LICENSEfile. For instructions, see Creating a LICENSE file.
Procedure
Move all required files into a single directory:
$ mkdir pello-0.1.1 $ mv pello.py pello-0.1.1/ $ mv LICENSE pello-0.1.1/Create the archive for distribution:
$ tar -cvzf pello-0.1.1.tar.gz pello-0.1.1 pello-0.1.1/ pello-0.1.1/LICENSE pello-0.1.1/pello.pyMove the created archive to the
~/rpmbuild/SOURCES/directory, which is the default directory where therpmbuildcommand stores the files for building packages:$ mv pello-0.1.1.tar.gz ~/rpmbuild/SOURCES/
The cello project is a Hello World file in C.
The following example contains only the cello.c and the Makefile files. Therefore, the resulting tar.gz archive has two files in addition to the LICENSE file.
The patch file is not distributed in the archive with the program. The RPM package manager applies the patch when the RPM is built. The patch will be placed into the ~/rpmbuild/SOURCES/ directory together with the tar.gz archive.
Prerequisites
-
Assume that the
1.0version of thecelloprogram is used. -
You created a
LICENSEfile. For instructions, see Creating a LICENSE file.
Procedure
Move all required files into a single directory:
$ mkdir cello-1.0 $ mv cello.c cello-1.0/ $ mv Makefile cello-1.0/ $ mv LICENSE cello-1.0/Create the archive for distribution:
$ tar -cvzf cello-1.0.tar.gz cello-1.0 cello-1.0/ cello-1.0/Makefile cello-1.0/cello.c cello-1.0/LICENSEMove the created archive to the
~/rpmbuild/SOURCES/directory, which is the default directory where therpmbuildcommand stores the files for building packages:$ mv cello-1.0.tar.gz ~/rpmbuild/SOURCES/