p-

a simple package manager

p- like 'plain', a simple package manager, plain simple.

Plain: /plān/, Adjective
1. Free from obstructions; open; clear: in plain view.
2. Obvious to the mind; evident: make one's intention plain.
3. Not elaborate or complicated; simple: plain food.

Simple packaging requires simple packaging system
— photo by the second fiddle

About p-

Example

The Debian way
apt-cache search     foo        apt-cache, apt-get, dpkg, etc.
sudo apt-get install foobar     sudo or not sudo (that is the question)
sudo apt-get remove  foobar     get or remove? Does not make sense
sudo dpkg  --install foobar.deb install vs --install, I never remember
sudo add-apt-repository ppa:foobar-plusplus  one more app to remember

The p- way
p-search      foo
p-install     foobar
p-remove      foobar
p-install-deb foobar.deb
p-add-ppa     ppa:foobar-plusplus

Plain simple.

p-

a simple package manager

Installation

OK, you absolutely must install this. It's simple: grab the p- debian package, install it, and eventually install missing dependencies.

wget https://github.com/oluc/p-/blob/debian-packages-archive/p-_0.8_all.deb?raw=true> \
       -O p-_0.8_all.deb
sudo dpkg --install p-_0.8_all.deb

If there are missing dependencies, dpkg will throw an error, like:
dpkg: dependency problems prevent configuration of p-:
 p- depends on localepurge; however:
  Package localepurge is not installed.

Just install the missing dependencies and apt will finish p- installation:
sudo apt-get install localepurge

Now p- is installed and will be active on any new login shell.
If however you want to use it in your current shell, just run:
source /etc/profile.d/p-package-manager.sh

That's it.

You can now run p-help to start with.

p-help
...

p-

a simple package manager

Usage

Getting help

You can always run p-help to get help. This will list all available commands, and their Debian equivalent. You can also type p- + Tab + Tab to display all possible commands. With most keyboard layouts it is very quick to type because p and- are two keys very close to each other.

p-h Tab
  p-help Enter
  The 'p-' package manager

  p-command                deb command                 min args
  -------------            ---------------             ------------
  p-status                 dpkg --status               + package name
  p-listfiles              dpkg --listfiles            + package name
...

p- Tab Tab
p-clean-cache          p-remove               p-update
p-help                 p-search               p-upgrade
p-install              p-src-build-package    p-version
...

If you are familiar with UNIX systems and the Debian packaging system, this should be enough for you to use p-. The next sections detail the various commands.

Querying installed packages

Which package installed this file? Do I have version 2 of this package? What files have been installed by this package? Is this package installed? What are its dependencies? etc.

p- command Argument Action
p-owning-file file which package installed this file
p-list-files package list the files installed by the package
p-version package returns the version number of the package
p-status package returns the full status of the package
p-owning-file /usr/bin/hello              Which package owns bin/hello?
hello: /usr/bin/hello
p-list-files hello                       What other files it installed?
/.
/usr
/usr/bin
/usr/bin/hello
/usr/share
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/hello.1.gz
...
p-list-files hello | grep NEWS | xargs less          Show me the NEWS
...
p-version hello                                   What is its version?
Version: 2.8-3
p-status hello                                        Complete status
Package: hello
Status: install ok installed
Priority: optional
...
p-status hello | grep Maintainer:               Who is the maintainer?
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Santiago Vila <sanvila@debian.org>

Installing packages

p- command Argument Action
p-search keywords search exact package name. By default, this is the same as 'p-search-name', but you can use advanced options with it.
p-search-name keywords search exact package name, containing 'keywords' in his name
p-search-description keywords search exact package name, containing 'keywords' in his description
p-install package list install the named paclages
p-install-deb deb package list install the debian packages (.deb)
p-update (no arg) update the package database
p-upgrade (no arg) upgrade all installed packages to the latest release
p-add-ppa ppa:<ppa name> add a new source of packages (ppa)

To install a package we need its exact name. If we do not know it, we can search for it:

We search for packages containing 'hello' in their name:
p-search hello
p  gpe-othello             - othello board game for GPE              
i  hello                   - The classic greeting, and a good example
p  hello-debhelper         - The classic greeting, and a good example
p  ruby-mixlib-shellout    - mixin library for subprocess management
'i' indicates that the package is installed.
'p' indicates that the package is purged (not installed).

But sometimes the p-search commands return a lot of results. You can grep the output to narrow the search. Let's say, for example, that we want to install the text-based mail client that we had at the university, but we can't remember at all its name. We will search for keywords in its description:

We search for packages containing 'mail' in their description,
and we count the output's number of lines:
p-search-description mail  | wc -l 
1392
This is a lot. Let's grep for those lines mentionning 'text-based':
p-search-description mail | grep text-based  | wc -l
2
OK, now this is very interresting, let's look at these 2 results:
p-search-description mail | grep text-based
p  mutt              - text-based mailreader supporting MIME, GPG
p  python-cheetah    - text-based template engine and Python code
Yes! Now we remember, it was mutt!

We install it immediately
p-install mutt
...

Now we just revealed the install command, p-install. There is actually another one, p-install-deb. The first one deals with packages on remote repositories. The second one deals with local packages, which are '.deb' files. Let's look at them:

p-install mutt                         --> will install remote packages,
...                                      the argument is the package name.
p-install-deb mutt-1.5.21.deb          --> will install a local package,
...                                           the argument is a .deb file.

The three following commands deal with package repositories. When a repository is updated, for example when new packages are added or upgraded, you should update your system accordingly. This is the p-update command. After you updated your system, if some of your installed packages were upgraded in the repository, you may want to upgrade them on your system. This is the p-upgrade command. Finally you may be given a reference to a new repository (of type PPA), to add it to your system, you use the p-add-ppa command.

p-update
... throwing lot of lines...
...
Fetched 326 kB in 6s (49,7 kB/s)
Current status: 31 updates [+16], 2395 new [+8].
p-upgrade
Resolving dependencies...
The following NEW packages will be installed:
  libhello-1.0-0{a} ...
The following packages will be upgraded:
  hello mutt ...

7 packages upgraded, 3 newly installed.
Need to get 31,2 MB of archives. After unpacking 58 MB will be used.
Do you want to continue? [Y/n/?] 
type 'Y' to proceed,
this will upgrade your installed packages and install new ones,
and eventually remove obsolete ones.

Now, if we want a package, for example super-package, that is in a new repository (PPA), for example ppa:super-ppa

p-add-ppa ppa:super-ppa                                We add the ppa
...
p-update                                          We update our system
...
p-install super-package                         We install the package
...

Cleaning up

This section is about cleaning up your system from unneeded files, or packages. There are three things that you can remove: packages, the package download cache, and unused locale files.

We remove packages with p-remove. When we install or upgrade packages, the sytem keeps the downloaded packages. This may take a large space our your disk. We clean the cache with p-clean-cache.

p-remove hello                       Removes package 'hello'
p-cache-size                         Gives the current size of the cache
107M  /var/cache/apt/archives/
p-cache-clean                        Will empty the cache.

Finally the packaging system installs locale files (mostly translations of interface and documentation into various languages) for all available locales (50+ languages). On personal computer you rarely use more than a few languages. So the locale files for all other locales can be safely removed. This is done with p-locale-purge. Normally ....

p-locale-purge

config !!!
automatic vs manual


Advanced usage

Rebuilding packages

Advanced arguments

Features not included in p- - use parent tool options/parameters/arguments - documentation - dpkg/apt-get/etc. --help - man dpkg/apt-get/etc. - online doc

Extending p- locally

- extend p- locally, add aliases feel free to share your own common commands and propose for inclusion

p-

a simple package manager

Project

p- is Free Software

p- is Free Software. It is protected by copyright laws and distributed under the GNU GPL2 license. It means that everybody is free to use it, free to study it, free to modify it, and free to redistribute. This is with one condition: if you redistribute it, you must do it under the same conditions (GPL2), and grant the same freedom to everybody.

p- is distributed for free with the hope that it is useful to others.

Motivation

I have been using Debian and Ubuntu for years with a lot of satisfaction. Their packaging system and package database have been highly stable and usualy included all the packages I have ever wished. However I have always been a little bit annoyed by the variety of tools we have to use and their different synopsis. The other day I finally took the time to write a few aliases for the command I used the most. Then I wrote a UNIX pipe of commands to self document the commands (it greps the alias file for the packaging management commands and print these lines). Finally I put all these commands in a separate file. So it could be shared with friends.

In the end, I thought, why not sharing it with the world? Github makes it trivial to set up a public project for free. It takes a few clicks to set up a public code repository, and no more to set up a project web page.

Et voilà !

Contribution

Feedback and contributions are warmly welcome!

Feel free to share your own aliases, and ask for inclusion in p- if it makes sense. Use the issue tracker for bugs, ideas, and feedback. Fork the project, and send pull requests.

Bugs, ideas, feedback
goes to the issue tracker at github
Source code
is in the source code repository at github

Credits

p-

a simple package manager