dpkg
وapt
حتى يظنّان أن بعض الحزم مثبتة، رغم أنها ليست في الحقيقة إلا قواقع فارغة. هذا يسمح بتلبية اعتماديات حزمة ما عندما يكون البرنامج المطلوب مُثبّتاً خارج مدى نظام الحزم. هذه الطريقة ناجحة، لكن يجب تفاديها قدر الإمكان، لأنه لا يُضمَن أن يعمل البرنامج المُثبّت يدوياً مثل عمل الحزمة الموافقة له تماماً، وقد لا تعمل الحزم الأخرى التي تعتمد عليه بشكل سليم.
equivs-control
وequivs-build
(من الحزمة equivs)، ينشئ الأمر equivs-control
ملف ترويسة حزمة دبيان يجب تعديله حتى يحوي اسم الحزمة المنشأة، ورقم إصدارها، واسم مشرفها، واعتمادياتها، ووصفها. الحقول الأخرى التي لا تملك قيماً افتراضية ليست إلزامية ويمكن حذفها. الحقول Copyright
وChangelog
وReadme
وExtra-Files
ليست حقولاً معيارية في في حزم دبيان؛ لا معنى لهذه الحقول خارج نطاق equivs-build
، وسوف تُحذَف من ترويسات الحزم المولّدة.
مثال 15.2. ملف ترويسة الحزمة الزائفة libxml-libxml-perl
Section: perl Priority: optional Standards-Version: 3.9.6 Package: libxml-libxml-perl Version: 2.0116-1 Maintainer: Raphael Hertzog <hertzog@debian.org> Depends: libxml2 (>= 2.7.4) Architecture: all Description: Fake package - module manually installed in site_perl This is a fake package to let the packaging system believe that this Debian package is installed. . In fact, the package is not installed since a newer version of the module has been manually compiled & installed in the site_perl directory.
equivs-build file
. تهانينا: أُنشِئَت الحزمة في المجلد الحالي ويمكن التعامل معها مثل أي حزمة دبيان أخرى.
falcot-data-1.0
لتخزين الحزمة المصدرية. سوف تُسمّى الحزمة ‒منطقياً‒ falcot-data
وستحمل رقم الإصدار 1.0
. بعدها يضع مدير النظام المستندات في المجلد الفرعي data
. ثم يستدعي الأمر dh_make
(من الحزمة dh-make) لإضافة الملفات اللازمة لعملية توليد الحزمة، التي ستحفظ جميعاً في المجلد الفرعي debian
:
$
cd falcot-data-1.0
$
dh_make --native
Type of package: (single, indep, library, python) [s/i/l/p]?
i
Maintainer Name : Raphael Hertzog Email-Address : hertzog@debian.org Date : Fri, 04 Sep 2015 12:09:39 -0400 Package Name : falcot-data Version : 1.0 License : gpl3 Package Type : indep Are the details correct? [Y/n/q] Currently there is not top level Makefile. This may require additional tuning Done. Please edit the files in the debian/ subdirectory now. $
Architecture: all
). single acts as a counterpart, and leads to a single binary package that is dependent on the target architecture (Architecture: any
). In this case, the former choice is more relevant since the package only contains documents and no binary programs, so it can be used similarly on computers of all architectures.
dh_make
مجلداً فرعياً بالاسم debian
يحوي ملفات عديدة. بعض هذه الملفات ضروري، خصوصاً rules
وcontrol
وchangelog
وcopyright
. أما الملفات ذات اللاحقة .ex
فهي أمثلة يمكن استخدامها بعد تعديلها (وإزالة اللاحقة) إذا كانت تناسبك. أما إذا لم تكن بحاجة لها، فعليك إزالتها. لكن حافظ على الملف compat
، لأنه يلزم لعمل مجموعة برامج debhelper (كلها تبدأ أسماؤها بالبادئة dh_
) بشكل صحيح، التي تستخدم في المراحل المختلفة من عملية بناء الحزمة.
copyright
file must contain information about the authors of the documents included in the package, and the related license. In our case, these are internal documents and their use is restricted to within the Falcot Corp company. The default changelog
file is generally appropriate; replacing the “Initial release” with a more verbose explanation and changing the distribution from unstable
to internal
is enough. The control
file was also updated: the Section
field has been changed to misc and the Homepage
, Vcs-Git
and Vcs-Browser
fields were removed. The Depends
fields was completed with firefox-esr | www-browser
so as to ensure the availability of a web browser able to display the documents in the package.
مثال 15.3. ملف control
Source: falcot-data Section: misc Priority: optional Maintainer: Raphael Hertzog <hertzog@debian.org> Build-Depends: debhelper (>= 10) Standards-Version: 4.1.2 Package: falcot-data Architecture: all Depends: firefox-esr | www-browser, ${misc:Depends} Description: Internal Falcot Corp Documentation This package provides several documents describing the internal structure at Falcot Corp. This includes: - organization diagram - contacts for each department. . These documents MUST NOT leave the company. Their use is INTERNAL ONLY.
مثال 15.4. ملف changelog
falcot-data (1.0) internal; urgency=low * Initial Release. * Let's start with few documents: - internal company structure; - contacts for each department. -- Raphael Hertzog <hertzog@debian.org> Fri, 04 Sep 2015 12:09:39 -0400
مثال 15.5. ملف copyright
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: falcot-data Files: * Copyright: 2004-2015 Falcot Corp License: All rights reserved.
rules
عادة مجموعة قواعد تستخدم لضبط وبناء وتثبيت البرنامج في مجلد فرعي مخصص (يسمى حسب اسم الحزمة الثنائية). بعدها تؤرشف محتويات هذا المجلد الفرعي في حزمة دبيان كما لو كانت جذر نظام الملفات. في حالتنا، سوف تثبت الملفات في المجلد الفرعي debian/falcot-data/usr/share/falcot-data/
، حتى يؤدي تثبيت الحزمة المولّدة لنشر الملفات في /usr/share/falcot-data/
. يستخدم الملف rules
كملف Makefile
فيه بضعة أهداف قياسية (منها clean
الذي يستخدم لتنظيف المجلد المصدر، وbinary
الذي يستخدم لتوليد الحزمة الثنائية).
debhelper
. وهذه هي حالة الملفات التي يولدها dh_make
. لتثبيت ملفاتنا، علينا فقط ضبط سلوك الأمر dh_install
عبر إنشاء ملف debian/falcot-data.install
التالي:
data/* usr/share/falcot-data/
falcot-data.desktop
file and get it installed in /usr/share/applications
by adding a second line to debian/falcot-data.install
.
مثال 15.6. ملف falcot-data.desktop
[Desktop Entry] Name=Internal Falcot Corp Documentation Comment=Starts a browser to read the documentation Exec=x-www-browser /usr/share/falcot-data/index.html Terminal=false Type=Application Categories=Documentation;
debian/falcot-data.install
كما يبدو بعد تحديثه:
data/* usr/share/falcot-data/ falcot-data.desktop usr/share/applications/
dpkg-buildpackage -us -uc
من داخل المجلد falcot-data-1.0
.