Skip to Navigation

Chapter 15. Package Building

If you want to create an OPM package (.opm) you need to create a spec file (.sopm) which includes the properties of the package.

Package Spec File

The OPM package is XML based. You can create/edit the .sopm via a text or xml editor. It contains meta data, a file list and database options.

Name

The package name (required).

<Name>Calendar</Name>
            

Version

The package version (required).

<Version>1.2.3</Version>
            

Framework

The required framework version (2.0.x means e.g. 2.0.1 or 2.0.9) (required).

<Framework>2.0.x</Framework>
            

Vendor

The package vendor (required).

<Vendor>OTRS AG</Vendor>
            

URL

The vendor URL (required).

<URL>http://otrs.org/</URL>
            

License

The license of the package (required).

<License>GNU GENERAL PUBLIC LICENSE Version 2, June 1991</License>
            

ChangeLog

The package change log (optional).

<ChangeLog Version="1.1.2" Date="2007-02-15 18:45:21">Added some feature.</ChangeLog>
<ChangeLog Version="1.1.1" Date="2007-02-15 16:17:51">New package.</ChangeLog>
            

Description

The package description in different languages (required).

<Description Lang="en">A web calendar.</Description>
<Description Lang="de">Ein Web Kalender.</Description>
            

BuildHost

This will be filled in automatically by OPM (auto).

<BuildHost>?</BuildHost>
            

BuildDate

This will be filled in automatically by OPM (auto).

<BuildDate>?</BuildDate>
            

PackageRequired

Packages that must be installed beforehand (optional). If PackageRequired is used, a version of the required package must be specified.

<PackageRequired Version="1.0.3">SomeOtherPackage</PackageRequired>
<PackageRequired Version="5.3.2">SomeotherPackage2</PackageRequired>
            

OS (^M)

Required OS (optional).

<OS>Linux</OS>
<OS>MacOS</OS>
            

Filelist

This is a list of files included in the package (optional).

<Filelist>
    <File Permission="644" Location="Kernel/Config/Files/Calendar.pm"/>
    <File Permission="644" Location="Kernel/System/CalendarEvent.pm"/>
    <File Permission="644" Location="Kernel/Modules/AgentCalendar.pm"/>
    <File Permission="644" Location="Kernel/Language/de_AgentCalendar.pm"/>
</Filelist>
            

DatabaseInstall

Database entries that have to be created when a package is installed (optional).

<DatabaseInstall>
    <TableCreate Name="calendar_event">
    <Column Name="id" Required="true" PrimaryKey="true" AutoIncrement="true" Type="BIGINT"/>
    <Column Name="title" Required="true" Size="250" Type="VARCHAR"/>
    <Column Name="content" Required="false" Size="250" Type="VARCHAR"/>
    <Column Name="start_time" Required="true" Type="DATE"/>
    <Column Name="end_time" Required="true" Type="DATE"/>
    <Column Name="owner_id" Required="true" Type="INTEGER"/>
    <Column Name="event_status" Required="true" Size="50" Type="VARCHAR"/>
    </TableCreate>
</DatabaseInstall>
            

DatabaseUpgrade

Information on which actions have to be performed in case of an upgrade (subject to version tag), (optional). Example (if installed package version is below 1.3.4, defined action will be performed):

<DatabaseUpgrade>
    <TableCreate Name="calendar_event_involved" Version="1.3.4">
        <Column Name="event_id" Required="true" Type="BIGINT"/>
        <Column Name="user_id" Required="true" Type="INTEGER"/>
    </TableCreate>
</DatabaseUpgrade>
            

DatabaseReinstall

Information on what actions have to be performed if the package is reinstalled, (optional).

<DatabaseReinstall></DatabaseReinstall>
            

DatabaseUninstall

Uninstall (if a package gets uninstalled), (optional).

<DatabaseUninstall>
    <TableDrop Name="calendar_event" />
</DatabaseUninstall>
            

CodeInstall

To execute perl code if the package is installed (optional).

<CodeInstall>
    # example
    if (1) {
        print STDERR "Some info to STDERR\n";
    }
    # log example
    $Self->{LogObject}->Log(
        Priority => 'notice',
        Message => "Some Message!",
    )
    # database example
    $Self->{DBObject}->Do(SQL => "SOME SQL");
</CodeInstall>
            

CodeUninstall

To execute perl code if the package is uninstalled (optional).

<CodeUninstall>
    # example
    if (1) {
        print STDERR "Some info to STDERR\n";
    }
</CodeUninstall>
            

CodeReinstall

To execute perl code if the package is reinstalled (optional).

<CodeReinstall>
    # example
    if (1) {
        print STDERR "Some info to STDERR\n";
    }
</CodeReinstall>
            

CodeUpgrade

To execute perl code if the package is upgraded (optional).

<CodeUpgrade>
    # example
    if (1) {
        print STDERR "Some info to STDERR\n";
    }
</CodeUpgrade>
            

IntroInstall(Pre|Post)

To show a pre or post install introdution in installation dialog.

<IntroInstallPre Title="Some Title" Lang="en">
Some Info formated in dtl/html....
</IntroInstallPre>
            

IntroUninstall(Pre|Post)

To show a pre or post uninstall introdution in uninstallation dialog.

<IntroUninstallPre Title="Some Title" Lang="en">
Some Info formated in dtl/html....
</IntroUninstallPre>
            

IntroReinstall(Pre|Post)

To show a pre or post reinstall introdution in reinstallation dialog.

<IntroReinstallPre Title="Some Title" Lang="en">
Some Info formated in dtl/html....
</IntroReinstallPre>
            

IntroUpgrade(Pre|Post)

To show a pre or post upgrade introdution in upgrading dialog.

<IntroUpgradePre Title="Some Title" Lang="en">
Some Info formated in dtl/html....
</IntroUpgradePre>