From ab1d5af38bb1d9133ebece45760d7d0af642d976 Mon Sep 17 00:00:00 2001 From: Olivier Thauvin Date: Mon, 6 Dec 2004 23:27:42 +0000 Subject: - 5.0.0 - more test and fix --- MANIFEST | 1 + Makefile | 844 -------------------------------------------------------- Makefile.PL | 14 +- Packdrakeng.pm | 160 ++++++----- packdrake.pm | 9 +- rpmtools.spec | 8 +- t/02packdrake.t | 66 +++++ 7 files changed, 172 insertions(+), 930 deletions(-) delete mode 100644 Makefile create mode 100755 t/02packdrake.t diff --git a/MANIFEST b/MANIFEST index 4155599..8b40b02 100644 --- a/MANIFEST +++ b/MANIFEST @@ -5,6 +5,7 @@ packdrake Packdrakeng.pm packdrake.pm t/01packdrakeng.t +t/02packdrake.t parsehdlist.c rpm2header.c Makefile.PL diff --git a/Makefile b/Makefile deleted file mode 100644 index a6a04ba..0000000 --- a/Makefile +++ /dev/null @@ -1,844 +0,0 @@ -# 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 -INCRPM = -I/usr/include/rpm -RPMTOOLSVERSION = 5.0 -FROMCC_STATIC = $(FROMCC:%=%_static) -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: - - -# --- MakeMaker installbin section: - -$(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) '' > $(DISTNAME).ppd - $(NOECHO) $(ECHO) ' $(DISTNAME)' >> $(DISTNAME).ppd - $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd - $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd - $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd - $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd - $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd - $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd - $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd - $(NOECHO) $(ECHO) '' >> $(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) $(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 - - -# End. diff --git a/Makefile.PL b/Makefile.PL index 289b915..ef7a4b5 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -3,7 +3,7 @@ # use 5.008; use ExtUtils::MakeMaker; -my $rpmtools_version = '5.0'; +my $rpmtools_version = '5.0.0'; sub MY::postamble { < $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', diff --git a/Packdrakeng.pm b/Packdrakeng.pm index 0504ec4..ce4c86a 100644 --- a/Packdrakeng.pm +++ b/Packdrakeng.pm @@ -51,7 +51,7 @@ sub _new { level => $options{comp_level} || 6, # compression level, aka -X gzip or bzip option - bloc_size => $options{bloc_size} || 400 * 1024, # A compressed bloc will contain 400k of compressed data + block_size => $options{block_size} || 400 * 1024, # A compressed block will contain 400k of compressed data bufsize => $options{bufsize} || 65536, # Arbitrary buffer size to read files # Internal data @@ -70,10 +70,10 @@ sub _new { direct_write => 0, # Define if wrapper write directly in archive and not into temp file # Data we need keep in memory to achieve the storage - current_bloc_files => {}, # Files in pending compressed bloc - current_bloc_csize => 0, # Actual size in pending compressed bloc - current_bloc_coff => 0, # The bloc bloc location (offset) - current_bloc_off => 0, # Actual uncompressed file offset within the pending bloc + current_block_files => {}, # Files in pending compressed block + current_block_csize => 0, # Actual size in pending compressed block + current_block_coff => 0, # The block block location (offset) + current_block_off => 0, # Actual uncompressed file offset within the pending block cstream_data => undef, # Wrapper data we need to keep in memory (compression) ustream_data => undef, # Wrapper data we need to keep in memory (uncompression) @@ -92,7 +92,7 @@ sub new { sysopen($pack->{handle}, $pack->{filename}, O_WRONLY | O_TRUNC | O_CREAT) or return undef; $pack->choose_compression_method(); $pack->{need_build_toc} = 1; - $pack->{log}->("Creating new archive with '%s' / '%s'%s.", + $pack->{debug}->("Creating new archive with '%s' / '%s'%s.", $pack->{compress_method}, $pack->{uncompress_method}, $pack->{use_extern} ? "" : " (internal compression)"); $pack @@ -103,7 +103,7 @@ sub open { my $pack = _new($class, %options); sysopen($pack->{handle}, $pack->{filename}, O_RDONLY) or return undef; $pack->read_toc() or return undef; - $pack->{log}->("Opening archive with '%s' / '%s'%s.", + $pack->{debug}->("Opening archive with '%s' / '%s'%s.", $pack->{compress_method}, $pack->{uncompress_method}, $pack->{use_extern} ? "" : " (internal compression)"); $pack @@ -142,39 +142,58 @@ sub DESTROY { close($pack->{handle}) if ($pack->{handle}); } -# Flush current compressed bloc +# Flush current compressed block # Write sub build_toc { my ($pack) = @_; $pack->{need_build_toc} or return 1; - $pack->end_bloc(); - $pack->end_seek(); + $pack->end_block(); + $pack->end_seek() or do { + warn "Can't seek into archive"; + return 0; + }; my ($toc_length, $cf, $cd, $cl) = (0, 0, 0, 0); - sysseek($pack->{handle}, $pack->{coff}, 0) == $pack->{coff} or return 0; - foreach my $entry (keys %{$pack->{'dir'}}) { $cd++; - $toc_length += syswrite($pack->{handle}, $entry . "\n"); + my $w = syswrite($pack->{handle}, $entry . "\n") or do { + warn "Can't write toc into archive"; + return 0; + }; + $toc_length += $w; } foreach my $entry (keys %{$pack->{'symlink'}}) { $cl++; - $toc_length += syswrite($pack->{handle}, sprintf("%s\n%s\n", $entry, $pack->{'symlink'}{$entry})); - } + my $w = syswrite($pack->{handle}, sprintf("%s\n%s\n", $entry, $pack->{'symlink'}{$entry})) or do { + warn "Can't write toc into archive"; + return 0; + }; + $toc_length += $w + } foreach my $entry (sort keys %{$pack->{files}}) { $cf++; - $toc_length += syswrite($pack->{handle}, $entry ."\n"); + my $w = syswrite($pack->{handle}, $entry ."\n") or do { + warn "Can't write toc into archive"; + return 0; + }; + $toc_length += $w; } foreach my $file (sort keys %{$pack->{files}}) { my $entry = $pack->{files}{$file}; - syswrite($pack->{handle}, pack('NNNN', $entry->{coff}, $entry->{csize}, $entry->{off}, $entry->{size})) or return 0; + syswrite($pack->{handle}, pack('NNNN', $entry->{coff}, $entry->{csize}, $entry->{off}, $entry->{size})) or do { + warn "Can't write toc into archive"; + return 0; + }; } syswrite($pack->{handle}, pack("a4NNNNa40a4", $toc_header, $cd, $cl, $cf, $toc_length, $pack->{uncompress_method}, - $toc_footer)) or return 0; + $toc_footer)) or do { + warn "Can't write toc into archive"; + return 0; + }; 1 } @@ -222,27 +241,27 @@ sub read_toc { # Goto to the end of written compressed data sub end_seek { my ($pack) = @_; - my $seekvalue = $pack->{direct_write} ? $pack->{coff} + $pack->{current_bloc_csize} : $pack->{coff}; + my $seekvalue = $pack->{direct_write} ? $pack->{coff} + $pack->{current_block_csize} : $pack->{coff}; sysseek($pack->{handle}, $seekvalue, 0) == $seekvalue } -#- To terminate a compressed bloc, flush the pending compressed data, +#- To terminate a compressed block, flush the pending compressed data, #- fill toc data still unknown -sub end_bloc { +sub end_block { my ($pack) = @_; $pack->end_seek() or return 0; my $m = $pack->{subcompress}; my (undef, $csize) = $pack->$m(undef); - $pack->{current_bloc_csize} += $csize; - foreach (keys %{$pack->{current_bloc_files}}) { - $pack->{files}{$_} = $pack->{current_bloc_files}{$_}; - $pack->{files}{$_}{csize} = $pack->{current_bloc_csize}; + $pack->{current_block_csize} += $csize; + foreach (keys %{$pack->{current_block_files}}) { + $pack->{files}{$_} = $pack->{current_block_files}{$_}; + $pack->{files}{$_}{csize} = $pack->{current_block_csize}; } - $pack->{coff} += $pack->{current_bloc_csize}; - $pack->{current_bloc_coff} += $pack->{current_bloc_csize}; - $pack->{current_bloc_csize} = 0; - $pack->{current_bloc_files} = {}; - $pack->{current_bloc_off} = 0; + $pack->{coff} += $pack->{current_block_csize}; + $pack->{current_block_coff} += $pack->{current_block_csize}; + $pack->{current_block_csize} = 0; + $pack->{current_block_files} = {}; + $pack->{current_block_off} = 0; } ####################### @@ -256,15 +275,15 @@ sub extern_compress { if (defined($pack->{cstream_data})) { $hout = $pack->{cstream_data}{hout}; - $filesize = (stat($pack->{cstream_data}{file_bloc}))[7]; + $filesize = (stat($pack->{cstream_data}{file_block}))[7]; } if (defined($sourcefh)) { if (!defined($pack->{cstream_data})) { my $hin; - ($hin, $pack->{cstream_data}{file_bloc}) = tempfile(); + ($hin, $pack->{cstream_data}{file_block}) = tempfile(); close($hin); # ensure the flush $pack->{cstream_data}{pid} = CORE::open($hout, - "|$pack->{compress_method} > $pack->{cstream_data}{file_bloc}") or do { + "|$pack->{compress_method} > $pack->{cstream_data}{file_block}") or do { warn "Unable to start $pack->{compress_method}"; return 0, 0; }; @@ -278,18 +297,18 @@ sub extern_compress { warn "can't push all data to compressor"; }; $insize += $l; - $outsize = (stat($pack->{cstream_data}{file_bloc}))[7]; + $outsize = (stat($pack->{cstream_data}{file_block}))[7]; } } elsif (defined($pack->{cstream_data})) { - # If $sourcefh is not set, this mean we want a flush(), for end_bloc() + # If $sourcefh is not set, this mean we want a flush(), for end_block() close($hout); waitpid $pack->{cstream_data}{pid}, 0; - sysopen(my $hin, $pack->{cstream_data}{file_bloc}, O_RDONLY) or do { - warn "Can't open temp bloc file"; + sysopen(my $hin, $pack->{cstream_data}{file_block}, O_RDONLY) or do { + warn "Can't open temp block file"; return 0, 0; }; - $outsize = (stat($pack->{cstream_data}{file_bloc}))[7]; - unlink($pack->{cstream_data}{file_bloc}); + $outsize = (stat($pack->{cstream_data}{file_block}))[7]; + unlink($pack->{cstream_data}{file_block}); while (my $lenght = sysread($hin, my $data, $pack->{bufsize})) { (my $l = syswrite($pack->{handle}, $data)) == $lenght or do { warn "Can't write all data in archive"; @@ -298,13 +317,13 @@ sub extern_compress { close($hin); $pack->{cstream_data} = undef; } - ($insize, $outsize - $pack->{current_bloc_csize}) + ($insize, $outsize - $pack->{current_block_csize}) } sub extern_uncompress { my ($pack, $destfh, $fileinfo) = @_; - # We have to first extract the bloc to a temp file, burk ! + # We have to first extract the block to a temp file, burk ! my ($tempfh, $tempname) = tempfile(); my $cread = 0; @@ -371,7 +390,7 @@ sub gzip_compress { my ($pack, $sourcefh) = @_; my ($insize, $outsize) = (0, 0); # aka uncompressed / compressed data length - # If $sourcefh is not set, this mean we want a flush(), for end_bloc() + # If $sourcefh is not set, this mean we want a flush(), for end_block() # EOF, flush compress stream, adding crc if (!defined($sourcefh)) { if (defined($pack->{cstream_data}{object})) { @@ -490,8 +509,8 @@ sub gzip_uncompress { # Debug functions # ################### -# This function extract in $dest the whole bloc containing $file, can be usefull for debugging -sub extract_bloc { +# This function extract in $dest the whole block containing $file, can be usefull for debugging +sub extract_block { my ($pack, $dest, $file) = @_; sysopen(my $handle, $dest, O_WRONLY | O_TRUNC | O_CREAT) or do { @@ -549,19 +568,19 @@ sub add_virtual { my $m = $pack->{subcompress}; my ($size, $csize) = $pack->$m($data); - $pack->{current_bloc_files}{$filename} = { + $pack->{current_block_files}{$filename} = { size => $size, - off => $pack->{current_bloc_off}, - coff => $pack->{current_bloc_coff}, - csize => -1, # Still unknown, will be fill by end_bloc + off => $pack->{current_block_off}, + coff => $pack->{current_block_coff}, + csize => -1, # Still unknown, will be fill by end_block }; # Storing in toc structure availlable info - # Updating internal info about current bloc - $pack->{current_bloc_off} += $size; - $pack->{current_bloc_csize} += $csize; + # Updating internal info about current block + $pack->{current_block_off} += $size; + $pack->{current_block_csize} += $csize; $pack->{need_build_toc} = 1; - if ($pack->{bloc_size} > 0 && $pack->{current_bloc_csize} >= $pack->{bloc_size}) { - $pack->end_bloc(); + if ($pack->{block_size} > 0 && $pack->{current_block_csize} >= $pack->{block_size}) { + $pack->end_block(); } return 1; }; @@ -570,25 +589,30 @@ sub add_virtual { sub add { my ($pack, $prefix, @files) = @_; - $prefix ||= ""; $prefix =~ s://+:/:; + $prefix ||= ""; foreach my $file (@files) { $file =~ s://+:/:; my $srcfile = $prefix ? "$prefix/$file" : $file; + $pack->{debug}->("Adding '%s' as '%s' into archive", $srcfile, $file); - -l $file and do { + -l $srcfile and do { $pack->add_virtual('l', $file, readlink($srcfile)); next; }; - -d $file and do { # dir simple case + -d $srcfile and do { # dir simple case $pack->add_virtual('d', $file); next; }; - -f $file and do { - sysopen(my $htocompress, $srcfile, O_RDONLY) or next; + -f $srcfile and do { + sysopen(my $htocompress, $srcfile, O_RDONLY) or do { + warn "Can't add $srcfile: $!"; + next; + }; $pack->add_virtual('f', $file, $htocompress); close($htocompress); next; }; + warn "Can't pack $srcfile"; } 1 } @@ -731,7 +755,7 @@ fully compatible with old packdrake. =head1 IMPLEMENTATION -Compressed data are stored by bloc: +Compressed data are stored by block: UncompresseddatA1UncompresseddatA2 UncompresseddatA3UncompresseddatA4 |--- size 1 ---||--- size 2 ---| |--- size 3 ---||--- size 4 ---| @@ -743,7 +767,7 @@ give: |--- c. size 1, 2 ---| |--- c. size 3, 4 ---| |<-c. offset 1, 2 |<-c. offset 3, 4 -A new bloc is started when its size exceed the C value. +A new block is started when its size exceed the C value. Compressed data are followed by the toc, ie a simple list of packed files. Each file name is terminated by the "\n" character: @@ -766,8 +790,8 @@ file2 fileN Follow the files sizes, 4 values for each files are stored: -offset into archive of compressed bloc, size of compressed bloc, -offset into bloc of the file and the file's size. +offset into archive of compressed block, size of compressed block, +offset into block of the file and the file's size. Finally the archive contain a 64 bytes length trailer, about the toc and the archive itself: @@ -817,11 +841,11 @@ yet. The compression level passed as an argument to the compression program. By default, this is set to 6. -=item bloc_size +=item block_size -The limit size after which we start a new compressed bloc. The default value is -400KB. Set it to 0 to be sure a new bloc will be started for each packed -files, and -1 to never start a new bloc. Be aware a big size of bloc will slow +The limit size after which we start a new compressed block. The default value is +400KB. Set it to 0 to be sure a new block will be started for each packed +files, and -1 to never start a new block. Be aware a big size of block will slow the file extraction. =item quiet @@ -841,8 +865,8 @@ Open an existing archive for extracting or adding files. The uncompression command is found into the archive, and the compression command is deduced from it. -If you add files, a new compressed bloc will be started even if the -last bloc is smaller than C. If some compression options can't be +If you add files, a new compressed block will be started even if the +last block is smaller than C. If some compression options can't be found in the archive, the new preference will be applied. Options are same than the C function. diff --git a/packdrake.pm b/packdrake.pm index 6ba51c4..e463f3e 100644 --- a/packdrake.pm +++ b/packdrake.pm @@ -38,7 +38,6 @@ sub new { sub extract_archive { my ($pack, $dir, @files) = @_; - print @files; if (! scalar(@files)) { my ($d, $f, $l) = $pack->getcontent(); push(@files, @$d, @$f, @$l); @@ -57,18 +56,18 @@ 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, + block_size => $size, comp_level => $comp_level, ) or return; while (my $line = <$listh>) { chomp($line); $pack->add($dir, $line) or return; } + 1 } sub cat_archive { @@ -134,13 +133,13 @@ Extract files list into the specified directory. List files packed into achives given. -=item B +=item B 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 +- $blocksize is the size of compressed block - $compress is the program to use to compress data - $uncompress is the program to use to uncompress data diff --git a/rpmtools.spec b/rpmtools.spec index 96ea950..a9aab62 100644 --- a/rpmtools.spec +++ b/rpmtools.spec @@ -1,8 +1,8 @@ %define name rpmtools -%define release 0.1mdk +%define release 1mdk # do not modify here, see Makefile in the CVS -%define version 5.0 +%define version 5.0.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) @@ -56,6 +56,10 @@ Various tools needed by urpmi and drakxtools for handling rpm files. %{_mandir}/*/* %changelog +* Mon Dec 06 2004 Olivier Thauvin 5.0.0-1mdk +- 5.0.0 +- Packdrakeng, new code + * Thu Sep 02 2004 Rafael Garcia-Suarez 4.5-25mdk - Make rpm tools handle new keywords in hdlists file. diff --git a/t/02packdrake.t b/t/02packdrake.t new file mode 100755 index 0000000..26fef2f --- /dev/null +++ b/t/02packdrake.t @@ -0,0 +1,66 @@ +#!/usr/bin/perl + +# $Id$ + +use strict; +use Test::More tests => 7; +use Digest::MD5; + +use_ok('packdrake'); + +-d "test" || mkdir "test" or die "Can't create directory test"; + +my $coin = " + ___________ +< Coin coin > + ----------- + \ ,~~. + \ __( o ) + `--'==( ___/) + ( ( . / + \ '-' / + ~'`~'`~'`~'`~ +"; + +sub clean_test_files { + -d "test" or return; + system("rm -fr $_") foreach (glob("test/*")); +} + +clean_test_files(); + +mkdir "test/dir" or die "Can't create 'test/dir'"; +open(my $fh, "> test/file") or die "Can't create 'test/file'"; +print $fh $coin; +close $fh; + +symlink("file", "test/link") or die "Can't create symlink 'test/link'"; + +open($fh, "> test/list") or die "can't open 'test/list'"; +print($fh join("\n", qw(dir file link)) ."\n"); +close($fh); + +open(my $listh, "< test/list"); +ok(packdrake::build_archive( + $listh, + "test", + "packtest.cz", + 400_000, + "gzip -9", + "gzip -d", +), "Creating a packdrake archive"); +close($listh); + +clean_test_files(); + +my $pack = packdrake->new("packtest.cz"); +ok($pack->extract_archive("test", qw(dir file link)), "Extracting files from archive"); + +ok(open($fh, "test/file"), "Opening extract file"); +sysread($fh, my $data, 1_000); +ok($data == $coin, "data succefully restored"); +ok(-d "test/dir", "dir succefully restored"); +ok(readlink("test/link") eq "file", "symlink succefully restored"); + +clean_test_files(); + -- cgit v1.2.1