[devel] lua-rpm-0.1 (squeeze.lua)

Alexey Tourbin =?iso-8859-1?q?at_=CE=C1_altlinux=2Eru?=
Пт Апр 8 06:34:25 MSD 2005


Здравствуйте.
Я научился программировать на lua. :)

Кто-нибудь сталкивался?  Язычок в принципе ничего.  Очень раздражает
отсутствие 'continue' в цикле (при том, что есть 'break').  Разработчики
языка не хотят добавлять continue по каким-то принципиальным
соображениям.  В результате вместо

	while ... do
		if ... then
			continue
		end
	end

приходится писать

	while ... do
		while true do
			if ... then
				break
			end
			break
		end
	end

Ну так вот.  Алгоритм оптимизации зависимостей в BuildRequires.
Происходит в два этапа: 1) expand: список зависимостей дополняется
настолько, насколько это возможно; 2) squeeze: список зависимостей
сжимается настолько, насколько это возможно.

Ниже приводится протокол выполнения алгоритма для списка пакетов
{ rpm-build, xvfb-run }.  На выходе получается тот же самый список (т.е.
эти пакеты между собой не зависят, а всё остальное успешно выносится.
Usage: ./squeeze.lua <список пакетов>.

Для сборки нужно librpm-devel, liblua5-devel, для запуска lua5.

$ ./squeeze.lua rpm-build xvfb-run
        Expanding (pass 1, 2 packages)...
rpm-build -> librpmbuild
rpm-build -> rpm
rpm-build -> shadow-utils
Warning: autoconf provided by { autoconf_2.13, autoconf_2.5 }
rpm-build -> autoconf-common
Warning: automake provided by { automake_1.4, automake_1.8, automake_1.6, automake_1.7 }
rpm-build -> automake-common
rpm-build -> bison
rpm-build -> coreutils
rpm-build -> cpio
Warning: gcc provided by { gcc3.4, gcc2.95, gcc2.96 }
rpm-build -> gettext-tools
rpm-build -> glibc-devel
rpm-build -> file
Warning: kernel-headers provided by { kernel-headers-std-up, glibc-kernheaders, kernel24-headers }
Warning: libtool provided by { libtool_1.4, libtool_1.5 }
rpm-build -> m4
rpm-build -> make
rpm-build -> net-tools
rpm-build -> procps
rpm-build -> psmisc
rpm-build -> sed
rpm-build -> service
rpm-build -> sh
rpm-build -> texinfo
rpm-build -> which
rpm-build -> bzip2
rpm-build -> gzip
rpm-build -> info-install
rpm-build -> mktemp
rpm-build -> patch
rpm-build -> tar
rpm-build -> rpm-build-perl
rpm-build -> rpm-build-python
rpm-build -> rpm-build-tcl
rpm-build -> binutils
rpm-build -> diffutils
rpm-build -> findutils
rpm-build -> gawk
rpm-build -> glibc-core
rpm-build -> grep
rpm-build -> libpopt.so.0 -> libpopt
rpm-build -> librpm-4.0.4.so -> librpm
rpm-build -> perl(File/Basename.pm) -> perl-base
xvfb-run -> xorg-x11-Xvfb
xvfb-run -> xorg-x11-xauth
xvfb-run -> fakeroot
        Expanding (pass 2, 44 packages)...
Warning: autoconf provided by { autoconf_2.13, autoconf_2.5 }
Warning: automake provided by { automake_1.4, automake_1.8, automake_1.6, automake_1.7 }
Warning: gcc provided by { gcc3.4, gcc2.95, gcc2.96 }
Warning: kernel-headers provided by { kernel-headers-std-up, glibc-kernheaders, kernel24-headers }
Warning: libtool provided by { libtool_1.4, libtool_1.5 }
rpm -> alt-gpgkeys
shadow-utils -> shadow-convert
shadow-utils -> tcb-utils
shadow-utils -> /etc/pam.d -> pam-config
Warning: libpam(include) provided by { libpam2, libpam0 }
shadow-utils -> libpam.so.0 -> libpam0
shadow-utils -> libpam_userpass.so.1 -> pam0_userpass
shadow-utils -> libtcb.so.0 -> libtcb
shadow-utils -> pam0(system-auth-use_first_pass) -> pam0-config
shadow-utils -> pam_rootok.so -> pam
coreutils -> libtinfo.so.5 -> libtinfo
gettext-tools -> gettext
gettext-tools -> /etc/emacs/site-start.d -> emacs-base
gettext-tools -> libintl.so.3 -> libintl3
glibc-devel -> glibc
glibc-devel -> glibc-kernheaders
glibc-devel -> kernel-headers-common
file -> libmagic
file -> libz.so.1 -> zlib
procps -> libncurses.so.5 -> libncurses
psmisc -> SysVinit
service -> /bin/tput -> termutils
service -> chkconfig
bzip2 -> bzlib
binutils -> libbfd
glibc-core -> setup
librpm -> libbeecrypt
librpm -> libdb4.3
xorg-x11-Xvfb -> xorg-x11-server-common
xorg-x11-Xvfb -> libXau.so.6 -> xorg-x11-libs
xorg-x11-Xvfb -> libfreetype.so.6 -> freetype2
fakeroot -> getopt
        Expanding (pass 3, 75 packages)...
Warning: autoconf provided by { autoconf_2.13, autoconf_2.5 }
Warning: automake provided by { automake_1.4, automake_1.8, automake_1.6, automake_1.7 }
Warning: gcc provided by { gcc3.4, gcc2.95, gcc2.96 }
Warning: libtool provided by { libtool_1.4, libtool_1.5 }
tcb-utils -> pam_tcb -> pam0_tcb
pam0-config -> pam_passwdqc.so -> pam0_passwdqc
libtinfo -> terminfo
glibc -> glibc-nss
glibc -> glibc-locales
glibc -> glibc-gconv-modules
glibc -> iconv
glibc -> glibc-timezones
glibc -> glibc-utils
libncurses -> libgpm.so.1 -> libgpm
SysVinit -> /sbin/sulogin -> msulogin
xorg-x11-server-common -> xorg-x11-misc-fonts
xorg-x11-server-common -> xorg-x11-utils
xorg-x11-server-common -> util-linux
xorg-x11-server-common -> xinitrc
xorg-x11-server-common -> app-defaults
xorg-x11-libs -> freetype
xorg-x11-libs -> xorg-x11-locales
xorg-x11-libs -> libexpat.so.0 -> libexpat
xorg-x11-libs -> libfontconfig.so.1 -> fontconfig
        Expanding (pass 4, 95 packages)...
Warning: autoconf provided by { autoconf_2.13, autoconf_2.5 }
Warning: automake provided by { automake_1.4, automake_1.8, automake_1.6, automake_1.7 }
Warning: gcc provided by { gcc3.4, gcc2.95, gcc2.96 }
Warning: libtool provided by { libtool_1.4, libtool_1.5 }
pam0_tcb -> nss_tcb
pam0_tcb -> control
xorg-x11-misc-fonts -> chkfontpath
xorg-x11-misc-fonts -> xorg-x11-font-utils
xorg-x11-utils -> xterm
xinitrc -> bash
        Expanding (pass 5, 101 packages)...
Warning: autoconf provided by { autoconf_2.13, autoconf_2.5 }
Warning: automake provided by { automake_1.4, automake_1.8, automake_1.6, automake_1.7 }
Warning: gcc provided by { gcc3.4, gcc2.95, gcc2.96 }
Warning: libtool provided by { libtool_1.4, libtool_1.5 }
xterm -> libutempter
xterm -> alternatives
bash -> libhistory.so.4.3 -> libreadline
        Expanding (pass 6, 104 packages)...
Warning: autoconf provided by { autoconf_2.13, autoconf_2.5 }
Warning: automake provided by { automake_1.4, automake_1.8, automake_1.6, automake_1.7 }
Warning: gcc provided by { gcc3.4, gcc2.95, gcc2.96 }
Warning: libtool provided by { libtool_1.4, libtool_1.5 }
alternatives -> ed
        Expanding (pass 7, 105 packages)...
Warning: autoconf provided by { autoconf_2.13, autoconf_2.5 }
Warning: automake provided by { automake_1.4, automake_1.8, automake_1.6, automake_1.7 }
Warning: gcc provided by { gcc3.4, gcc2.95, gcc2.96 }
Warning: libtool provided by { libtool_1.4, libtool_1.5 }
{ rpm-build, xvfb-run, librpmbuild, rpm, shadow-utils, autoconf-common, automake-common, bison, coreutils, cpio, gettext-tools, glibc-devel, file, m4, make, net-tools, procps, psmisc, sed, service, sh, texinfo, which, bzip2, gzip, info-install, mktemp, patch, tar, rpm-build-perl, rpm-build-python, rpm-build-tcl, binutils, diffutils, findutils, gawk, glibc-core, grep, libpopt, librpm, perl-base, xorg-x11-Xvfb, xorg-x11-xauth, fakeroot, alt-gpgkeys, shadow-convert, tcb-utils, pam-config, libpam0, pam0_userpass, libtcb, pam0-config, pam, libtinfo, gettext, emacs-base, libintl3, glibc, glibc-kernheaders, kernel-headers-common, libmagic, zlib, libncurses, SysVinit, termutils, chkconfig, bzlib, libbfd, setup, libbeecrypt, libdb4.3, xorg-x11-server-common, xorg-x11-libs, freetype2, getopt, pam0_tcb, pam0_passwdqc, terminfo, glibc-nss, glibc-locales, glibc-gconv-modules, iconv, glibc-timezones, glibc-utils, libgpm, msulogin, xorg-x11-misc-fonts, xorg-x11-utils, util-linux, xinitrc, app-defaults, freetype, xorg-x11-locales, libexpat, fontconfig, nss_tcb, control, chkfontpath, xorg-x11-font-utils, xterm, bash, libutempter, alternatives, libreadline, ed }
        Squeezing terminfo ...
terminfo < termutils
        Squeezing alt-gpgkeys ...
alt-gpgkeys < rpm
        Squeezing setup ...
setup < glibc-core
        Squeezing emacs-base ...
emacs-base < /etc/emacs/site-start.d < gettext-tools
        Squeezing glibc-kernheaders ...
glibc-kernheaders < glibc-devel
        Squeezing glibc-core ...
glibc-core < libc.so.6 < getopt
        Squeezing getopt ...
getopt < fakeroot
        Squeezing app-defaults ...
app-defaults < xorg-x11-server-common
        Squeezing mktemp ...
mktemp < glibc-utils
        Squeezing net-tools ...
net-tools < rpm-build
        Squeezing chkfontpath ...
chkfontpath < xorg-x11-misc-fonts
        Squeezing pam-config ...
pam-config < pam0-config
        Squeezing patch ...
patch < rpm-build
        Squeezing msulogin ...
msulogin < /sbin/sulogin < SysVinit
        Squeezing rpm-build-python ...
rpm-build-python < rpm-build
        Squeezing automake-common ...
automake-common < gettext-tools
        Squeezing autoconf-common ...
autoconf-common < rpm-build
        Squeezing gzip ...
gzip < /bin/zcat < info-install
        Squeezing rpm-build-tcl ...
rpm-build-tcl < rpm-build
        Squeezing which ...
which < xinitrc
        Squeezing chkconfig ...
chkconfig < kernel-headers-common
        Squeezing xvfb-run ...
        Squeezing xorg-x11-misc-fonts ...
xorg-x11-misc-fonts < xorg-x11-server-common
        Squeezing libtcb ...
libtcb < libtcb.so.0 < shadow-convert
        Squeezing libexpat ...
libexpat < libexpat.so.0 < fontconfig
        Squeezing pam0-config ...
pam0-config < pam0(system-auth-use_first_pass) < shadow-utils
        Squeezing zlib ...
zlib < libz.so.1 < freetype2
        Squeezing gettext ...
gettext < gettext-tools
        Squeezing ed ...
ed < alternatives
        Squeezing info-install ...
info-install < /usr/sbin/uninstall_info < automake-common
        Squeezing psmisc ...
psmisc < service
        Squeezing glibc-gconv-modules ...
glibc-gconv-modules < glibc
        Squeezing xorg-x11-locales ...
xorg-x11-locales < xorg-x11-libs
        Squeezing cpio ...
cpio < rpm-build
        Squeezing pam0_passwdqc ...
pam0_passwdqc < pam_passwdqc.so < pam0-config
        Squeezing shadow-convert ...
shadow-convert < tcb-utils
        Squeezing glibc-timezones ...
glibc-timezones < glibc
        Squeezing bzlib ...
bzlib < bzip2
        Squeezing libpopt ...
libpopt < chkconfig
        Squeezing freetype2 ...
freetype2 < libfreetype.so.6 < xorg-x11-font-utils
        Squeezing control ...
control < util-linux
        Squeezing pam0_userpass ...
pam0_userpass < libpam_userpass.so.1 < shadow-utils
        Squeezing file ...
file < rpm-build
        Squeezing sh ...
sh < /bin/sh < app-defaults
        Squeezing libbfd ...
libbfd < binutils
        Squeezing xorg-x11-server-common ...
xorg-x11-server-common < xorg-x11-Xvfb
        Squeezing glibc ...
glibc < glibc-devel
        Squeezing libreadline ...
libreadline < libhistory.so.4.3 < bash
        Squeezing libgpm ...
libgpm < libgpm.so.1 < libncurses
        Squeezing tcb-utils ...
tcb-utils < shadow-utils
        Squeezing sed ...
sed < control
        Squeezing libdb4.3 ...
libdb4.3 < libdb-4.3.so < pam
        Squeezing bzip2 ...
bzip2 < /bin/bzcat < info-install
        Squeezing termutils ...
termutils < service
        Squeezing make ...
make < rpm-build
        Squeezing libutempter ...
libutempter < xterm
        Squeezing m4 ...
m4 < bison
        Squeezing librpmbuild ...
librpmbuild < rpm
        Squeezing alternatives ...
alternatives < xterm
        Squeezing nss_tcb ...
nss_tcb < pam0_tcb
        Squeezing tar ...
tar < gettext-tools
        Squeezing kernel-headers-common ...
kernel-headers-common < glibc-devel
        Squeezing libtinfo ...
libtinfo < libtinfo.so.5 < psmisc
        Squeezing libintl3 ...
libintl3 < gettext
        Squeezing libmagic ...
libmagic < file
        Squeezing iconv ...
iconv < glibc
        Squeezing grep ...
grep < control
        Squeezing fakeroot ...
fakeroot < xvfb-run
        Squeezing glibc-locales ...
glibc-locales < glibc
        Squeezing xorg-x11-xauth ...
xorg-x11-xauth < xvfb-run
        Squeezing rpm-build-perl ...
rpm-build-perl < rpm-build
        Squeezing findutils ...
findutils < control
        Squeezing SysVinit ...
SysVinit < psmisc
        Squeezing procps ...
procps < rpm-build
        Squeezing diffutils ...
diffutils < texinfo
        Squeezing libbeecrypt ...
libbeecrypt < librpm
        Squeezing freetype ...
freetype < xorg-x11-libs
        Squeezing bison ...
bison < rpm-build
        Squeezing bash ...
bash < xinitrc
        Squeezing libpam0 ...
libpam0 < pam_deny.so < pam0-config
        Squeezing libncurses ...
libncurses < libncurses.so.5 < procps
        Squeezing xorg-x11-font-utils ...
xorg-x11-font-utils < xorg-x11-misc-fonts
        Squeezing fontconfig ...
fontconfig < libfontconfig.so.1 < xorg-x11-libs
        Squeezing glibc-utils ...
glibc-utils < glibc
        Squeezing service ...
service < kernel-headers-common
        Squeezing pam ...
pam < pam_limits.so < pam0-config
        Squeezing gawk ...
gawk < alternatives
        Squeezing glibc-devel ...
glibc-devel < rpm-build
        Squeezing xorg-x11-Xvfb ...
xorg-x11-Xvfb < xvfb-run
        Squeezing texinfo ...
texinfo < rpm-build
        Squeezing rpm ...
rpm < rpm-build-python
        Squeezing util-linux ...
util-linux < xorg-x11-server-common
        Squeezing binutils ...
binutils < gettext-tools
        Squeezing glibc-nss ...
glibc-nss < glibc
        Squeezing shadow-utils ...
shadow-utils < libutempter
        Squeezing coreutils ...
coreutils < rpm-build-python
        Squeezing pam0_tcb ...
pam0_tcb < pam_tcb.so < pam0-config
        Squeezing perl-base ...
perl-base < rpm-build-perl
        Squeezing librpm ...
librpm < librpmbuild
        Squeezing xorg-x11-libs ...
xorg-x11-libs < xorg-x11-xauth
        Squeezing xterm ...
xterm < xinitrc
        Squeezing xinitrc ...
xinitrc < xorg-x11-server-common
        Squeezing gettext-tools ...
gettext-tools < rpm-build
        Squeezing xorg-x11-utils ...
xorg-x11-utils < xorg-x11-server-common
        Squeezing rpm-build ...
{ xvfb-run, rpm-build }
$
----------- следующая часть -----------
Было удалено вложение не в текстовом формате...
Имя     : lua-rpm-0.1.tar.gz
Тип     : application/x-gzip
Размер  : 3740 байтов
Описание: =?iso-8859-1?q?=CF=D4=D3=D5=D4=D3=D4=D7=D5=C5=D4?=
Url     : <http://lists.altlinux.org/pipermail/devel/attachments/20050408/e6ef862c/attachment-0002.bin>
----------- следующая часть -----------
Было удалено вложение не в текстовом формате...
Имя     : =?iso-8859-1?q?=CF=D4=D3=D5=D4=D3=D4=D7=D5=C5=D4?=
Тип     : application/pgp-signature
Размер  : 189 байтов
Описание: =?iso-8859-1?q?=CF=D4=D3=D5=D4=D3=D4=D7=D5=C5=D4?=
Url     : <http://lists.altlinux.org/pipermail/devel/attachments/20050408/e6ef862c/attachment-0003.bin>


Подробная информация о списке рассылки Devel