Product SiteDocumentation Site

15.3. إنشاء مستودع حزم للأداة APT

بدأت شركة فلكوت تدريجياً بمتابعة صيانة عدد من حزم دبيان، سواء الحزم المعدلة محلياً عن حزم سابقة، أو حزم منشأة من الصفر لتوزيع بيانات وبرامج داخلية.
To make deployment easier, they want to integrate these packages in a package archive that can be directly used by APT. For obvious maintenance reasons, they wish to separate internal packages from locally-rebuilt packages. The goal is for the matching entries in a /etc/apt/sources.list.d/falcot.list file to be as follows:
deb http://packages.falcot.com/ updates/
deb http://packages.falcot.com/ internal/
The administrators therefore configure a virtual host on their internal HTTP server, with /srv/vhosts/packages/ as the root of the associated web space. The management of the archive itself is delegated to the mini-dinstall command (in the similarly-named package). This tool keeps an eye on an incoming/ directory (in our case, /srv/vhosts/packages/mini-dinstall/incoming/) and waits for new packages there; when a package is uploaded, it is installed into a Debian archive at /srv/vhosts/packages/. The mini-dinstall command reads the *.changes file created when the Debian package is generated. These files contain a list of all other files associated with the version of the package (*.deb, *.dsc, *.diff.gz/*.debian.tar.gz, *.orig.tar.gz, or their equivalents with other compression tools), and these allow mini-dinstall to know which files to install. *.changes files also contain the name of the target distribution (often unstable) mentioned in the latest debian/changelog entry, and mini-dinstall uses this information to decide where the package should be installed. This is why administrators must always change this field before building a package, and set it to internal or updates, depending on the target location. mini-dinstall then generates the files required by APT, such as Packages.gz.
لإعداد mini-dinstall يجب ضبط الملف ~/.mini-dinstall.conf؛ كانت المحتويات في حالة شركة فلكوت كالتالي:
[DEFAULT]
archive_style = flat
archivedir = /srv/vhosts/packages

verify_sigs = 0
mail_to = admin@falcot.com

generate_release = 1
release_origin = Falcot Corp
release_codename = stable

[updates]
release_label = Recompiled Debian Packages

[internal]
release_label = Internal Packages
أحد القرارات التي تستحق الذكر هو توليد ملفات Release لكل أرشيف. وهذه تساعد في إدارة أولويات تثبيت الحزم باستخدام ملف الضبط /etc/apt/preferences (انظر قسم 6.2.5, “إدارة أولويات الحزم” لمزيد من التفاصيل).
استدعاء mini-dinstall في الواقع يبدأ تشغيل خدمة في الخلفية. وطالما أن هذه الخدمة تعمل، سوف تفحص ورود حزم جديدة إلى المجلد incoming/ كل نصف ساعة؛ عند وصول حزمة جديدة، سوف تُنقَل إلى الأرشيف ويعاد توليد ملفات Packages.gz و Sources.gz المناسبة. إذا كان تشغيل الخدمة يسبب مشكلة، يمكن أيضاً استدعاء mini-dinstall يدوياً في الوضع اللاتفاعلي (أو الدفعي batch)، باستخدام الخيار -b، في كل مرة تُرفَع فيها حزمة جديدة إلى المجلد incoming/. الإمكانيات الأخرى التي يوفرها mini-dinstall موثقة في صفحة الدليل mini-dinstall(1).‎