# # spec file for package perl-File-chmod # # Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via https://bugs.opensuse.org/ # %define cpan_name File-chmod Name: perl-File-chmod Version: 0.420.0 Release: 0 # 0.42 -> normalize -> 0.420.0 %define cpan_version 0.42 License: Artistic-1.0 OR GPL-1.0-or-later Summary: Implements symbolic and ls chmod modes URL: https://metacpan.org/release/%{cpan_name} Source0: https://cpan.metacpan.org/authors/id/X/XE/XENO/%{cpan_name}-%{cpan_version}.tar.gz BuildArch: noarch BuildRequires: perl BuildRequires: perl-macros BuildRequires: perl(autodie) Provides: perl(File::chmod) = %{version} %undefine __perllib_provides %{perl_requires} %description File::chmod is a utility that allows you to bypass system calls or bit processing of a file's permissions. It overloads the chmod() function with its own that gets an octal mode, a symbolic mode (see below), or an "ls" mode (see below). If you wish not to overload chmod(), you can export symchmod() and lschmod(), which take, respectively, a symbolic mode and an "ls" mode. An added feature to version 0.30 is the '$UMASK' variable, explained in detail below; if 'symchmod()' is called and this variable is true, then the function uses the (also new) '$MASK' variable (which defaults to 'umask()') as a mask against the new mode. This mode is on by default, and changes the behavior from what you would expect if you are used to UNIX 'chmod'. *This may change in the future.* Symbolic modes are thoroughly described in your chmod(1) man page, but here are a few examples. chmod("+x","file1","file2"); # overloaded chmod(), that is... # turns on the execute bit for all users on those two files chmod("o=,g-w","file1","file2"); # removes 'other' permissions, and the write bit for 'group' chmod("=u","file1","file2"); # sets all bits to those in 'user' "ls" modes are the type produced on the left-hand side of an 'ls -l' on a directory. Examples are: chmod("-rwxr-xr-x","file1","file2"); # the 0755 setting; user has read-write-execute, group and others # have read-execute priveleges chmod("-rwsrws---","file1","file2"); # sets read-write-execute for user and group, none for others # also sets set-uid and set-gid bits The regular chmod() and lschmod() are absolute; that is, they are not appending to or subtracting from the current file mode. They set it, regardless of what it had been before. symchmod() is useful for allowing the modifying of a file's permissions without having to run a system call or determining the file's permissions, and then combining that with whatever bits are appropriate. It also operates separately on each file. %prep %autosetup -n %{cpan_name}-%{cpan_version} %build perl Makefile.PL INSTALLDIRS=vendor %make_build %check make test %install %perl_make_install %perl_process_packlist %perl_gen_filelist %files -f %{name}.files %doc Changes CONTRIBUTING README %license LICENSE %changelog