From 27634a53cde3d71dd777487745195cfe306b0b1a Mon Sep 17 00:00:00 2001 From: Eric Dodd Date: Sat, 22 Jan 2022 20:28:31 -0500 Subject: [PATCH 1/2] parameterized rpmbuild dir --- .../SOURCES/sgug-rpm-tools.sgifixes.patch | 83 +++++++++++++++++++ .../sgug-rpm-tools/SPECS/sgug-rpm-tools.spec | 8 +- 2 files changed, 89 insertions(+), 2 deletions(-) create mode 100644 packages/sgug-rpm-tools/SOURCES/sgug-rpm-tools.sgifixes.patch diff --git a/packages/sgug-rpm-tools/SOURCES/sgug-rpm-tools.sgifixes.patch b/packages/sgug-rpm-tools/SOURCES/sgug-rpm-tools.sgifixes.patch new file mode 100644 index 000000000..3e8f4a692 --- /dev/null +++ b/packages/sgug-rpm-tools/SOURCES/sgug-rpm-tools.sgifixes.patch @@ -0,0 +1,83 @@ +diff -Naur sgug-rpm-tools-0.2.2.orig/src/sgug-rpm-tools/sgug_world_builder.cpp sgug-rpm-tools-0.2.2/src/sgug-rpm-tools/sgug_world_builder.cpp +--- sgug-rpm-tools-0.2.2.orig/src/sgug-rpm-tools/sgug_world_builder.cpp 2020-12-09 17:07:28.000000000 +0000 ++++ sgug-rpm-tools-0.2.2/src/sgug-rpm-tools/sgug_world_builder.cpp 2022-01-22 20:04:45.801896600 +0000 +@@ -315,15 +315,22 @@ + worldrebuilderfile << "sgug_rse_srpm_output_root=" << outputsrpm_p << endl; + worldrebuilderfile << "sgug_rse_rpm_output_root=" << outputrpm_p << endl; + ++ worldrebuilderfile << "_rpmbuild=$1" << endl; ++ worldrebuilderfile << "if [[ -z $_rpmbuild ]] ; then" << endl; ++ worldrebuilderfile << " echo 'Usage: ./worldrebuilder.sh /path/to/rpmbuild'" << endl; ++ worldrebuilderfile << " echo 'Note this DELETES the rpmbuild directory as its first action!'" << endl; ++ worldrebuilderfile << " exit 0" << endl; ++ worldrebuilderfile << "fi" << endl; ++ + worldrebuilderfile << "ORIG_WD=`pwd`" << endl; + worldrebuilderfile << "cleanUpDirs () {" << endl; +- worldrebuilderfile << " rm -rf ~/rpmbuild" << endl; +- worldrebuilderfile << " mkdir -p ~/rpmbuild/BUILD" << endl; +- worldrebuilderfile << " mkdir -p ~/rpmbuild/BUILDROOT" << endl; +- worldrebuilderfile << " mkdir -p ~/rpmbuild/RPMS" << endl; +- worldrebuilderfile << " mkdir -p ~/rpmbuild/SOURCES" << endl; +- worldrebuilderfile << " mkdir -p ~/rpmbuild/SPECS" << endl; +- worldrebuilderfile << " mkdir -p ~/rpmbuild/SRPMS" << endl; ++ worldrebuilderfile << " rm -rf ${_rpmbuild}" << endl; ++ worldrebuilderfile << " mkdir -p ${_rpmbuild}/BUILD" << endl; ++ worldrebuilderfile << " mkdir -p ${_rpmbuild}/BUILDROOT" << endl; ++ worldrebuilderfile << " mkdir -p ${_rpmbuild}/RPMS" << endl; ++ worldrebuilderfile << " mkdir -p ${_rpmbuild}/SOURCES" << endl; ++ worldrebuilderfile << " mkdir -p ${_rpmbuild}/SPECS" << endl; ++ worldrebuilderfile << " mkdir -p ${_rpmbuild}/SRPMS" << endl; + worldrebuilderfile << " mkdir -p $build_progress_dir" << endl; + worldrebuilderfile << " mkdir -p $sgug_rse_srpm_output_root" << endl; + worldrebuilderfile << " mkdir -p $sgug_rse_rpm_output_root/noarch" << endl; +@@ -335,23 +342,23 @@ + worldrebuilderfile << "}" << endl; + worldrebuilderfile << "copySgugGitPackage () {" << endl; + worldrebuilderfile << " sgugGitPackageRoot=$1" << endl; +- worldrebuilderfile << " cp -r $sgugGitPackageRoot/* ~/rpmbuild/" << endl; ++ worldrebuilderfile << " cp -r $sgugGitPackageRoot/* ${_rpmbuild}/" << endl; + worldrebuilderfile << "}" << endl; + worldrebuilderfile << "rpmbuildPackage () {" << endl; + worldrebuilderfile << " packageName=$1" << endl; +- worldrebuilderfile << " cd ~/rpmbuild/SPECS" << endl; ++ worldrebuilderfile << " cd ${_rpmbuild}/SPECS" << endl; + worldrebuilderfile << " rpmbuild -ba \"$packageName.spec\" --nocheck 1>$build_progress_dir/$packageName.log 2>&1" << endl; + worldrebuilderfile << " rpmrc=$?" << endl; + worldrebuilderfile << " cd $ORIG_WD" << endl; + worldrebuilderfile << " return $rpmrc" << endl; + worldrebuilderfile << "}" << endl; + worldrebuilderfile << "archiveBuiltArtefacts () {" << endl; +- worldrebuilderfile << " mv ~/rpmbuild/SRPMS/* $sgug_rse_srpm_output_root/" << endl; +- worldrebuilderfile << " if [[ -e ~/rpmbuild/RPMS/noarch ]]; then" << endl; +- worldrebuilderfile << " mv ~/rpmbuild/RPMS/noarch/* $sgug_rse_rpm_output_root/noarch/" << endl; ++ worldrebuilderfile << " mv ${_rpmbuild}/SRPMS/* $sgug_rse_srpm_output_root/" << endl; ++ worldrebuilderfile << " if [[ -e ${_rpmbuild}/RPMS/noarch ]]; then" << endl; ++ worldrebuilderfile << " mv ${_rpmbuild}/RPMS/noarch/* $sgug_rse_rpm_output_root/noarch/" << endl; + worldrebuilderfile << " fi" << endl; +- worldrebuilderfile << " if [[ -e ~/rpmbuild/RPMS/mips ]]; then" << endl; +- worldrebuilderfile << " mv ~/rpmbuild/RPMS/mips/* $sgug_rse_rpm_output_root/mips/" << endl; ++ worldrebuilderfile << " if [[ -e ${_rpmbuild}/RPMS/mips ]]; then" << endl; ++ worldrebuilderfile << " mv ${_rpmbuild}/RPMS/mips/* $sgug_rse_rpm_output_root/mips/" << endl; + worldrebuilderfile << " fi" << endl; + worldrebuilderfile << "}" << endl; + worldrebuilderfile << "doPackageBuild () {" << endl; +@@ -387,15 +394,15 @@ + const string & srpm = package_to_srpm_map[name]; + worldrebuilderfile << "doPackageBuild '" << name << "' '" << + srpm << "'" << endl; +- // worldrebuilderfile << "touch ~/rpmbuild/PROGRESS/" << name << ".start" << ++ // worldrebuilderfile << "touch ${_rpmbuild}/PROGRESS/" << name << ".start" << + // endl; + // worldrebuilderfile << "rpmbuild -ba " << name << ".spec --nocheck" << + // endl; + // worldrebuilderfile << "if [[ $? -ne 0 ]]; then" << endl; +- // worldrebuilderfile << " touch ~/rpmbuild/PROGRESS/" << name << ++ // worldrebuilderfile << " touch ${_rpmbuild}/PROGRESS/" << name << + // ".failed" << endl; + // worldrebuilderfile << "fi" << endl; +- // worldrebuilderfile << "touch ~/rpmbuild/PROGRESS/" << name << ".done" << ++ // worldrebuilderfile << "touch ${_rpmbuild}/PROGRESS/" << name << ".done" << + // endl; + } + diff --git a/packages/sgug-rpm-tools/SPECS/sgug-rpm-tools.spec b/packages/sgug-rpm-tools/SPECS/sgug-rpm-tools.spec index 7fc7b931b..953084fdd 100644 --- a/packages/sgug-rpm-tools/SPECS/sgug-rpm-tools.spec +++ b/packages/sgug-rpm-tools/SPECS/sgug-rpm-tools.spec @@ -9,11 +9,12 @@ Summary: SGUG RPM Tools Name: sgug-rpm-tools -Version: 0.2.2 +Version: 0.2.3 Release: 1%{?dist} License: GPLv3+ URL: https://github.com/sgidevnet/sgug-rpm-tools Source: https://github.com/sgidevnet/sgug-rpm-tools/releases/download/v%{version}/sgug-rpm-tools-%{version}.tar.gz +Patch100: sgug-rpm-tools.sgifixes.patch BuildRequires: g++ BuildRequires: automake, autoconf, libtool, pkgconfig @@ -23,7 +24,7 @@ BuildRequires: rpm-build, rpm-devel Some utility programs to help with release / dependency management. %prep -%setup -q +%autosetup -p1 %build %if 0%{debug} @@ -45,6 +46,9 @@ make install DESTDIR=$RPM_BUILD_ROOT prefix=%{_prefix} INSTALL='install -p' %{_bindir}/sgug_world_builder %changelog +* Sat Jan 22 2022 Eric Dodd - 0.2.3 +- Added rpmbuild dir parameter for worldrebuilder.sh for safety + * Thu Dec 17 2020 Daniel Hams - 0.2.2 - Upgrade to 0.2.2 with info and desktop-file-utils in minimal From 1c52f0e6bb02c0fced370b0392242ebccf95e3cf Mon Sep 17 00:00:00 2001 From: Eric Dodd Date: Sun, 23 Jan 2022 19:49:17 -0500 Subject: [PATCH 2/2] forcing to be used by rpm and rpmbuild --- .../SOURCES/sgug-rpm-tools.sgifixes.patch | 28 +++++++++++++++---- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/packages/sgug-rpm-tools/SOURCES/sgug-rpm-tools.sgifixes.patch b/packages/sgug-rpm-tools/SOURCES/sgug-rpm-tools.sgifixes.patch index 3e8f4a692..e22d39759 100644 --- a/packages/sgug-rpm-tools/SOURCES/sgug-rpm-tools.sgifixes.patch +++ b/packages/sgug-rpm-tools/SOURCES/sgug-rpm-tools.sgifixes.patch @@ -1,14 +1,24 @@ diff -Naur sgug-rpm-tools-0.2.2.orig/src/sgug-rpm-tools/sgug_world_builder.cpp sgug-rpm-tools-0.2.2/src/sgug-rpm-tools/sgug_world_builder.cpp --- sgug-rpm-tools-0.2.2.orig/src/sgug-rpm-tools/sgug_world_builder.cpp 2020-12-09 17:07:28.000000000 +0000 -+++ sgug-rpm-tools-0.2.2/src/sgug-rpm-tools/sgug_world_builder.cpp 2022-01-22 20:04:45.801896600 +0000 -@@ -315,15 +315,22 @@ ++++ sgug-rpm-tools-0.2.2/src/sgug-rpm-tools/sgug_world_builder.cpp 2022-01-23 19:43:00.460553000 +0000 +@@ -304,10 +304,6 @@ + worldrebuilderfile.open("worldrebuilder.sh"); + worldrebuilderfile << "#!/usr/sgug/bin/bash" << endl; + worldrebuilderfile << "# This script should be run as your user!" << endl; +- worldrebuilderfile << "echo 'This script is SUPER DESTRUCTIVE.'" << endl; +- worldrebuilderfile << "echo 'So you must edit it which confirms you'" << endl; +- worldrebuilderfile << "echo 'agree with what it will do.'" << endl; +- worldrebuilderfile << "exit 1" << endl; + worldrebuilderfile << "# Some useful variables" << endl; + worldrebuilderfile << "build_progress_dir=" << buildprogress_p << endl; + worldrebuilderfile << "sgug_rse_srpm_archive_root=" << inputsrpm_p << endl; +@@ -315,15 +311,21 @@ worldrebuilderfile << "sgug_rse_srpm_output_root=" << outputsrpm_p << endl; worldrebuilderfile << "sgug_rse_rpm_output_root=" << outputrpm_p << endl; + worldrebuilderfile << "_rpmbuild=$1" << endl; + worldrebuilderfile << "if [[ -z $_rpmbuild ]] ; then" << endl; + worldrebuilderfile << " echo 'Usage: ./worldrebuilder.sh /path/to/rpmbuild'" << endl; -+ worldrebuilderfile << " echo 'Note this DELETES the rpmbuild directory as its first action!'" << endl; + worldrebuilderfile << " exit 0" << endl; + worldrebuilderfile << "fi" << endl; + @@ -31,7 +41,12 @@ diff -Naur sgug-rpm-tools-0.2.2.orig/src/sgug-rpm-tools/sgug_world_builder.cpp s worldrebuilderfile << " mkdir -p $build_progress_dir" << endl; worldrebuilderfile << " mkdir -p $sgug_rse_srpm_output_root" << endl; worldrebuilderfile << " mkdir -p $sgug_rse_rpm_output_root/noarch" << endl; -@@ -335,23 +342,23 @@ +@@ -331,27 +333,27 @@ + worldrebuilderfile << "}" << endl; + worldrebuilderfile << "installSrpm () {" << endl; + worldrebuilderfile << " packageSrpmfile=$1" << endl; +- worldrebuilderfile << " rpm -ivh $packageSrpmfile" << endl; ++ worldrebuilderfile << " rpm --define "_topdir ${_rpmbuild}" -ivh $packageSrpmfile" << endl; worldrebuilderfile << "}" << endl; worldrebuilderfile << "copySgugGitPackage () {" << endl; worldrebuilderfile << " sgugGitPackageRoot=$1" << endl; @@ -41,8 +56,9 @@ diff -Naur sgug-rpm-tools-0.2.2.orig/src/sgug-rpm-tools/sgug_world_builder.cpp s worldrebuilderfile << "rpmbuildPackage () {" << endl; worldrebuilderfile << " packageName=$1" << endl; - worldrebuilderfile << " cd ~/rpmbuild/SPECS" << endl; +- worldrebuilderfile << " rpmbuild -ba \"$packageName.spec\" --nocheck 1>$build_progress_dir/$packageName.log 2>&1" << endl; + worldrebuilderfile << " cd ${_rpmbuild}/SPECS" << endl; - worldrebuilderfile << " rpmbuild -ba \"$packageName.spec\" --nocheck 1>$build_progress_dir/$packageName.log 2>&1" << endl; ++ worldrebuilderfile << " rpmbuild --define "_topdir ${_rpmbuild}" -ba \"$packageName.spec\" --nocheck 1>$build_progress_dir/$packageName.log 2>&1" << endl; worldrebuilderfile << " rpmrc=$?" << endl; worldrebuilderfile << " cd $ORIG_WD" << endl; worldrebuilderfile << " return $rpmrc" << endl; @@ -62,7 +78,7 @@ diff -Naur sgug-rpm-tools-0.2.2.orig/src/sgug-rpm-tools/sgug_world_builder.cpp s worldrebuilderfile << " fi" << endl; worldrebuilderfile << "}" << endl; worldrebuilderfile << "doPackageBuild () {" << endl; -@@ -387,15 +394,15 @@ +@@ -387,15 +389,15 @@ const string & srpm = package_to_srpm_map[name]; worldrebuilderfile << "doPackageBuild '" << name << "' '" << srpm << "'" << endl;