From 28453c21125d62edabe44e99d5d43d5f576378ee Mon Sep 17 00:00:00 2001 From: CentOS Buildsys Date: Jan 27 2014 10:53:09 +0000 Subject: import scl-utils-20130529-5.el7.src.rpm --- 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/macros.scl-filesystem b/SOURCES/macros.scl-filesystem index 78b3ce5..721f3d9 100644 --- a/SOURCES/macros.scl-filesystem +++ b/SOURCES/macros.scl-filesystem @@ -1,4 +1,6 @@ %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 @@ -89,7 +91,6 @@ %dir %{_scl_root}/var/spool %attr(755,root,root) %{_scl_root}/var/spool/lpd %attr(775,root,mail) %{_scl_root}/var/spool/mail -%attr(755,uucp,uucp) %{_scl_root}/var/spool/uucp %attr(1777,root,root) %{_scl_root}/var/tmp %{_scl_root}/var/yp } @@ -262,18 +263,23 @@ H EOF mkdir -p %{buildroot}%{_scl_root} rm -f $RPM_BUILD_DIR/%{buildsubdir}/filesystem -cd %{buildroot}%{_scl_root} +pushd %{buildroot}%{_scl_root} mkdir -p boot dev \\ etc/{X11/{applnk,fontpath.d},xdg/autostart,opt,pm/{config.d,power.d,sleep.d},xinetd.d,skel,sysconfig,pki} \\ home media mnt opt proc root run/lock srv sys tmp \\ - usr/{bin,etc,games,include,%{_lib}/{games,sse2,tls,X11,pm-utils/{module.d,power.d,sleep.d}},lib/{games,locale,modules,sse2},libexec,local/{bin,etc,games,lib,%{_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} \\ - var/{adm,empty,gopher,lib/{games,misc,rpm-state},local,lock/subsys,log,nis,preserve,run,spool/{mail,lpd,uucp},tmp,db,cache,opt,games,yp} + 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} \\ + var/{adm,empty,gopher,lib/{games,misc,rpm-state},local,lock/subsys,log,nis,preserve,run,spool/{mail,lpd},tmp,db,cache,opt,games,yp} +%ifarch x86_64 ppc ppc64 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 ../var/tmp usr/tmp ln -snf spool/mail var/mail ln -snf usr/bin bin ln -snf usr/sbin sbin ln -snf usr/lib lib +%ifarch x86_64 ppc ppc64 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 @@ -321,4 +327,5 @@ 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}/filesystem done set -x +popd } 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 index 14abfcf..1cb7c6e 100644 --- a/SPECS/scl-utils.spec +++ b/SPECS/scl-utils.spec @@ -1,28 +1,37 @@ -Summary: Utilities for alternative packaging -Name: scl-utils -Version: 20130529 -Release: 1%{?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 -Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +Summary: Utilities for alternative packaging +Name: scl-utils +Version: 20130529 +Release: 5%{?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 +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 +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 %build make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS" @@ -38,6 +47,7 @@ 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 @@ -50,10 +60,11 @@ rm -rf %buildroot %files %defattr(-,root,root,-) %dir /opt/rh -%dir %{_sysconfdir}/scl/conf +%{_sysconfdir}/scl/conf %dir %{_sysconfdir}/scl/prefixes %{_bindir}/scl %{_bindir}/scl_enabled +%{_bindir}/scl_source %{_mandir}/man1/* %{_sysconfdir}/bash_completion.d/scl.bash @@ -68,6 +79,23 @@ rm -rf %buildroot %{_rpmconfigdir}/brp-scl-python-bytecompile %changelog +* 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