aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MANIFEST14
-rw-r--r--Makefile872
-rw-r--r--Makefile.PL71
-rw-r--r--packdrake-pm/Makefile.PL9
-rw-r--r--packdrake-pm/packdrake.pm515
-rw-r--r--packdrake.pm173
-rw-r--r--rpmtools.spec34
7 files changed, 1100 insertions, 588 deletions
diff --git a/MANIFEST b/MANIFEST
new file mode 100644
index 0000000..4155599
--- /dev/null
+++ b/MANIFEST
@@ -0,0 +1,14 @@
+gendistrib
+genhdlist
+rpm2cpio.pl
+packdrake
+Packdrakeng.pm
+packdrake.pm
+t/01packdrakeng.t
+parsehdlist.c
+rpm2header.c
+Makefile.PL
+rpmtools.spec
+MANIFEST
+
+META.yml Module meta-data (added by MakeMaker)
diff --git a/Makefile b/Makefile
index 3e34895..a6a04ba 100644
--- a/Makefile
+++ b/Makefile
@@ -1,56 +1,844 @@
-VERSION = 4.5
-PREFIX = /usr/local
+# This Makefile is for the rpmtools extension to perl.
+#
+# It was generated automatically by MakeMaker version
+# 6.17 (Revision: 1.133) from the contents of
+# Makefile.PL. Don't edit this file, edit Makefile.PL instead.
+#
+# ANY CHANGES MADE HERE WILL BE LOST!
+#
+# MakeMaker ARGV: ()
+#
+# MakeMaker Parameters:
+
+# C => []
+# CCFLAGS => q[-Wall]
+# EXE_FILES => [q[gendistrib], q[genhdlist], q[packdrake], q[rpm2header], q[parsehdlist], q[rpm2cpio.pl]]
+# INC => q[]
+# INSTALLDIRS => q[vendor]
+# LIBS => [q[]]
+# NAME => q[rpmtools]
+# OBJECT => q[]
+# OPTIMIZE => q[-O3 -fomit-frame-pointer -fno-exceptions -pipe -s -ffast-math -fexpensive-optimizations]
+# PM => { Packdrakeng.pm=>q[$(INST_LIBDIR)/Packdrakeng.pm], packdrake.pm=>q[$(INST_LIBDIR)/packdrake.pm] }
+# VERSION => q[5.0]
+# depend => { pm_to_blib=>q[buildc], clean_subdirs=>q[cleanc] }
+# dist => { COMPRESS=>q[bzip2 --best], SUFFIX=>q[.bz2] }
+# macro => { LIBRPM=>q[-lrpm -lrpmio -lrpmdb -lrpmbuild -lz -lbz2 -lpopt], DEFRPM=>q[-DRPM_42], FROMC=>q[parsehdlist rpm2header #rpm-find-leaves], INCRPM=>q[-I/usr/include/rpm], RPMTOOLSVERSION=>q[5.0], FROMCC_STATIC=>q[$(FROMCC:%=%_static)], FROMCC=>q[#gendepslist2 hdlist2names hdlist2files hdlist2prereq hdlist2groups], FROMC_STATIC=>q[$(FROMC:%=%_static)] }
+
+# --- MakeMaker post_initialize section:
+
+
+# --- MakeMaker const_config section:
+
+# These definitions are from config.sh (via /usr/lib/perl5/5.8.6/i386-linux/Config.pm)
+
+# They may have been overridden via Makefile.PL or on the command line
+AR = ar
+CC = gcc
+CCCDLFLAGS = -fPIC
+CCDLFLAGS = -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.8.6/i386-linux/CORE
+DLEXT = so
+DLSRC = dl_dlopen.xs
+LD = gcc
+LDDLFLAGS = -shared -L/usr/local/lib
+LDFLAGS = -L/usr/local/lib
+LIBC = /lib/libc-2.3.3.so
+LIB_EXT = .a
+OBJ_EXT = .o
+OSNAME = linux
+OSVERS = 2.6.8.1-2mdkenterprise
+RANLIB = :
+SITELIBEXP = /usr/lib/perl5/site_perl/5.8.6
+SITEARCHEXP = /usr/lib/perl5/site_perl/5.8.6/i386-linux
+SO = so
+EXE_EXT =
+FULL_AR = /usr/bin/ar
+VENDORARCHEXP = /usr/lib/perl5/vendor_perl/5.8.6/i386-linux
+VENDORLIBEXP = /usr/lib/perl5/vendor_perl/5.8.6
+
+
+# --- MakeMaker constants section:
+AR_STATIC_ARGS = cr
+DIRFILESEP = /
NAME = rpmtools
+NAME_SYM = rpmtools
+VERSION = 5.0
+VERSION_MACRO = VERSION
+VERSION_SYM = 5_0
+DEFINE_VERSION = -D$(VERSION_MACRO)=\"$(VERSION)\"
+XS_VERSION = 5.0
+XS_VERSION_MACRO = XS_VERSION
+XS_DEFINE_VERSION = -D$(XS_VERSION_MACRO)=\"$(XS_VERSION)\"
+INST_ARCHLIB = blib/arch
+INST_SCRIPT = blib/script
+INST_BIN = blib/bin
+INST_LIB = blib/lib
+INST_MAN1DIR = blib/man1
+INST_MAN3DIR = blib/man3
+MAN1EXT = 1
+MAN3EXT = 3pm
+INSTALLDIRS = vendor
+DESTDIR =
+PREFIX =
+PERLPREFIX = /usr
+SITEPREFIX = /usr
+VENDORPREFIX = /usr
+INSTALLPRIVLIB = $(PERLPREFIX)/lib/perl5/5.8.6
+DESTINSTALLPRIVLIB = $(DESTDIR)$(INSTALLPRIVLIB)
+INSTALLSITELIB = $(SITEPREFIX)/lib/perl5/site_perl/5.8.6
+DESTINSTALLSITELIB = $(DESTDIR)$(INSTALLSITELIB)
+INSTALLVENDORLIB = $(VENDORPREFIX)/lib/perl5/vendor_perl/5.8.6
+DESTINSTALLVENDORLIB = $(DESTDIR)$(INSTALLVENDORLIB)
+INSTALLARCHLIB = $(PERLPREFIX)/lib/perl5/5.8.6/i386-linux
+DESTINSTALLARCHLIB = $(DESTDIR)$(INSTALLARCHLIB)
+INSTALLSITEARCH = $(SITEPREFIX)/lib/perl5/site_perl/5.8.6/i386-linux
+DESTINSTALLSITEARCH = $(DESTDIR)$(INSTALLSITEARCH)
+INSTALLVENDORARCH = $(VENDORPREFIX)/lib/perl5/vendor_perl/5.8.6/i386-linux
+DESTINSTALLVENDORARCH = $(DESTDIR)$(INSTALLVENDORARCH)
+INSTALLBIN = $(PERLPREFIX)/bin
+DESTINSTALLBIN = $(DESTDIR)$(INSTALLBIN)
+INSTALLSITEBIN = $(SITEPREFIX)/bin
+DESTINSTALLSITEBIN = $(DESTDIR)$(INSTALLSITEBIN)
+INSTALLVENDORBIN = $(VENDORPREFIX)/bin
+DESTINSTALLVENDORBIN = $(DESTDIR)$(INSTALLVENDORBIN)
+INSTALLSCRIPT = $(PERLPREFIX)/bin
+DESTINSTALLSCRIPT = $(DESTDIR)$(INSTALLSCRIPT)
+INSTALLMAN1DIR = $(PERLPREFIX)/share/man/man1
+DESTINSTALLMAN1DIR = $(DESTDIR)$(INSTALLMAN1DIR)
+INSTALLSITEMAN1DIR = $(SITEPREFIX)/share/man/man1
+DESTINSTALLSITEMAN1DIR = $(DESTDIR)$(INSTALLSITEMAN1DIR)
+INSTALLVENDORMAN1DIR = $(VENDORPREFIX)/share/man/man1
+DESTINSTALLVENDORMAN1DIR = $(DESTDIR)$(INSTALLVENDORMAN1DIR)
+INSTALLMAN3DIR = $(PERLPREFIX)/share/man/man3
+DESTINSTALLMAN3DIR = $(DESTDIR)$(INSTALLMAN3DIR)
+INSTALLSITEMAN3DIR = $(SITEPREFIX)/share/man/man3
+DESTINSTALLSITEMAN3DIR = $(DESTDIR)$(INSTALLSITEMAN3DIR)
+INSTALLVENDORMAN3DIR = $(VENDORPREFIX)/share/man/man3
+DESTINSTALLVENDORMAN3DIR = $(DESTDIR)$(INSTALLVENDORMAN3DIR)
+PERL_LIB = /usr/lib/perl5/5.8.6
+PERL_ARCHLIB = /usr/lib/perl5/5.8.6/i386-linux
+LIBPERL_A = libperl.a
+FIRST_MAKEFILE = Makefile
+MAKEFILE_OLD = $(FIRST_MAKEFILE).old
+MAKE_APERL_FILE = $(FIRST_MAKEFILE).aperl
+PERLMAINCC = $(CC)
+PERL_INC = /usr/lib/perl5/5.8.6/i386-linux/CORE
+PERL = /usr/bin/perl5.8.6
+FULLPERL = /usr/bin/perl5.8.6
+ABSPERL = $(PERL)
+PERLRUN = $(PERL)
+FULLPERLRUN = $(FULLPERL)
+ABSPERLRUN = $(ABSPERL)
+PERLRUNINST = $(PERLRUN) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)"
+FULLPERLRUNINST = $(FULLPERLRUN) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)"
+ABSPERLRUNINST = $(ABSPERLRUN) "-I$(INST_ARCHLIB)" "-I$(INST_LIB)"
+PERL_CORE = 0
+PERM_RW = 644
+PERM_RWX = 755
+
+MAKEMAKER = /usr/lib/perl5/5.8.6/ExtUtils/MakeMaker.pm
+MM_VERSION = 6.17
+MM_REVISION = 1.133
+
+# FULLEXT = Pathname for extension directory (eg Foo/Bar/Oracle).
+# BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. (eg Oracle)
+# PARENT_NAME = NAME without BASEEXT and no trailing :: (eg Foo::Bar)
+# DLBASE = Basename part of dynamic library. May be just equal BASEEXT.
+FULLEXT = rpmtools
+BASEEXT = rpmtools
+PARENT_NAME =
+DLBASE = $(BASEEXT)
+VERSION_FROM =
+INC =
+OBJECT =
+LDFROM = $(OBJECT)
+LINKTYPE = dynamic
+
+# Handy lists of source code files:
+XS_FILES =
+C_FILES =
+O_FILES =
+H_FILES =
+MAN1PODS = parsehdlist \
+ rpm2header
+MAN3PODS = Packdrakeng.pm
+
+# Where is the Config information that we are using/depend on
+CONFIGDEP = $(PERL_ARCHLIB)$(DIRFILESEP)Config.pm $(PERL_INC)$(DIRFILESEP)config.h
+
+# Where to build things
+INST_LIBDIR = $(INST_LIB)
+INST_ARCHLIBDIR = $(INST_ARCHLIB)
+
+INST_AUTODIR = $(INST_LIB)/auto/$(FULLEXT)
+INST_ARCHAUTODIR = $(INST_ARCHLIB)/auto/$(FULLEXT)
+
+INST_STATIC =
+INST_DYNAMIC =
+INST_BOOT =
+
+# Extra linker info
+EXPORT_LIST =
+PERL_ARCHIVE =
+PERL_ARCHIVE_AFTER =
+
+
+TO_INST_PM = Packdrakeng.pm \
+ packdrake.pm
+
+PM_TO_BLIB = Packdrakeng.pm \
+ $(INST_LIBDIR)/Packdrakeng.pm \
+ packdrake.pm \
+ $(INST_LIBDIR)/packdrake.pm
+
+
+# --- MakeMaker platform_constants section:
+MM_Unix_VERSION = 1.42
+PERL_MALLOC_DEF = -DPERL_EXTMALLOC_DEF -Dmalloc=Perl_malloc -Dfree=Perl_mfree -Drealloc=Perl_realloc -Dcalloc=Perl_calloc
+
+
+# --- MakeMaker tool_autosplit section:
+# Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto
+AUTOSPLITFILE = $(PERLRUN) -e 'use AutoSplit; autosplit($$ARGV[0], $$ARGV[1], 0, 1, 1)'
+
+
+
+# --- MakeMaker tool_xsubpp section:
+
+
+# --- MakeMaker tools_other section:
+SHELL = /bin/sh
+CHMOD = chmod
+CP = cp
+MV = mv
+NOOP = $(SHELL) -c true
+NOECHO = @
+RM_F = rm -f
+RM_RF = rm -rf
+TEST_F = test -f
+TOUCH = touch
+UMASK_NULL = umask 0
+DEV_NULL = > /dev/null 2>&1
+MKPATH = $(PERLRUN) "-MExtUtils::Command" -e mkpath
+EQUALIZE_TIMESTAMP = $(PERLRUN) "-MExtUtils::Command" -e eqtime
+ECHO = echo
+ECHO_N = echo -n
+UNINST = 0
+VERBINST = 0
+MOD_INSTALL = $(PERLRUN) -MExtUtils::Install -e 'install({@ARGV}, '\''$(VERBINST)'\'', 0, '\''$(UNINST)'\'');'
+DOC_INSTALL = $(PERLRUN) "-MExtUtils::Command::MM" -e perllocal_install
+UNINSTALL = $(PERLRUN) "-MExtUtils::Command::MM" -e uninstall
+WARN_IF_OLD_PACKLIST = $(PERLRUN) "-MExtUtils::Command::MM" -e warn_if_old_packlist
+
+
+# --- MakeMaker makemakerdflt section:
+makemakerdflt: all
+ $(NOECHO) $(NOOP)
+
+
+# --- MakeMaker dist section:
+TAR = tar
+TARFLAGS = cvf
+ZIP = zip
+ZIPFLAGS = -r
+COMPRESS = bzip2 --best
+SUFFIX = .bz2
+SHAR = shar
+PREOP = $(NOECHO) $(NOOP)
+POSTOP = $(NOECHO) $(NOOP)
+TO_UNIX = $(NOECHO) $(NOOP)
+CI = ci -u
+RCS_LABEL = rcs -Nv$(VERSION_SYM): -q
+DIST_CP = best
+DIST_DEFAULT = tardist
+DISTNAME = rpmtools
+DISTVNAME = rpmtools-5.0
+
+
+# --- MakeMaker macro section:
+LIBRPM = -lrpm -lrpmio -lrpmdb -lrpmbuild -lz -lbz2 -lpopt
+DEFRPM = -DRPM_42
FROMC = parsehdlist rpm2header #rpm-find-leaves
-FROMCC = #gendepslist2 hdlist2names hdlist2files hdlist2prereq hdlist2groups
-FROMC_STATIC = $(FROMC:%=%_static)
+INCRPM = -I/usr/include/rpm
+RPMTOOLSVERSION = 5.0
FROMCC_STATIC = $(FROMCC:%=%_static)
-ALL = $(FROMC) $(FROMCC)
-ALL_STATIC = $(FROMC_STATIC) $(FROMCC_STATIC)
-CFLAGS = -Wall -g `perl -e 'qx(rpm -q --qf %{VERSION} rpm)=~/^(?:4\.[2-9]|[5-9]|\d{2})/&&print -DRPM_42'`
-LIBRPM = -lrpm -lrpmio `perl -e 'local $$_ = qx(rpm -q --qf %{VERSION} rpm); /^4\.0\s*$$/ or print "-lrpmdb"'` -lz -lbz2 -I/usr/include/rpm -lpopt
-LIBRPM_STATIC =
-RPM = `rpm --eval %_topdir`
+FROMCC = #gendepslist2 hdlist2names hdlist2files hdlist2prereq hdlist2groups
+FROMC_STATIC = $(FROMC:%=%_static)
+
+
+# --- MakeMaker depend section:
+pm_to_blib : buildc
+clean_subdirs : cleanc
+
+
+# --- MakeMaker cflags section:
+
+
+# --- MakeMaker const_loadlibs section:
+
+
+# --- MakeMaker const_cccmd section:
+
+
+# --- MakeMaker post_constants section:
+
+
+# --- MakeMaker pasthru section:
+
+PASTHRU = LIB="$(LIB)"\
+ LIBPERL_A="$(LIBPERL_A)"\
+ LINKTYPE="$(LINKTYPE)"\
+ PREFIX="$(PREFIX)"\
+ OPTIMIZE="$(OPTIMIZE)"\
+ PASTHRU_DEFINE="$(PASTHRU_DEFINE)"\
+ PASTHRU_INC="$(PASTHRU_INC)"
+
+
+# --- MakeMaker special_targets section:
+.SUFFIXES: .xs .c .C .cpp .i .s .cxx .cc $(OBJ_EXT)
+
+.PHONY: all config static dynamic test linkext manifest
+
+
+
+# --- MakeMaker c_o section:
+
+
+# --- MakeMaker xs_c section:
+
+
+# --- MakeMaker xs_o section:
+
+
+# --- MakeMaker top_targets section:
+all :: pure_all manifypods
+ $(NOECHO) $(NOOP)
+
+
+pure_all :: config pm_to_blib subdirs linkext
+ $(NOECHO) $(NOOP)
+
+subdirs :: $(MYEXTLIB)
+ $(NOECHO) $(NOOP)
+
+config :: $(FIRST_MAKEFILE) $(INST_LIBDIR)$(DIRFILESEP).exists
+ $(NOECHO) $(NOOP)
+
+config :: $(INST_ARCHAUTODIR)$(DIRFILESEP).exists
+ $(NOECHO) $(NOOP)
+
+config :: $(INST_AUTODIR)$(DIRFILESEP).exists
+ $(NOECHO) $(NOOP)
+
+$(INST_AUTODIR)/.exists :: /usr/lib/perl5/5.8.6/i386-linux/CORE/perl.h
+ $(NOECHO) $(MKPATH) $(INST_AUTODIR)
+ $(NOECHO) $(EQUALIZE_TIMESTAMP) /usr/lib/perl5/5.8.6/i386-linux/CORE/perl.h $(INST_AUTODIR)/.exists
+
+ -$(NOECHO) $(CHMOD) $(PERM_RWX) $(INST_AUTODIR)
+
+$(INST_LIBDIR)/.exists :: /usr/lib/perl5/5.8.6/i386-linux/CORE/perl.h
+ $(NOECHO) $(MKPATH) $(INST_LIBDIR)
+ $(NOECHO) $(EQUALIZE_TIMESTAMP) /usr/lib/perl5/5.8.6/i386-linux/CORE/perl.h $(INST_LIBDIR)/.exists
+
+ -$(NOECHO) $(CHMOD) $(PERM_RWX) $(INST_LIBDIR)
+
+$(INST_ARCHAUTODIR)/.exists :: /usr/lib/perl5/5.8.6/i386-linux/CORE/perl.h
+ $(NOECHO) $(MKPATH) $(INST_ARCHAUTODIR)
+ $(NOECHO) $(EQUALIZE_TIMESTAMP) /usr/lib/perl5/5.8.6/i386-linux/CORE/perl.h $(INST_ARCHAUTODIR)/.exists
+
+ -$(NOECHO) $(CHMOD) $(PERM_RWX) $(INST_ARCHAUTODIR)
+
+config :: $(INST_MAN1DIR)$(DIRFILESEP).exists
+ $(NOECHO) $(NOOP)
+
+
+$(INST_MAN1DIR)/.exists :: /usr/lib/perl5/5.8.6/i386-linux/CORE/perl.h
+ $(NOECHO) $(MKPATH) $(INST_MAN1DIR)
+ $(NOECHO) $(EQUALIZE_TIMESTAMP) /usr/lib/perl5/5.8.6/i386-linux/CORE/perl.h $(INST_MAN1DIR)/.exists
+
+ -$(NOECHO) $(CHMOD) $(PERM_RWX) $(INST_MAN1DIR)
+
+config :: $(INST_MAN3DIR)$(DIRFILESEP).exists
+ $(NOECHO) $(NOOP)
+
+
+$(INST_MAN3DIR)/.exists :: /usr/lib/perl5/5.8.6/i386-linux/CORE/perl.h
+ $(NOECHO) $(MKPATH) $(INST_MAN3DIR)
+ $(NOECHO) $(EQUALIZE_TIMESTAMP) /usr/lib/perl5/5.8.6/i386-linux/CORE/perl.h $(INST_MAN3DIR)/.exists
+
+ -$(NOECHO) $(CHMOD) $(PERM_RWX) $(INST_MAN3DIR)
+
+help:
+ perldoc ExtUtils::MakeMaker
+
+
+# --- MakeMaker linkext section:
+
+linkext :: $(LINKTYPE)
+ $(NOECHO) $(NOOP)
+
+
+# --- MakeMaker dlsyms section:
+
+
+# --- MakeMaker dynamic section:
+
+dynamic :: $(FIRST_MAKEFILE) $(INST_DYNAMIC) $(INST_BOOT)
+ $(NOECHO) $(NOOP)
+
+
+# --- MakeMaker dynamic_bs section:
+
+BOOTSTRAP =
+
+
+# --- MakeMaker dynamic_lib section:
+
+
+# --- MakeMaker static section:
+
+## $(INST_PM) has been moved to the all: target.
+## It remains here for awhile to allow for old usage: "make static"
+static :: $(FIRST_MAKEFILE) $(INST_STATIC)
+ $(NOECHO) $(NOOP)
+
+
+# --- MakeMaker static_lib section:
+
+
+# --- MakeMaker manifypods section:
+
+POD2MAN_EXE = $(PERLRUN) "-MExtUtils::Command::MM" -e pod2man "--"
+POD2MAN = $(POD2MAN_EXE)
+
+
+manifypods : pure_all \
+ parsehdlist \
+ rpm2header \
+ Packdrakeng.pm \
+ Packdrakeng.pm
+ $(NOECHO) $(POD2MAN) --section=1 --perm_rw=$(PERM_RW)\
+ parsehdlist $(INST_MAN1DIR)/parsehdlist.$(MAN1EXT) \
+ rpm2header $(INST_MAN1DIR)/rpm2header.$(MAN1EXT)
+ $(NOECHO) $(POD2MAN) --section=3 --perm_rw=$(PERM_RW)\
+ Packdrakeng.pm $(INST_MAN3DIR)/Packdrakeng.$(MAN3EXT)
+
+
+
+
+# --- MakeMaker processPL section:
+
-all: $(ALL)
- @echo $(INSTALLVENDORLIB)
+# --- MakeMaker installbin section:
-install: $(ALL)
- install -d $(PREFIX)/usr/bin
- install -s $(ALL) $(PREFIX)/usr/bin
- install gendistrib distriblint genhdlist packdrake rpm2cpio.pl $(PREFIX)/usr/bin
+$(INST_SCRIPT)/.exists :: /usr/lib/perl5/5.8.6/i386-linux/CORE/perl.h
+ $(NOECHO) $(MKPATH) $(INST_SCRIPT)
+ $(NOECHO) $(EQUALIZE_TIMESTAMP) /usr/lib/perl5/5.8.6/i386-linux/CORE/perl.h $(INST_SCRIPT)/.exists
+
+ -$(NOECHO) $(CHMOD) $(PERM_RWX) $(INST_SCRIPT)
+
+EXE_FILES = gendistrib genhdlist packdrake rpm2header parsehdlist rpm2cpio.pl
+
+FIXIN = $(PERLRUN) "-MExtUtils::MY" -e "MY->fixin(shift)"
+
+pure_all :: $(INST_SCRIPT)/genhdlist $(INST_SCRIPT)/rpm2cpio.pl $(INST_SCRIPT)/parsehdlist $(INST_SCRIPT)/rpm2header $(INST_SCRIPT)/packdrake $(INST_SCRIPT)/gendistrib
+ $(NOECHO) $(NOOP)
+
+realclean ::
+ $(RM_F) $(INST_SCRIPT)/genhdlist $(INST_SCRIPT)/rpm2cpio.pl $(INST_SCRIPT)/parsehdlist $(INST_SCRIPT)/rpm2header $(INST_SCRIPT)/packdrake $(INST_SCRIPT)/gendistrib
+
+$(INST_SCRIPT)/genhdlist: genhdlist $(FIRST_MAKEFILE) $(INST_SCRIPT)/.exists
+ $(NOECHO) $(RM_F) $(INST_SCRIPT)/genhdlist
+ $(CP) genhdlist $(INST_SCRIPT)/genhdlist
+ $(FIXIN) $(INST_SCRIPT)/genhdlist
+ -$(NOECHO) $(CHMOD) $(PERM_RWX) $(INST_SCRIPT)/genhdlist
+
+$(INST_SCRIPT)/rpm2cpio.pl: rpm2cpio.pl $(FIRST_MAKEFILE) $(INST_SCRIPT)/.exists
+ $(NOECHO) $(RM_F) $(INST_SCRIPT)/rpm2cpio.pl
+ $(CP) rpm2cpio.pl $(INST_SCRIPT)/rpm2cpio.pl
+ $(FIXIN) $(INST_SCRIPT)/rpm2cpio.pl
+ -$(NOECHO) $(CHMOD) $(PERM_RWX) $(INST_SCRIPT)/rpm2cpio.pl
+
+$(INST_SCRIPT)/parsehdlist: parsehdlist $(FIRST_MAKEFILE) $(INST_SCRIPT)/.exists
+ $(NOECHO) $(RM_F) $(INST_SCRIPT)/parsehdlist
+ $(CP) parsehdlist $(INST_SCRIPT)/parsehdlist
+ $(FIXIN) $(INST_SCRIPT)/parsehdlist
+ -$(NOECHO) $(CHMOD) $(PERM_RWX) $(INST_SCRIPT)/parsehdlist
+
+$(INST_SCRIPT)/rpm2header: rpm2header $(FIRST_MAKEFILE) $(INST_SCRIPT)/.exists
+ $(NOECHO) $(RM_F) $(INST_SCRIPT)/rpm2header
+ $(CP) rpm2header $(INST_SCRIPT)/rpm2header
+ $(FIXIN) $(INST_SCRIPT)/rpm2header
+ -$(NOECHO) $(CHMOD) $(PERM_RWX) $(INST_SCRIPT)/rpm2header
+
+$(INST_SCRIPT)/packdrake: packdrake $(FIRST_MAKEFILE) $(INST_SCRIPT)/.exists
+ $(NOECHO) $(RM_F) $(INST_SCRIPT)/packdrake
+ $(CP) packdrake $(INST_SCRIPT)/packdrake
+ $(FIXIN) $(INST_SCRIPT)/packdrake
+ -$(NOECHO) $(CHMOD) $(PERM_RWX) $(INST_SCRIPT)/packdrake
+
+$(INST_SCRIPT)/gendistrib: gendistrib $(FIRST_MAKEFILE) $(INST_SCRIPT)/.exists
+ $(NOECHO) $(RM_F) $(INST_SCRIPT)/gendistrib
+ $(CP) gendistrib $(INST_SCRIPT)/gendistrib
+ $(FIXIN) $(INST_SCRIPT)/gendistrib
+ -$(NOECHO) $(CHMOD) $(PERM_RWX) $(INST_SCRIPT)/gendistrib
+
+
+# --- MakeMaker subdirs section:
+
+# none
+
+# --- MakeMaker clean_subdirs section:
+clean_subdirs :
+ $(NOECHO) $(NOOP)
+
+
+# --- MakeMaker clean section:
+
+# Delete temporary files but do not touch installed files. We don't delete
+# the Makefile here so a later make realclean still has a makefile to use.
+
+clean :: clean_subdirs
+ -$(RM_RF) ./blib $(MAKE_APERL_FILE) $(INST_ARCHAUTODIR)/extralibs.all $(INST_ARCHAUTODIR)/extralibs.ld perlmain.c tmon.out mon.out so_locations pm_to_blib *$(OBJ_EXT) *$(LIB_EXT) perl.exe perl perl$(EXE_EXT) $(BOOTSTRAP) $(BASEEXT).bso $(BASEEXT).def lib$(BASEEXT).def $(BASEEXT).exp $(BASEEXT).x core core.*perl.*.? *perl.core core.[0-9] core.[0-9][0-9] core.[0-9][0-9][0-9] core.[0-9][0-9][0-9][0-9] core.[0-9][0-9][0-9][0-9][0-9]
+ -$(MV) $(FIRST_MAKEFILE) $(MAKEFILE_OLD) $(DEV_NULL)
+
+
+# --- MakeMaker realclean_subdirs section:
+realclean_subdirs :
+ $(NOECHO) $(NOOP)
+
+
+# --- MakeMaker realclean section:
+
+# Delete temporary files (via clean) and also delete installed files
+realclean purge :: clean realclean_subdirs
+ $(RM_RF) $(INST_AUTODIR) $(INST_ARCHAUTODIR)
+ $(RM_RF) $(DISTVNAME)
+ $(RM_F) $(INST_LIBDIR)/Packdrakeng.pm $(MAKEFILE_OLD) $(FIRST_MAKEFILE) $(INST_LIBDIR)/packdrake.pm
+
+
+# --- MakeMaker metafile section:
+metafile :
+ $(NOECHO) $(ECHO) '# http://module-build.sourceforge.net/META-spec.html' > META.yml
+ $(NOECHO) $(ECHO) '#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#' >> META.yml
+ $(NOECHO) $(ECHO) 'name: rpmtools' >> META.yml
+ $(NOECHO) $(ECHO) 'version: 5.0' >> META.yml
+ $(NOECHO) $(ECHO) 'version_from: ' >> META.yml
+ $(NOECHO) $(ECHO) 'installdirs: vendor' >> META.yml
+ $(NOECHO) $(ECHO) 'requires:' >> META.yml
+ $(NOECHO) $(ECHO) '' >> META.yml
+ $(NOECHO) $(ECHO) 'distribution_type: module' >> META.yml
+ $(NOECHO) $(ECHO) 'generated_by: ExtUtils::MakeMaker version 6.17' >> META.yml
+
+
+# --- MakeMaker metafile_addtomanifest section:
+metafile_addtomanifest:
+ $(NOECHO) $(PERLRUN) -MExtUtils::Manifest=maniadd -e 'eval { maniadd({q{META.yml} => q{Module meta-data (added by MakeMaker)}}) } ' \
+ -e ' or print "Could not add META.yml to MANIFEST: $${'\''@'\''}\n"'
+
+
+# --- MakeMaker dist_basics section:
+distclean :: realclean distcheck
+ $(NOECHO) $(NOOP)
+
+distcheck :
+ $(PERLRUN) "-MExtUtils::Manifest=fullcheck" -e fullcheck
+
+skipcheck :
+ $(PERLRUN) "-MExtUtils::Manifest=skipcheck" -e skipcheck
+
+manifest :
+ $(PERLRUN) "-MExtUtils::Manifest=mkmanifest" -e mkmanifest
+
+veryclean : realclean
+ $(RM_F) *~ *.orig */*~ */*.orig
+
+
+
+# --- MakeMaker dist_core section:
+
+dist : $(DIST_DEFAULT) $(FIRST_MAKEFILE)
+ $(NOECHO) $(PERLRUN) -l -e 'print '\''Warning: Makefile possibly out of date with $(VERSION_FROM)'\''' \
+ -e ' if -e '\''$(VERSION_FROM)'\'' and -M '\''$(VERSION_FROM)'\'' < -M '\''$(FIRST_MAKEFILE)'\'';'
+
+tardist : $(DISTVNAME).tar$(SUFFIX)
+ $(NOECHO) $(NOOP)
+
+uutardist : $(DISTVNAME).tar$(SUFFIX)
+ uuencode $(DISTVNAME).tar$(SUFFIX) $(DISTVNAME).tar$(SUFFIX) > $(DISTVNAME).tar$(SUFFIX)_uu
+
+$(DISTVNAME).tar$(SUFFIX) : distdir
+ $(PREOP)
+ $(TO_UNIX)
+ $(TAR) $(TARFLAGS) $(DISTVNAME).tar $(DISTVNAME)
+ $(RM_RF) $(DISTVNAME)
+ $(COMPRESS) $(DISTVNAME).tar
+ $(POSTOP)
+
+zipdist : $(DISTVNAME).zip
+ $(NOECHO) $(NOOP)
+
+$(DISTVNAME).zip : distdir
+ $(PREOP)
+ $(ZIP) $(ZIPFLAGS) $(DISTVNAME).zip $(DISTVNAME)
+ $(RM_RF) $(DISTVNAME)
+ $(POSTOP)
+
+shdist : distdir
+ $(PREOP)
+ $(SHAR) $(DISTVNAME) > $(DISTVNAME).shar
+ $(RM_RF) $(DISTVNAME)
+ $(POSTOP)
+
+
+# --- MakeMaker distdir section:
+distdir : metafile metafile_addtomanifest
+ $(RM_RF) $(DISTVNAME)
+ $(PERLRUN) "-MExtUtils::Manifest=manicopy,maniread" \
+ -e "manicopy(maniread(),'$(DISTVNAME)', '$(DIST_CP)');"
+
+
+
+# --- MakeMaker dist_test section:
+
+disttest : distdir
+ cd $(DISTVNAME) && $(ABSPERLRUN) Makefile.PL
+ cd $(DISTVNAME) && $(MAKE) $(PASTHRU)
+ cd $(DISTVNAME) && $(MAKE) test $(PASTHRU)
+
+
+# --- MakeMaker dist_ci section:
+
+ci :
+ $(PERLRUN) "-MExtUtils::Manifest=maniread" \
+ -e "@all = keys %{ maniread() };" \
+ -e "print(qq{Executing $(CI) @all\n}); system(qq{$(CI) @all});" \
+ -e "print(qq{Executing $(RCS_LABEL) ...\n}); system(qq{$(RCS_LABEL) @all});"
+
+
+# --- MakeMaker install section:
+
+install :: all pure_install doc_install
+
+install_perl :: all pure_perl_install doc_perl_install
+
+install_site :: all pure_site_install doc_site_install
+
+install_vendor :: all pure_vendor_install doc_vendor_install
+
+pure_install :: pure_$(INSTALLDIRS)_install
+
+doc_install :: doc_$(INSTALLDIRS)_install
+
+pure__install : pure_site_install
+ $(NOECHO) $(ECHO) INSTALLDIRS not defined, defaulting to INSTALLDIRS=site
+
+doc__install : doc_site_install
+ $(NOECHO) $(ECHO) INSTALLDIRS not defined, defaulting to INSTALLDIRS=site
+
+pure_perl_install ::
+ $(NOECHO) $(MOD_INSTALL) \
+ read $(PERL_ARCHLIB)/auto/$(FULLEXT)/.packlist \
+ write $(DESTINSTALLARCHLIB)/auto/$(FULLEXT)/.packlist \
+ $(INST_LIB) $(DESTINSTALLPRIVLIB) \
+ $(INST_ARCHLIB) $(DESTINSTALLARCHLIB) \
+ $(INST_BIN) $(DESTINSTALLBIN) \
+ $(INST_SCRIPT) $(DESTINSTALLSCRIPT) \
+ $(INST_MAN1DIR) $(DESTINSTALLMAN1DIR) \
+ $(INST_MAN3DIR) $(DESTINSTALLMAN3DIR)
+ $(NOECHO) $(WARN_IF_OLD_PACKLIST) \
+ $(SITEARCHEXP)/auto/$(FULLEXT)
+
+
+pure_site_install ::
+ $(NOECHO) $(MOD_INSTALL) \
+ read $(SITEARCHEXP)/auto/$(FULLEXT)/.packlist \
+ write $(DESTINSTALLSITEARCH)/auto/$(FULLEXT)/.packlist \
+ $(INST_LIB) $(DESTINSTALLSITELIB) \
+ $(INST_ARCHLIB) $(DESTINSTALLSITEARCH) \
+ $(INST_BIN) $(DESTINSTALLSITEBIN) \
+ $(INST_SCRIPT) $(DESTINSTALLSCRIPT) \
+ $(INST_MAN1DIR) $(DESTINSTALLSITEMAN1DIR) \
+ $(INST_MAN3DIR) $(DESTINSTALLSITEMAN3DIR)
+ $(NOECHO) $(WARN_IF_OLD_PACKLIST) \
+ $(PERL_ARCHLIB)/auto/$(FULLEXT)
+
+pure_vendor_install ::
+ $(NOECHO) $(MOD_INSTALL) \
+ read $(VENDORARCHEXP)/auto/$(FULLEXT)/.packlist \
+ write $(DESTINSTALLVENDORARCH)/auto/$(FULLEXT)/.packlist \
+ $(INST_LIB) $(DESTINSTALLVENDORLIB) \
+ $(INST_ARCHLIB) $(DESTINSTALLVENDORARCH) \
+ $(INST_BIN) $(DESTINSTALLVENDORBIN) \
+ $(INST_SCRIPT) $(DESTINSTALLSCRIPT) \
+ $(INST_MAN1DIR) $(DESTINSTALLVENDORMAN1DIR) \
+ $(INST_MAN3DIR) $(DESTINSTALLVENDORMAN3DIR)
+
+doc_perl_install ::
+ $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod
+ -$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB)
+ -$(NOECHO) $(DOC_INSTALL) \
+ "Module" "$(NAME)" \
+ "installed into" "$(INSTALLPRIVLIB)" \
+ LINKTYPE "$(LINKTYPE)" \
+ VERSION "$(VERSION)" \
+ EXE_FILES "$(EXE_FILES)" \
+ >> $(DESTINSTALLARCHLIB)/perllocal.pod
+
+doc_site_install ::
+ $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod
+ -$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB)
+ -$(NOECHO) $(DOC_INSTALL) \
+ "Module" "$(NAME)" \
+ "installed into" "$(INSTALLSITELIB)" \
+ LINKTYPE "$(LINKTYPE)" \
+ VERSION "$(VERSION)" \
+ EXE_FILES "$(EXE_FILES)" \
+ >> $(DESTINSTALLARCHLIB)/perllocal.pod
+
+doc_vendor_install ::
+ $(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod
+ -$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB)
+ -$(NOECHO) $(DOC_INSTALL) \
+ "Module" "$(NAME)" \
+ "installed into" "$(INSTALLVENDORLIB)" \
+ LINKTYPE "$(LINKTYPE)" \
+ VERSION "$(VERSION)" \
+ EXE_FILES "$(EXE_FILES)" \
+ >> $(DESTINSTALLARCHLIB)/perllocal.pod
+
+
+uninstall :: uninstall_from_$(INSTALLDIRS)dirs
+
+uninstall_from_perldirs ::
+ $(NOECHO) $(UNINSTALL) $(PERL_ARCHLIB)/auto/$(FULLEXT)/.packlist
+
+uninstall_from_sitedirs ::
+ $(NOECHO) $(UNINSTALL) $(SITEARCHEXP)/auto/$(FULLEXT)/.packlist
+
+uninstall_from_vendordirs ::
+ $(NOECHO) $(UNINSTALL) $(VENDORARCHEXP)/auto/$(FULLEXT)/.packlist
+
+
+# --- MakeMaker force section:
+# Phony target to force checking subdirectories.
+FORCE:
+ $(NOECHO) $(NOOP)
+
+
+# --- MakeMaker perldepend section:
+
+
+# --- MakeMaker makefile section:
+
+# We take a very conservative approach here, but it's worth it.
+# We move Makefile to Makefile.old here to avoid gnu make looping.
+$(FIRST_MAKEFILE) : Makefile.PL $(CONFIGDEP)
+ $(NOECHO) $(ECHO) "Makefile out-of-date with respect to $?"
+ $(NOECHO) $(ECHO) "Cleaning current config before rebuilding Makefile..."
+ $(NOECHO) $(RM_F) $(MAKEFILE_OLD)
+ $(NOECHO) $(MV) $(FIRST_MAKEFILE) $(MAKEFILE_OLD)
+ -$(MAKE) -f $(MAKEFILE_OLD) clean $(DEV_NULL) || $(NOOP)
+ $(PERLRUN) Makefile.PL
+ $(NOECHO) $(ECHO) "==> Your Makefile has been rebuilt. <=="
+ $(NOECHO) $(ECHO) "==> Please rerun the make command. <=="
+ false
+
+
+
+# --- MakeMaker staticmake section:
+
+# --- MakeMaker makeaperl section ---
+MAP_TARGET = perl
+FULLPERL = /usr/bin/perl5.8.6
+
+$(MAP_TARGET) :: static $(MAKE_APERL_FILE)
+ $(MAKE) -f $(MAKE_APERL_FILE) $@
+
+$(MAKE_APERL_FILE) : $(FIRST_MAKEFILE)
+ $(NOECHO) $(ECHO) Writing \"$(MAKE_APERL_FILE)\" for this $(MAP_TARGET)
+ $(NOECHO) $(PERLRUNINST) \
+ Makefile.PL DIR= \
+ MAKEFILE=$(MAKE_APERL_FILE) LINKTYPE=static \
+ MAKEAPERL=1 NORECURS=1 CCCDLFLAGS=
+
+
+# --- MakeMaker test section:
+
+TEST_VERBOSE=0
+TEST_TYPE=test_$(LINKTYPE)
+TEST_FILE = test.pl
+TEST_FILES = t/*.t
+TESTDB_SW = -d
+
+testdb :: testdb_$(LINKTYPE)
+
+test :: $(TEST_TYPE)
+
+test_dynamic :: pure_all
+ PERL_DL_NONLAZY=1 $(FULLPERLRUN) "-MExtUtils::Command::MM" "-e" "test_harness($(TEST_VERBOSE), '$(INST_LIB)', '$(INST_ARCHLIB)')" $(TEST_FILES)
+
+testdb_dynamic :: pure_all
+ PERL_DL_NONLAZY=1 $(FULLPERLRUN) $(TESTDB_SW) "-I$(INST_LIB)" "-I$(INST_ARCHLIB)" $(TEST_FILE)
+
+test_ : test_dynamic
+
+test_static :: test_dynamic
+testdb_static :: testdb_dynamic
+
+
+# --- MakeMaker ppd section:
+# Creates a PPD (Perl Package Description) for a binary distribution.
+ppd:
+ $(NOECHO) $(ECHO) '<SOFTPKG NAME="$(DISTNAME)" VERSION="5,0,0,0">' > $(DISTNAME).ppd
+ $(NOECHO) $(ECHO) ' <TITLE>$(DISTNAME)</TITLE>' >> $(DISTNAME).ppd
+ $(NOECHO) $(ECHO) ' <ABSTRACT></ABSTRACT>' >> $(DISTNAME).ppd
+ $(NOECHO) $(ECHO) ' <AUTHOR></AUTHOR>' >> $(DISTNAME).ppd
+ $(NOECHO) $(ECHO) ' <IMPLEMENTATION>' >> $(DISTNAME).ppd
+ $(NOECHO) $(ECHO) ' <OS NAME="$(OSNAME)" />' >> $(DISTNAME).ppd
+ $(NOECHO) $(ECHO) ' <ARCHITECTURE NAME="i386-linux" />' >> $(DISTNAME).ppd
+ $(NOECHO) $(ECHO) ' <CODEBASE HREF="" />' >> $(DISTNAME).ppd
+ $(NOECHO) $(ECHO) ' </IMPLEMENTATION>' >> $(DISTNAME).ppd
+ $(NOECHO) $(ECHO) '</SOFTPKG>' >> $(DISTNAME).ppd
+
+
+# --- MakeMaker pm_to_blib section:
+
+pm_to_blib: $(TO_INST_PM)
+ $(NOECHO) $(PERLRUN) -MExtUtils::Install -e 'pm_to_blib({@ARGV}, '\''$(INST_LIB)/auto'\'', '\''$(PM_FILTER)'\'')'\
+ Packdrakeng.pm $(INST_LIBDIR)/Packdrakeng.pm \
+ packdrake.pm $(INST_LIBDIR)/packdrake.pm
+ $(NOECHO) $(TOUCH) $@
+
+# --- MakeMaker selfdocument section:
+
+
+# --- MakeMaker postamble section:
+.PHONY: ChangeLog
$(FROMCC): %: %.cc
- $(CXX) $(CFLAGS) -DVERSION_STRING=\"$(VERSION)\" $< $(LIBRPM) -o $@
+ $(CXX) $(CCFLAGS) $(OPTIMIZE) -DVERSION_STRING=\"$(RPMTOOLSVERSION)\" $< $(LIBRPM) $(INCRPM) $(DEFRPM) -o $@
$(FROMCC_STATIC): %_static: %.cc
- $(CXX) -s -static $(CFLAGS) -DVERSION_STRING=\"$(VERSION)\" $< $(LIBRPM) -o $@
+ $(CXX) -s -static $(CCFLAGS) $(OPTIMIZE) -DVERSION_STRING=\"$(RPMTOOLSVERSION)\" $< $(LIBRPM) $(INCRPM) $(DEFRPM) -o $@
$(FROMC): %: %.c
- $(CC) $(CFLAGS) -DVERSION_STRING=\"$(VERSION)\" $< $(LIBRPM) -o $@
+ $(CC) $(CCFLAGS) $(OPTIMIZE) -DVERSION_STRING=\"$(RPMTOOLSVERSION)\" $< $(LIBRPM) $(INCRPM) $(DEFRPM) -o $@
$(FROMC_STATIC): %_static: %.c
- $(CC) -s -static $(CFLAGS) -DVERSION_STRING=\"$(VERSION)\" $< $(LIBRPM) $(LIBRPM_STATIC) -o $@
-
-clean:
- rm -rf *~ $(ALL) $(ALL_STATIC)
-
-dis: clean
- rm -rf $(NAME)-$(VERSION) ../$(NAME)-$(VERSION).tar*
- mkdir -p $(NAME)-$(VERSION)
- find . -not -name "$(NAME)-$(VERSION)"|cpio -pd $(NAME)-$(VERSION)/
- find $(NAME)-$(VERSION) -type d -name CVS -o -name .cvsignore -o -name unused |xargs rm -rf
- perl -p -i -e 's|^%define version.*|%define version $(VERSION)|' $(NAME).spec
- tar cf ../$(NAME)-$(VERSION).tar $(NAME)-$(VERSION)
- bzip2 -9f ../$(NAME)-$(VERSION).tar
- rm -rf $(NAME)-$(VERSION)
-
-rpm: dis ../$(NAME)-$(VERSION).tar.bz2
- cp -f ../$(NAME)-$(VERSION).tar.bz2 $(RPM)/SOURCES
- cp -f $(NAME).spec $(RPM)/SPECS/
- -rpmbuild -ba --clean --rmsource $(NAME).spec
- rm -f ../$(NAME)-$(VERSION).tar.bz2
-
-changelog:
- cvs2cl -W 400 -I ChangeLog --accum -U ../../soft/common/username
+ $(CC) -g -s -static $(CCFLAGS) $(OPTIMIZE) -DVERSION_STRING=\"$(RPMTOOLSVERSION)\" $< $(LIBRPM) $(LIBRPM_STATIC) $(INCRPM) $(DEFRPM) -o $@
+
+buildc: $(FROMC) $(FROMCC) # $(FROMC_STATIC) $(FROMCC_STATIC)
+
+cleanc:
+ rm -f $(FROMC) $(FROMCC) $(FROMC_STATIC) $(FROMCC_STATIC)
+
+ChangeLog:
+ cvs2cl -W 400 -I ChangeLog --accum -U ../common/username
rm -f *.bak
+
+rpm: dist
+ rpm --define "_sourcedir `pwd`" -ba rpmtools.spec
+
+
+# End.
diff --git a/Makefile.PL b/Makefile.PL
new file mode 100644
index 0000000..289b915
--- /dev/null
+++ b/Makefile.PL
@@ -0,0 +1,71 @@
+# $Id$
+
+# use 5.008;
+use ExtUtils::MakeMaker;
+
+my $rpmtools_version = '5.0';
+
+sub MY::postamble {
+ <<MAKEMAKEFILE;
+.PHONY: ChangeLog
+
+\$(FROMCC): %: %.cc
+ \$(CXX) \$(CCFLAGS) \$(OPTIMIZE) -DVERSION_STRING=\\"\$(RPMTOOLSVERSION)\\" \$< \$(LIBRPM) \$(INCRPM) \$(DEFRPM) -o \$@
+
+\$(FROMCC_STATIC): %_static: %.cc
+ \$(CXX) -s -static \$(CCFLAGS) \$(OPTIMIZE) -DVERSION_STRING=\\"\$(RPMTOOLSVERSION)\\" \$< \$(LIBRPM) \$(INCRPM) \$(DEFRPM) -o \$@
+
+\$(FROMC): %: %.c
+ \$(CC) \$(CCFLAGS) \$(OPTIMIZE) -DVERSION_STRING=\\"\$(RPMTOOLSVERSION)\\" \$< \$(LIBRPM) \$(INCRPM) \$(DEFRPM) -o \$@
+
+\$(FROMC_STATIC): %_static: %.c
+ \$(CC) -g -s -static \$(CCFLAGS) \$(OPTIMIZE) -DVERSION_STRING=\\"\$(RPMTOOLSVERSION)\\" \$< \$(LIBRPM) \$(LIBRPM_STATIC) \$(INCRPM) \$(DEFRPM) -o \$@
+
+buildc: \$(FROMC) \$(FROMCC) # \$(FROMC_STATIC) \$(FROMCC_STATIC)
+
+cleanc:
+ rm -f \$(FROMC) \$(FROMCC) \$(FROMC_STATIC) \$(FROMCC_STATIC)
+
+ChangeLog:
+ cvs2cl -W 400 -I ChangeLog --accum -U ../common/username
+ rm -f *.bak
+
+rpm: dist
+ rpm --define "_sourcedir `pwd`" -ba rpmtools.spec
+MAKEMAKEFILE
+}
+
+WriteMakefile(
+ NAME => 'rpmtools',
+ VERSION => $rpmtools_version,
+ macro => {
+ RPMTOOLSVERSION => $rpmtools_version,
+ FROMC => 'parsehdlist rpm2header #rpm-find-leaves',
+ FROMCC => '#gendepslist2 hdlist2names hdlist2files hdlist2prereq hdlist2groups',
+ FROMC_STATIC => '$(FROMC:%=%_static)',
+ FROMCC_STATIC => '$(FROMCC:%=%_static)',
+ LIBRPM => '-lrpm -lrpmio -lrpmdb -lrpmbuild -lz -lbz2 -lpopt',
+ INCRPM => '-I/usr/include/rpm',
+ DEFRPM => '-DRPM_42',
+ },
+ depend => {
+ clean_subdirs => 'cleanc',
+ pm_to_blib => 'buildc',
+ },
+ PM => {
+ 'Packdrakeng.pm' => '$(INST_LIBDIR)/Packdrakeng.pm',
+ 'packdrake.pm' => '$(INST_LIBDIR)/packdrake.pm',
+ },
+ 'EXE_FILES' => [ qw(gendistrib genhdlist packdrake rpm2header parsehdlist rpm2cpio.pl) ],
+ C => [],
+ 'OBJECT' => '',
+ CCFLAGS => '-Wall',
+ OPTIMIZE => '-O3 -fomit-frame-pointer -fno-exceptions -pipe -s -ffast-math -fexpensive-optimizations',
+ INC => '',
+ LIBS => [ '' ],
+ INSTALLDIRS => 'vendor',
+ dist => {
+ COMPRESS => 'bzip2 --best',
+ SUFFIX => '.bz2',
+ },
+);
diff --git a/packdrake-pm/Makefile.PL b/packdrake-pm/Makefile.PL
deleted file mode 100644
index 71f56ac..0000000
--- a/packdrake-pm/Makefile.PL
+++ /dev/null
@@ -1,9 +0,0 @@
-use ExtUtils::MakeMaker;
-# See lib/ExtUtils/MakeMaker.pm for details of how to influence
-# the contents of the Makefile that is written.
-
-WriteMakefile(
- 'NAME' => 'packdrake',
- 'VERSION_FROM' => 'packdrake.pm',
-);
-
diff --git a/packdrake-pm/packdrake.pm b/packdrake-pm/packdrake.pm
deleted file mode 100644
index 2b66f8a..0000000
--- a/packdrake-pm/packdrake.pm
+++ /dev/null
@@ -1,515 +0,0 @@
-package packdrake;
-
-use strict;
-use vars qw($VERSION);
-
-$VERSION = "0.04";
-
-=head1 NAME
-
-packdrake - Simple Archive Extractor/Builder
-
-=head1 SYNOPSIS
-
- require packdrake;
-
- packdrake::cat_archive("/export/media/media_info/hdlist.cz",
- "/export/media/media_info/hdlist2.cz");
- packdrake::list_archive("/tmp/modules.cz2");
-
- my $packer = new packdrake("/tmp/modules.cz2");
- $packer->extract_archive("/tmp", "file1.o", "file2.o");
-
- my $packer = packdrake::build_archive
- (\*STDIN, "/lib/modules", "/tmp/modules.cz2",
- 400000, "bzip2", "bzip2 -d");
- my $packer = packdrake::build_archive
- (\*STDIN, "/export/media/media_info/hdlist.cz",
- 400000, "gzip -9", "gzip -d");
-
-=head1 DESCRIPTION
-
-C<packdrake> is a very simple archive extractor and builder used by Mandrakesoft.
-
-=head1 IMPLEMENTATION
-
-uncompressing sheme is:
- | |
- | | | |
- $off1 =|*| } | |
- |*| } $off2 =|+| }
- |*| } $siz1 => 'gzip/bzip2 -d' => |+| } $siz2 => $filename
- |*| } |+| }
- |*| } | |
- | | | |
- | | | |
- | |
-where %data has the following format:
- { 'filename' => [ 'f', $off1, $siz1, $off2, $siz2 ] }
-except for symbolink link where it is:
- { 'filename_symlink' => [ 'l', $symlink_value ] }
-and directory where it is only
- { 'filename_directory' => [ 'd' ] }
-as you can see, there is no owner, group, filemode... an extension could be
-made with 'F' (instead of 'f'), 'L' instead of 'l' for exemple.
-we do not need them as it is used for DrakX for fast archive extraction and
-owner/filemode is for user running only (ie root).
-
-archive file contains concatenation of all bzip2'ed group of files whose
-filenames are on input,
-then a TOC (describing %data, concatenation of toc_line) follow and a
-TOC_TRAILER for summary.
-
-=head1 SEE ALSO
-
-The packdrake command is a simple executable perl script using this module.
-
-=head1 COPYRIGHT
-
-Copyright (C) 2000-2004 Mandrakesoft <fpons@mandrakesoft.com>
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-=cut
-
-#- taken from DrakX common stuff, for conveniance and modified to match our expectation.
-sub dirname { @_ == 1 or die "packdrake: usage: dirname <name>\n"; local $_ = shift; s|[^/]*/*\s*$||; s|(.)/*$|$1|; $_ || '.' }
-sub basename { @_ == 1 or die "packdrake: usage: basename <name>\n"; local $_ = shift; s|/*\s*$||; s|.*/||; $_ }
-sub mkdir_ {
- my $root = dirname $_[0];
- if (-e $root) {
- -d $root or die "packdrake: mkdir: error creating directory $_[0]: $root is a file and i won't delete it\n";
- } else {
- mkdir_($root);
- }
- -d $_[0] and return;
- mkdir $_[0], 0755 or die "packdrake: mkdir: error creating directory $_[0]: $!\n";
-}
-sub symlink_ { mkdir_ dirname($_[1]); unlink $_[1]; symlink $_[0], $_[1] }
-
-#- for building an archive, returns the string containing the file and data associated.
-sub build_toc_line {
- my ($file, $data) = @_;
-
- for ($data->[0]) {
- return(/l/ && pack("anna*", 'l', length($file), length($data->[1]), "$file$data->[1]") ||
- /d/ && pack("ana*", 'd', length($file), $file) ||
- /f/ && pack("anNNNNa*", 'f', length($file), @$data[1..4], $file) ||
- die "packdrake: unknown extension $_\n");
- }
-}
-
-sub build_toc_trailer {
- my ($packer) = @_;
-
- #- 'cz[0' is toc_trailer header where 0 is version information, only 0 now.
- #- '0]cz' is toc_trailer trailer that match the corresponding header for information.
- pack "a4NNNNa40a4", ($packer->{header},
- $packer->{toc_d_count}, $packer->{toc_l_count}, $packer->{toc_f_count},
- $packer->{toc_str_size}, $packer->{uncompress},
- $packer->{trailer});
-}
-
-#- degraded reading of toc at end of archive, do not check filelist.
-sub read_toc_trailer {
- my ($packer, $file) = @_;
- my $toc_trailer;
-
- local *ARCHIVE;
- open ARCHIVE, "<$file" or die "packdrake: cannot open archive file $file\n";
- $packer->{archive} = $file;
-
- #- seek to end of file minus 64, size of trailer.
- #- read toc_trailer, check header/trailer for version 0.
- seek ARCHIVE, -64, 2;
- read ARCHIVE, $toc_trailer, 64 or die "packdrake: cannot read toc_trailer of archive file $file\n";
- @$packer{qw(header toc_d_count toc_l_count toc_f_count toc_str_size uncompress trailer)} =
- unpack "a4NNNNZ40a4", $toc_trailer;
- $packer->{header} eq 'cz[0' && $packer->{trailer} eq '0]cz' or die "packdrake: bad toc_trailer in archive file $file\n";
-
- close ARCHIVE;
-}
-
-#- read toc at end of archive.
-sub read_toc {
- my ($packer, $file) = @_;
- my ($toc, $toc_trailer, $toc_size);
- my @toc_str;
- my @toc_data;
-
- local *ARCHIVE;
- open ARCHIVE, "<$file" or die "packdrake: cannot open archive file $file\n";
- $packer->{archive} = $file;
-
- #- seek to end of file minus 64, size of trailer.
- #- read toc_trailer, check header/trailer for version 0.
- seek ARCHIVE, -64, 2;
- read ARCHIVE, $toc_trailer, 64 or die "packdrake: cannot read toc_trailer of archive file $file\n";
- @$packer{qw(header toc_d_count toc_l_count toc_f_count toc_str_size uncompress trailer)} =
- unpack "a4NNNNZ40a4", $toc_trailer;
- $packer->{header} eq 'cz[0' && $packer->{trailer} eq '0]cz' or die "packdrake: bad toc_trailer in archive file $file\n";
-
- #- read toc, extract data hashes.
- $toc_size = $packer->{toc_str_size} + 16*$packer->{toc_f_count};
- seek ARCHIVE, -64-$toc_size, 2;
-
- #- read strings separated by \n, so this char cannot be inside filename, oops.
- read ARCHIVE, $toc, $packer->{toc_str_size} or die "packdrake: cannot read toc of archive file $file\n";
- @toc_str = split "\n", $toc;
-
- #- read data for file.
- read ARCHIVE, $toc, 16*$packer->{toc_f_count} or die "packdrake: cannot read toc of archive file $file\n";
- @toc_data = unpack "N" . 4*$packer->{toc_f_count}, $toc;
-
- close ARCHIVE;
-
- foreach (0..$packer->{toc_d_count}-1) {
- my $file = $toc_str[$_];
- push @{$packer->{files}}, $file;
- $packer->{data}{$file} = [ 'd' ];
- }
- foreach (0..$packer->{toc_l_count}-1) {
- my ($file, $symlink) = ($toc_str[$packer->{toc_d_count}+2*$_],
- $toc_str[$packer->{toc_d_count}+2*$_+1]);
- push @{$packer->{files}}, $file;
- $packer->{data}{$file} = [ 'l', $symlink ];
- }
- foreach (0..$packer->{toc_f_count}-1) {
- my $file = $toc_str[$packer->{toc_d_count}+2*$packer->{toc_l_count}+$_];
- push @{$packer->{files}}, $file;
- $packer->{data}{$file} = [ 'f', @toc_data[4*$_ .. 4*$_+3] ];
- }
-
- scalar keys %{$packer->{data}} == $packer->{toc_d_count}+$packer->{toc_l_count}+$packer->{toc_f_count} or
- die "packdrake: mismatch count when reading toc, bad archive file $file\n";
-}
-
-sub catsksz {
- my ($input, $seek, $siz, $output) = @_;
- my ($buf, $sz);
-
- while ($sz = sysread($input, $buf, $seek > 65536 ? 65536 : $seek)) {
- $seek -= $sz;
- last unless $seek > 0;
- }
- while ($sz = sysread($input, $buf, $siz > 65536 ? 65536 : $siz)) {
- $siz -= $sz;
- syswrite($output, $buf);
- last unless $siz > 0;
- }
-}
-
-sub cat_compress {
- my ($packer, $srcdir, @filenames) = @_;
- local *F;
- open F, "| $ENV{LD_LOADER} $packer->{compress} >$packer->{tmpz}"
- or die "packdrake: cannot start \"$packer->{compress}\"\n";
- foreach (@filenames) {
- my $srcfile = $srcdir ? "$srcdir/$_" : $_;
- my ($buf, $siz, $sz);
- local *FILE;
- open FILE, $srcfile or die "packdrake: cannot open $srcfile: $!\n";
- $siz = -s $srcfile;
- while ($sz = sysread(FILE, $buf, $siz > 65536 ? 65536 : $siz)) {
- $siz -= $sz;
- syswrite(F, $buf);
- last unless $siz > 0;
- }
- close FILE;
- }
- close F or die "packdrake: unable to compress data using \"$packer->{compress}\"\n";
- -s $packer->{tmpz};
-}
-
-#- compute the closure of filename list according to symlinks or directory
-#- contents inside the archive.
-sub compute_closure {
- my $packer = shift;
- my %file;
- my @file;
-
- #- keep in mind when a filename already exist and remove doublons.
- @file{@_} = ();
-
- #- navigate through filename list to follow symlinks.
- do {
- @file = grep { !$file{$_} } keys %file;
- foreach (@file) {
- my $file = $_;
-
- #- keep in mind this one has been processed and does not need
- #- to be examined again.
- $file{$file} = 1;
-
- exists $packer->{data}{$file} or next;
-
- for ($packer->{data}{$file}[0]) {
- #- on symlink, try to follow it and mark %file if
- #- it is still inside the archive contents.
- /l/ and do {
- my ($source, $target) = ($file, $packer->{data}{$file}[1]);
-
- $source =~ s|[^/]*$||; #- remove filename to navigate directory.
- if ($source) {
- while ($target =~ s|^\./|| || $target =~ s|//+|/| || $target =~ s|/$|| or
- $source and $target =~ s|^\.\./|| and $source =~ s|[^/]*/$||) {}
- }
-
- #- FALL THROUGH with new selection.
- $file = $target =~ m|^/| ? $target : $source.$target;
- };
-
- #- on directory, try all files on data starting with
- #- this directory, provided they are not already taken
- #- into account.
- /[ld]/ && do {
- @file{grep { !$file{$_} && m|^$file$| || m|^$file/| } keys %{$packer->{data}}} = ();
- last;
- };
- }
- }
- } while @file > 0;
-
- keys %file;
-}
-
-
-#- getting an packer object.
-sub new {
- my ($class, $file, %options) = @_;
- my $packer = bless {
- #- toc trailer data information.
- header => 'cz[0',
- toc_d_count => 0,
- toc_l_count => 0,
- toc_f_count => 0,
- toc_str_size => 0,
- uncompress => 'gzip -d',
- trailer => '0]cz',
-
- #- tempories used for making an archive.
- tmpz => ($ENV{TMPDIR} || "/tmp") . "/packdrake-tmp.$$",
- compress => 'gzip',
-
- #- internal data to handle compression or uncompression.
- archive => undef,
- files => [],
- data => {},
-
- log => $options{quiet} ? sub {} : sub { printf STDERR "%s\n", $_[0] },
- }, $class;
- $file and $packer->read_toc($file);
- $packer;
-}
-
-sub cat_archive {
- foreach (@_) {
- my $packer = new packdrake;
-
- #- update %data according to TOC_TRAILER of each archive.
- $packer->read_toc_trailer($_);
-
- #- dump all the file according to
- if (my $pid = fork()) {
- waitpid $pid, 0;
- } else {
- open STDIN, "<$_" or die "packdrake: unable to open archive $_\n";
- open STDERR, ">/dev/null" or die "packdrake: unable to open /dev/null\n";
-
- exec(($ENV{LD_LOADER} ? $ENV{LD_LOADER} : @{[]}), split " ", $packer->{uncompress});
-
- die "packdrake: unable to cat the archive with $packer->{uncompress}\n";
- }
- }
-}
-
-sub list_archive {
- foreach (@_) {
- my $packer = new packdrake($_);
- my $count = scalar keys %{$packer->{data}};
-
- $packer->{log}->("processing archive \"$_\"");
- print "$count files in archive, uncompression method is \"$packer->{uncompress}\"\n";
- foreach my $file (@{$packer->{files}}) {
- for ($packer->{data}{$file}[0]) {
- /l/ and do { printf "l %13c %s -> %s\n", ' ', $file, $packer->{data}{$file}[1]; last };
- /d/ and do { printf "d %13c %s\n", ' ', $file; last };
- /f/ && do { printf "f %12d %s\n", $packer->{data}{$file}[4], $file; last };
- }
- }
- }
-}
-
-sub extract_archive {
- my ($packer, $dir, @file) = @_;
- my %extract_table;
-
- #- compute closure.
- @file = $packer->compute_closure(@file);
-
- foreach my $file (@file) {
- #- check for presence of file, but do not abort, continue with others.
- unless ($packer->{data}{$file}) {
- $packer->{log}->("packdrake: unable to find file $file in archive $packer->{archive}");
- next;
- }
-
- my $newfile = "$dir/$file";
-
- $packer->{log}->("extracting $file");
- for ($packer->{data}{$file}[0]) {
- /l/ and do { symlink_ $packer->{data}{$file}[1], $newfile; last };
- /d/ and do { $dir and mkdir_ $newfile; last };
- /f/ and do { $dir and mkdir_ dirname $newfile;
- my $data = $packer->{data}{$file};
- $extract_table{$data->[1]} ||= [ $data->[2], [] ];
- push @{$extract_table{$data->[1]}[1]}, [ $newfile, $data->[3], $data->[4] ];
- $extract_table{$data->[1]}[0] == $data->[2] or die "packdrake: mismatched relocation in toc\n";
- last;
- };
- die "packdrake: unknown extension \"$_\" when uncompressing archive $packer->{archive}\n";
- }
- }
-
- #- delayed extraction is done on each block for a single execution
- #- of uncompress executable.
- foreach (sort { $a <=> $b } keys %extract_table) {
- local *OUTPUT;
- if (open OUTPUT, "-|") {
- #- $curr_off is used to handle the reading in a pipe and simulating
- #- a seek on it as done by catsksz, so last file position is
- #- last byte not read (ie last block read start + last block read size).
- local *FILE;
- my $curr_off = 0;
- foreach (sort { $a->[1] <=> $b->[1] } @{$extract_table{$_}[1]}) {
- my ($newfile, $off, $siz) = @$_;
- open FILE, $dir ? ">$newfile" : ">&STDOUT";
- catsksz(\*OUTPUT, $off - $curr_off, $siz, \*FILE);
- $curr_off = $off + $siz;
- close FILE;
- }
- } else {
- local *BUNZIP2;
- open BUNZIP2, "| $ENV{LD_LOADER} $packer->{uncompress}";
- local *ARCHIVE;
- open ARCHIVE, "<$packer->{archive}" or die "packdrake: cannot open archive $packer->{archive}\n";
- catsksz(\*ARCHIVE, $_, $extract_table{$_}[0], \*BUNZIP2);
- exec 'true'; #- exit ala _exit
- }
- }
-}
-
-sub build_archive {
- my ($f, $srcdir, $archivename, $maxsiz, $compress, $uncompress, $tmpz) = @_;
- my ($off1, $siz1, $off2, $siz2) = (0, 0, 0, 0);
- my @filelist;
- my $packer = new packdrake;
-
- $packer->{archive} = $archivename;
- $compress && $uncompress and ($packer->{compress}, $packer->{uncompress}) = ($compress, $uncompress);
- $tmpz and $packer->{tmpz} = $tmpz;
-
- $packer->{log}->("choosing compression method with \"$packer->{compress}\" for archive $packer->{archive}");
-
- unlink $packer->{archive};
- unlink $packer->{tmpz};
-
- my $file;
- while ($file = <$f>) {
- chomp $file;
- my $srcfile = $srcdir ? "$srcdir/$file" : $file;
- -e $srcfile or die "packdrake: unable to find file $srcfile\n";
-
- push @{$packer->{files}}, $file;
- #- now symbolic link and directory are supported, extension is
- #- available with the first field of $data{$file}.
- if (-l $file) {
- $packer->{data}{$file} = [ 'l', readlink $srcfile ];
- } elsif (-d $file) {
- $packer->{data}{$file} = [ 'd' ];
- } else {
- $siz2 = -s $srcfile;
-
- push @filelist, $file;
- $packer->{data}{$file} = [ 'f', -1, -1, $off2, $siz2 ];
-
- if ($off2 + $siz2 > $maxsiz) { #- need compression.
- $siz1 = cat_compress($packer, $srcdir, @filelist);
-
- foreach (@filelist) {
- $packer->{data}{$_} = [ 'f', $off1, $siz1, $packer->{data}{$_}[3], $packer->{data}{$_}[4] ];
- }
-
- system "$ENV{LD_LOADER} cat '$packer->{tmpz}' >>'$packer->{archive}'";
- $off1 += $siz1;
- $off2 = 0; $siz2 = 0;
- @filelist = ();
- }
- $off2 += $siz2;
- }
- }
- if (scalar @filelist) {
- $siz1 = cat_compress($packer, $srcdir, @filelist);
-
- foreach (@filelist) {
- $packer->{data}{$_} = [ 'f', $off1, $siz1, $packer->{data}{$_}[3], $packer->{data}{$_}[4] ];
- }
-
- system "$ENV{LD_LOADER} cat '$packer->{tmpz}' >>'$packer->{archive}'";
- $off1 += $siz1;
- }
- $packer->{log}->("real archive size of $packer->{archive} is $off1");
-
- #- produce a TOC directly at the end of the file, follow with
- #- a trailer with TOC summary and archive summary.
- local *OUTPUT;
- open OUTPUT, ">>$packer->{archive}";
-
- my ($toc_str, $toc_data) = ('', '');
- my @data_d;
- my @data_l;
- my @data_f;
-
- foreach my $file (@{$packer->{files}}) {
- $packer->{data}{$file} or die "packdrake: internal error on $file\n";
-
- #- specific according to type.
- #- with this version, only f has specific data other than strings.
- for ($packer->{data}{$file}[0]) {
- /d/ and do { push @data_d, $file; last };
- /l/ and do { push @data_l, $file; last };
- /f/ and do { push @data_f, $file; $toc_data .= pack("NNNN", @{$packer->{data}{$file}}[1..4]); last };
- die "packdrake: unknown extension $_\n";
- }
- }
-
- foreach (@data_d) { $toc_str .= $_ . "\n" }
- foreach (@data_l) { $toc_str .= $_ . "\n" . $packer->{data}{$_}[1] . "\n" }
- foreach (@data_f) { $toc_str .= $_ . "\n" }
-
- @$packer{qw(toc_d_count toc_l_count toc_f_count toc_str_size uncompress)} =
- (scalar(@data_d), scalar(@data_l), scalar(@data_f), length($toc_str), $uncompress);
-
- print OUTPUT $toc_str;
- print OUTPUT $toc_data;
- print OUTPUT build_toc_trailer($packer);
- close OUTPUT or die "packdrake: unable to build toc trailer of $packer->{archive}\n";
-
- unlink $packer->{tmpz};
-
- $packer;
-}
-
-1;
diff --git a/packdrake.pm b/packdrake.pm
new file mode 100644
index 0000000..6ba51c4
--- /dev/null
+++ b/packdrake.pm
@@ -0,0 +1,173 @@
+##- Nanar <nanardon@mandrake.org>
+##-
+##- This program is free software; you can redistribute it and/or modify
+##- it under the terms of the GNU General Public License as published by
+##- the Free Software Foundation; either version 2, or (at your option)
+##- any later version.
+##-
+##- This program is distributed in the hope that it will be useful,
+##- but WITHOUT ANY WARRANTY; without even the implied warranty of
+##- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+##- GNU General Public License for more details.
+##-
+##- You should have received a copy of the GNU General Public License
+##- along with this program; if not, write to the Free Software
+##- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+##- $Id$
+
+package packdrake;
+
+use strict;
+use warnings;
+use vars qw($VERSION);
+use Packdrakeng;
+our @ISA = qw(Packdrakeng);
+
+$VERSION = $Packdrakeng::VERSION;
+
+sub new {
+ my ($class, $file, %options) = @_;
+ my $pack = Packdrakeng->open(
+ %options,
+ archive => $file
+ ) or return undef;
+
+ bless($pack, $class);
+}
+
+sub extract_archive {
+ my ($pack, $dir, @files) = @_;
+ print @files;
+ if (! scalar(@files)) {
+ my ($d, $f, $l) = $pack->getcontent();
+ push(@files, @$d, @$f, @$l);
+ }
+ $pack->extract($dir, @files);
+}
+
+sub list_archive {
+ foreach my $archive (@_) {
+ my $pack = Packdrakeng->open(archive => $archive) or next;
+ $pack->list();
+ }
+}
+
+sub build_archive {
+ my ($listh, $dir, $archive, $size, $compress, $uncompress) = @_;
+ my ($comp_level) = $compress =~ m/ -(\d)(?:\s|$)/;
+ $compress =~ s/ -\d(\s|$)/$1/;
+ $uncompress =~ s/ -d(\s|$)/$1/;
+ my $pack = Packdrakeng->new(
+ archive => $archive,
+ compress => $compress,
+ uncompress => $uncompress,
+ bloc_size => $size,
+ comp_level => $comp_level,
+ ) or return;
+ while (my $line = <$listh>) {
+ chomp($line);
+ $pack->add($dir, $line) or return;
+ }
+}
+
+sub cat_archive {
+ foreach my $archive (@_) {
+ my $pack = Packdrakeng->open(archive => $archive) or next;
+ (undef, my $files, undef) = $pack->getcontent();
+ foreach (@$files) {
+ $pack->extract_virtual(\*STDOUT, $_);
+ }
+ }
+}
+
+1;
+
+__END__
+
+=head1 NAME
+
+packdrake - Simple Archive Extractor/Builder
+
+This module is provide for compatibility with old packdrake.
+
+=head1 SYNOPSIS
+
+ require packdrake;
+
+ packdrake::cat_archive("/export/media/media_info/hdlist.cz",
+ "/export/media/media_info/hdlist2.cz");
+ packdrake::list_archive("/tmp/modules.cz2");
+
+ my $packer = new packdrake("/tmp/modules.cz2");
+ $packer->extract_archive("/tmp", "file1.o", "file2.o");
+
+ my $packer = packdrake::build_archive
+ (\*STDIN, "/lib/modules", "/tmp/modules.cz2",
+ 400000, "bzip2", "bzip2 -d");
+ my $packer = packdrake::build_archive
+ (\*STDIN, "/export/media/media_info/hdlist.cz",
+ 400000, "gzip -9", "gzip -d");
+
+=head1 DESCRIPTION
+
+C<packdrake> is a very simple archive extractor and builder used by Mandrakesoft.
+
+=head1 SEE ALSO
+
+Packdrakeng
+
+=head1 FUNCTIONS
+
+=over
+
+=item B<new($file, %options)>
+
+Open the packdrake archive $file and return a packdrake object.
+Return undef on failure.
+
+=item B<packdrake->extract_archive($dir, @files)>
+
+Extract files list into the specified directory.
+
+=item B<packdrake::list_archive(@list)>
+
+List files packed into achives given.
+
+=item B<packdrake::build_archive($input, $dir, $archive, $blocsize, $compress, $uncompress)>
+
+Build a new archive:
+- $input is a file handle to find file list to pack
+- $dir is the directory based where file are located
+- $archive is the archive filename to create
+- $blocsize is the size of compressed bloc
+- $compress is the program to use to compress data
+- $uncompress is the program to use to uncompress data
+
+=item B<packdrake::cat_archive(@files)>
+
+Dump data to STDOUT of files given as parameters, or all files if no files are
+specified
+
+=back
+
+=head1 COPYRIGHT
+
+Copyright (C) 2000-2004 Mandrakesoft <nanardon@mandrake.org>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+=cut
+
diff --git a/rpmtools.spec b/rpmtools.spec
index a3e5944..96ea950 100644
--- a/rpmtools.spec
+++ b/rpmtools.spec
@@ -1,22 +1,16 @@
%define name rpmtools
-%define release 25mdk
+%define release 0.1mdk
# do not modify here, see Makefile in the CVS
-%define version 4.5
+%define version 5.0
%define group %(perl -e 'printf "%%s\\n", "%_vendor" =~ /mandrake/i ? "System/Configuration/Packaging" : "System Environment/Base"')
%define rpm_version %(rpm -q --queryformat '%{VERSION}-%{RELEASE}' rpm)
-%{expand:%%define rpm_define %%(perl -e 'printf "%%s\\n", ("%rpm_version" =~ /^(?:4\.[2-9]|[5-9]|\d{2})/ ? "-DRPM_42" : "")')}
-
-%{expand:%%define compat_makeinstall_std %(perl -e 'printf "%%s\n", "%{?makeinstall_std:1}" ? "%%makeinstall_std" : "%%{__make} install PREFIX=%%{buildroot}%%{_prefix}"')}
-%{expand:%%define compat_perl_vendorlib %(perl -MConfig -e 'printf "%%s\n", "%{?perl_vendorlib:1}" ? "%%{perl_vendorlib}" : "$Config{installvendorlib}"')}
-%{expand:%%define buildreq_perl_devel %%(perl -e 'printf "%%s\\n", "%_vendor" =~ /mandrake/i ? "perl-devel" : "perl"')}
-%{expand:%%define real_release %%(perl -e 'printf "%%s\\n", ("%_vendor" !~ /mandrake/i && ("%release" =~ /(.*?)mdk/)[0] || "%release")')}
Summary: Contains various rpm command-line tools
Name: %{name}
Version: %{version}
-Release: %{real_release}
+Release: %{release}
# get the source from our cvs repository (see
# http://www.linuxmandrake.com/en/cvs.php3)
Source0: %{name}-%{version}.tar.bz2
@@ -25,7 +19,8 @@ Group: %{group}
URL: http://cvs.mandrakesoft.com/cgi-bin/cvsweb.cgi/soft/rpmtools
BuildRoot: %{_tmppath}/%{name}-buildroot
Prefix: %{_prefix}
-BuildRequires: %{buildreq_perl_devel} rpm-devel >= 4.0.3 bzip2-devel
+BuildRequires: rpm-devel >= 4.0.3 bzip2-devel
+BuildRequires: perl-devel
Requires: rpm >= %{rpm_version} bzip2 >= 1.0 perl-URPM >= 0.94 perl-base >= 5.8.4
Conflicts: rpmtools-compat <= 2.0 rpmtools-devel <= 2.0
Provides: perl(packdrake)
@@ -34,21 +29,16 @@ Provides: perl(packdrake)
Various tools needed by urpmi and drakxtools for handling rpm files.
%prep
-%setup
+%setup -q
%build
-(
- cd packdrake-pm ;
- %{__perl} Makefile.PL INSTALLDIRS=vendor
- %{__make} OPTIMIZE="$RPM_OPT_FLAGS"
-)
-%{__make} CFLAGS="$RPM_OPT_FLAGS %{rpm_define}"
+%{__perl} Makefile.PL INSTALLDIRS=vendor
+%make OPTIMIZE="%optflags"
+%make test
%install
%{__rm} -rf %{buildroot}
-%{__make} install PREFIX=%{buildroot}
-%{compat_makeinstall_std} -C packdrake-pm
-%{__rm} -f %{buildroot}%{perl_archlib}/perllocal.pod
+%makeinstall_std
%clean
%{__rm} -rf %{buildroot}
@@ -59,10 +49,10 @@ Various tools needed by urpmi and drakxtools for handling rpm files.
%{_bindir}/parsehdlist
%{_bindir}/rpm2header
%{_bindir}/gendistrib
-%{_bindir}/distriblint
%{_bindir}/genhdlist
%{_bindir}/rpm2cpio.pl
-%{compat_perl_vendorlib}/packdrake.pm
+%{perl_vendorlib}/packdrake.pm
+%{perl_vendorlib}/Packdrakeng.pm
%{_mandir}/*/*
%changelog