diff --git a/build-scripts/package b/build-scripts/package index 4c3c0baa9..9a269d439 100755 --- a/build-scripts/package +++ b/build-scripts/package @@ -1,59 +1,83 @@ -#!/bin/sh -x +#!/bin/sh +# +# CFEngine package build script +# Creates distribution packages (RPM, DEB, Solaris, FreeBSD, HP-UX, MSI, AIX) from compiled CFEngine binaries +# Source common build functions and environment configuration . "$(dirname "$0")"/functions . detect-environment . compile-options . version -# Select what to build +# Determine package name and build options based on project type and role +log_debug "Determining package name for PROJECT=$PROJECT ROLE=$ROLE" case "$PROJECT-$ROLE" in community-*) + # Community edition package - basic CFEngine PKG=cfengine-community DEB_BUILD_OPTIONS= RPMBUILD_OPTIONS= + log_debug "Selected community package: $PKG" ;; nova-hub) + # Enterprise Hub package - includes things like Mission Portal PKG=cfengine-nova-hub DEB_BUILD_OPTIONS= RPMBUILD_OPTIONS="--define 'with_expansion 1'" + log_debug "Selected enterprise hub package: $PKG" ;; nova-agent) + # Enterprise Agent package - client-only installation PKG=cfengine-nova DEB_BUILD_OPTIONS= RPMBUILD_OPTIONS= + log_debug "Selected enterprise agent package: $PKG" ;; *) - echo "Unknown packaging type: $PROJECT-$ROLE" + log_error "Unknown packaging type: $PROJECT-$ROLE" exit 42 ;; esac +# Configure debug/release build options for different package formats +log_debug "Configuring build options for BUILD_TYPE=$BUILD_TYPE" case "$BUILD_TYPE" in DEBUG) + # Debug build - disable optimization, keep debug symbols DEB_BUILD_OPTIONS="$DEB_BUILD_OPTIONS noopt nostrip" RPMBUILD_OPTIONS="$RPMBUILD_OPTIONS --define 'with_optimize 0'" RPMBUILD_OPTIONS="$RPMBUILD_OPTIONS --define 'with_debugsym 1'" + log_debug "Debug build: DEB_BUILD_OPTIONS=$DEB_BUILD_OPTIONS" + log_debug "Debug build: RPMBUILD_OPTIONS=$RPMBUILD_OPTIONS" ;; RELEASE | CODE_COVERAGE) + # Release/Coverage build - keep symbols DEB_BUILD_OPTIONS="nostrip" + log_debug "Release/Coverage build: DEB_BUILD_OPTIONS=$DEB_BUILD_OPTIONS" ;; *) - echo "Unknown build type: $BUILD_TYPE" + log_error "Unknown build type: $BUILD_TYPE" exit 42 ;; esac -# Clean -devel packages, so their contents doesn't end up in our packages, set env variable for dev trouble shooting -if [ "x$LEAVE_DEVEL_PACKAGES" != "xyes" ]; then +# Remove development packages to prevent their contents from being included in production packages +# Can be skipped for debugging by setting LEAVE_DEVEL_PACKAGES=yes +if [ "$LEAVE_DEVEL_PACKAGES" != yes ]; then + log_debug "Removing development packages" uninstall_cfbuild_devel +else + log_debug "Leaving development packages (LEAVE_DEVEL_PACKAGES=yes)" fi -# Build it +# Path to packaging spec files and scripts P="$BASEDIR/buildscripts/packaging/$PKG" +# Enterprise Hub specific setup - configure fonts for PDF generation in Mission Portal ( if [ "$PROJECT-$ROLE" = "nova-hub" ]; then + log_debug "Configuring fonts for Enterprise Hub" if test -f "$BASEDIR/mission-portal/vendor/tecnickcom/tcpdf/tools/tcpdf_addfont.php"; then cd "$BASEDIR"/mission-portal # Add Red Hat Text font to TCPDF library that we use in Mission Portal for PDF generation @@ -65,91 +89,123 @@ P="$BASEDIR/buildscripts/packaging/$PKG" fi ) -if [ "$BUILDPREFIX" != "/var/cfengine" ]; then +# Handle custom installation prefix (default is /var/cfengine) +if [ "$BUILDPREFIX" != /var/cfengine ]; then + log_debug "Custom prefix detected: $BUILDPREFIX" safe_prefix="$(echo "$BUILDPREFIX" | sed -e 's:/::g')" file_to_patch=$P/../common/script-templates/$PACKAGING-script-common.sh if [ -f "$file_to_patch" ]; then - # replace PREFIX in *-script-common.sh file + # Update installation scripts to use custom prefix + log_debug "Patching script template: $file_to_patch" sed "s:/var/cfengine:$BUILDPREFIX:" "$file_to_patch" >"$file_to_patch".new mv "$file_to_patch".new "$file_to_patch" fi +else + log_debug "Using default prefix: /var/cfengine" fi +# Parse version string to separate main version from supplementary version +# Format: MAIN_VERSION~SUPP_VERSION (e.g., 3.27.0~build1) +log_debug "Parsing version string: $VERSION" case "$VERSION" in *~*) - # everything before the tilde - MAIN_VERSION="${VERSION%\~*}" - # everything after the tilde - SUPP_VERSION="${VERSION#*~}" + # Split on tilde character + MAIN_VERSION="${VERSION%\~*}" # everything before the tilde + SUPP_VERSION="${VERSION#*~}" # everything after the tilde + log_debug "Version components: MAIN_VERSION=$MAIN_VERSION, SUPP_VERSION=$SUPP_VERSION" ;; *) + # No tilde, use entire version as main MAIN_VERSION="${VERSION}" SUPP_VERSION="" + log_debug "Version components: MAIN_VERSION=$MAIN_VERSION (no supplementary version)" ;; esac +# Main packaging switch - handle different package formats based on target OS +log_debug "Starting packaging for system: $PACKAGING" case "$PACKAGING" in rpm | lpp) - mkdir -p "$BASEDIR/$PKG/BUILD" - mkdir -p "$BASEDIR/$PKG/RPMS" - mkdir -p "$BASEDIR/$PKG/SOURCES" - mkdir -p "$BASEDIR/$PKG/SRPMS" + # RPM packaging (Red Hat, SUSE) and LPP packaging (AIX) + log_debug "Creating RPM/LPP package for $PKG" + # Create standard RPM build directory structure + for _dir in BUILD RPMS SOURCES SRPMS; do + log_debug "Creating directory: $BASEDIR/$PKG/$_dir" + mkdir -p "$BASEDIR/$PKG/$_dir" + done + # Set paths for spec file and installation scripts SPEC="$P/$PKG.spec" PREINSTALL="$P/generated.preinstall" POSTINSTALL="$P/generated.postinstall" PREREMOVE="$P/generated.preremove" POSTREMOVE="$P/generated.postremove" + # Use AIX-specific spec template for LPP packaging if [ "$PACKAGING" = lpp ]; then SPECIN="$P/$PKG.spec.aix.in" + log_debug "Using AIX spec template: $SPECIN" else SPECIN="$P/$PKG.spec.in" + log_debug "Using RPM spec template: $SPECIN" fi + # Generate installation/removal scripts from templates + log_debug "Generating installation scripts" "$P/../common/produce-script" "$PKG" preinstall rpm >"$PREINSTALL" "$P/../common/produce-script" "$PKG" postinstall rpm >"$POSTINSTALL" "$P/../common/produce-script" "$PKG" preremove rpm >"$PREREMOVE" "$P/../common/produce-script" "$PKG" postremove rpm >"$POSTREMOVE" RPM_VERSION="$MAIN_VERSION" + log_debug "RPM_VERSION set to: $RPM_VERSION" - # Set RPM_RELEASE, which sets the "release" tag in the RPM spec - # file, which is an incremental version of the specific package in - # case it is rebuilt and re-released for any reason. + # Determine RPM release number based on build type and version info + # RPM_RELEASE is used for the "Release:" field in the spec file + # This allows rebuilds of the same version with incremental release numbers if [ -z "$SUPP_VERSION" ]; then - - if [ "$BUILD_TYPE" = "RELEASE" ]; then + # Standard versioning without supplementary version + if [ "$BUILD_TYPE" = RELEASE ]; then RPM_RELEASE="$RELEASE" + log_debug "Release build RPM_RELEASE: $RPM_RELEASE" else RPM_RELEASE="$BUILD_NUMBER" + log_debug "Non-release build RPM_RELEASE: $RPM_RELEASE" fi else - # SUPP_VERSION is the part of the git tag after the dash, e.g. build1 - - if [ "$BUILD_TYPE" = "RELEASE" ]; then + # Supplementary version present (e.g., build1) + if [ "$BUILD_TYPE" = RELEASE ]; then RPM_RELEASE="$SUPP_VERSION" + log_debug "Release build with supp version RPM_RELEASE: $RPM_RELEASE" else RPM_RELEASE="$SUPP_VERSION.$BUILD_NUMBER" + log_debug "Non-release build with supp version RPM_RELEASE: $RPM_RELEASE" fi fi - # determine the system-provided versions of dependencies we build against so we can Require them later in our RPM spec files. - if [ "$OS" = "rhel" ]; then + # These are used to set minimum required versions in the RPM spec + if [ "$OS" = rhel ]; then + log_debug "Detecting RHEL system dependencies" + # Get SELinux policy version for compatibility requirements SELINUX_POLICY_VERSION=$(rpm -q --qf '%{VERSION}\n' selinux-policy) if [ -z "$SELINUX_POLICY_VERSION" ]; then - echo "error: unable to determine selinux-policy package version" + log_error "Unable to determine selinux-policy package version" exit 1 fi + log_debug "SELinux policy version: $SELINUX_POLICY_VERSION" + # Get OpenSSL version to ensure compatibility OPENSSL_VERSION=$(rpm -q --provides openssl-libs | grep OPENSSL_ | sed 's/^.*_\([0-9.]*\).*$/\1/' | sort -n | tail -1) if [ -z "$OPENSSL_VERSION" ]; then - echo "error: unable to determine openssl package version" + log_error "Unable to determine OpenSSL package version" exit 1 fi + log_debug "OpenSSL version: $OPENSSL_VERSION" fi + # Generate RPM spec file from template, substituting version info and scripts + log_debug "Generating spec file: $SPEC" sed \ -e "s/@@VERSION@@/$RPM_VERSION/g" \ -e "s/@@RELEASE@@/$safe_prefix$RPM_RELEASE/g" \ @@ -161,6 +217,8 @@ rpm | lpp) -e "/^%postun\$/r $POSTREMOVE" \ "$SPECIN" >"$SPEC" + # Link all packaging files (except spec files) to SOURCES directory + log_debug "Linking packaging files to SOURCES directory" # shellcheck disable=SC2044 # TODO: CFE-4584 for i in $(find "$BASEDIR/buildscripts/packaging/$PKG" ! -name "*.spec"); do @@ -170,12 +228,10 @@ rpm | lpp) ) || false done - # eval and double quoting is needed to separate args, - # example cmd --define 'a b': - # - argv[1] = --define - # - argv[2] = a b - # Also note that $RPMBUILD_OPTIONS might have spaces - # which must be preserved + # Build the RPM package using rpmbuild + # eval is needed to preserve spaces in arguments within quotes + # Example: --define 'with_expansion 1' needs to be passed as two args + log_debug "Building RPM package with rpmbuild" eval rpmbuild -bb \ --define "'_topdir $BASEDIR/$PKG'" \ --define "'buildprefix $BUILDPREFIX'" \ @@ -183,122 +239,162 @@ rpm | lpp) "$RPMBUILD_OPTIONS" "$SPEC" if [ "$PACKAGING" = lpp ]; then - # Create AIX bff packages + # AIX-specific: Create BFF (Backup File Format) packages for AIX + log_debug "Creating AIX BFF package" chmod +x "$P/$PKG.bff.sh" "$P/$PKG.bff.sh" "$RPM_VERSION-$safe_prefix$RPM_RELEASE" "$BASEDIR" "$PREFIX" else - # Create TAR package + # Create generic TAR package for non-package-manager installations + log_debug "Creating generic TAR package" TARBALL="$BASEDIR/$PKG/RPMS/$PKG-$VERSION-$safe_prefix$RPM_RELEASE.$ARCH.pkg.tar.gz" - # RHEL4 and RHEL6 have buildroot in different folders. - # Below lines try to be careful about finding it. - # Note that `mv` command will fail and abort the build - # if it was found incorrectly (doesn't have expected subdirs) + log_debug "TAR package path: $TARBALL" + + # Navigate to build root cd "$BASEDIR/$PKG/" [ -d BUILDROOT ] && cd BUILDROOT - # test that there are 0 or 1 $PKG-* dirs - # note that * must be unquoted! + + # Find the package directory (should be exactly one) for p in "$PKG"-*; do if [ -d "$p" ]; then - # If there are more $PKG-* dirs, then the next cd will (most likely) fail cd "$p" || fatal "More than 1 $PKG-* dirs" fi done - # $LOCAL_PREFIX is $PREFIX without first slash, i.e. var/cfengine - # $LOCAL_DIR is first (outermost) dir in $LOCAL_PREFIX, i.e. var + + # Prepare directory structure for tar package + # Strip leading slash from PREFIX to get relative path LOCAL_PREFIX="$(echo "$PREFIX" | sed 's_^/__')" LOCAL_DIR="$(echo "$LOCAL_PREFIX" | sed 's_/.*__')" + + # Move system files to CFEngine's share directory mkdir -p "$LOCAL_PREFIX/share/usr/lib/systemd" mv usr/lib/systemd/system "$LOCAL_PREFIX/share/usr/lib/systemd/" mkdir -p "$LOCAL_PREFIX/share/etc" for dir in etc/init.d etc/sysconfig etc/profile.d; do test -d $dir && mv $dir "$LOCAL_PREFIX/share/etc" done + + # Create compressed tar archive and file list + log_debug "Creating tar archive: $TARBALL" tar czvf "$TARBALL" "$LOCAL_DIR" >"$TARBALL.filelist" fi ;; deb) - if [ "$BUILDPREFIX" != "/var/cfengine" ]; then - #change the base path of cfengine files + # Debian/Ubuntu package creation + log_debug "Creating Debian/Ubuntu package for $PKG" + # Update paths in debian control files for custom prefix + if [ "$BUILDPREFIX" != /var/cfengine ]; then + log_debug "Updating debian control files for custom prefix: $BUILDPREFIX" for i in "$P/debian"/*; do sed -i "s:/var/cfengine:$BUILDPREFIX:" "$i" done fi + # Prepare clean packaging directory + log_debug "Preparing clean packaging directory" rm -rf "$BASEDIR/$PKG/pkg" mkdir -p "$BASEDIR/$PKG/pkg" cp -a "$P"/* "$BASEDIR/$PKG/pkg" - if [ "$BUILD_TYPE" = "RELEASE" ]; then + # Set DEB version based on build type + if [ "$BUILD_TYPE" = RELEASE ]; then DEB_VERSION="$VERSION-$RELEASE" + log_debug "Release DEB version: $DEB_VERSION" else - DEB_VERSION="$VERSION~$BUILD_NUMBER" + DEB_VERSION="$VERSION~$BUILD_NUMBER" # Tilde ensures dev versions sort before release + log_debug "Development DEB version: $DEB_VERSION" fi - # on debian/ubuntu, $OS_VERSION contains too many details. - # leave only major version: - # 7.0 => 7 - # 16.04 => 16 + # Extract major version from OS_VERSION (e.g., 16.04 -> 16, 7.0 -> 7) + # This is appended to package name for OS-specific builds + # TODO: Define this in detect-environment script (CFE-4586) os_version_major="${OS_VERSION%%.*}" + log_debug "OS version major: $os_version_major" + # Generate debian changelog with version info + log_debug "Generating debian changelog" sed -e "s/@@VERSION@@/$DEB_VERSION$safe_prefix.$OS$os_version_major/" "$BASEDIR/$PKG/pkg/debian/changelog.in" >"$BASEDIR/$PKG/pkg/debian/changelog" + # Generate debian package maintainer scripts + log_debug "Generating debian maintainer scripts" "$P/../common/produce-script" "$PKG" preinstall deb >"$BASEDIR/$PKG/pkg/debian/$PKG.preinst" "$P/../common/produce-script" "$PKG" postinstall deb >"$BASEDIR/$PKG/pkg/debian/$PKG.postinst" "$P/../common/produce-script" "$PKG" preremove deb >"$BASEDIR/$PKG/pkg/debian/$PKG.prerm" "$P/../common/produce-script" "$PKG" postremove deb >"$BASEDIR/$PKG/pkg/debian/$PKG.postrm" + # Build the DEB package + log_debug "Building DEB package with dpkg-buildpackage" + log_debug "DEB_BUILD_OPTIONS: $DEB_BUILD_OPTIONS" ( cd "$BASEDIR/$PKG/pkg" export DEB_BUILD_OPTIONS="$DEB_BUILD_OPTIONS" - dpkg-buildpackage -b -us -uc -rfakeroot + dpkg-buildpackage -b -us -uc -rfakeroot # -b: binary only, -us/-uc: don't sign ) || false - # Create TAR package + # Also create generic TAR package for manual installation + log_debug "Creating generic TAR package for DEB build" TARBALL="$BASEDIR/$PKG/pkg/$PKG-$DEB_VERSION$safe_prefix.$ARCH.pkg.tar.gz" + log_debug "TAR package path: $TARBALL" cd "$BASEDIR/$PKG/pkg/debian/tmp/" - # $LOCAL_PREFIX is $PREFIX without first slash, i.e. var/cfengine - # $LOCAL_DIR is first (outermost) dir in $LOCAL_PREFIX, i.e. var + + # Prepare directory structure (same as RPM tar package) + # Strip leading slash from PREFIX to get relative path LOCAL_PREFIX="$(echo "$PREFIX" | sed 's_^/__')" LOCAL_DIR="$(echo "$LOCAL_PREFIX" | sed 's_/.*__')" + + # Move system files to CFEngine's share directory mkdir -p "$LOCAL_PREFIX/share/usr/lib/systemd" mv usr/lib/systemd/system "$LOCAL_PREFIX/share/usr/lib/systemd/" mkdir -p "$LOCAL_PREFIX/share/etc" for dir in etc/init.d etc/sysconfig etc/profile.d; do test -d $dir && mv $dir "$LOCAL_PREFIX/share/etc" done + + # Create compressed tar archive and file list tar czvf "$TARBALL" "$LOCAL_DIR" >"$TARBALL.filelist" ;; solaris) + # Solaris package creation + log_debug "Creating Solaris package for $PKG" + + # Prepare clean packaging directory + log_debug "Preparing clean packaging directory" sudo rm -rf "$BASEDIR/$PKG/pkg" mkdir -p "$BASEDIR/$PKG/pkg" + # Copy CFEngine files to package staging area + log_debug "Copying CFEngine files to staging area" rsync -lpr "$BASEDIR/cfengine/dist"/* "$BASEDIR/$PKG/pkg/" rsync -lpr "$PREFIX/bin"/* "$BASEDIR/$PKG/pkg$PREFIX/bin/" rsync -lpr "$PREFIX/lib"/* "$BASEDIR/$PKG/pkg$PREFIX/lib/" cd "$BASEDIR/$PKG/pkg" - # IMPORTANT: Before this step, do not copy any files into the current - # directory that shouldn't be in the package, otherwise they will be - # included as package files. + + # Generate package prototype file listing all files + # pkgproto scans the indicated paths and generates prototype(4) file entries that may be used as input to the pkgmk(1) command. + # IMPORTANT: Any files in current dir after this will be included in package + log_debug "Generating package prototype file" pkgproto .=/ >../prototype.tmp mv ../prototype.tmp . - # Paste several things together in the prototype. + # Build final prototype file with proper ownership ( - cat "$P/solaris/prototype.head" - # Replace last two words with "root root" and filter out directories that - # aren't ours. + cat "$P/solaris/prototype.head" # Package header info + # Set ownership to root:root and filter for CFEngine directories only sed -e 's/^\([fd].* \)[^ ][^ ]* *[^ ][^ ]*$/\1root root/' prototype.tmp | grep -E "^([^d]|d none $PREFIX)" ) >prototype + # Generate package info file ARCH="$(uname -p)" + log_debug "Solaris architecture: $ARCH" + log_debug "Generating package info file" sed -e "s/@@PKG@@/$PKG/g;s/@@ARCH@@/$ARCH/g;s/@@VERSION@@/$VERSION$safe_prefix/g" "$P/solaris/pkginfo.in" >"$BASEDIR/$PKG/pkg/pkginfo" + # Generate package installation scripts + log_debug "Generating Solaris package scripts" # shellcheck disable=SC2094 - # > Make sure not to read and write the same file in the same pipeline. - # The second argument is just treated as a "type" argument, the file is not read from. + # ^ The file is being created, not read "$P/../common/produce-script" "$PKG" preinstall pkg >preinstall # shellcheck disable=SC2094 "$P/../common/produce-script" "$PKG" postinstall pkg >postinstall @@ -307,63 +403,42 @@ solaris) # shellcheck disable=SC2094 "$P/../common/produce-script" "$PKG" postremove pkg >postremove + # Build the Solaris package + log_debug "Building Solaris package with pkgmk" pkgmk -o -r "$(pwd)" -d "$BASEDIR/$PKG/pkg" + + # Set package filename based on build type if [ "$BUILD_TYPE" = "RELEASE" ]; then NAME="$PKG-$VERSION.$RELEASE-solaris$OS_VERSION-$ARCH.pkg" + log_debug "Release package name: $NAME" else NAME="$PKG-$VERSION-solaris$OS_VERSION-$ARCH.pkg" + log_debug "Development package name: $NAME" fi - pkgtrans -o -s "$BASEDIR/$PKG/pkg" "$BASEDIR/$PKG/$NAME" "CFE$PKG" - ;; -freebsd) - rm -rf "$BASEDIR/$PKG/pkg" - mkdir -p "$BASEDIR/$PKG/pkg$PREFIX" - - cp -pr "$P/freebsd"/* "$BASEDIR/$PKG/pkg/" - cp -pr "$BASEDIR/cfengine/dist$PREFIX"/* "$BASEDIR/$PKG/pkg$PREFIX" - cp -pr "$PREFIX/bin"/* "$BASEDIR/$PKG/pkg$PREFIX/bin" - cp -pr "$PREFIX/lib"/* "$BASEDIR/$PKG/pkg$PREFIX/lib" - - cd "$BASEDIR/$PKG/pkg" - echo "@comment pkg-plist,v 1.00 $(date)" >>pkg-plist - echo "@comment ORIGIN:sysutils/cfengine-nova" >>pkg-plist - pkgdir="$BASEDIR/$PKG/pkg/" - for f in $(find "$BASEDIR/$PKG/pkg/" | grep -Ev 'pkg-comment|pkg-descr|pkg-plist.foot|pkg-plist'); do - - destf="${f#"$pkgdir"}" - if [ -f "$destf" ]; then - echo "$destf" >>pkg-plist - fi - done - cat pkg-plist.foot >>pkg-plist - - /usr/sbin/pkg_create -j -f "${pkgdir}/pkg-plist" -c "${pkgdir}/pkg-comment" -d "${pkgdir}/pkg-descr" -p "${pkgdir}" "${pkgdir}/cfengine-nova-$VERSION$safe_prefix\_1.tbz" - - cd "$pkgdir/" - - tar xvf "cfengine-nova-$VERSION\_1.tbz" - - head -n 2 ./+CONTENTS >plist-head - sed '1,3d' ./+CONTENTS >tmp - rm ./+CONTENTS - cat plist-head >CONTENTS - echo "@cwd /" >>CONTENTS - cat tmp >>CONTENTS - rm plist-head tmp - mv CONTENTS ./+CONTENTS - tar cjvf "cfengine-nova-$VERSION\_1.tbz" +CONTENTS +DESC +COMMENT -- * + # Create the final package file + log_debug "Creating final package with pkgtrans" + pkgtrans -o -s "$BASEDIR/$PKG/pkg" "$BASEDIR/$PKG/$NAME" "CFE$PKG" ;; hpux) + # HP-UX depot package creation + log_debug "Creating HP-UX depot package for $PKG" ARCH="$UNAME_M" OS_VER="$UNAME_R" + log_debug "HP-UX architecture: $ARCH, OS version: $OS_VER" + # Prepare clean packaging directory + log_debug "Preparing clean packaging directory" rm -rf "$BASEDIR/$PKG/pkg" mkdir -p "$BASEDIR/$PKG/pkg$PREFIX" + # Copy CFEngine distribution files + log_debug "Copying CFEngine distribution files" cp -pr "$BASEDIR/cfengine/dist"/* "$BASEDIR/$PKG/pkg" cp -pr "$PREFIX/lib"/* "$BASEDIR/$PKG/pkg$PREFIX/lib" + # Generate HP-UX depot installation scripts + log_debug "Generating HP-UX depot installation scripts" PREINSTALL="$BASEDIR/$PKG/pkg/generated.preinstall" POSTINSTALL="$BASEDIR/$PKG/pkg/generated.postinstall" PREREMOVE="$BASEDIR/$PKG/pkg/generated.preremove" @@ -376,20 +451,35 @@ hpux) cd "$BASEDIR/$PKG/pkg/" - if [ "$BUILD_TYPE" = "RELEASE" ]; then + # Set package filename based on build type + if [ "$BUILD_TYPE" = RELEASE ]; then NAME="$PKG-$VERSION.$RELEASE$safe_prefix-$OS_VER-$ARCH" + log_debug "Release package name: $NAME" else NAME="$PKG-$VERSION$safe_prefix-$OS_VER-$ARCH" + log_debug "Development package name: $NAME" fi + # Generate PSF (Product Specification File) for HP-UX + log_debug "Generating PSF (Product Specification File)" "$P/hpux/psf.pl" . "$PKG" "$VERSION" >"$BASEDIR/$PKG/$PKG-$VERSION$safe_prefix.psf" + + # Create HP-UX depot package using swpackage + log_debug "Creating HP-UX depot package with swpackage" /usr/sbin/swpackage -s "$BASEDIR/$PKG/$PKG-$VERSION$safe_prefix.psf" -x media_type=tape @ "$BASEDIR/$PKG/pkg/$NAME.depot" ;; msi) + # Windows MSI package creation + log_debug "Creating Windows MSI package for $PKG" + # Delegate to dedicated MSI packaging script + log_debug "Delegating to package-msi script" package-msi ;; *) - echo "Unknown packaging system: $PACKAGING" + # Unsupported packaging system + log_error "Unknown packaging system: $PACKAGING" exit 1 ;; esac + +log_debug "Package creation completed for $PKG"