My primary focus for the start of this thread will be about petget and tazpkg. I'm not sure if well get much into the other ones in this thread or instead we will discuss them in another thread.
Like many package managers the official package manager for pet-get does many things besides just installing packages onto a system; such as:
1. resolving and installing dependencies
2. updating various databases such as icon caches and mime types
3. update desktop menus.
4. show compatible packages for download
5. download compatible packages
6. authentic downloads
Depending on the application we might not need any of the above extra functionality and in which case it is rather trivial to write a package manager.
I consider the most core part of the package manager to:
7. copy the files into the system and
8. update the databases which indicate what packages are installed on the system.
The core aspects (Items #7 and #8 ) are rather minimal and one would only need busybox to implement them. However, it is handy to have other tools (e.g. AWK and find) to make this process easier and also because the petspec database structure is well suited to the use of AWK. Find is helps to make listing the package contents easier but one could write their own script to achieve this functionality.
Regarding Item#7 this is fairly trival. For example one could do the following:
Code: Select all
cp --remove-destination -arf \
"$source_dir/"* \
"$dest_root"/ 2>/dev/null
1. reading a list of files
2. using the find command
3. walking the source directory structure
or use another utility to copy the files such as: CPIO, rsync or install
Needless to say there is no shortage of ways to copy files in linux.
In a addition to copying the files into the system a list of files is created which itemizes the package contents. This list is stored in one of two places:
Code: Select all
/root/.packages/pkg_name-version.files
/root/.packages/builtin_files/pkgname
TazPkg also uses one text file per package to keep track of the package contents. It is stored in
Code: Select all
/var/lib/tazpkg/installed/$pkg_name/files.list
The next piece of information that is stored is some meta information (i.e. the pet.specs) about the package. In petget this is stored typically in two files which are:
Code: Select all
/root/.packages/user-installed-packages
/root/.packages/woof-installed-packages
Code: Select all
/root/.packages/*-installed-packages
Code: Select all
sed -i "\%|${PKG}|%d" /root/.packages/*-installed-packages
(Note that the enclosing percent sign means use regular expressions, the -i means edit in place the d after the percent sign means delete).
In the case of remove_builtin we are matching the second field of the pet spec. This field is the name of the package without the version. If the filename in the buitin_files folder has the package version then this function will fail to remove the petspec from the above files. Also the way in which remove_builtin is written, the pet specs for all versions of the package will be removed from these pet spec tables. However, only one version will be deleted for the list of files for the package and for the actual files on the system.
TazPkg also stores similar meta data. One place that this metadata is stored is in :
Code: Select all
/var/lib/tazpkg/installed/pkg_name/receipt
One application of having multiple files that store the pet spec (i.e. /root/.packages/*-installed-packages) might be to have different sfs files use different prefixes so that the spec list in each sfs can coexist with those with the other loaded sfs files.
(To be contined.....) It is time for me to go to sleep.