* [devel] cpp.req -- зависимости *.h файлов (телеграфом)
@ 2008-03-03 15:26 Alexey Tourbin
2008-03-03 16:22 ` Kirill A. Shutemov
2008-03-17 21:21 ` Alexey Tourbin
0 siblings, 2 replies; 4+ messages in thread
From: Alexey Tourbin @ 2008-03-03 15:26 UTC (permalink / raw)
To: devel
[-- Attachment #1: Type: text/plain, Size: 1280 bytes --]
Я обнаружил, что пакет libmesa-devel требует (необоснованно)
libexpat-devel. У пакета libmesa-devel прописано очень много
зависимостей вручную.
Такого быть не должно. В иделе, все зависимости, прописанные
вручную, нужно удалить. Чтобы это стало более возможным (и почти
возможным), нужно релизовать замыкание зависимостей по включаемым
хедерам.
Я также обнаружил, что 'сpp -M' и 'cpp -MM' плохо подохдят для задачи
вычисления зависимостей хедеров. Но идея вычисления зависимостей
хедеров представляется не совсем уж утопической.
Можно использовать просто 'cpp'.
info cpp 'Preprocessor Output'
Вывод препроцессора позволяет построить стек включаемых файлов и,
следовательно, определить top-level includes. Если первый флаг 1,
то это push на стек, а если первый флаг 2 -- то это pop. Push на
начальной глубине даёт непосредственные зависимости исследуемого хедера.
$ cpp /usr/include/rpm/rpmlib.h |grep ^# |awk '$4==1{++I;if(I==1)print$3}$4==2{--I}'
"/usr/include/rpm/rpmio.h"
"/usr/include/rpm/rpmmessages.h"
"/usr/include/rpm/rpmerr.h"
"/usr/include/rpm/header.h"
"/usr/include/popt.h"
$ grep -w include /usr/include/rpm/rpmlib.h
#include "rpmio.h"
#include "rpmmessages.h"
#include "rpmerr.h"
#include "header.h"
#include "popt.h"
$
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [devel] cpp.req -- зависимости *.h файлов (телеграфом)
2008-03-03 15:26 [devel] cpp.req -- зависимости *.h файлов (телеграфом) Alexey Tourbin
@ 2008-03-03 16:22 ` Kirill A. Shutemov
2008-03-03 21:42 ` Alexey Tourbin
2008-03-17 21:21 ` Alexey Tourbin
1 sibling, 1 reply; 4+ messages in thread
From: Kirill A. Shutemov @ 2008-03-03 16:22 UTC (permalink / raw)
To: ALT Linux Team development discussions
[-- Attachment #1: Type: text/plain, Size: 390 bytes --]
On [Mon, 03.03.2008 18:26], Alexey Tourbin wrote:
> Я также обнаружил, что 'сpp -M' и 'cpp -MM' плохо подохдят для задачи
> вычисления зависимостей хедеров.
Почему?
--
Regards, Kirill A. Shutemov
+ Belarus, Minsk
+ Velesys Ltd, http://www.velesys.com/
+ ALT Linux Team, http://www.altlinux.com/
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [devel] cpp.req -- зависимости *.h файлов (телеграфом)
2008-03-03 16:22 ` Kirill A. Shutemov
@ 2008-03-03 21:42 ` Alexey Tourbin
0 siblings, 0 replies; 4+ messages in thread
From: Alexey Tourbin @ 2008-03-03 21:42 UTC (permalink / raw)
To: ALT Linux Team development discussions
[-- Attachment #1: Type: text/plain, Size: 2246 bytes --]
On Mon, Mar 03, 2008 at 06:22:48PM +0200, Kirill A. Shutemov wrote:
> On [Mon, 03.03.2008 18:26], Alexey Tourbin wrote:
> > Я также обнаружил, что 'сpp -M' и 'cpp -MM' плохо подохдят для задачи
> > вычисления зависимостей хедеров.
>
> Почему?
Обе разворачивают рекурсивно, при этом вторая исключает "системные
хедеры". Ни одна ни даёт того, что нужно.
$ cpp -M /usr/include/rpm/rpmlib.h
rpmlib.o: /usr/include/rpm/rpmlib.h /usr/include/rpm/rpmio.h \
/usr/include/sys/types.h /usr/include/features.h \
/usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \
/usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \
/usr/include/bits/types.h \
/usr/lib/gcc/i586-alt-linux/4.1.2/include/stddef.h \
/usr/include/bits/typesizes.h /usr/include/time.h /usr/include/endian.h \
/usr/include/bits/endian.h /usr/include/sys/select.h \
/usr/include/bits/select.h /usr/include/bits/sigset.h \
/usr/include/bits/time.h /usr/include/sys/sysmacros.h \
/usr/include/bits/pthreadtypes.h /usr/include/sys/stat.h \
/usr/include/bits/stat.h /usr/include/dirent.h \
/usr/include/bits/dirent.h /usr/include/bits/posix1_lim.h \
/usr/include/bits/local_lim.h /usr/include/linux/limits.h \
/usr/include/glob.h /usr/include/stdio.h /usr/include/libio.h \
/usr/include/_G_config.h /usr/include/wchar.h /usr/include/bits/wchar.h \
/usr/include/gconv.h /usr/lib/gcc/i586-alt-linux/4.1.2/include/stdarg.h \
/usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
/usr/include/stdlib.h /usr/include/alloca.h /usr/include/unistd.h \
/usr/include/bits/posix_opt.h /usr/include/bits/confname.h \
/usr/include/getopt.h /usr/include/rpm/rpmmessages.h \
/usr/include/rpm/rpmlog.h /usr/include/rpm/rpmerr.h \
/usr/include/rpm/header.h /usr/include/rpm/hdrinline.h \
/usr/include/popt.h
$ cpp -MM /usr/include/rpm/rpmlib.h
rpmlib.o: /usr/include/rpm/rpmlib.h /usr/include/rpm/rpmio.h \
/usr/include/rpm/rpmmessages.h /usr/include/rpm/rpmlog.h \
/usr/include/rpm/rpmerr.h /usr/include/rpm/header.h \
/usr/include/rpm/hdrinline.h
$ grep -w include /usr/include/rpm/rpmlib.h
#include "rpmio.h"
#include "rpmmessages.h"
#include "rpmerr.h"
#include "header.h"
#include "popt.h"
$
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [devel] cpp.req -- зависимости *.h файлов (телеграфом)
2008-03-03 15:26 [devel] cpp.req -- зависимости *.h файлов (телеграфом) Alexey Tourbin
2008-03-03 16:22 ` Kirill A. Shutemov
@ 2008-03-17 21:21 ` Alexey Tourbin
1 sibling, 0 replies; 4+ messages in thread
From: Alexey Tourbin @ 2008-03-17 21:21 UTC (permalink / raw)
To: devel
[-- Attachment #1: Type: text/plain, Size: 10140 bytes --]
On Mon, Mar 03, 2008 at 06:26:17PM +0300, Alexey Tourbin wrote:
> Вывод препроцессора позволяет построить стек включаемых файлов и,
> следовательно, определить top-level includes. Если первый флаг 1,
> то это push на стек, а если первый флаг 2 -- то это pop. Push на
> начальной глубине даёт непосредственные зависимости исследуемого хедера.
>
> $ cpp /usr/include/rpm/rpmlib.h |grep ^# |awk '$4==1{++I;if(I==1)print$3}$4==2{--I}'
> "/usr/include/rpm/rpmio.h"
> "/usr/include/rpm/rpmmessages.h"
> "/usr/include/rpm/rpmerr.h"
> "/usr/include/rpm/header.h"
> "/usr/include/popt.h"
> $ grep -w include /usr/include/rpm/rpmlib.h
> #include "rpmio.h"
> #include "rpmmessages.h"
> #include "rpmerr.h"
> #include "header.h"
> #include "popt.h"
> $
Предварительная релизация опубликована в моем репозитарии rpm.git.
Она ещё не совсем хорошо работает (на реальной сборке в хешере),
потому что по умолчанию используется "cpp -x c++", то есть пока
для работы требуется gcc4.1-c++.
Но можно уже смотреть, что получается.
Примеры:
а) Зависимости хедеров у пакета librpm-devel.
$ rpm -ql librpm-devel |file -NF$'\t' -f - |/usr/lib/rpm/cpp.req.files |/usr/lib/rpm/cpp.req -v |sort -u
cpp.req: /usr/include/rpm/header.h: /usr/include/stdio.h -> glibc-devel (via rpmdb)
cpp.req: /usr/include/rpm/header.h: /usr/include/rpm/rpmio.h -> librpm-devel (via rpmdb)
cpp.req: /usr/include/rpm/header.h: /usr/include/rpm/hdrinline.h -> librpm-devel (via rpmdb)
cpp.req: /usr/include/rpm/misc.h: /usr/include/string.h -> glibc-devel (via rpmdb)
cpp.req: /usr/include/rpm/rpmbuild.h: /usr/include/rpm/rpmcli.h -> librpm-devel (via rpmdb)
cpp.req: /usr/include/rpm/rpmbuild.h: /usr/include/rpm/stringbuf.h -> librpm-devel (via rpmdb)
cpp.req: /usr/include/rpm/rpmbuild.h: /usr/include/rpm/misc.h -> librpm-devel (via rpmdb)
cpp.req: /usr/include/rpm/rpmbuild.h: /usr/include/rpm/rpmspec.h -> librpm-devel (via rpmdb)
cpp.req: /usr/include/rpm/rpmbuild.h: /usr/include/ctype.h -> glibc-devel (via rpmdb)
cpp.req: /usr/include/rpm/rpmcli.h: /usr/include/rpm/rpmlib.h -> librpm-devel (via rpmdb)
cpp.req: /usr/include/rpm/rpmcli.h: /usr/include/rpm/rpmurl.h -> librpm-devel (via rpmdb)
cpp.req: /usr/include/rpm/rpmcli.h: /usr/include/rpm/rpmmacro.h -> librpm-devel (via rpmdb)
cpp.req: /usr/include/rpm/rpmdb.h: /usr/include/rpm/rpmlib.h -> librpm-devel (via rpmdb)
cpp.req: /usr/include/rpm/rpmerr.h: /usr/include/rpm/rpmlog.h -> librpm-devel (via rpmdb)
cpp.req: /usr/include/rpm/rpmio.h: /usr/include/sys/types.h -> glibc-devel (via rpmdb)
cpp.req: /usr/include/rpm/rpmio.h: /usr/include/sys/stat.h -> glibc-devel (via rpmdb)
cpp.req: /usr/include/rpm/rpmio.h: /usr/include/dirent.h -> glibc-devel (via rpmdb)
cpp.req: /usr/include/rpm/rpmio.h: /usr/include/glob.h -> glibc-devel (via rpmdb)
cpp.req: /usr/include/rpm/rpmio.h: /usr/include/stdio.h -> glibc-devel (via rpmdb)
cpp.req: /usr/include/rpm/rpmio.h: /usr/include/stdlib.h -> glibc-devel (via rpmdb)
cpp.req: /usr/include/rpm/rpmio.h: /usr/include/unistd.h -> glibc-devel (via rpmdb)
cpp.req: /usr/include/rpm/rpmlib.h: /usr/include/rpm/rpmio.h -> librpm-devel (via rpmdb)
cpp.req: /usr/include/rpm/rpmlib.h: /usr/include/rpm/rpmmessages.h -> librpm-devel (via rpmdb)
cpp.req: /usr/include/rpm/rpmlib.h: /usr/include/rpm/rpmerr.h -> librpm-devel (via rpmdb)
cpp.req: /usr/include/rpm/rpmlib.h: /usr/include/rpm/header.h -> librpm-devel (via rpmdb)
cpp.req: /usr/include/rpm/rpmlib.h: /usr/include/popt.h -> libpopt-devel (via rpmdb)
cpp.req: /usr/include/rpm/rpmlog.h: /usr/lib/gcc/i586-alt-linux/4.1.2/include/stdarg.h -> gcc4.1 (via rpmdb)
cpp.req: /usr/include/rpm/rpmmessages.h: /usr/include/rpm/rpmlog.h -> librpm-devel (via rpmdb)
cpp.req: /usr/include/rpm/rpmurl.h: /usr/include/assert.h -> glibc-devel (via rpmdb)
gcc4.1
glibc-devel
libpopt-devel
librpm-devel
$
Таким образом, у librpm-devel реальная зависимость это только
libpopt-devel. Тогда как вручную у него прописано гораздо больше
(лишних) зависимостей:
$ rpm -qR librpm-devel |grep -e -devel
bzlib-devel
libbeecrypt-devel
libdb4.4-devel
libpopt-devel
zlib-devel
$
б) Зависимости хедеров у пакета imlib-devel.
$ rpm -ql imlib-devel |file -NF$'\t' -f - |/usr/lib/rpm/cpp.req.files |/usr/lib/rpm/cpp.req -v |sort -u
cpp.req: /usr/include/Imlib.h: /usr/include/Imlib_types.h -> imlib-devel (via rpmdb)
cpp.req: /usr/include/Imlib_private.h: /usr/include/stdio.h -> glibc-devel (via rpmdb)
cpp.req: /usr/include/Imlib_private.h: /usr/include/unistd.h -> glibc-devel (via rpmdb)
cpp.req: /usr/include/Imlib_private.h: /usr/include/stdlib.h -> glibc-devel (via rpmdb)
cpp.req: /usr/include/Imlib_private.h: /usr/include/math.h -> glibc-devel (via rpmdb)
cpp.req: /usr/include/Imlib_private.h: /usr/include/ctype.h -> glibc-devel (via rpmdb)
cpp.req: /usr/include/Imlib_private.h: /usr/include/time.h -> glibc-devel (via rpmdb)
cpp.req: /usr/include/Imlib_private.h: /usr/include/netinet/in.h -> glibc-devel (via rpmdb)
cpp.req: /usr/include/Imlib_private.h: /usr/include/sys/time.h -> glibc-devel (via rpmdb)
cpp.req: /usr/include/Imlib_private.h: /usr/include/X11/Xlib.h -> libX11-devel (via rpmdb)
cpp.req: /usr/include/Imlib_private.h: /usr/include/X11/Xutil.h -> libX11-devel (via rpmdb)
cpp.req: /usr/include/Imlib_private.h: /usr/include/X11/Xatom.h -> xorg-x11-proto-devel (via rpmdb)
cpp.req: /usr/include/Imlib_private.h: /usr/include/X11/Xos.h -> xorg-x11-proto-devel (via rpmdb)
cpp.req: /usr/include/Imlib_private.h: /usr/include/X11/extensions/shape.h -> xorg-x11-proto-devel (via rpmdb)
cpp.req: /usr/include/Imlib_private.h: /usr/include/X11/cursorfont.h -> libX11-devel (via rpmdb)
cpp.req: /usr/include/Imlib_types.h: /usr/include/X11/Xlib.h -> libX11-devel (via rpmdb)
cpp.req: /usr/include/Imlib_types.h: /usr/include/X11/Xutil.h -> libX11-devel (via rpmdb)
cpp.req: /usr/include/Imlib_types.h: /usr/include/X11/Xatom.h -> xorg-x11-proto-devel (via rpmdb)
cpp.req: /usr/include/Imlib_types.h: /usr/include/X11/Xos.h -> xorg-x11-proto-devel (via rpmdb)
cpp.req: /usr/include/Imlib_types.h: /usr/include/X11/extensions/shape.h -> xorg-x11-proto-devel (via rpmdb)
cpp.req: /usr/include/Imlib_types.h: /usr/include/stdio.h -> glibc-devel (via rpmdb)
cpp.req: /usr/include/Imlib_types.h: /usr/include/stdlib.h -> glibc-devel (via rpmdb)
cpp.req: /usr/include/Imlib_types.h: /usr/include/math.h -> glibc-devel (via rpmdb)
cpp.req: /usr/include/Imlib_types.h: /usr/include/ctype.h -> glibc-devel (via rpmdb)
cpp.req: /usr/include/Imlib_types.h: /usr/include/netinet/in.h -> glibc-devel (via rpmdb)
cpp.req: /usr/include/gdk_imlib.h: /usr/include/gdk_imlib_types.h -> imlib-devel (via rpmdb)
cpp.req: /usr/include/gdk_imlib_private.h: /usr/include/stdio.h -> glibc-devel (via rpmdb)
cpp.req: /usr/include/gdk_imlib_private.h: /usr/include/unistd.h -> glibc-devel (via rpmdb)
cpp.req: /usr/include/gdk_imlib_private.h: /usr/include/stdlib.h -> glibc-devel (via rpmdb)
cpp.req: /usr/include/gdk_imlib_private.h: /usr/include/math.h -> glibc-devel (via rpmdb)
cpp.req: /usr/include/gdk_imlib_private.h: /usr/include/ctype.h -> glibc-devel (via rpmdb)
cpp.req: /usr/include/gdk_imlib_private.h: /usr/include/time.h -> glibc-devel (via rpmdb)
cpp.req: /usr/include/gdk_imlib_private.h: /usr/include/netinet/in.h -> glibc-devel (via rpmdb)
cpp.req: /usr/include/gdk_imlib_private.h: /usr/include/sys/time.h -> glibc-devel (via rpmdb)
cpp.req: /usr/include/gdk_imlib_private.h: /usr/include/X11/Xlib.h -> libX11-devel (via rpmdb)
cpp.req: /usr/include/gdk_imlib_private.h: /usr/include/X11/Xutil.h -> libX11-devel (via rpmdb)
cpp.req: /usr/include/gdk_imlib_private.h: /usr/include/X11/Xatom.h -> xorg-x11-proto-devel (via rpmdb)
cpp.req: /usr/include/gdk_imlib_private.h: /usr/include/X11/Xos.h -> xorg-x11-proto-devel (via rpmdb)
cpp.req: /usr/include/gdk_imlib_private.h: /usr/include/X11/extensions/shape.h -> xorg-x11-proto-devel (via rpmdb)
cpp.req: /usr/include/gdk_imlib_private.h: /usr/include/X11/cursorfont.h -> libX11-devel (via rpmdb)
cpp.req: /usr/include/gdk_imlib_private.h: /usr/include/gtk-1.2/gdk/gdkprivate.h -> gtk+-devel (via rpmdb)
cpp.req: /usr/include/gdk_imlib_private.h: /usr/include/gtk-1.2/gdk/gdkx.h -> gtk+-devel (via rpmdb)
cpp.req: /usr/include/gdk_imlib_types.h: /usr/include/gtk-1.2/gdk/gdk.h -> gtk+-devel (via rpmdb)
glibc-devel
gtk+-devel
imlib-devel
libX11-devel
xorg-x11-proto-devel
$
Установим эти зависимости в чрут (кроме самого пакета imlib-devel).
$ hsh --init
$ hsh-install glibc-devel gtk+-devel libX11-devel xorg-x11-proto-devel
Preparing packages for installation...
libX11-locales-1.1.4-alt3
libXau-1.0.3-alt1
libXdmcp-1.0.2-alt1.0
libxcb-1.1-alt4
libxcb-devel-1.1-alt4
glib-1.2.10-alt13
glib-devel-1.2.10-alt13
libX11-1.1.4-alt3
libXext-1.0.4-alt1
libXi-1.1.3-alt2
gtk+-1.2.10-alt15
libICE-1.0.4-alt1
libSM-1.0.3-alt1
libXt-1.0.5-alt1
xorg-x11-proto-devel-7.3.0-alt12
libICE-devel-1.0.4-alt1
libSM-devel-1.0.3-alt1
libXdmcp-devel-1.0.2-alt1.0
libXau-devel-1.0.3-alt1
libX11-devel-1.1.4-alt3
libXt-devel-1.0.5-alt1
gtk+-devel-1.2.10-alt15
$
Теперь поставим в чрут сам пакет imlib-devel и посмотрим, какие лишние
лишние пакеты он вытягивает.
$ hsh-install imlib
Preparing packages for installation...
libjpeg-6b-alt8
libpng12-1.2.25-alt1
libtiff-3.8.2-alt1
libungif-4.1.4-alt1
imlib-1.9.15-alt1
$ hsh-install imlib-devel
Preparing packages for installation...
imlib-cfgeditor-1.9.15-alt1
libXext-devel-1.0.4-alt1
libjpeg-devel-6b-alt8
zlib-devel-1.2.3-alt4
libpng-devel-1.2.25-alt1
libtiff-devel-3.8.2-alt1
libungif-devel-4.1.4-alt1
imlib-devel-1.9.15-alt1
$
Шесть лишних *-devel пакетов.
В общем, вроде бы, идея жизнеспособна.
Встают следующие вопросы:
1) Как поточнее выбрать хедеры -- в Си+плюсе хедеры не обязаны иметь
конвенциональный суффикс *.h.
2) Как быть с "cpp -x c++" -- он запускает cc1plus, которого по
сборочным зависимостям может и не быть (и нежелательно его туда
вносить).
3) Как быть с зависимостями на glibc-devel и gcc4.1 (тж.
libstdc++4.1-devel).
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-03-17 21:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-03 15:26 [devel] cpp.req -- зависимости *.h файлов (телеграфом) Alexey Tourbin
2008-03-03 16:22 ` Kirill A. Shutemov
2008-03-03 21:42 ` Alexey Tourbin
2008-03-17 21:21 ` Alexey Tourbin
ALT Linux Team development discussions
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
public-inbox-index devel
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.devel
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git