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:
Jindrich Novy 2012-02-29 14:30:42 +01:00
parent a60bbbf019
commit 48898610db
5 changed files with 48 additions and 8 deletions

2
.gitignore vendored
View File

@ -1,3 +1,3 @@
/scl
/scl.o
/scl-utils-20120209.tar.gz
/scl-utils-20120229.tar.gz

View File

@ -5,10 +5,9 @@
%scl_package() %{expand:%{!?_root_prefix:
%global pkg_name %1
%global scl_short_prefix scl
%global scl_name %{scl_short_prefix}_%{scl}
%global scl_runtime %{scl_name}-runtime
%global scl_prefix %{scl_name}_
%global scl_name %{scl}
%global scl_prefix %{scl}-
%global scl_runtime %{scl}-runtime
%{!?_scl_prefix: %global _scl_prefix /opt/rh}
%global _scl_scripts %{_scl_prefix}/%{scl}
%global _scl_root %{_scl_prefix}/%{scl}/root
@ -41,7 +40,7 @@
%global _mandir %{_datadir}/man
%global _docdir %{_datadir}/doc
%global _defaultdocdir %{_docdir}
%global scl_pkg_name %{scl_short_prefix}_%{scl}_%{pkg_name}
%global scl_pkg_name %{scl}-%{pkg_name}
BuildRequires: scl-utils-build
}}

View File

@ -1,6 +1,6 @@
Summary: Utilities for alternative packaging
Name: scl-utils
Version: 20120209
Version: 20120229
Release: 1%{?dist}
License: GPLv2+
Group: Applications/File
@ -47,6 +47,11 @@ rm -rf %buildroot
%{_sysconfdir}/rpm/macros.scl
%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
- fix minor bugs (#788194)
- clear temp files

36
scl.c
View File

@ -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) {
struct stat st;
char *path, *enablepath;
@ -57,6 +88,11 @@ int main(int argc, char **argv) {
char *cmd = NULL, *bash_cmd, *echo, *enabled;
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 */
size_t r;

View File

@ -1 +1 @@
d52975ee97b0be67ffb8c014b68f9012 scl-utils-20120209.tar.gz
56205bacbc93096c482f8027e15c9b7f scl-utils-20120229.tar.gz