cosam
Active Member
As I mentioned elsewhere, I've been thinking about the possibility of implementing a "proper" package manager which can handle removable storage. This would be fully compatible with the PXML/.zip system and works by adding a few (entirely optional) tags to the XML file itself. The location (i.e. path and storage device) of packages modified in this way can be tracked. The system will also happily install unmodified PXML archives according to the user's preferences.
I'm posting what I've come up with so far. Bare in mind it's a very early, very high-level design. I would very much appreciate any comments.
Apologies for the excessively long post - I'm not entitled to upload attachments. Maybe a moderator can sort that out if deemed necessary.
CODE
===============
Package Manager
===============
1. Functional Requirements
==========================
1.1 General
-----------
The package manager's function is to facilitate the installation, removal and
updating of software.
1.2 Packaging
-------------
Software is to be distributed in package form, consisting of one file in which
all necessary data for the installation and removal of that package can be
recorded. The package format is to be compressed and use open standards.
Packages should be compatible with the PXML standard.
1.3 Dependencies
----------------
The system must be able to automatically download and install any dependencies
for a given package. Removal of packages on which others depend must be
detected and deterred by means of a clear message to the user.
Packages are required to list all of their dependencies (including version
information) so that these may be catered for during installation.
1.4 Removable Storage
---------------------
The system must be able to handle the removal of any part of the filesystem
that resides on removable media. A system must be implemented by means of which
the media on which a package resides can be determined. Removable media must
be identifiable by a user defined, natural language identifier.
1.5 Database
------------
The package manager's database will keep track of the status of all installed
packages and optionally an easily updated list of available packages, including
version information. The database must be available independent of which
removable storage devices are mounted.
1.6 Program Launching
---------------------
A means of checking for dependencies when a program is launched must be
implemented. This mechanism will prompt the user regarding which removable
media must be mounted in order to run the requested program. If the program's
dependencies span more devices that is catered for (e.g. the data is stored on
three storage devices, and harware limits mounting to two) the user should be
prompted and suggestions should be made as to how the situation can be
resolved (e.g. by duplicating data from one device to another).
2. Packaging
============
2.1 Applicable requirements
---------------------------
"Software is to be distributed in package form, consisting of one file in which
all necessary data for the installation and removal of that package can be
recorded. The package format will be compressed and use open standards."
"Packages are required to list all of their dependencies (including version
information) so that these may be catered for during installation."
"Packages should be compatible with the PXML standard."
2.2 Package Format
------------------
The package format is based on that used by the PXML system. Packages consist
of a single directory compressed using PKZIP-compatible compression. The
directory (including any subdirectory thereof) must contain at least one PXML
file. Such ZIP archives which support the package management system may include
extra tags in the PXML file(s), enclosed between <package> and </package> tags
directly under the root element. All such tags are optional.
2.3 Dependencies
----------------
Dependencies are indicated by adding the following XML tag:
<depends minversion="2.0" maxversion="2.4">glibc</depends>
Would be used to register a dependency on the "glibc" package which of version
2.0 thru 2.4 inclusive. Multiple "depends" tags are permitted.
2.4 Scripts
-----------
Two extra XML tags can be used to run scripts before (preinstall) or after
(postinstall) package installation. These can be used to shutdown/restart
services, prepare or clean up files and directories, etc.
<preinstall>scripts/runfirst.sh</preinstall>
<postinstall>scripts/cleanup.sh</postinstall>
Similar tags can be used to run scripts before (preremove) of after
(postremove) a package is removed:
<preremove>scripts/shutdown.sh</preremove>
<postremove>scripts/realclean.sh</postremove>
All paths are relative to the PXML file in question. No more than one of each
of these tags may be present in one <package></package> element.
3. Dependencies
===============
3.1 Applicable requirements
---------------------------
"The system must be able to automatically download and install any dependencies
for a given package. Removal of packages on which others depend must be
detected and deterred by means of a clear message to the user."
3.2 Repository
--------------
The packaging system is dependent on a yet to be determined type of repository
where software packages are made available for anonymous download. Multiple
repositories can be configured for used by one system.
3.2 Installation
----------------
Installation of a package implies that this package be downloaded form a
previously configured repository. Ideally the repositories will provide an
index of available packages so that dependencies can be resolved before
downloading begins. This is however not required as any package can be
downloaded, examined for dependencies, and these dependencies can subsequently
also be downloaded. This process can continue recursively until all depend-
encies are met.
Once dependencies are resolved, the package manager will download the package
(and if dependencies have already been resolved, the packages on which this
depends), extract them, and run the appropriate scripts. The package manager
database is updated to reflect the new status of each installed package.
3.3 Removal
-----------
Removal of packages entails the deletion of the extracted packages from their
storage location and updating the database to reflect this new status. Packages
on which others are dependent cannot be removed without confirmation from the
user. Packages which are no longer required, due to being installed solely to
fulfil the dependencies of another (now removed) package, can optionally be
removed after user confirmation.
3.4 Updating
------------
Updating a package is tantamount to removing the old package and installing a
later version.
4. Removable Storage
====================
4.1 Applicable requirements
---------------------------
"The system must be able to handle the removal of any part of the filesystem
that resides on removable media. A system must be implemented by means of which
the media on which a package resides can be determined. Removable media must
be identifiable by a user defined, natural language identifier."
4.2 Package/storage Tracking
----------------------------
Each removable device attached to the system must be able to be uniquely
identified. Depending on the media type, this may be a software-accessible
serial number, a volume label, or something else. Where possible, an identifier
which does not change over time should be used. The package manager uses this
unique identifier to track the storage device on which each package is
installed.
During installation of a package, the user should be prompted to select a
storage device onto which the package will be installed. It should also be
possible to configure a default device to avoid this prompt.
The same package may be installed on multiple storage devices to allow programs
to access their dependencies from different sources when necessary. All
locations are recorded in the database. It is necessary that all copies of a
particular package be updated to the same version. This can be performed when
a package is updated, i.e. the user is prompted to insert all media on which
the package is known to reside. Should the user decline, the status of the
package on the out-of-date media should be marked. Upon mounting an out-of-date
device, the user should be prompted to update the package.
Packages may be removed from devices independently (i.e. a package can be
removed from one card yet remain installed on another) or globally (i.e. all
copies are removed from all devices known to contain the package) at the user's
discretion.
4.3 Natural Language Labels
---------------------------
The package manager database will record a natural language label for each
storage device. This label will be mapped to the device's unique identifier
as defined above. The natural language label may be altered at any time without
further affecting the working of the package manager.
5. Database
===========
TBA
6. Program Launcher
===================
6.1 Applicable requirements
---------------------------
"A means of checking for dependencies when a program is launched must be
implemented. This mechanism will prompt the user regarding which removable
media must be mounted in order to run the requested program. If the program's
dependencies span more devices that is catered for (e.g. the data is stored on
three storage devices, and hardware limits mounting to two) the user should be
prompted and suggestions should be made as to how the situation can be
resolved (e.g. by duplicating data from one device to another)."
6.2 Launch Wrapper
------------------
A wrapper can be used to assess the availability of dependencies when the
user requests to launch a program. The launcher must also be able to start
regular (i.e. non-packaged) executables.
The launcher will use the package manager database to analyse the dependencies
of the program to be launched and ensure that the required storage devices are
available. Should the required devices not be mounted, the user will be
prompted to insert/attach the appropriate device. Should this not be possible
due to hardware constrains (e.g. the dependencies are spread over three devices
and only two can be inserted simultaneously) the launcher will suggest to the
user how the problem can be resolved. This may involve copying or moving a
package to a different storage device. This copying or moving should be
automated as much as possible.
Calling the launcher may be achieved from within a program directly via a
function provided by the package manager library. The prototype of this
function will follow that of the the exec() system call. A stand-alone tool
will also be created that uses this aforementioned library and can be run from
the command line with arguments, e.g.:
$ launch myprogram -option1 -option2
Where "launch" is the wrapper program, "myprogram" the executable to launch.
The remaining arguments are passed as arguments to the program being launched.
I'm posting what I've come up with so far. Bare in mind it's a very early, very high-level design. I would very much appreciate any comments.
Apologies for the excessively long post - I'm not entitled to upload attachments. Maybe a moderator can sort that out if deemed necessary.
CODE
===============
Package Manager
===============
1. Functional Requirements
==========================
1.1 General
-----------
The package manager's function is to facilitate the installation, removal and
updating of software.
1.2 Packaging
-------------
Software is to be distributed in package form, consisting of one file in which
all necessary data for the installation and removal of that package can be
recorded. The package format is to be compressed and use open standards.
Packages should be compatible with the PXML standard.
1.3 Dependencies
----------------
The system must be able to automatically download and install any dependencies
for a given package. Removal of packages on which others depend must be
detected and deterred by means of a clear message to the user.
Packages are required to list all of their dependencies (including version
information) so that these may be catered for during installation.
1.4 Removable Storage
---------------------
The system must be able to handle the removal of any part of the filesystem
that resides on removable media. A system must be implemented by means of which
the media on which a package resides can be determined. Removable media must
be identifiable by a user defined, natural language identifier.
1.5 Database
------------
The package manager's database will keep track of the status of all installed
packages and optionally an easily updated list of available packages, including
version information. The database must be available independent of which
removable storage devices are mounted.
1.6 Program Launching
---------------------
A means of checking for dependencies when a program is launched must be
implemented. This mechanism will prompt the user regarding which removable
media must be mounted in order to run the requested program. If the program's
dependencies span more devices that is catered for (e.g. the data is stored on
three storage devices, and harware limits mounting to two) the user should be
prompted and suggestions should be made as to how the situation can be
resolved (e.g. by duplicating data from one device to another).
2. Packaging
============
2.1 Applicable requirements
---------------------------
"Software is to be distributed in package form, consisting of one file in which
all necessary data for the installation and removal of that package can be
recorded. The package format will be compressed and use open standards."
"Packages are required to list all of their dependencies (including version
information) so that these may be catered for during installation."
"Packages should be compatible with the PXML standard."
2.2 Package Format
------------------
The package format is based on that used by the PXML system. Packages consist
of a single directory compressed using PKZIP-compatible compression. The
directory (including any subdirectory thereof) must contain at least one PXML
file. Such ZIP archives which support the package management system may include
extra tags in the PXML file(s), enclosed between <package> and </package> tags
directly under the root element. All such tags are optional.
2.3 Dependencies
----------------
Dependencies are indicated by adding the following XML tag:
<depends minversion="2.0" maxversion="2.4">glibc</depends>
Would be used to register a dependency on the "glibc" package which of version
2.0 thru 2.4 inclusive. Multiple "depends" tags are permitted.
2.4 Scripts
-----------
Two extra XML tags can be used to run scripts before (preinstall) or after
(postinstall) package installation. These can be used to shutdown/restart
services, prepare or clean up files and directories, etc.
<preinstall>scripts/runfirst.sh</preinstall>
<postinstall>scripts/cleanup.sh</postinstall>
Similar tags can be used to run scripts before (preremove) of after
(postremove) a package is removed:
<preremove>scripts/shutdown.sh</preremove>
<postremove>scripts/realclean.sh</postremove>
All paths are relative to the PXML file in question. No more than one of each
of these tags may be present in one <package></package> element.
3. Dependencies
===============
3.1 Applicable requirements
---------------------------
"The system must be able to automatically download and install any dependencies
for a given package. Removal of packages on which others depend must be
detected and deterred by means of a clear message to the user."
3.2 Repository
--------------
The packaging system is dependent on a yet to be determined type of repository
where software packages are made available for anonymous download. Multiple
repositories can be configured for used by one system.
3.2 Installation
----------------
Installation of a package implies that this package be downloaded form a
previously configured repository. Ideally the repositories will provide an
index of available packages so that dependencies can be resolved before
downloading begins. This is however not required as any package can be
downloaded, examined for dependencies, and these dependencies can subsequently
also be downloaded. This process can continue recursively until all depend-
encies are met.
Once dependencies are resolved, the package manager will download the package
(and if dependencies have already been resolved, the packages on which this
depends), extract them, and run the appropriate scripts. The package manager
database is updated to reflect the new status of each installed package.
3.3 Removal
-----------
Removal of packages entails the deletion of the extracted packages from their
storage location and updating the database to reflect this new status. Packages
on which others are dependent cannot be removed without confirmation from the
user. Packages which are no longer required, due to being installed solely to
fulfil the dependencies of another (now removed) package, can optionally be
removed after user confirmation.
3.4 Updating
------------
Updating a package is tantamount to removing the old package and installing a
later version.
4. Removable Storage
====================
4.1 Applicable requirements
---------------------------
"The system must be able to handle the removal of any part of the filesystem
that resides on removable media. A system must be implemented by means of which
the media on which a package resides can be determined. Removable media must
be identifiable by a user defined, natural language identifier."
4.2 Package/storage Tracking
----------------------------
Each removable device attached to the system must be able to be uniquely
identified. Depending on the media type, this may be a software-accessible
serial number, a volume label, or something else. Where possible, an identifier
which does not change over time should be used. The package manager uses this
unique identifier to track the storage device on which each package is
installed.
During installation of a package, the user should be prompted to select a
storage device onto which the package will be installed. It should also be
possible to configure a default device to avoid this prompt.
The same package may be installed on multiple storage devices to allow programs
to access their dependencies from different sources when necessary. All
locations are recorded in the database. It is necessary that all copies of a
particular package be updated to the same version. This can be performed when
a package is updated, i.e. the user is prompted to insert all media on which
the package is known to reside. Should the user decline, the status of the
package on the out-of-date media should be marked. Upon mounting an out-of-date
device, the user should be prompted to update the package.
Packages may be removed from devices independently (i.e. a package can be
removed from one card yet remain installed on another) or globally (i.e. all
copies are removed from all devices known to contain the package) at the user's
discretion.
4.3 Natural Language Labels
---------------------------
The package manager database will record a natural language label for each
storage device. This label will be mapped to the device's unique identifier
as defined above. The natural language label may be altered at any time without
further affecting the working of the package manager.
5. Database
===========
TBA
6. Program Launcher
===================
6.1 Applicable requirements
---------------------------
"A means of checking for dependencies when a program is launched must be
implemented. This mechanism will prompt the user regarding which removable
media must be mounted in order to run the requested program. If the program's
dependencies span more devices that is catered for (e.g. the data is stored on
three storage devices, and hardware limits mounting to two) the user should be
prompted and suggestions should be made as to how the situation can be
resolved (e.g. by duplicating data from one device to another)."
6.2 Launch Wrapper
------------------
A wrapper can be used to assess the availability of dependencies when the
user requests to launch a program. The launcher must also be able to start
regular (i.e. non-packaged) executables.
The launcher will use the package manager database to analyse the dependencies
of the program to be launched and ensure that the required storage devices are
available. Should the required devices not be mounted, the user will be
prompted to insert/attach the appropriate device. Should this not be possible
due to hardware constrains (e.g. the dependencies are spread over three devices
and only two can be inserted simultaneously) the launcher will suggest to the
user how the problem can be resolved. This may involve copying or moving a
package to a different storage device. This copying or moving should be
automated as much as possible.
Calling the launcher may be achieved from within a program directly via a
function provided by the package manager library. The prototype of this
function will follow that of the the exec() system call. A stand-alone tool
will also be created that uses this aforementioned library and can be run from
the command line with arguments, e.g.:
$ launch myprogram -option1 -option2
Where "launch" is the wrapper program, "myprogram" the executable to launch.
The remaining arguments are passed as arguments to the program being launched.
Last edited by a moderator: