Rebased to scl-utils 2.0
This commit is contained in:
parent
f06d1fccdb
commit
9d7bbf214e
1
.gitignore
vendored
1
.gitignore
vendored
@ -7,3 +7,4 @@
|
||||
/scl-utils-20140108.tar.gz
|
||||
/scl-utils-20140127.tar.gz
|
||||
/scl-utils-20140815.tar.gz
|
||||
/scl-utils-2.0.tar.bz2
|
||||
|
@ -1,30 +0,0 @@
|
||||
From 2d94a156c27f53301c0cda8075e1af3115fbdaa4 Mon Sep 17 00:00:00 2001
|
||||
From: Jan Zeleny <jzeleny@redhat.com>
|
||||
Date: Wed, 27 Aug 2014 14:20:16 +0200
|
||||
Subject: [PATCH] Add missing /scls/ to %_sharedstatedir, %_localstatedir and
|
||||
%_sysconfdir
|
||||
|
||||
---
|
||||
macros.scl | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/macros.scl b/macros.scl
|
||||
index f4eac508a77970d8c7df708f0b6f364f84f4d0b0..094bde95d390640fb070424b50d31b0a495c732c 100644
|
||||
--- a/macros.scl
|
||||
+++ b/macros.scl
|
||||
@@ -67,9 +67,9 @@ package or when debugging this package.
|
||||
%global _sbindir %{_exec_prefix}/sbin
|
||||
%global _libexecdir %{_exec_prefix}/libexec
|
||||
%global _datadir %{_prefix}/share
|
||||
-%global _sysconfdir %{_root_sysconfdir}/opt/%{scl_vendor}/%{scl}
|
||||
-%global _sharedstatedir %{_root_localstatedir}/opt/%{scl_vendor}/%{scl}/lib
|
||||
-%global _localstatedir %{_root_localstatedir}/opt/%{scl_vendor}/%{scl}
|
||||
+%global _sysconfdir %{_root_sysconfdir}/opt/%{scl_vendor}/scls/%{scl}
|
||||
+%global _sharedstatedir %{_root_localstatedir}/opt/%{scl_vendor}/scls/%{scl}/lib
|
||||
+%global _localstatedir %{_root_localstatedir}/opt/%{scl_vendor}/scls/%{scl}
|
||||
%global _libdir %{_exec_prefix}/%{_lib}
|
||||
%global _includedir %{_prefix}/include
|
||||
%global _infodir %{_datadir}/info
|
||||
--
|
||||
1.9.3
|
||||
|
@ -1,49 +0,0 @@
|
||||
From acf0985e22e8ce49513bdbfa504dd132fe1a8624 Mon Sep 17 00:00:00 2001
|
||||
From: Jan Zeleny <jzeleny@redhat.com>
|
||||
Date: Thu, 11 Dec 2014 13:17:18 +0100
|
||||
Subject: [PATCH 1/2] Add support for %nfsmountable macro
|
||||
|
||||
If the macro is set in the collection, the layout of the collection changes:
|
||||
- the configuration is moved out of /opt to /etc/opt
|
||||
- the data are moved from /opt to /var/opt
|
||||
|
||||
Along with this change, another one is necessary. For the sake of conformance
|
||||
with FHS, let's not make the _scl_base configurable. Having collections
|
||||
anywhere outside /opt would not make much sense and more importantly, it would
|
||||
likely cause troubles (having /etc/usr/lib instead of /etc/opt and similar).
|
||||
---
|
||||
macros.scl | 11 +++++++----
|
||||
1 file changed, 7 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/macros.scl b/macros.scl
|
||||
index 094bde95d390640fb070424b50d31b0a495c732c..aaa7a809ab33f266f915554275a4566abf3505e3 100644
|
||||
--- a/macros.scl
|
||||
+++ b/macros.scl
|
||||
@@ -42,7 +42,7 @@ package or when debugging this package.
|
||||
%global pkg_name %1
|
||||
%global scl_name %{scl}
|
||||
%global scl_runtime %{scl}-runtime
|
||||
-%{!?scl_basedir: %global scl_basedir /opt}
|
||||
+%global scl_basedir /opt
|
||||
%{!?scl_vendor: %global scl_vendor rh}
|
||||
%{!?_scl_prefix: %global _scl_prefix %{scl_basedir}/%{scl_vendor}}
|
||||
%global _scl_scripts %{_scl_prefix}/%{scl}
|
||||
@@ -67,9 +67,12 @@ package or when debugging this package.
|
||||
%global _sbindir %{_exec_prefix}/sbin
|
||||
%global _libexecdir %{_exec_prefix}/libexec
|
||||
%global _datadir %{_prefix}/share
|
||||
-%global _sysconfdir %{_root_sysconfdir}/opt/%{scl_vendor}/scls/%{scl}
|
||||
-%global _sharedstatedir %{_root_localstatedir}/opt/%{scl_vendor}/scls/%{scl}/lib
|
||||
-%global _localstatedir %{_root_localstatedir}/opt/%{scl_vendor}/scls/%{scl}
|
||||
+%global _sysconfdir %{_scl_root}/etc
|
||||
+%{?nfsmountable: %global _sysconfdir %{_root_sysconfdir}%{_scl_prefix}/scls/%{scl}}
|
||||
+%global _sharedstatedir %{_scl_root}/var/lib
|
||||
+%{?nfsmountable: %global _sharedstatedir %{_root_localstatedir}%{_scl_prefix}/scls/%{scl}/lib}
|
||||
+%global _localstatedir %{_scl_root}/var
|
||||
+%{?nfsmountable: %global _localstatedir %{_root_localstatedir}%{_scl_prefix}/scls/%{scl}}
|
||||
%global _libdir %{_exec_prefix}/%{_lib}
|
||||
%global _includedir %{_prefix}/include
|
||||
%global _infodir %{_datadir}/info
|
||||
--
|
||||
1.9.3
|
||||
|
@ -1,166 +0,0 @@
|
||||
From 67f6024e0c7f045b5519276fae64af8b605a614c Mon Sep 17 00:00:00 2001
|
||||
From: Jan Zeleny <jzeleny@redhat.com>
|
||||
Date: Thu, 11 Dec 2014 13:27:35 +0100
|
||||
Subject: [PATCH 2/2] Run register and deregister scriptlets during the
|
||||
respective operations
|
||||
|
||||
---
|
||||
scl.c | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
|
||||
1 file changed, 77 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/scl.c b/scl.c
|
||||
index c933855e149466221bab87ef7e4acd7bff6bd135..0da6d7041a0e1d54d109123c15d51b31cdaaf51e 100644
|
||||
--- a/scl.c
|
||||
+++ b/scl.c
|
||||
@@ -85,6 +85,7 @@ static int check_directory(const char *dir_name, struct stat *sb, int *count, st
|
||||
|
||||
if ((*count = scandir(dir_name, nl, 0, alphasort)) < 0) {
|
||||
perror("scandir");
|
||||
+ fprintf(stderr, "%s\n", dir_name);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
@@ -109,12 +110,14 @@ static int get_collection_dir_path(char *col_name, char **_col_dir) {
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -398,6 +401,44 @@ static int check_valid_collection(char *col_dir) {
|
||||
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;
|
||||
@@ -410,7 +451,8 @@ static int register_collection(char *col_path) {
|
||||
}
|
||||
|
||||
if (access(col_path, F_OK)) {
|
||||
- perror("Unable to register collection");
|
||||
+ perror("Directory doesn't exist");
|
||||
+ fprintf(stderr, "%s\n", col_path);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
@@ -438,15 +480,29 @@ static int register_collection(char *col_path) {
|
||||
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 <command>'\n", name);
|
||||
- fclose(f);
|
||||
free(new_file);
|
||||
free(col);
|
||||
|
||||
@@ -473,6 +529,7 @@ static int check_package(char *file_path, int *_status) {
|
||||
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);
|
||||
@@ -496,13 +553,30 @@ static int deregister_collection(char *col_path, bool force) {
|
||||
}
|
||||
}
|
||||
|
||||
+ 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 deregister collection");
|
||||
+ 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;
|
||||
--
|
||||
1.9.3
|
||||
|
@ -1,39 +0,0 @@
|
||||
From 7adf1f898cb1890164ec39ff74ea52a5413d6016 Mon Sep 17 00:00:00 2001
|
||||
From: Jan Zeleny <jzeleny@redhat.com>
|
||||
Date: Fri, 12 Dec 2014 13:16:16 +0100
|
||||
Subject: [PATCH] Use vendor in package names if required
|
||||
|
||||
---
|
||||
macros.scl | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/macros.scl b/macros.scl
|
||||
index aaa7a809ab33f266f915554275a4566abf3505e3..8a8ffab756f937c0fc1857cab5fccc1428259c7d 100644
|
||||
--- a/macros.scl
|
||||
+++ b/macros.scl
|
||||
@@ -41,10 +41,12 @@ package or when debugging this package.
|
||||
%scl_package() %{expand:%{!?_root_prefix:
|
||||
%global pkg_name %1
|
||||
%global scl_name %{scl}
|
||||
-%global scl_runtime %{scl}-runtime
|
||||
%global scl_basedir /opt
|
||||
%{!?scl_vendor: %global scl_vendor rh}
|
||||
%{!?_scl_prefix: %global _scl_prefix %{scl_basedir}/%{scl_vendor}}
|
||||
+%global scl_meta_name %{?scl_vendor_in_name:%{scl_vendor}-}%{scl}
|
||||
+%global scl_full_prefix %{scl_meta_name}-
|
||||
+%global scl_runtime %{scl_meta_name}-runtime
|
||||
%global _scl_scripts %{_scl_prefix}/%{scl}
|
||||
%global _scl_root %{_scl_prefix}/%{scl}/root
|
||||
%global _root_prefix %{_prefix}
|
||||
@@ -81,7 +83,7 @@ package or when debugging this package.
|
||||
%global _docdir %{_datadir}/doc
|
||||
%global _defaultdocdir %{_docdir}
|
||||
}
|
||||
-%global scl_pkg_name %{scl}-%{pkg_name}
|
||||
+%global scl_pkg_name %{scl_full_prefix}%{pkg_name}
|
||||
%scl_debug
|
||||
%global __os_install_post %{expand:
|
||||
/usr/lib/rpm/brp-scl-compress %{_scl_root}
|
||||
--
|
||||
1.9.3
|
||||
|
@ -1,26 +1,27 @@
|
||||
Summary: Utilities for alternative packaging
|
||||
Name: scl-utils
|
||||
Version: 20140815
|
||||
Release: 4%{?dist}
|
||||
License: GPLv2+
|
||||
Group: Applications/File
|
||||
URL: https://fedorahosted.org/SoftwareCollections/
|
||||
Source0: https://fedorahosted.org/released/scl-utils/%{name}-%{version}.tar.gz
|
||||
Source1: macros.scl-filesystem
|
||||
Patch1: 0001-Add-missing-scls-to-_sharedstatedir-_localstatedir-a.patch
|
||||
Patch2: 0002-Add-support-for-nfsmountable-macro.patch
|
||||
Patch3: 0003-Run-register-and-deregister-scriptlets-during-the-re.patch
|
||||
Patch4: 0004-Use-vendor-in-package-names-if-required.patch
|
||||
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
Name: scl-utils
|
||||
Epoch: 1
|
||||
Version: 2.0
|
||||
Release: 1%{dist}
|
||||
Summary: Utilities for alternative packaging
|
||||
|
||||
License: GPLv2+
|
||||
Group: Applications/File
|
||||
URL: https://fedorahosted.org/SoftwareCollections/
|
||||
Source0: %{name}-%{version}.tar.bz2
|
||||
Source1: macros.scl-filesystem
|
||||
Buildrequires: cmake
|
||||
Buildrequires: rpm-devel
|
||||
Requires: environment-modules
|
||||
Requires: rpm-libs
|
||||
|
||||
%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.
|
||||
@ -29,41 +30,36 @@ Essential RPM build macros for alternative packaging.
|
||||
%autosetup
|
||||
|
||||
%build
|
||||
%cmake
|
||||
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
|
||||
|
||||
# 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
|
||||
%install
|
||||
rm -rf %{buildroot}
|
||||
make install DESTDIR=%{buildroot}
|
||||
cat %SOURCE1 >> %{buildroot}%{_sysconfdir}/rpm/macros.scl
|
||||
mkdir -p %{buildroot}%{_sysconfdir}/scl
|
||||
cd %{buildroot}%{_sysconfdir}/scl
|
||||
mkdir modulefiles
|
||||
mkdir prefixes
|
||||
ln -s prefixes conf
|
||||
|
||||
%clean
|
||||
rm -rf %buildroot
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%dir /opt/rh
|
||||
%{_sysconfdir}/scl/conf
|
||||
%dir %{_sysconfdir}/scl/modulefiles
|
||||
%dir %{_sysconfdir}/scl/prefixes
|
||||
%{_sysconfdir}/scl/conf
|
||||
%{_sysconfdir}/bash_completion.d/scl-completion.bash
|
||||
%{_sysconfdir}/profile.d/scl-init.sh
|
||||
%{_bindir}/scl
|
||||
%{_bindir}/scl_enabled
|
||||
%{_bindir}/scl_source
|
||||
%{_mandir}/man1/*
|
||||
%{_sysconfdir}/bash_completion.d/scl.bash
|
||||
%{_mandir}/man1/scl.1.gz
|
||||
%doc LICENSE
|
||||
|
||||
%{!?_rpmconfigdir:%global _rpmconfigdir /usr/lib/rpm}
|
||||
%files build
|
||||
%defattr(-,root,root,-)
|
||||
%{_sysconfdir}/rpm/macros.scl
|
||||
@ -74,6 +70,9 @@ rm -rf %buildroot
|
||||
%{_rpmconfigdir}/brp-scl-python-bytecompile
|
||||
|
||||
%changelog
|
||||
* Thu Jan 08 2015 Lubos Kardos <lkardos@redhat.com> - 2.0-1
|
||||
- rebase to scl-utils-2.0
|
||||
|
||||
* Fri Dec 12 2014 Jan Zeleny <jzeleny@redhat.com> - 20140815-4
|
||||
- propagate the %nfsmountable into -build subpackage content
|
||||
- use vendor prefix in the names of the packages if required
|
||||
|
Loading…
Reference in New Issue
Block a user