Simplify package naming
- do not prepend scl_* prefix to package names - unify package naming to <SCL>-package-version - add scl --list functionality to list available SCLs
This commit is contained in:
parent
a60bbbf019
commit
48898610db
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,3 @@
|
|||||||
/scl
|
/scl
|
||||||
/scl.o
|
/scl.o
|
||||||
/scl-utils-20120209.tar.gz
|
/scl-utils-20120229.tar.gz
|
||||||
|
@ -5,10 +5,9 @@
|
|||||||
|
|
||||||
%scl_package() %{expand:%{!?_root_prefix:
|
%scl_package() %{expand:%{!?_root_prefix:
|
||||||
%global pkg_name %1
|
%global pkg_name %1
|
||||||
%global scl_short_prefix scl
|
%global scl_name %{scl}
|
||||||
%global scl_name %{scl_short_prefix}_%{scl}
|
%global scl_prefix %{scl}-
|
||||||
%global scl_runtime %{scl_name}-runtime
|
%global scl_runtime %{scl}-runtime
|
||||||
%global scl_prefix %{scl_name}_
|
|
||||||
%{!?_scl_prefix: %global _scl_prefix /opt/rh}
|
%{!?_scl_prefix: %global _scl_prefix /opt/rh}
|
||||||
%global _scl_scripts %{_scl_prefix}/%{scl}
|
%global _scl_scripts %{_scl_prefix}/%{scl}
|
||||||
%global _scl_root %{_scl_prefix}/%{scl}/root
|
%global _scl_root %{_scl_prefix}/%{scl}/root
|
||||||
@ -41,7 +40,7 @@
|
|||||||
%global _mandir %{_datadir}/man
|
%global _mandir %{_datadir}/man
|
||||||
%global _docdir %{_datadir}/doc
|
%global _docdir %{_datadir}/doc
|
||||||
%global _defaultdocdir %{_docdir}
|
%global _defaultdocdir %{_docdir}
|
||||||
%global scl_pkg_name %{scl_short_prefix}_%{scl}_%{pkg_name}
|
%global scl_pkg_name %{scl}-%{pkg_name}
|
||||||
BuildRequires: scl-utils-build
|
BuildRequires: scl-utils-build
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
Summary: Utilities for alternative packaging
|
Summary: Utilities for alternative packaging
|
||||||
Name: scl-utils
|
Name: scl-utils
|
||||||
Version: 20120209
|
Version: 20120229
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
Group: Applications/File
|
Group: Applications/File
|
||||||
@ -47,6 +47,11 @@ rm -rf %buildroot
|
|||||||
%{_sysconfdir}/rpm/macros.scl
|
%{_sysconfdir}/rpm/macros.scl
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Feb 29 2012 Jindrich Novy <jnovy@redhat.com> 20120229-1
|
||||||
|
- do not prepend scl_* prefix to package names
|
||||||
|
- unify package naming to <SCL>-package-version
|
||||||
|
- add scl --list functionality to list available SCLs
|
||||||
|
|
||||||
* Thu Feb 09 2012 Jindrich Novy <jnovy@redhat.com> 20120209-1
|
* Thu Feb 09 2012 Jindrich Novy <jnovy@redhat.com> 20120209-1
|
||||||
- fix minor bugs (#788194)
|
- fix minor bugs (#788194)
|
||||||
- clear temp files
|
- clear temp files
|
||||||
|
36
scl.c
36
scl.c
@ -50,6 +50,37 @@ static void write_script( int tfd, char *s ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void list_collections() {
|
||||||
|
struct stat sb;
|
||||||
|
struct dirent **nl;
|
||||||
|
int n, i;
|
||||||
|
const char prefix[] = "/etc/scl/prefixes/";
|
||||||
|
|
||||||
|
if (stat(prefix, &sb) == -1) {
|
||||||
|
perror("stat");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!S_ISDIR(sb.st_mode)) {
|
||||||
|
fprintf(stderr, "%s is not a directory\n", prefix);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ((n = scandir(prefix, &nl, 0, alphasort)) < 0) {
|
||||||
|
perror("scandir");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i=0; i<n; i++) {
|
||||||
|
if (*nl[i]->d_name != '.') {
|
||||||
|
printf("%s\n", nl[i]->d_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
free(nl);
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
struct stat st;
|
struct stat st;
|
||||||
char *path, *enablepath;
|
char *path, *enablepath;
|
||||||
@ -57,6 +88,11 @@ int main(int argc, char **argv) {
|
|||||||
char *cmd = NULL, *bash_cmd, *echo, *enabled;
|
char *cmd = NULL, *bash_cmd, *echo, *enabled;
|
||||||
int i, tfd, ffd, stdin_read = 0;
|
int i, tfd, ffd, stdin_read = 0;
|
||||||
|
|
||||||
|
if (argc == 2 && (!strcmp(argv[1],"--list") || !strcmp(argv[1],"-l"))) {
|
||||||
|
list_collections();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (!strcmp(argv[argc-1], "-")) { /* reading command from stdin */
|
if (!strcmp(argv[argc-1], "-")) { /* reading command from stdin */
|
||||||
size_t r;
|
size_t r;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user