Search code examples
archiveterminology

What the difference between "package" and "archive"?


I know that archive represents file that contains other files with some metadata, but I can't understand what is package? Wiki says that package are one of the archive types that uses by package managers.

For example, I have .zip archive and .pkg ps4 game package. Zip is called archive, because it has files inside, but why Pkg is the package if It also contains files inside? Maybe because playstation has some sort of package manager that take care of Pkg, but why I can't say that 7-zip isn't package manager?


Solution

  • Packages are specialized archives, which have additional meta information to help package managers to operate on the data in a package. This means that some software is bundled into a package along of the needed metadata, which is then installed with the help of a package manager on a system. In your case, the "pkg" file is a type of package which your PS4 can understand, i.e. read, extract and install on your game console.

    I would not call 7zip a package manager, as the latter is there to install, upgrade, remove etc. software on your system. 7zip allows you to view the content of the archive, which does include packages, but not install it. You can extract the content, and if the software executable for your operating system is in an archive, run it, but this is not installing it in the classic sense.

    The naming convention of packages is up to the authors. Sony must have decided for .pkg, Debian likes its .deb and, in theory, you could name your package file ending .cool. File endings can help to associate the file with a program on your device, and also to visually distinguish them, but they are not a must on Unix-like system to my knowledge.

    Package managers come in various shapes and forms, some of the more well-known are from popular Linux distributions, such as dpkg (Debian), DNF (Fedora / RHEL) or pacman (Arch).

    To sum it up, and simplify it a little, I'd say: “Each package is an archive, but not each archive is a package”.

    Sources: Wikipedia on Package formats, Archive Files, Package Managers

    Edit: Please feel free to correct me on anything I said, new here, just trying my best.