On Tue, 2005-05-31 at 00:56 -0700, Zac Medico wrote: > #!/usr/bin/python > import sys > if len(sys.argv)!=2: > print "usage: %s <tbz2 file>" % sys.argv[0] > sys.exit(1) > sys.path = ["/usr/lib/portage/pym"]+sys.path > import xpak > mytbz2=xpak.tbz2(sys.argv[1]) > myuse=mytbz2.getelements("USE") > myiuse=mytbz2.getelements("IUSE") > for use in myiuse: > operator="-" > if use in myuse: > operator="+" > print operator + use + " "
Cool. This works as expected. But a few more questions and this is more towards how portage handles the Padded data in the tbz2. Looking that the variables of IUSE and USE via print myuse and print myiuse I get : ['x86', 'X', 'aac', 'aalib', 'acl', 'acpi', 'aim', 'alsa', 'apache2', 'avi', 'bash-completion', 'berkdb', 'bitmap-fonts', 'bonobo', 'bzlib', .... SNIP ...... 'kernel_linux', 'elibc_glibc'] ['mozilla', 'gtkhtml', 'debug', 'debug'] So if I understand it correctly, what is being done is XPAK will take the USE flags from the system which compiled the binary and then sort of make a comparison with the USE flags for that particular package and work from there? Am I right? Doing a $strings /usr/portage/packages/All/liferea-0.9.1.tbz2 gets me [snip] ... XPAKPACK <--- This marks the start of the XPAK padding ASFLAGS CATEGORY CBUILD CDEPEND CFLAGS CHOST CTARGET CXXFLAGS DEPEND EXTRA_ECONF EXTRA_EINSTALL EXTRA_EMAKE FEATURES INHERITED IUSE LDFLAGS LIBCFLAGS LIBCXXFLAGS LICENSE PDEPEND PKGUSE PROVIDE RDEPEND RESTRICT SLOT environment.bz2 liferea-0.9.1.ebuild net-news -O2 -march=pentium3 -fomit-frame-pointer -pipe -falign-functions=64 -mmmx -msse -msse2 i686-pc-linux-gnu -O2 -march=pentium3 -fomit-frame-pointer -pipe -falign-functions=64 -mmmx -msse -msse2 >=x11-libs/gtk+-2 >=dev-libs/libxml2-2.5.10 mozilla? ( www-client/mozilla gtkhtml? ( =gnome-extra/libgtkhtml-2* ) !mozilla? ( =gnome-extra/libgtkhtml-2* ) >=gnome-base/gconf-2 dev-util/pkgconfig >=sys-apps/sed-4 autoaddcvs autoconfig buildpkg candy ccache distlocks sandbox sfperms strict libtool gnome.org debug fdo-mime gnome2 libtool gnome.org debug fdo-mime gnome2 libtool gnome.org debug fdo-mi me gnome2 libtool gnome.org debug fdo-mime gnome2 mozilla gtkhtml debug debug <---- Package USE Flags [SNIP] x86 X aac aalib acl acpi aim alsa apache2 avi bash-completion berkdb .... SNIP ..... kernel_linux elibc_glibc -- Ow Mun Heng Gentoo/Linux on DELL D600 1.4Ghz 1.5GB RAM 98% Microsoft(tm) Free!! Neuromancer 16:20:55 up 18:22, 9 users, load average: 0.51, 0.74, 0.74 -- gentoo-user@gentoo.org mailing list