diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0a57992 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/scl-utils-20130529.tar.gz diff --git a/.scl-utils.metadata b/.scl-utils.metadata new file mode 100644 index 0000000..c50652f --- /dev/null +++ b/.scl-utils.metadata @@ -0,0 +1 @@ +3c00c18611f2854c734962fc516490c22f57f2e7 SOURCES/scl-utils-20130529.tar.gz diff --git a/SOURCES/0001-Rename-attr-macros-so-they-are-correctly-named.patch b/SOURCES/0001-Rename-attr-macros-so-they-are-correctly-named.patch new file mode 100644 index 0000000..7a2a72b --- /dev/null +++ b/SOURCES/0001-Rename-attr-macros-so-they-are-correctly-named.patch @@ -0,0 +1,21 @@ +From 3a20a905f80bd1a0c85de1b4c449d29f238eeb29 Mon Sep 17 00:00:00 2001 +From: Jan Zeleny +Date: Mon, 18 Nov 2013 10:26:04 +0100 +Subject: [PATCH] Rename attr macros so they are correctly named + +--- + scl.attr | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/scl.attr b/scl.attr +index 6521995388fdd4201f0b032abff9ce5287cb08dd..3e546568261b996e065be3bfaed648d785466c36 100644 +--- a/scl.attr ++++ b/scl.attr +@@ -1,2 +1,2 @@ +-%__pkgconfig_provides %{_rpmconfigdir}/scldeps.sh --provides %{scl} +-%__pkgconfig_path %{?scl:^%{_scl_prefix}/.*$} ++%__scl_provides %{_rpmconfigdir}/scldeps.sh --provides %{scl} ++%__scl_path %{?scl:^%{_scl_prefix}/.*$} +-- +1.8.3.1 + diff --git a/SOURCES/0002-Implement-as-a-command-separator.patch b/SOURCES/0002-Implement-as-a-command-separator.patch new file mode 100644 index 0000000..d53f5f1 --- /dev/null +++ b/SOURCES/0002-Implement-as-a-command-separator.patch @@ -0,0 +1,195 @@ +From f5bf4407d7801d5add15b786a7425b6135dfb7e2 Mon Sep 17 00:00:00 2001 +From: Jan Zeleny +Date: Thu, 21 Nov 2013 12:18:46 +0100 +Subject: [PATCH] Implement "--" as a command separator + +Whatever comes after the first "--" will be considered a command. If there +are multiple arguments after the first "--", they will all be concatenated by +spaces and treated as a single command afterwards. +--- + scl.1 | 9 ++++++- + scl.c | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++---------------- + 2 files changed, 76 insertions(+), 21 deletions(-) + +diff --git a/scl.1 b/scl.1 +index aa797739b1faafe8760e9fc7c5ddaa6ef5da5f4f..f552653f82e97e6503e81f5f75d63b8ca0429bfa 100644 +--- a/scl.1 ++++ b/scl.1 +@@ -5,6 +5,8 @@ scl \- Setup and run software from Software Collection environment + .PP + \fBscl\fP \fI\fR \fI\fR [\fI ...\fR] \fI\fR + .PP ++\fBscl\fP \fI\fR \fI\fR [\fI ...\fR] -- \fI\fR ++.PP + \fBscl\fP {\fB-l|--list\fP} [\fI ...\fR] + .SH "DESCRIPTION" + .PP +@@ -27,6 +29,10 @@ collections which are enabled by the left-right order as present on \fBscl\fP co + Collection environment enabled. Control is returned back to the caller with the original + environment as soon as the command finishes. It \fI\fR is '-' (dash) then it is + read from the standard input. ++.PP ++Note that if you use \fI\fR consisting of multiple arguments, you either need to ++use quotes or the \fB--\fP command separator. Everything that follows the ++separator will be considered a command or its argument. + .SH "OPTIONS" + .PP + .IP "\fB-l, --list\fP" +@@ -52,4 +58,5 @@ scl -l example + list all packages within example collection + .SH "AUTHOR" + .PP +-\fBscl\fP was written by Jindrich Novy . ++\fBscl\fP was written by Jindrich Novy and Jan Zeleny ++ +diff --git a/scl.c b/scl.c +index 81fdf5d94a9e011d697cd422cd581d21364d7eca..cf3ff5bfa7fce0b95705b0aa09946524d06801c5 100644 +--- a/scl.c ++++ b/scl.c +@@ -31,6 +31,7 @@ + #include + + #define SCL_CONF_DIR "/etc/scl/conf/" ++#define MIN(X,Y) ((X) < (Y) ? (X) : (Y)) + + static void check_asprintf( char **strp, const char *fmt, ... ) { + va_list args; +@@ -245,8 +246,10 @@ int main(int argc, char **argv) { + struct stat st; + char *path, *enablepath; + char tmp[] = "/var/tmp/sclXXXXXX"; +- char *cmd = NULL, *bash_cmd, *echo, *enabled; +- int i, tfd, ffd, stdin_read = 0; ++ char *bash_cmd, *echo, *enabled; ++ int i, tfd, ffd; ++ int separator_pos = 0; ++ char *command = NULL; + + if (argc == 2 && (!strcmp(argv[1],"--help") || !strcmp(argv[1],"-h"))) { + print_usage(argv[0]); +@@ -263,25 +266,58 @@ int main(int argc, char **argv) { + exit(EXIT_SUCCESS); + } + +- if (!strcmp(argv[argc-1], "-")) { /* reading command from stdin */ +- size_t r; ++ for (i = 0; i < argc; i++) { ++ if (strcmp(argv[i], "--") == 0) { ++ break; ++ } ++ } ++ separator_pos = i; + ++ if (separator_pos == argc) { ++ /* Separator not found */ + if (argc < 4) { +- fprintf(stderr, "Need at least 3 arguments.\nRun %s without arguments to get help.\n", argv[0]); ++ fprintf(stderr, "Need at least 3 arguments.\nRun %s --help to get help.\n", argv[0]); + exit(EXIT_FAILURE); + } + +- cmd = malloc(BUFSIZ); ++ command = strdup(argv[argc-1]); ++ if (command == NULL) { ++ fprintf(stderr, "Can't duplicate string.\n"); ++ } ++ } else if (separator_pos == argc-1) { ++ command = "-"; ++ } else if (separator_pos <= 2) { ++ fprintf(stderr, "Need at least 2 arguments before command is specified.\nRun %s --help to get help.\n", argv[0]); ++ exit(EXIT_FAILURE); ++ } else { ++ command = NULL; ++ } + +- if (!cmd) { ++ if ((command == NULL && !strcmp(argv[separator_pos+1], "-")) || ++ (command != NULL && !strcmp(command, "-"))) { /* reading command from stdin */ ++ size_t r; ++ ++ ++ command = malloc(BUFSIZ+1); ++ if (!command) { + fprintf(stderr, "Can't allocate memory.\n"); + exit(EXIT_FAILURE); + } + +- for (r=0; (r += fread(cmd+r, 1, BUFSIZ, stdin));) { +- if (feof(stdin)) break; +- cmd = realloc(cmd, r+BUFSIZ); +- if (!cmd) { ++ for (r=0; (r += fread(command+r, 1, BUFSIZ, stdin));) { ++ if (feof(stdin)) { ++ if (r % BUFSIZ == 0) { ++ command = realloc(command, r+1); ++ if (!command) { ++ fprintf(stderr, "Can't reallocate memory.\n"); ++ exit(EXIT_FAILURE); ++ } ++ } ++ command[r] = '\0'; ++ break; ++ } ++ command = realloc(command, r+BUFSIZ+1); ++ if (!command) { + fprintf(stderr, "Can't reallocate memory.\n"); + exit(EXIT_FAILURE); + } +@@ -290,15 +326,27 @@ int main(int argc, char **argv) { + fprintf(stderr, "Error reading command from stdin.\n"); + exit(EXIT_FAILURE); + } +- stdin_read = 1; +- } ++ } else if (command == NULL) { ++ int len = 0; ++ for (i = separator_pos+1; i < argc; i++) { ++ len += strlen(argv[i])+3; /* +1 for additional space, +2 for additional quotes */ ++ } + +- if (!stdin_read) { +- if (argc < 4) { +- print_usage(argv[0]); ++ command = malloc((len+1)*sizeof(char)); ++ if (command == NULL) { ++ fprintf(stderr, "Can't allocate memory.\n"); + exit(EXIT_FAILURE); + } +- cmd = strdup(argv[argc-1]); ++ ++ len = 0; ++ for (i = separator_pos+1; i < argc; i++) { ++ command[len++] = '"'; ++ strcpy(command+len, argv[i]); ++ len += strlen(argv[i]); ++ command[len++] = '"'; ++ command[len++] = ' '; ++ } ++ command[len] = '\0'; + } + + tfd = mkstemp(tmp); +@@ -307,7 +355,7 @@ int main(int argc, char **argv) { + write_script(tfd, enabled); + free(enabled); + +- for (i=2; i +Date: Fri, 22 Nov 2013 09:42:30 +0100 +Subject: [PATCH 1/4] Mention environment-modifying commands in the man page + +--- + scl.1 | 10 +++++++- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/scl.1 b/scl.1 +index c9d322ddfa3671826c5f0f7c160fbc260d5007c9..cbefc44a7d539370065912021a62a39844a51f80 100644 +--- a/scl.1 ++++ b/scl.1 +@@ -27,12 +27,18 @@ collections which are enabled by the lef + .PP + \fI\fR is an arbitrary command or set of commands to execute within the Software + Collection environment enabled. Control is returned back to the caller with the original +-environment as soon as the command finishes. It \fI\fR is '-' (dash) then it is ++environment as soon as the command finishes. If \fI\fR is '-' (dash) then it is + read from the standard input. + .PP +-Note that if you use \fI\fR consisting of multiple arguments, you either need to ++Note: if you use \fI\fR consisting of multiple arguments, you either need to + use quotes or the \fB--\fP command separator. Everything that follows the + separator will be considered a command or its argument. ++.PP ++Note: some commands modify user environment in some way. Those commands may ++potentially break SCLs, as their activation also usually depends on env. ++modification as well. Typical examples of such commands are \fBsu\fP and ++\fBsudo\fP. Every collection modifies the environment differently, thus more ++details may be found in the documentation of the particular collection. + .SH "OPTIONS" + .PP + .IP "\fB-l, --list\fP" +-- +1.8.3.1 + diff --git a/SOURCES/0004-Check-whether-a-file-was-created-when-doing-mkstemp-.patch b/SOURCES/0004-Check-whether-a-file-was-created-when-doing-mkstemp-.patch new file mode 100644 index 0000000..2b5211c --- /dev/null +++ b/SOURCES/0004-Check-whether-a-file-was-created-when-doing-mkstemp-.patch @@ -0,0 +1,39 @@ +From 2187471296c9a1ac0fb8cc08157949a637ad96c8 Mon Sep 17 00:00:00 2001 +From: Jan Zeleny +Date: Wed, 8 Jan 2014 09:23:46 +0100 +Subject: [PATCH 4/4] Check whether a file was created when doing mkstemp + (#1032666) + +--- + scl.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/scl.c b/scl.c +index cf3ff5bfa7fce0b95705b0aa09946524d06801c5..fcdebcbfd35dec2c4ff68536bc90771d439fc044 100644 +--- a/scl.c ++++ b/scl.c +@@ -105,6 +105,10 @@ static char **read_script_output( char *ori_cmd ) { + FILE *f; + + tfd = mkstemp(tmp); ++ if (tfd < 0) { ++ fprintf(stderr, "Cannot create a temporary file: %s\n", tmp); ++ exit(EXIT_FAILURE); ++ } + check_asprintf(&cmd, "%s > %s", ori_cmd, tmp); + i = system(cmd); + free(cmd); +@@ -350,6 +354,10 @@ int main(int argc, char **argv) { + } + + tfd = mkstemp(tmp); ++ if (tfd < 0) { ++ fprintf(stderr, "Cannot create a temporary file: %s\n", tmp); ++ exit(EXIT_FAILURE); ++ } + + check_asprintf(&enabled, "eval \"SCLS=( ${X_SCLS[*]} )\"\n"); + write_script(tfd, enabled); +-- +1.8.3.1 + diff --git a/SOURCES/0005-Various-fixes-in-Provides-and-Requires-of-scl-packag.patch b/SOURCES/0005-Various-fixes-in-Provides-and-Requires-of-scl-packag.patch new file mode 100644 index 0000000..7f4a9d7 --- /dev/null +++ b/SOURCES/0005-Various-fixes-in-Provides-and-Requires-of-scl-packag.patch @@ -0,0 +1,81 @@ +From 4daefe484e42d5cccbf1b3fe1e5f3494269c9e98 Mon Sep 17 00:00:00 2001 +From: Jan Zeleny +Date: Mon, 27 Jan 2014 10:23:36 +0100 +Subject: [PATCH] Various fixes in Provides and Requires of scl packages + +- add new Requires: %scl_runtime, to all scl packages + (every scl package requires the runtime to be installed anyway) +- add new Provides: scl-package(%scl) for metapackage and build subpackage +- exclude both from the main metapackage +- move the _root_path conditional in macros.scl: when BuildArch is + specified in spec file, rpm recursively parses spec file again. That's + the reason why the conditional is there. However, when the wrong + pieces of code are included in in, it brings some problems. This + change keep only the path definition inside the conditional, the rest + can be easily redefined again. +--- + macros.scl | 8 ++++++-- + scl.attr | 3 ++- + scldeps.sh | 3 +++ + 3 files changed, 11 insertions(+), 3 deletions(-) + +diff --git a/macros.scl b/macros.scl +index 8b6377e..d344b5e 100644 +--- a/macros.scl ++++ b/macros.scl +@@ -40,6 +40,7 @@ + %global _mandir %{_datadir}/man + %global _docdir %{_datadir}/doc + %global _defaultdocdir %{_docdir} ++} + %global scl_pkg_name %{scl}-%{pkg_name} + %global __os_install_post %{expand: + /usr/lib/rpm/brp-scl-compress %{_scl_root} +@@ -58,6 +59,7 @@ + Summary: Debug information for package %{name} + Group: Development/Debug + AutoReqProv: 0 ++Requires: %scl_runtime + Provides: scl-package(%scl) + %description debuginfo + This package provides debug information for package %{name}. +@@ -68,10 +70,12 @@ package or when debugging this package. + %endif + %{nil}} + BuildRequires: scl-utils-build +-} ++%if "%{?scl}%{!?scl:0}" == "%{pkg_name}" ++Requires: %{scl_runtime} ++Provides: scl-package(%{scl}) ++%endif + %{?scl_package_override:%scl_package_override} + } + + %scl_require() %{_scl_prefix}/%1/enable, %1 + %scl_require_package() %1-%2 +- +diff --git a/scl.attr b/scl.attr +index 3e54656..c16ade6 100644 +--- a/scl.attr ++++ b/scl.attr +@@ -1,2 +1,3 @@ + %__scl_provides %{_rpmconfigdir}/scldeps.sh --provides %{scl} +-%__scl_path %{?scl:^%{_scl_prefix}/.*$} ++%__scl_requires %{_rpmconfigdir}/scldeps.sh --requires %{scl_runtime} ++%__scl_path %{?scl:^%{_scl_prefix}/.*$|%{_root_sysconfdir}/rpm/macros.%{scl}-config$} +diff --git a/scldeps.sh b/scldeps.sh +index 268d6bb..df8ddb3 100755 +--- a/scldeps.sh ++++ b/scldeps.sh +@@ -9,5 +9,8 @@ case $1 in + -P|--provides) + echo -n "scl-package($2)" + ;; ++-R|--requires) ++ echo -n "$2" ++ ;; + esac + exit 0 +-- +1.9.3 + diff --git a/SOURCES/0006-Modified-the-behavior-of-debuginfo-generation-proces.patch b/SOURCES/0006-Modified-the-behavior-of-debuginfo-generation-proces.patch new file mode 100644 index 0000000..3e5f733 --- /dev/null +++ b/SOURCES/0006-Modified-the-behavior-of-debuginfo-generation-proces.patch @@ -0,0 +1,92 @@ +From a2aefc2276e124b1c329a722ed43cf7fcf7f473f Mon Sep 17 00:00:00 2001 +From: Jan Zeleny +Date: Wed, 30 Jul 2014 10:00:26 +0200 +Subject: [PATCH] Modified the behavior of debuginfo generation process + +* add correct dependencies to debuginfo packages. +* add conditional definition of __debug_package macro + (allow turning debuginfor packages off) +* remove automatic creation of debuginfo for metapackage +--- + macros.scl | 51 ++++++++++++++++++++++++++++++++++----------------- + 1 file changed, 34 insertions(+), 17 deletions(-) + +diff --git a/macros.scl b/macros.scl +index d344b5e80f4fa6d97c7243df2f40847303eb26df..db85a5002f831e5e319152db8eba6e9e92efec82 100644 +--- a/macros.scl ++++ b/macros.scl +@@ -3,6 +3,39 @@ + # Copyright (C) 2012 Red Hat, Inc. + # Written by Jindrich Novy . + ++%scl_debug() %{expand: ++%define old_debug %{lua:print(rpm.expand("%{debug_package}"):len())} ++%global debug_package %{expand: ++%if "%{?old_debug}" == "0" ++ %{expand: %{nil}} ++%else ++%if "%{?scl}%{!?scl:0}" == "%{pkg_name}" ++ %{expand: %{nil}} ++%else ++%ifnarch noarch ++%package debuginfo ++Summary: Debug information for package %{name} ++Group: Development/Debug ++AutoReqProv: 0 ++Requires: %scl_runtime ++Provides: scl-package(%scl) ++%{lua: ++ debuginfo=tonumber(rpm.expand("%{old_debug}")) ++ if debuginfo > 0 then ++ rpm.define("__debug_package 1") ++ end ++} ++%description debuginfo ++This package provides debug information for package %{name}. ++Debug information is useful when developing applications that use this ++package or when debugging this package. ++%files debuginfo -f debugfiles.list ++%defattr(-,root,root) ++%endif ++%endif ++%endif ++%{nil}}} ++ + %scl_package() %{expand:%{!?_root_prefix: + %global pkg_name %1 + %global scl_name %{scl} +@@ -42,6 +75,7 @@ + %global _defaultdocdir %{_docdir} + } + %global scl_pkg_name %{scl}-%{pkg_name} ++%scl_debug + %global __os_install_post %{expand: + /usr/lib/rpm/brp-scl-compress %{_scl_root} + %{!?__debug_package:/usr/lib/rpm/redhat/brp-strip %{__strip} +@@ -52,23 +86,6 @@ + /usr/lib/rpm/redhat/brp-python-hardlink + %{!?__jar_repack:/usr/lib/rpm/redhat/brp-java-repack-jars} + %{nil}} +-%global debug_package %{expand: +-%ifnarch noarch +-%global __debug_package 1 +-%package debuginfo +-Summary: Debug information for package %{name} +-Group: Development/Debug +-AutoReqProv: 0 +-Requires: %scl_runtime +-Provides: scl-package(%scl) +-%description debuginfo +-This package provides debug information for package %{name}. +-Debug information is useful when developing applications that use this +-package or when debugging this package. +-%files debuginfo -f debugfiles.list +-%defattr(-,root,root) +-%endif +-%{nil}} + BuildRequires: scl-utils-build + %if "%{?scl}%{!?scl:0}" == "%{pkg_name}" + Requires: %{scl_runtime} +-- +1.9.3 + diff --git a/SOURCES/0007-Changed-command-description-in-scl-man-pages.patch b/SOURCES/0007-Changed-command-description-in-scl-man-pages.patch new file mode 100644 index 0000000..0d6fa68 --- /dev/null +++ b/SOURCES/0007-Changed-command-description-in-scl-man-pages.patch @@ -0,0 +1,30 @@ +From ff24defdb7ff7e0460785202933ac024f273c82f Mon Sep 17 00:00:00 2001 +From: Albert Uchytil +Date: Tue, 8 Apr 2014 14:22:29 +0200 +Subject: [PATCH] Changed description in scl man pages + +--- + scl.1 | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/scl.1 b/scl.1 +index cbefc44a7d539370065912021a62a39844a51f80..51f32e4db0f18ca6a97231ad641f78ae88806e13 100644 +--- a/scl.1 ++++ b/scl.1 +@@ -25,9 +25,10 @@ to update search paths, etc. + One can enable more Software Collections if needed and therefore one can use multiple + collections which are enabled by the left-right order as present on \fBscl\fP command-line. + .PP +-\fI\fR is an arbitrary command or set of commands to execute within the Software +-Collection environment enabled. Control is returned back to the caller with the original +-environment as soon as the command finishes. If \fI\fR is '-' (dash) then it is ++\fI\fR marks specified Software Collections as enabled. Executes the script, ++which is expected to set proper environment. Executes the \fI\fR. ++Control is returned back to the caller with the original environment as soon ++as the command finishes. If \fI\fR is '-' (dash) then it is + read from the standard input. + .PP + Note: if you use \fI\fR consisting of multiple arguments, you either need to +-- +1.9.0 + diff --git a/SOURCES/0008-Changed-script-paths-in-__os_install_post.patch b/SOURCES/0008-Changed-script-paths-in-__os_install_post.patch new file mode 100644 index 0000000..69cd5f9 --- /dev/null +++ b/SOURCES/0008-Changed-script-paths-in-__os_install_post.patch @@ -0,0 +1,34 @@ +From 295ae5cb8198ea6dc45fc176ba9b2ee649997f2d Mon Sep 17 00:00:00 2001 +From: Jan Zeleny +Date: Wed, 30 Jul 2014 10:05:56 +0200 +Subject: [PATCH] Changed script paths in __os_install_post + +Required to keep up with rpm and the current system layout +--- + macros.scl | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/macros.scl b/macros.scl +index 56d85c9ed7af098e138704a5267beaf86d8f76ba..d888e01a22acc2b2cb8ea56ebeae6814f4ffa721 100644 +--- a/macros.scl ++++ b/macros.scl +@@ -78,12 +78,12 @@ package or when debugging this package. + %scl_debug + %global __os_install_post %{expand: + /usr/lib/rpm/brp-scl-compress %{_scl_root} +- %{!?__debug_package:/usr/lib/rpm/redhat/brp-strip %{__strip} +- /usr/lib/rpm/redhat/brp-strip-comment-note %{__strip} %{__objdump} ++ %{!?__debug_package:/usr/lib/rpm/brp-strip %{__strip} ++ /usr/lib/rpm/brp-strip-comment-note %{__strip} %{__objdump} + } +- /usr/lib/rpm/redhat/brp-strip-static-archive %{__strip} ++ /usr/lib/rpm/brp-strip-static-archive %{__strip} + /usr/lib/rpm/brp-scl-python-bytecompile %{__python} %{?_python_bytecompile_errors_terminate_build} %{_scl_root} +- /usr/lib/rpm/redhat/brp-python-hardlink ++ /usr/lib/rpm/brp-python-hardlink + %{!?__jar_repack:/usr/lib/rpm/redhat/brp-java-repack-jars} + %{nil}} + BuildRequires: scl-utils-build +-- +1.9.3 + diff --git a/SOURCES/0009-Remove-sclbuild-as-it-s-not-that-useful.patch b/SOURCES/0009-Remove-sclbuild-as-it-s-not-that-useful.patch new file mode 100644 index 0000000..cb68ec4 --- /dev/null +++ b/SOURCES/0009-Remove-sclbuild-as-it-s-not-that-useful.patch @@ -0,0 +1,58 @@ +From fdf5b1e5582acae15d485a4c2e2af2ff2819a8c6 Mon Sep 17 00:00:00 2001 +From: Jan Zeleny +Date: Tue, 29 Jul 2014 15:36:16 +0200 +Subject: [PATCH] Remove sclbuild, as it's not that useful + +--- + Makefile | 5 ++--- + sclbuild | 8 -------- + 2 files changed, 2 insertions(+), 11 deletions(-) + delete mode 100755 sclbuild + +diff --git a/Makefile b/Makefile +index f050285c1ca85537f30bcfc7bf2cd0a38dd75821..a2d368926638c13ba3b230f02f17e27229046445 100644 +--- a/Makefile ++++ b/Makefile +@@ -3,7 +3,7 @@ VERSION=`date +%Y%m%d` + WARNINGS?=-Wall -Wshadow -Wcast-align -Winline -Wextra -Wmissing-noreturn + CFLAGS?=-O2 + CFILES=scl.c +-OTHERFILES=Makefile scl_enabled macros.scl scl.1 scldeps.sh scl.attr brp-scl-compress brp-scl-python-bytecompile scl.bash sclbuild ++OTHERFILES=Makefile scl_enabled macros.scl scl.1 scldeps.sh scl.attr brp-scl-compress brp-scl-python-bytecompile scl.bash + SOURCES=$(CFILES) $(OTHERFILES) + + BINDIR?=/usr/bin +@@ -37,7 +37,6 @@ install: all + mkdir -p $(DESTDIR)/$(RPMCONFDIR)/fileattrs + cp macros.scl $(DESTDIR)/$(CNFDIR)/rpm + cp scl $(DESTDIR)/$(BINDIR) +- cp sclbuild $(DESTDIR)/$(BINDIR) + cp scl_enabled $(DESTDIR)/$(BINDIR) + cp scl.1 $(DESTDIR)/$(MANDIR)/man1 + cp scl.attr $(DESTDIR)/$(RPMCONFDIR)/fileattrs +@@ -47,7 +46,7 @@ install: all + cp scl.bash $(DESTDIR)/$(CNFDIR)/bash_completion.d + + uninstall: +- rm -f $(BINDIR)/scl $(BINDIR)/scl_enabled $(BINDIR)/sclbuild ++ rm -f $(BINDIR)/scl $(BINDIR)/scl_enabled + rm -f $(CNFDIR)/rpm/macros.scl + rm -f $(MANDIR)/man1/scl.1 + rm -f $(RPMCONFDIR)/fileattrs/scl.attr +diff --git a/sclbuild b/sclbuild +deleted file mode 100755 +index 183d8e8d8fbcd8140052cf9b381ae73bc9f633c1..0000000000000000000000000000000000000000 +--- a/sclbuild ++++ /dev/null +@@ -1,8 +0,0 @@ +-#!/bin/sh +-if [ $# -le 1 ]; then +- echo "$0 " +-else +- SCL=$1 +- shift +- rpmbuild $@ --define "scl $SCL" +-fi +-- +1.9.3 + diff --git a/SOURCES/0010-Added-capability-to-register-and-deregister-collecti.patch b/SOURCES/0010-Added-capability-to-register-and-deregister-collecti.patch new file mode 100644 index 0000000..2035320 --- /dev/null +++ b/SOURCES/0010-Added-capability-to-register-and-deregister-collecti.patch @@ -0,0 +1,601 @@ +From 9c93f0540b2afe736a8633c0ac8ac6e4e425726d Mon Sep 17 00:00:00 2001 +From: Jan Zeleny +Date: Wed, 30 Jul 2014 09:03:35 +0200 +Subject: [PATCH] Added capability to register and deregister collections + +- scl register creates record for the collection in the scl + conf dir +- scl deregister removes the collection record from the + scl conf dir +--- + scl.1 | 18 +++ + scl.bash | 11 +- + scl.c | 427 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---- + 3 files changed, 427 insertions(+), 29 deletions(-) + +diff --git a/scl.1 b/scl.1 +index 9e13778..c9c2abe 100644 +--- a/scl.1 ++++ b/scl.1 +@@ -8,6 +8,10 @@ scl \- Setup and run software from Software Collection environment + \fBscl\fP \fI\fR \fI\fR [\fI ...\fR] -- \fI\fR + .PP + \fBscl\fP {\fB-l|--list\fP} [\fI ...\fR] ++.PP ++\fBscl register\fP \fI\f ++.PP ++\fBscl deregister\fP \fI\fR [\fB--force\fP] + .SH "DESCRIPTION" + .PP + This manual page documents \fBscl\fP, a +@@ -46,6 +50,14 @@ details may be found in the documentation of the particular collection. + Lists all installed Software Collections on the system. + .IP "\fB-l, --list\fP \fI ...\fR" + If a collection name is specified then list of installed packages belonging to the collection is listed. ++.IP "\fBregister\fP \fI\fR" ++If \fI\fR leads to valid SCL file structure, \fBscl\fP will register that as a SCL. ++\fI\fR directory needs to contain \fBenable\fR scriptlet and \fBroot\fP directory, ++to be considered valid SCL. ++ needs to be an absolute path to the collection location. ++.IP "\fBderegister\fP \fI\fR [\fB--force\fP]" ++\fI\fR will no longer be considered SCL. ++If the \fI\fR was installed locally, then the use of \fB--force\fP is needed.i + .SH "EXAMPLES" + .TP + scl enable example 'less --version' +@@ -63,6 +75,12 @@ list all installed collections + .TP + scl -l example + list all packages within example collection ++scl register /foo/bar ++registers new collection with a name bar ++.TP ++scl deregister bar --force ++forces the deregistration of collection bar ++.TP + .SH "AUTHOR" + .PP + \fBscl\fP was written by Jindrich Novy and Jan Zeleny +diff --git a/scl.bash b/scl.bash +index 7f77233..5fae09a 100644 +--- a/scl.bash ++++ b/scl.bash +@@ -14,17 +14,18 @@ _scl() + return 0 + fi + ++ local collections=($(find /etc/scl/prefixes -maxdepth 1 -mindepth 1 -type f -exec basename {} \; | sort -u)) ++ + # handle scriptlets; the first parameter must be a scriptlet if it is not an option + if ((COMP_CWORD == 1)); then + # get array of scriptlets found throughout collections +- local collections=($(find /etc/scl/prefixes -maxdepth 1 -mindepth 1 -type f -exec basename {} \; | sort -u)) + local scriptlets=() + for col in ${collections[@]}; do + local prefix=`cat /etc/scl/prefixes/$col` + scriptlets+=($(find $prefix/$col/* -maxdepth 1 -type f -exec basename {} \; | sort -u)) + done + scriptlets_str=`echo ${scriptlets[@]} | sed 's/ /\n/g'| sort -u` +- COMPREPLY=( $(compgen -W "$scriptlets_str" -- ${cur}) ) ++ COMPREPLY=( $(compgen -W "$scriptlets_str register deregister" -- ${cur}) ) + return 0 + fi + +@@ -35,7 +36,11 @@ _scl() + fi + + # handle collections; if it is not an option or a command, it must be a collection +- local collections=($(find /etc/scl/prefixes -maxdepth 1 -mindepth 1 -type f -exec basename {} \; | sort -u)) ++ if [ $prev == "register" ]; then ++ compopt -o nospace ++ COMPREPLY=( $(compgen -A directory ${cur}) ) ++ return 0 ++ fi + COMPREPLY=( $(compgen -W "${collections[*]}" -- ${cur}) ) + return 0 + } +diff --git a/scl.c b/scl.c +index fcdebcb..f8e2ed4 100644 +--- a/scl.c ++++ b/scl.c +@@ -22,8 +22,10 @@ + #include + #include + #include ++#include + #include + #include ++#include + #include + #include + #include +@@ -56,6 +58,8 @@ static void write_script( int tfd, char *s ) { + static void print_usage( const char *name ) { + fprintf(stderr, "usage: %s [...] \n", name); + fprintf(stderr, " or: %s -l|--list [...]\n", name); ++ fprintf(stderr, " or: %s register \n", name); ++ fprintf(stderr, " or: %s deregister [--force]\n", name); + + fprintf(stderr, "\nOptions:\n" + " -l, --list list installed Software Collections or packages\n" +@@ -68,32 +72,121 @@ static void print_usage( const char *name ) { + "\nUse '-' as to read the command from standard input.\n"); + } + ++static int check_directory(const char *dir_name, struct stat *sb, int *count, struct dirent ***nl) { ++ if (stat(dir_name, sb) == -1) { ++ fprintf(stderr, "%s does not exist\n", dir_name); ++ return EXIT_FAILURE; ++ } ++ ++ if (!S_ISDIR(sb->st_mode)) { ++ fprintf(stderr, "%s is not a directory\n", dir_name); ++ return EXIT_FAILURE; ++ } ++ ++ if ((*count = scandir(dir_name, nl, 0, alphasort)) < 0) { ++ perror("scandir"); ++ fprintf(stderr, "%s\n", dir_name); ++ return EXIT_FAILURE; ++ } ++ return EXIT_SUCCESS; ++} ++ ++static int get_collection_dir_path(char *col_name, char **_col_dir) { ++ int i; ++ int fd = -1; ++ char *file_path = NULL; ++ char *col_dir = NULL; ++ struct stat st; ++ int ret = EXIT_FAILURE; ++ int col_name_len = strlen(col_name); ++ int col_dir_len; ++ ++ file_path = (char *)malloc(sizeof(SCL_CONF_DIR) + col_name_len + 1); ++ if (file_path == NULL) { ++ fprintf(stderr, "Can't allocate memory.\n"); ++ return EXIT_FAILURE; ++ } ++ sprintf(file_path, "%s%s", SCL_CONF_DIR, col_name); ++ ++ if (stat(file_path, &st) != 0) { ++ perror("Unable to get file status"); ++ fprintf(stderr, "%s\n", file_path); ++ goto done; ++ } ++ ++ fd = open(file_path, O_RDONLY); ++ if (fd < 0) { ++ perror("Unable to open file"); ++ fprintf(stderr, "%s\n", file_path); ++ goto done; ++ } ++ ++ /* One for slash, one for terminating zero*/ ++ col_dir = (char *)calloc(st.st_size + col_name_len + 2, 1); ++ if (col_dir == NULL) { ++ fprintf(stderr, "Can't allocate memory.\n"); ++ goto done; ++ } ++ if ((col_dir_len = read(fd, col_dir, st.st_size)) < 0) { ++ fprintf(stderr, "Unable to read from file.\n"); ++ goto done; ++ } ++ for (i = col_dir_len-1; i > 0; i--) { ++ if (isspace(col_dir[i]) || col_dir[i] == '/') { ++ col_dir[i] = '\0'; ++ } else { ++ break; ++ } ++ } ++ col_dir[i+1] = '/'; ++ memcpy(col_dir + i + 2, col_name, col_name_len + 1); ++ ++ *_col_dir = col_dir; ++ ++ ret = EXIT_SUCCESS; ++done: ++ if (fd > 0) { ++ close(fd); ++ } ++ if (ret != EXIT_SUCCESS) { ++ free(col_dir); ++ } ++ free(file_path); ++ return ret; ++} ++ ++static int col_available(char *col_name) { ++ char *col_dir = NULL; ++ int ret = 0; ++ ++ if (get_collection_dir_path(col_name, &col_dir)) { ++ return EXIT_FAILURE; ++ } ++ ret = access(col_dir, F_OK); ++ free(col_dir); ++ return ret; ++} ++ + static void list_collections() { + struct stat sb; + struct dirent **nl; + int n, i; + +- if (stat(SCL_CONF_DIR, &sb) == -1) { +- fprintf(stderr, "%s does not exist\n", SCL_CONF_DIR); +- exit(EXIT_FAILURE); +- } +- +- if (!S_ISDIR(sb.st_mode)) { +- fprintf(stderr, "%s is not a directory\n", SCL_CONF_DIR); +- exit(EXIT_FAILURE); +- } +- +- if ((n = scandir(SCL_CONF_DIR, &nl, 0, alphasort)) < 0) { +- perror("scandir"); ++ if (check_directory(SCL_CONF_DIR, &sb, &n, &nl)) { + exit(EXIT_FAILURE); + } + + for (i=0; id_name != '.') { +- printf("%s\n", nl[i]->d_name); ++ if (col_available(nl[i]->d_name) == 0) { ++ printf("%s\n", nl[i]->d_name); ++ } + } + } + ++ for (i = 0; i < n; i++) { ++ free(nl[i]); ++ } + free(nl); + } + +@@ -157,7 +250,7 @@ static char **read_script_output( char *ori_cmd ) { + return lines; + } + +-static int list_packages_in_collection( const char *colname) { ++static int list_packages_in_collection(const char *colname) { + struct stat sb; + struct dirent **nl; + int i, n, found, smax, ss; +@@ -165,18 +258,7 @@ static int list_packages_in_collection( const char *colname) { + char **srpms = NULL; + size_t cns; + +- if (stat(SCL_CONF_DIR, &sb) == -1) { +- fprintf(stderr, "%s does not exist\n", SCL_CONF_DIR); +- exit(EXIT_FAILURE); +- } +- +- if (!S_ISDIR(sb.st_mode)) { +- fprintf(stderr, "%s is not a directory\n", SCL_CONF_DIR); +- exit(EXIT_FAILURE); +- } +- +- if ((n = scandir(SCL_CONF_DIR, &nl, 0, alphasort)) < 0) { +- perror("scandir"); ++ if (check_directory(SCL_CONF_DIR, &sb, &n, &nl)) { + exit(EXIT_FAILURE); + } + +@@ -246,6 +328,260 @@ static int list_packages_in_collection( const char *colname) { + return 0; + } + ++static int split_path(char *col_path, char **_col, char **_fname) { ++ char *name_start = NULL; ++ char *name_end = NULL; ++ char *col = NULL; ++ int col_path_len = strlen(col_path); ++ ++ col = (char *)malloc(strlen(col_path) + 1); ++ if (col == NULL) { ++ fprintf(stderr, "Can't allocate memory.\n"); ++ return EXIT_FAILURE; ++ } ++ memcpy(col, col_path, col_path_len + 1); ++ ++ name_end = col + col_path_len - 1; ++ while (name_end > col && *name_end == '/') { ++ *name_end = '\0'; ++ name_end--; ++ } ++ ++ name_start = strrchr(col, '/'); ++ if (name_start == NULL) { ++ free(col); ++ return EXIT_FAILURE; ++ } else { ++ *name_start = '\0'; ++ name_start++; ++ } ++ ++ *_fname = name_start; ++ *_col = col; ++ return EXIT_SUCCESS; ++} ++ ++static int get_collection_conf_path(char *col_name, char **_col_path) { ++ char *col_path = (char *)malloc(sizeof(SCL_CONF_DIR) + strlen(col_name) + 1); ++ if (col_path == NULL) { ++ fprintf(stderr, "Can't allocate memory.\n"); ++ return EXIT_FAILURE; ++ } ++ sprintf(col_path, "%s%s", SCL_CONF_DIR, col_name); ++ *_col_path = col_path; ++ return EXIT_SUCCESS; ++} ++ ++static int check_valid_collection(char *col_dir) { ++ struct stat sb; ++ struct dirent **nl; ++ int n, i; ++ bool missing_root = true; ++ bool missing_enable = true; ++ ++ if (check_directory(col_dir, &sb, &n, &nl)) { ++ exit(EXIT_FAILURE); ++ } ++ ++ for (i=0; id_name != '.') { ++ if (!strcmp(nl[i]->d_name, "root")) { ++ missing_root = false; ++ } else if (!strcmp(nl[i]->d_name, "enable")) { ++ missing_enable = false; ++ } ++ } ++ free(nl[i]); ++ } ++ free(nl); ++ ++ return missing_root || missing_enable; ++} ++ ++static int run_script(char *script_path, char *script_name) { ++ char *script = NULL; ++ char *cmd = NULL; ++ int status; ++ int ret = EXIT_FAILURE; ++ ++ if (script_path[strlen(script_path) - 1] == '/') { ++ check_asprintf(&script, "%s%s", script_path, script_name); ++ } else { ++ check_asprintf(&script, "%s/%s", script_path, script_name); ++ } ++ ++ if (!access(script, F_OK)) { ++ check_asprintf(&cmd, "/bin/bash %s", script); ++ status = system(cmd); ++ if (status == -1) { ++ perror("Unable to execute script\n"); ++ fprintf(stderr, "%s\n", script); ++ goto done; ++ } ++ if (!WIFEXITED(status)) { ++ fprintf(stderr, "Script %s didn't terminate normally\n", script); ++ goto done; ++ } ++ if (WEXITSTATUS(status)) { ++ fprintf(stderr, "Script %s returned nonzero return code\n", script); ++ goto done; ++ } ++ } ++ ++ ret = EXIT_SUCCESS; ++ ++done: ++ free(script); ++ free(cmd); ++ return ret; ++} ++ ++static int register_collection(char *col_path) { ++ FILE *f; ++ char *col = NULL; ++ char *name = NULL; ++ char *new_file = NULL; ++ ++ if (col_path == NULL || col_path[0] != '/') { ++ fprintf(stderr, "Collection must be specified as an absolute path!\n"); ++ return EXIT_FAILURE; ++ } ++ ++ if (access(col_path, F_OK)) { ++ perror("Directory doesn't exist"); ++ fprintf(stderr, "%s\n", col_path); ++ return EXIT_FAILURE; ++ } ++ ++ if (check_valid_collection(col_path)) { ++ fprintf(stderr, "Unable to register collection: %s is not a valid collection\n", col_path); ++ return EXIT_FAILURE; ++ } ++ ++ if (split_path(col_path, &col, &name)) { ++ return EXIT_FAILURE; ++ } ++ ++ if (get_collection_conf_path(name, &new_file)) { ++ free(col); ++ return EXIT_FAILURE; ++ } ++ ++ if (access(new_file, F_OK) == 0) { ++ fprintf(stderr, "Unable to register collection: Collection with the same name is already registered\n"); ++ free(new_file); ++ free(col); ++ return EXIT_FAILURE; ++ } ++ ++ f = fopen(new_file, "w+"); ++ if (f == NULL) { ++ perror("Unable to open file"); ++ fprintf(stderr, "%s\n", new_file); ++ free(col); ++ free(new_file); ++ return EXIT_FAILURE; ++ } ++ ++ fprintf(f, "%s\n", col); ++ fclose(f); ++ ++ if (run_script(col_path, "register")) { ++ fprintf(stderr, "Execution of register script failed\n"); ++ if (unlink(new_file)) { ++ perror("Unable to remove file: "); ++ fprintf(stderr, "%s\n", new_file); ++ fprintf(stderr, "Remove this file manually before a new try to register collection!\n"); ++ } ++ free(new_file); ++ free(col); ++ return EXIT_FAILURE; ++ } ++ ++ printf("Collection succesfully registered.\n" ++ "The collection can now be enabled using 'scl enable %s '\n", name); ++ free(new_file); ++ free(col); ++ ++ return EXIT_SUCCESS; ++} ++ ++static int check_package(char *file_path, int *_status) { ++ char *cmd = NULL; ++ int path_len = strlen(file_path); ++ char rpm_query[] = "rpm -qf %s > /dev/null 2> /dev/null"; ++ ++ cmd = (char *)malloc(path_len + sizeof(rpm_query) - 1); ++ if (cmd == NULL) { ++ fprintf(stderr, "Can't allocate memory.\n"); ++ return EXIT_FAILURE; ++ } ++ sprintf(cmd, rpm_query, file_path); ++ *_status = system(cmd); ++ free(cmd); ++ ++ return EXIT_SUCCESS; ++} ++ ++static int deregister_collection(char *col_path, bool force) { ++ char *col = NULL; ++ char *col_name = NULL; ++ char *col_dir = NULL; ++ ++ if (get_collection_conf_path(col_path, &col_name)) { ++ free(col); ++ return EXIT_FAILURE; ++ } ++ ++ if (!force) { ++ int status; ++ if (check_package(col_name, &status)) { ++ free(col_name); ++ free(col); ++ return EXIT_FAILURE; ++ } ++ ++ if (status == 0) { ++ fprintf(stderr, "Unable to deregister collection: " ++ "Collection was installed as a package, please use --force to deregister it.\n"); ++ free(col); ++ free(col_name); ++ return EXIT_FAILURE; ++ } ++ } ++ ++ if (get_collection_dir_path(col_path, &col_dir)) { ++ free(col_name); ++ free(col); ++ return EXIT_FAILURE; ++ } ++ ++ if (run_script(col_dir, "deregister")) { ++ fprintf(stderr, "Execution of deregister script failed\n"); ++ free(col_dir); ++ free(col_name); ++ free(col); ++ return EXIT_FAILURE; ++ } ++ ++ if (remove(col_name)) { ++ perror("Unable to delete file"); ++ fprintf(stderr, "%s\n", col_name); ++ free(col_dir); ++ free(col_name); ++ free(col); ++ return EXIT_FAILURE; ++ } ++ printf("Collection successfully deregistered.\n"); ++ free(col_dir); ++ free(col_name); ++ free(col); ++ return EXIT_SUCCESS; ++} ++ ++ ++ ++ + int main(int argc, char **argv) { + struct stat st; + char *path, *enablepath; +@@ -254,6 +590,7 @@ int main(int argc, char **argv) { + int i, tfd, ffd; + int separator_pos = 0; + char *command = NULL; ++ int failed = 0; + + if (argc == 2 && (!strcmp(argv[1],"--help") || !strcmp(argv[1],"-h"))) { + print_usage(argv[0]); +@@ -270,6 +607,44 @@ int main(int argc, char **argv) { + exit(EXIT_SUCCESS); + } + ++ if (argc > 2 && (!strcmp(argv[1], "register"))) { ++ failed = 0; ++ for (i = 2; i < argc; i++) { ++ if (register_collection(argv[i]) != 0) { ++ failed++; ++ } ++ } ++ if (failed > 0) { ++ fprintf(stderr, "Registration of %d collections failed!\n", failed); ++ exit(EXIT_FAILURE); ++ } else { ++ exit(EXIT_SUCCESS); ++ } ++ } ++ if (argc > 2 && (!(strcmp(argv[1], "deregister")))) { ++ bool force = false; ++ for (i = 2; i < argc; i++) { ++ if (!strcmp(argv[i], "--force")) { ++ force = true; ++ break; ++ } ++ } ++ for (i = 2; i < argc; i++) { ++ if (strcmp(argv[i], "--force") != 0) { ++ failed = 0; ++ if (deregister_collection(argv[i], force) != 0) { ++ failed++; ++ } ++ } ++ } ++ if (failed > 0) { ++ fprintf(stderr, "Deregistration of %d collections failed!\n", failed); ++ exit(EXIT_FAILURE); ++ } else { ++ exit(EXIT_SUCCESS); ++ } ++ } ++ + for (i = 0; i < argc; i++) { + if (strcmp(argv[i], "--") == 0) { + break; +-- +1.9.3 + diff --git a/SOURCES/0011-Fix-missing-allocation-check-in-read_script_output.patch b/SOURCES/0011-Fix-missing-allocation-check-in-read_script_output.patch new file mode 100644 index 0000000..3cafb83 --- /dev/null +++ b/SOURCES/0011-Fix-missing-allocation-check-in-read_script_output.patch @@ -0,0 +1,28 @@ +From 95d287071663ef5a0025c8ee136b31c905b63ae0 Mon Sep 17 00:00:00 2001 +From: Jan Zeleny +Date: Wed, 30 Jul 2014 10:24:26 +0200 +Subject: [PATCH] Fix missing allocation check in read_script_output() + +--- + scl.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/scl.c b/scl.c +index fcdebcbfd35dec2c4ff68536bc90771d439fc044..907f368a58f6f1b4ba75ec62ad95ebb535778903 100644 +--- a/scl.c ++++ b/scl.c +@@ -217,7 +217,10 @@ static char **read_script_output( char *ori_cmd ) { + unlink(tmp); + + ls = 0x100; +- lines = malloc(ls*sizeof(char*)); ++ if ((lines = (char **)malloc(ls*sizeof(char*))) == NULL) { ++ fprintf(stderr, "Unable to allocate memory.\n"); ++ exit(EXIT_FAILURE); ++ } + *lines = NULL; + + for (mp=m; mp && mp < &m[sb.st_size];) { +-- +1.9.3 + diff --git a/SOURCES/0012-Introduce-scl_dependency_generators-macro.patch b/SOURCES/0012-Introduce-scl_dependency_generators-macro.patch new file mode 100644 index 0000000..bbe7a06 --- /dev/null +++ b/SOURCES/0012-Introduce-scl_dependency_generators-macro.patch @@ -0,0 +1,35 @@ +From d854427f573cba1f74c6e9141d31e5b2e31ca657 Mon Sep 17 00:00:00 2001 +From: Jan Zeleny +Date: Tue, 26 Aug 2014 13:44:12 +0200 +Subject: [PATCH] Introduce %scl_dependency_generators macro + +Up until now, collections with custom dependency generators used the +%scl_package_override macro. However with the rewritten dependency +dependency generators several commits back, this is no longer working, +as the dependency generators defined in %scl_package are final. This +macro can be now udes to override dependency generators in -build +subpackages on anywhere else in a way compatible with the %scl_package +definition. + +As an effect, dependency generators defined in +%scl_dependency_generators macro will be taken into account when +%generating automatic dependencies for SCLized packages. +--- + macros.scl | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/macros.scl b/macros.scl +index 1500ab566f93b750873f5ebf752a0ce5a631f2a0..67c76be732d2f8abd54dc1af4da61a2c826432cc 100644 +--- a/macros.scl ++++ b/macros.scl +@@ -74,6 +74,7 @@ package or when debugging this package. + %global _docdir %{_datadir}/doc + %global _defaultdocdir %{_docdir} + } ++%{?scl_dependency_generators:%scl_dependency_generators} + %global scl_pkg_name %{scl}-%{pkg_name} + %scl_debug + %global __os_install_post %{expand: +-- +1.9.3 + diff --git a/SOURCES/0013-Add-capability-to-share-collections-using-nfs.patch b/SOURCES/0013-Add-capability-to-share-collections-using-nfs.patch new file mode 100644 index 0000000..e966df4 --- /dev/null +++ b/SOURCES/0013-Add-capability-to-share-collections-using-nfs.patch @@ -0,0 +1,31 @@ +From 5d045f6056750460e01f0b00d9004f64a6a6e1a6 Mon Sep 17 00:00:00 2001 +From: Lubos Kardos +Date: Wed, 24 Sep 2014 10:27:47 +0200 +Subject: [PATCH] Add capability to share collections using nfs + +- Add macro nfsmountable. If this macro is defined then syconfdir and + localstatedir are moved from /opt to /etc and /var. +--- + macros.scl | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/macros.scl b/macros.scl +index 67c76be..3bf00ce 100644 +--- a/macros.scl ++++ b/macros.scl +@@ -65,8 +65,11 @@ package or when debugging this package. + %global _libexecdir %{_exec_prefix}/libexec + %global _datadir %{_prefix}/share + %global _sysconfdir %{_scl_root}/etc +-%global _sharedstatedir %{_prefix}/com ++%{?nfsmountable: %global _sysconfdir %{_root_sysconfdir}%{_scl_prefix}/%{scl}} ++%global _sharedstatedir %{_scl_root}/var/lib ++%{?nfsmountable: %global _sharedstatedir %{_root_localstatedir}%{_scl_prefix}/%{scl}/lib} + %global _localstatedir %{_scl_root}/var ++%{?nfsmountable: %global _localstatedir %{_root_localstatedir}%{_scl_prefix}/%{scl}} + %global _libdir %{_exec_prefix}/%{_lib} + %global _includedir %{_prefix}/include + %global _infodir %{_datadir}/info +-- +1.9.3 + diff --git a/SOURCES/macros.scl-filesystem b/SOURCES/macros.scl-filesystem new file mode 100644 index 0000000..61a9424 --- /dev/null +++ b/SOURCES/macros.scl-filesystem @@ -0,0 +1,340 @@ +%scl_files %{expand: +%defattr(-,root,root,-) +%dir %_scl_prefix +%dir %attr(555,root,root) %{_scl_root} +%dir %attr(555,root,root) %{_scl_scripts} +%{_scl_scripts}/enable +%{_root_sysconfdir}/scl/prefixes/%scl +%{_scl_root}/bin +%attr(555,root,root) %{_scl_root}/boot +%{_scl_root}/dev +%dir %{_sysconfdir} +%{_sysconfdir}/X11 +%{_sysconfdir}/xdg +%{_sysconfdir}/opt +%{_sysconfdir}/pm +%{_sysconfdir}/xinetd.d +%{_sysconfdir}/skel +%{_sysconfdir}/sysconfig +%{_sysconfdir}/pki +%{_scl_root}/home +%{_scl_root}/lib +%ifarch x86_64 ppc ppc64 ppc64le aarch64 sparc sparc64 s390 s390x +%{_scl_root}/%{_lib} +%endif +%{_scl_root}/media +%dir %{_scl_root}/mnt +%dir %{_scl_root}/opt +%attr(555,root,root) %{_scl_root}/proc +%attr(550,root,root) %{_scl_root}/root +%{_scl_root}/run +%{_scl_root}/sbin +%{_scl_root}/srv +%{_scl_root}/sys +%attr(1777,root,root) %{_scl_root}/tmp +%dir %{_scl_root}/usr +%attr(555,root,root) %{_scl_root}/usr/bin +%{_scl_root}/usr/etc +%{_scl_root}/usr/games +%{_scl_root}/usr/include +%dir %attr(555,root,root) %{_scl_root}/usr/lib +%ifarch x86_64 ppc ppc64 ppc64le aarch64 sparc sparc64 s390 s390x +%attr(555,root,root) %{_scl_root}/usr/%{_lib} +%endif +%{_scl_root}/usr/libexec +%{_scl_root}/usr/local +%attr(555,root,root) %{_scl_root}/usr/sbin +%dir %{_scl_root}/usr/share +%{_scl_root}/usr/share/aclocal +%{_scl_root}/usr/share/applications +%{_scl_root}/usr/share/augeas +%{_scl_root}/usr/share/backgrounds +%{_scl_root}/usr/share/desktop-directories +%{_scl_root}/usr/share/dict +%{_scl_root}/usr/share/doc +%attr(555,root,root) %dir %{_scl_root}/usr/share/empty +%{_scl_root}/usr/share/games +%{_scl_root}/usr/share/ghostscript +%{_scl_root}/usr/share/gnome +%{_scl_root}/usr/share/icons +%{_scl_root}/usr/share/idl +%{_scl_root}/usr/share/info +%dir %{_scl_root}/usr/share/locale +%dir %{_scl_root}/usr/share/man +%{_scl_root}/usr/share/mime-info +%{_scl_root}/usr/share/misc +%{_scl_root}/usr/share/omf +%{_scl_root}/usr/share/pixmaps +%{_scl_root}/usr/share/sounds +%{_scl_root}/usr/share/themes +%{_scl_root}/usr/share/xsessions +%{_scl_root}/usr/share/X11 +%{_scl_root}/usr/src +%{_scl_root}/usr/tmp +%dir %{_localstatedir} +%{_localstatedir}/adm +%{_localstatedir}/cache +%{_localstatedir}/db +%{_localstatedir}/empty +%{_localstatedir}/games +%{_localstatedir}/gopher +%{_localstatedir}/lib +%{_localstatedir}/local +%ghost %dir %attr(755,root,root) %{_localstatedir}/lock +%ghost %{_localstatedir}/lock/subsys +%{_localstatedir}/log +%{_localstatedir}/mail +%{_localstatedir}/nis +%{_localstatedir}/opt +%{_localstatedir}/preserve +%ghost %attr(755,root,root) %{_localstatedir}/run +%dir %{_localstatedir}/spool +%attr(755,root,root) %{_localstatedir}/spool/lpd +%attr(775,root,mail) %{_localstatedir}/spool/mail +%attr(1777,root,root) %{_localstatedir}/tmp +%{_localstatedir}/yp +} + +%scl_install %{expand: +# scl specific stuff +mkdir -p %{buildroot}%{_root_sysconfdir}/{rpm,scl/prefixes} +cat >> %{buildroot}%{_root_sysconfdir}/rpm/macros.%{scl}-config << EOF +%%%%scl %scl +%{?nfsmountable:%%%%nfsmountable %{nfsmountable}} +%{!?nfsmountable:%%%%undefine nfsmountable} +EOF +cat >> %{buildroot}%{_root_sysconfdir}/scl/prefixes/%{scl} << EOF +%_scl_prefix +EOF +# filelist +set +x +cat >> %{buildroot}/lang-exceptions << EOF +af_ZA +am_ET +ast_ES +az_IR +bg_BG +bn_IN +ca@valencia +ca_ES +ca_ES@valencian +cs_CZ +de_AT +de_CH +de_DE +default +el_GR +en_AU +en_CA +en_GB +en_US +en_NZ +es_AR +es_CL +es_CO +es_CR +es_DO +es_EC +es_ES +es_GT +es_HN +es_MX +es_NI +es_PA +es_PE +es_PR +es_SV +es_UY +es_VE +et_EE +eu_ES +fa_IR +fi_FI +fr_BE +fr_CA +fr_CH +fr_FR +gl_ES +he_IL +hr_HR +hu_HU +it_CH +it_IT +ja_JP +ko_KR +ks@devanagari +lv_LV +ms_MY +my_MM +nb_NO +nds_DE +nl_BE +nl_NL +pl_PL +pt_BR +pt_PT +ru_RU +sl_SI +sq_AL +sr_RS +sv_SE +uk_UA +ur_PK +zh_CN +zh_CN.GB2312 +zh_HK +zh_TW +zh_TW.Big5 +en@boldquot +en@quot +nds@NFE +sr@ije +sr@ijekavian +sr@ijekavianlatin +sr@latin +sr@Latn +uz@cyrillic +uz@Latn +be@latin +en@shaw +brx +brx_IN +EOF +cat >> %{buildroot}/iso_639.sed << EOF +1,/\\)!{ + x + s/^$// + # we are on the first iso-code--nothing to process here + t + # process and write to output + s/\\s\\+/ /g + s/!! + # use '%' as a separator of parsed and unparsed input + s/\\(.*\\)iso_639_2T_code="\\([^"]\\+\\)"\\(.*\\)/\\2 % \\1 \\3/ + s/\\([^%]\\+\\)%\\(.*\\)iso_639_2B_code="\\([^"]\\+\\)"\\(.*\\)/\\1\\t\\3 % \\2 \\4/ + # clear subst. memory for the next t + t clear + :clear + s/\\([^%]\\+\\)%\\(.*\\)iso_639_1_code="\\([^"]\\+\\)"\\(.*\\)/\\1\\t\\3 % \\2 \\4/ + t name + # no 639-1 code--write xx + s/%/\\tXX %/ + :name + s/\\([^%]\\+\\)%\\(.*\\)name="\\([^"]\\+\\)"\\(.*\\)/\\1\\t\\3/ + s/ \\t/\\t/g + p + b + :noout +} +H +EOF +cat >> %{buildroot}/iso_3166.sed << EOF +1,/\\)!{ + x + s/^$// + # we are on the first iso-code--nothing to process here + t + # process and write to output + s/\\s\\+/ /g + s/!! + # use '%' as a separator of parsed and unparsed input + s/\\(.*\\)alpha_2_code="\\([^"]\\+\\)"\\(.*\\)/\\2 % \\1 \\3/ + s/\\([^%]\\+\\)%\\(.*\\)alpha_3_code="\\([^"]\\+\\)"\\(.*\\)/\\1% \\2 \\4/ + # clear subst. memory for the next t + t clear + :clear + s/\\([^%]\\+\\)%\\(.*\\)numeric_code="\\([^"]\\+\\)"\\(.*\\)/\\1% \\2 \\4/ + t name + # no 3166 code--write xx + s/%/\\tXX %/ + :name + s/\\([^%]\\+\\)%\\(.*\\)name="\\([^"]\\+\\)"\\(.*\\)/\\1\\t\\3/ + s/ \\t/\\t/g + p + b + :noout +} +H +EOF +mkdir -p %{buildroot}%{_localstatedir} +pushd %{buildroot}%{_localstatedir} +mkdir -p {adm,empty,gopher,lib/{games,misc,rpm-state},local,lock/subsys,log,nis,preserve,run,spool/{mail,lpd},tmp,db,cache,opt,games,yp} +popd +mkdir -p %{buildroot}%{_sysconfdir} +pushd %{buildroot}%{_sysconfdir} +mkdir -p {X11/{applnk,fontpath.d},xdg/autostart,opt,pm/{config.d,power.d,sleep.d},xinetd.d,skel,sysconfig,pki} +popd +mkdir -p %{buildroot}%{_scl_root} +rm -f $RPM_BUILD_DIR/%{buildsubdir}/filelist +rm -f $RPM_BUILD_DIR/%{buildsubdir}/filesystem +pushd %{buildroot}%{_scl_root} +mkdir -p boot dev \\ + home media mnt opt proc root run/lock srv sys tmp \\ + usr/{bin,etc,games,include,lib/{games,locale,modules,sse2},libexec,local/{bin,etc,games,lib,sbin,src,share/{applications,man/man{1,2,3,4,5,6,7,8,9,n,1x,2x,3x,4x,5x,6x,7x,8x,9x},info},libexec,include,},sbin,share/{aclocal,applications,augeas/lenses,backgrounds,desktop-directories,dict,doc,empty,games,ghostscript/conf.d,gnome,icons,idl,info,man/man{1,2,3,4,5,6,7,8,9,n,1x,2x,3x,4x,5x,6x,7x,8x,9x,0p,1p,3p},mime-info,misc,omf,pixmaps,sounds,themes,xsessions,X11},src,src/kernels,src/debug} +%ifarch x86_64 ppc ppc64 ppc64le aarch64 sparc sparc64 s390 s390x +mkdir -p usr/{%{_lib}/{games,sse2,tls,X11,pm-utils/{module.d,power.d,sleep.d}},local/%{_lib}} +%endif +ln -snf %{_localstatedir}/tmp usr/tmp +ln -snf spool/mail %{buildroot}%{_localstatedir}/mail +ln -snf usr/bin bin +ln -snf usr/sbin sbin +ln -snf usr/lib lib +%ifarch x86_64 ppc ppc64 ppc64le aarch64 sparc sparc64 s390 s390x +ln -snf usr/%{_lib} %{_lib} +%endif +sed -n -f %{buildroot}/iso_639.sed /usr/share/xml/iso-codes/iso_639.xml >%{buildroot}/iso_639.tab +sed -n -f %{buildroot}/iso_3166.sed /usr/share/xml/iso-codes/iso_3166.xml >%{buildroot}/iso_3166.tab +grep -v "^$" %{buildroot}/iso_639.tab | grep -v "^#" | while read a b c d ; do + [[ "$d" =~ "^Reserved" ]] && continue + [[ "$d" =~ "^No linguistic" ]] && continue + locale=$c + if [ "$locale" = "XX" ]; then + locale=$b + fi + echo "%lang(${locale}) %{_scl_root}/usr/share/locale/${locale}" >> $RPM_BUILD_DIR/%{buildsubdir}/filelist + echo "%lang(${locale}) %ghost %config(missingok) %{_scl_root}/usr/share/man/${locale}" >> $RPM_BUILD_DIR/%{buildsubdir}/filelist +done +cat %{buildroot}/lang-exceptions | grep -v "^#" | grep -v "^$" | while read loc ; do + locale=$loc + locality= + special= + [[ "$locale" =~ "@" ]] && locale=${locale%%%%@*} + [[ "$locale" =~ "_" ]] && locality=${locale##*_} + [[ "$locality" =~ "." ]] && locality=${locality%%%%.*} + [[ "$loc" =~ "_" ]] || [[ "$loc" =~ "@" ]] || special=$loc + # If the locality is not official, skip it + if [ -n "$locality" ]; then + grep -q "^$locality" %{buildroot}/iso_3166.tab || continue + fi + # If the locale is not official and not special, skip it + if [ -z "$special" ]; then + egrep -q "[[:space:]]${locale%%_*}[[:space:]]" \\ + %{buildroot}/iso_639.tab || continue + fi + echo "%lang(${locale}) %{_scl_root}/usr/share/locale/${loc}" >> $RPM_BUILD_DIR/%{buildsubdir}/filelist + echo "%lang(${locale}) %ghost %config(missingok) %{_scl_root}/usr/share/man/${loc}" >> $RPM_BUILD_DIR/%{buildsubdir}/filelist +done +rm -f %{buildroot}/iso_639.tab +rm -f %{buildroot}/iso_639.sed +rm -f %{buildroot}/iso_3166.tab +rm -f %{buildroot}/iso_3166.sed +rm -f %{buildroot}/lang-exceptions +cat $RPM_BUILD_DIR/%{buildsubdir}/filelist | grep "locale" | while read a b ; do + mkdir -p -m 755 %{buildroot}/$b/LC_MESSAGES +done +cat $RPM_BUILD_DIR/%{buildsubdir}/filelist | grep "/share/man" | while read a b c d; do + mkdir -p -m 755 %{buildroot}/$d/man{1,2,3,4,5,6,7,8,9,n,1x,2x,3x,4x,5x,6x,7x,8x,9x,0p,1p,3p} +done +for i in man{1,2,3,4,5,6,7,8,9,n,1x,2x,3x,4x,5x,6x,7x,8x,9x,0p,1p,3p}; do + echo "%{_scl_root}/usr/share/man/$i" >> $RPM_BUILD_DIR/%{buildsubdir}/filelist +done +ln -s $RPM_BUILD_DIR/%{buildsubdir}/filelist $RPM_BUILD_DIR/%{buildsubdir}/filesystem +set -x +popd +} diff --git a/SOURCES/scl-utils-20130529-shebang.patch b/SOURCES/scl-utils-20130529-shebang.patch new file mode 100644 index 0000000..6b9d8e3 --- /dev/null +++ b/SOURCES/scl-utils-20130529-shebang.patch @@ -0,0 +1,100 @@ + +https://bugzilla.redhat.com/show_bug.cgi?id=1372700 + +Backported from scl-utils-2.0. + +--- scl-utils-20130529/scl.c.shebang ++++ scl-utils-20130529/scl.c +@@ -35,6 +35,74 @@ + #define SCL_CONF_DIR "/etc/scl/conf/" + #define MIN(X,Y) ((X) < (Y) ? (X) : (Y)) + ++static int count_words(const char *str, char ch) ++{ ++ int count = 0; ++ bool inside_word = false; ++ ++ while (*str != '\0') { ++ if (*str != ch) { ++ if (!inside_word) { ++ count++; ++ } ++ inside_word = true; ++ } else { ++ inside_word = false; ++ } ++ str++; ++ } ++ ++ return count; ++} ++ ++/** ++ * Procedure to parse shebang line and transform it to standard command ++ * ++ * In general, the shebang line has n parts at the beginnning: ++ * argv[0] => the name of the utility stated in shebang ++ * argv[1] => all the arguments as one string ++ * argv[2] => the script which was executed ++ * argv[n] => argument for executed script ++ * ++ * Considering the following shebang line in script ./test.py: ++ * #!/usr/bin/scl enable collectionX ++ * argv[0] = "/usr/bin/scl" ++ * argv[1] = "enable collectionX" ++ * argv[2] = "./test.py" ++ * argv[n] = "argn" ++ */ ++static void parse_shebang(int argc, char *argv[], ++ int *_shebang_argc, char ***_shebang_argv) { ++ int i = 0; ++ char *p; ++ int shebang_argc; ++ char **shebang_argv; ++ ++ shebang_argc = count_words(argv[1], ' ') + argc - 1; ++ shebang_argv = (char **)malloc(sizeof(char *) * shebang_argc); ++ if (shebang_argv == NULL) { ++ fprintf(stderr, "Can't allocate memory.\n"); ++ exit(EXIT_FAILURE); ++ } ++ ++ shebang_argv[i++] = argv[0]; ++ ++ p = strtok(argv[1], " "); ++ while (p != NULL) { ++ shebang_argv[i++] = p; ++ p = strtok(NULL, " "); ++ } ++ ++ while (i < shebang_argc) { ++ shebang_argv[i] = argv[i - (shebang_argc - argc)]; ++ i++; ++ } ++ ++ *_shebang_argc = shebang_argc; ++ *_shebang_argv = shebang_argv; ++} ++ ++ + static void check_asprintf( char **strp, const char *fmt, ... ) { + va_list args; + +@@ -648,6 +716,17 @@ + } + } + ++ if (argc >= 3 && strchr(argv[1], ' ') != NULL) { ++ /* Apparently a shebang line */ ++ char **fake_argv = argv; ++ int fake_argc = argc; ++ ++ parse_shebang(argc, argv, &fake_argc, &fake_argv); ++ ++ argc = fake_argc; ++ argv = fake_argv; ++ } ++ + for (i = 0; i < argc; i++) { + if (strcmp(argv[i], "--") == 0) { + break; diff --git a/SOURCES/scl_source b/SOURCES/scl_source new file mode 100644 index 0000000..b0036bd --- /dev/null +++ b/SOURCES/scl_source @@ -0,0 +1,75 @@ +#!/bin/bash + +_scl_source_help="Usage: source scl_source [ ...] + +Don't use this script outside of SCL scriptlets! + +Options: + -h, --help display this help and exit" + +if [ $# -eq 0 -o $1 = "-h" -o $1 = "--help" ]; then + echo "$_scl_source_help" + return 0 +fi + + +if [ -z "$_recursion" ]; then + _recursion="false" +fi +if [ -z "$_scl_scriptlet_name" ]; then + # The only allowed action in the case of recursion is the same + # as was the original + _scl_scriptlet_name=$1 +fi +shift 1 + +if [ -z "$_scl_dir" ]; then + # No need to re-define the directory twice + _scl_dir=/etc/scl/conf + if [ ! -e $_scl_dir ]; then + _scl_dir=/etc/scl/prefixes + fi +fi + +for arg in "$@"; do + _scl_prefix_file=$_scl_dir/$arg + _scl_prefix=`cat $_scl_prefix_file 2> /dev/null` + if [ $? -ne 0 ]; then + echo "Can't read $_scl_prefix_file, $arg is probably not installed." + return 1 + fi + + # First check if the collection is already in the list + # of collections to be enabled + for scl in ${_scls[@]}; do + if [ $arg == $scl ]; then + continue 2 + fi + done + + # Now check if the collection isn't already enabled + /usr/bin/scl_enabled $arg > /dev/null 2> /dev/null + if [ $? -ne 0 ]; then + _scls+=($arg) + _scl_prefixes+=($_scl_prefix) + fi; +done + +if [ $_recursion == "false" ]; then + _i=0 + _recursion="true" + while [ $_i -lt ${#_scls[@]} ]; do + _scl_scriptlet_path="${_scl_prefixes[$_i]}/${_scls[$_i]}/${_scl_scriptlet_name}" + source "$_scl_scriptlet_path" + if [ $? -ne 0 ]; then + echo "Can't source $_scl_scriptlet_name, skipping." + else + export X_SCLS="${_scls[$_i]} $X_SCLS" + fi; + _i=$(($_i+1)) + done + _scls=() + _scl_prefixes=() + _scl_scriptlet_name="" + _recursion="false" +fi diff --git a/SPECS/scl-utils.spec b/SPECS/scl-utils.spec new file mode 100644 index 0000000..fd625e3 --- /dev/null +++ b/SPECS/scl-utils.spec @@ -0,0 +1,331 @@ +Summary: Utilities for alternative packaging +Name: scl-utils +Version: 20130529 +Release: 19%{?dist} +License: GPLv2+ +Group: Applications/File +URL: https://fedorahosted.org/released/scl-utils/ +Source0: https://fedorahosted.org/released/scl-utils/%{name}-%{version}.tar.gz +Source1: macros.scl-filesystem +Source2: scl_source +Patch0: 0001-Rename-attr-macros-so-they-are-correctly-named.patch +Patch1: 0002-Implement-as-a-command-separator.patch +Patch2: 0003-Mention-environment-modifying-commands-in-the-man-pa.patch +Patch3: 0004-Check-whether-a-file-was-created-when-doing-mkstemp-.patch +Patch4: 0005-Various-fixes-in-Provides-and-Requires-of-scl-packag.patch +Patch5: 0006-Modified-the-behavior-of-debuginfo-generation-proces.patch +Patch6: 0007-Changed-command-description-in-scl-man-pages.patch +Patch7: 0008-Changed-script-paths-in-__os_install_post.patch +Patch8: 0009-Remove-sclbuild-as-it-s-not-that-useful.patch +Patch9: 0010-Added-capability-to-register-and-deregister-collecti.patch +Patch10: 0011-Fix-missing-allocation-check-in-read_script_output.patch +Patch11: 0012-Introduce-scl_dependency_generators-macro.patch +Patch12: 0013-Add-capability-to-share-collections-using-nfs.patch +Patch14: scl-utils-20130529-shebang.patch +Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +%description +Run-time utility for alternative packaging. + +%package build +Summary: RPM build macros for alternative packaging +Group: Applications/File +Requires: iso-codes +Requires: redhat-rpm-config + +%description build +Essential RPM build macros for alternative packaging. + +%prep +%setup -q +%patch0 -p1 -b .attr-names +%patch1 -p1 -b .command-separator +%patch2 -p1 -b .env-variables-man +%patch3 -p1 -b .coverity-mkstemp +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 +%patch7 -p1 +%patch8 -p1 +%patch9 -p1 +%patch10 -p1 +%patch11 -p1 +%patch12 -p1 +%patch14 -p1 -b .shebang + +%build +make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS" + +%install +rm -rf %buildroot +mkdir -p %buildroot%{_sysconfdir}/rpm +mkdir -p %buildroot%{_sysconfdir}/scl/prefixes +pushd %buildroot%{_sysconfdir}/scl +ln -s prefixes conf +popd +mkdir -p %buildroot/opt/rh +install -d -m 755 %buildroot%{_mandir}/man1 +make install DESTDIR=%buildroot +cat %SOURCE1 >> %buildroot%{_sysconfdir}/rpm/macros.scl +install -m 755 %SOURCE2 %buildroot%{_bindir}/scl_source + +# remove brp-python-hardlink invocation as it is not present in RHEL5 +%if 0%{?rhel} == 5 + sed -i -e '/^.*brp-python-hardlink.*/d' %buildroot%{_sysconfdir}/rpm/macros.scl +%endif + +%clean +rm -rf %buildroot + +%files +%defattr(-,root,root,-) +%dir /opt/rh +%{_sysconfdir}/scl/conf +%dir %{_sysconfdir}/scl/prefixes +%{_bindir}/scl +%{_bindir}/scl_enabled +%{_bindir}/scl_source +%{_mandir}/man1/* +%{_sysconfdir}/bash_completion.d/scl.bash + +%{!?_rpmconfigdir:%global _rpmconfigdir /usr/lib/rpm} +%files build +%defattr(-,root,root,-) +%{_sysconfdir}/rpm/macros.scl +%{_rpmconfigdir}/scldeps.sh +%{_rpmconfigdir}/fileattrs/scl.attr +%{_rpmconfigdir}/brp-scl-compress +%{_rpmconfigdir}/brp-scl-python-bytecompile + +%changelog +* Mon Jun 18 2018 Joe Orton - 20130529-19 +- own lib64 directories on aarch64, ppc64le (#1475718) + +* Fri Jan 13 2017 Joe Orton - 20130529-18 +- fix "scl enable" usage in shebang lines (#1372700) + +* Thu Mar 05 2015 Lubos Karddos - 20130529-17 +- Remove /uucp/ from directory structure. + +* Thu Mar 05 2015 Lubos Karddos - 20130529-16 +- Remove /scls/ from macros _sysconfdir, _sharedstatedir and _localstatedir + +* Tue Jan 27 2015 Lubos Karddos - 20130529-15 +- fixed wrong syntax of or-operator in scl.attr + +* Tue Jan 06 2015 Jan Zeleny - 20142529-14 +- remove the vendor prefix from %%scl_install + +* Tue Jan 06 2015 Jan Zeleny - 20130529-13 +- bump the version to get in sync with 7.1 branch +- Reflect the state of %%nfsmountable macro in collections' rpm macro files +- escape all the %% chars in changelog + +* Mon Jan 05 2015 Jan Zeleny - 20132529-13 +- after a thorough discussion with scl maintainers, revert the vendor prefix + in package names + +* Fri Dec 12 2014 Jan Zeleny - 20132529-12 +- the second half of the macro rename + +* Fri Dec 12 2014 Jan Zeleny - 20130529-11 +- renamed %%scl_pkg_prefix to %%scl_full_prefix (#1167042) + +* Fri Dec 05 2014 Lubos Kardos - 20130529-10 +- Allow to use vendor prefix in packages names +- Include %%nfsmountable macro into scl's rpm macros file + +* Wed Oct 22 2014 Lubos Kardos - 20130529-9 +- "filesystem" is now symlink to file "filelist" + +* Wed Oct 08 2014 Lubos Kardos - 20130529-6 +Catch up with Fedora and RHEL6 +- add automatic Provides: scl-package(%%scl) to all scl packages + (except for metapackages) +- add automatic Requires: %%scl_runtime to all scl packages + (except for metapackages) +- the "filesystem" file renamed back to "filelist" +- add correct dependencies to debug packages. +- allow disabling debuginfo generation +- remove automatic creation of debuginfo for metapackage. +- rephrase command description in man page +- fix system paths in __os_install_post +- remove the sclbuild utility, as it's mostly useless +- add the command set to register/deregister collection +- fix missing allocation check in read_script_output() +- drop recursive ownership of /usr/lib within SCL root +- introduce %%scl_dependency_generators macro + +* Fri Jan 24 2014 Daniel Mach - 20130529-5 +- Mass rebuild 2014-01-24 + +* Tue Jan 14 2014 Jan Zeleny - 20130529-4 +- fixed some coverity-reported bugs (related: #1032616) +- a note about env. variables in man page (#968954) +- drop the /var/spool/uucp from the default fs structure (#1033674) + +* Fri Dec 27 2013 Daniel Mach - 20130529-3 +- Mass rebuild 2013-12-27 + +* Thu Nov 21 2013 Jan Zeleny - 20130529-2 +- add scl_source script for intercollection dependencies (#1032444) +- updated macros in macros.scl-filesystem (#1032451, #1032451) +- add delimiter between collections and command (#1032460) +- fix the name of attr macros (#1023628) + +* Wed May 29 2013 Jan Zeleny - 20130529-1 +- changed the upstream tarball location +- update to 20130529 + +* Fri Feb 01 2013 Jindrich Novy 20121110-2 +- add build compatibility fixes + +* Wed Dec 19 2012 Jindrich Novy 20121110-1 +- introduce sclbuild utility +- fix exporting of env. variables when mutiple collections are + enabled at the same time +- better bash completion +- fix changelog + +* Thu Sep 27 2012 Jindrich Novy 20120927-1 +- update to 20120927 +- better BUILDROOT processing +- bash completition for scl command +- debuginfo package now has SCL-specific provide +- non-SCL builds are without warning in build log +- improved help + +* Thu Aug 09 2012 Jindrich Novy 20120809-1 +- update to 20120809 +- processes the SCL buildroot correctly now + +* Thu Aug 02 2012 Jindrich Novy 20120802-1 +- update to 20120802 + +* Tue Jul 31 2012 Jindrich Novy 20120731-1 +- add functionality that allows to list all packages in a collection +- add dependency generators + +* Sat Jul 21 2012 Fedora Release Engineering - 20120613-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Wed Jun 13 2012 Jindrich Novy 20120613-1 +- Requires: iso-codes for basic filesystem in build subpackage +- add scl_require_package() macro to depend on a particular package + from the collection +- fix filesystem file list +- tighten runtime package dependency via scl_require() +- fix _localstatedir to point to the correct path according to redhat-rpm-config +- thanks to Bohuslav Kabrda for feature proposals/QA/fixes + +* Thu May 03 2012 Jindrich Novy 20120503-1 +- avoid doublefree corruption when reading commands from stdin + +* Sun Apr 22 2012 Jindrich Novy 20120423-1 +- keep filesystem macros out of the main sources as + it is distro-dependent + +* Fri Apr 13 2012 Jindrich Novy 20120413-1 +- filesystem ownership by meta package +- add man page +- fix memory leak when parsing commands from stdin +- use more descriptive error message if /etc/prefixes is missing + +* Wed Feb 29 2012 Jindrich Novy 20120229-1 +- do not prepend scl_* prefix to package names +- unify package naming to -package-version +- add scl --list functionality to list available SCLs + +* Thu Feb 09 2012 Jindrich Novy 20120209-1 +- fix minor bugs (#788194) + - clear temp files + - handle commands from stdin properly + - run command even if ran as "scl enable SCL command" from already + enabled SCL + +* Wed Jan 25 2012 Jindrich Novy 20120125-1 +- remove dsc macros +- trigger scl-utils-build BR inclusion while using scl macros + +* Wed Jan 11 2012 Jindrich Novy 20120111-1 +- add "dsc" alias to "scl" utility + +* Wed Dec 14 2011 Jindrich Novy 20111214-1 +- initial review fixes (#767556) + +* Fri Dec 9 2011 Jindrich Novy 20111209-1 +- allow to use dsc_* macros and dsc* package naming + +* Wed Nov 16 2011 Jindrich Novy 20111116-1 +- package is now named scl-utils + +* Mon Oct 17 2011 Jindrich Novy 20111017-1 +- initial packaging for upstream + +* Thu Sep 22 2011 Jindrich Novy 0.1-14 +- define %%_defaultdocdir to properly relocate docs into + a stack +- document a way how to pass command to stack via stdin + +* Wed Jun 22 2011 Jindrich Novy 0.1-13 +- fix Stack meta config configuration + +* Fri Jun 17 2011 Jindrich Novy 0.1-12 +- use own Stack path configuration mechanism + +* Fri Jun 17 2011 Jindrich Novy 0.1-11 +- avoid redefinition of %%_root* macros by multiple + occurence of %%stack_package +- make the Stack root path configurable + +* Tue Jun 14 2011 Jindrich Novy 0.1-10 +- stack utility allows to read command from stdin + +* Mon Jun 13 2011 Jindrich Novy 0.1-9 +- introduce stack enablement tracking +- introduce "stack_enabled" helper utility to let a stack + application figure out which stacks are actually enabled +- disallow running stacks recursively + +* Mon Jun 13 2011 Jindrich Novy 0.1-8 +- stack utility returns executed commands' exit value + +* Fri Jun 10 2011 Jindrich Novy 0.1-7 +- fix possible segfault in the stack utility + +* Fri Jun 10 2011 Jindrich Novy 0.1-6 +- %%stack_name: initial part of stack prefix and name of + meta package providing scriptlets +- %%stack_prefix: stack namespacing part to be prepended to + original non-stack package name, can be used for Provides + namespacing as well +- %%stack_runtime: run-time package name providing scriptlets +- %%stack_require: macro to define dependency to other stacks + +* Thu Jun 09 2011 Jindrich Novy 0.1-5 +- split the package into two - runtime and build part +- decrease verbosity when enabling a stack + +* Wed Jun 08 2011 Jindrich Novy 0.1-4 +- prepend stack package with stack_* to prevent namespace + conflicts with core packages + +* Thu Jun 02 2011 Jindrich Novy 0.1-3 +- introduce metapackage concept + +* Wed Jun 01 2011 Jindrich Novy 0.1-2 +- modify macros so that they don't change preamble tags + +* Sun May 08 2011 Jindrich Novy 0.1-1 +- initial packaging