RPM Community Forums

Mailing List Message of <rpm-cvs>

[CVS] RPM: rpm/tests/ test-change-dir-to-symlink-1.2.spec

From: Pinto Elia <devzero2000@rpm5.org>
Date: Fri 01 Oct 2010 - 16:40:19 CEST
Message-Id: <20101001144019.D96F0CE431@rpm5.org>
  RPM Package Manager, CVS Repository
  /cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Pinto Elia
  Root:   /v/rpm/cvs                       Email:  devzero2000@rpm5.org
  Module: rpm                              Date:   01-Oct-2010 16:40:19
  Branch: HEAD                             Handle: 2010100114401900

  Modified files:
    rpm/tests               test-change-dir-to-symlink-1.2.spec

  Log:
    estetic change to test-change-dir-to-symlink-1.2.spec

  Summary:
    Revision    Changes     Path
    1.3         +26 -15     rpm/tests/test-change-dir-to-symlink-1.2.spec
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/tests/test-change-dir-to-symlink-1.2.spec
  ============================================================================
  $ cvs diff -u -r1.2 -r1.3 test-change-dir-to-symlink-1.2.spec
  --- rpm/tests/test-change-dir-to-symlink-1.2.spec	30 Sep 2010 14:56:02 -0000	1.2
  +++ rpm/tests/test-change-dir-to-symlink-1.2.spec	1 Oct 2010 14:40:19 -0000	1.3
  @@ -3,15 +3,15 @@
   Version:	1
   Release:	2
   License:	LGPL
  -Group:		AAmusements/Games
  +Group:		Amusements/Games
   BuildRoot:	%{_tmppath}/%{name}-%{version}-root-%(id -u -n)
   URL:		
   BuildArch:      noarch
   
   %description
  -This is the second package release. It replace
  -a /tmp/%{name} directory in upgrade with 
  -a symbolic link to /tmp/%{name}-directory
  +This is the second package release of %{name}
  +In this release the /tmp/%{name} directory became
  +a symbolic link to /tmp/%{name}-directory.
   
   %prep
   #empty
  @@ -30,6 +30,12 @@
   #empty 
   
   %pretrans  -p <lua>
  +-- Lua block of code for removing a directory recursively
  +-- The Lua function remove_directory_deep should be called
  +-- with a directory name or, in a spec file, also with
  +-- a rpm macro defined to a directory name. This function
  +-- is a possible lua equivalent of the shell command "rm -rf"
  +-- using the lua posix extension embedded in rpm 
   local leaf_indent = '|   '
   local tail_leaf_indent = '    '
   local leaf_prefix = '|-- '
  @@ -40,7 +46,7 @@
       io.write(string.format(unpack(arg)))
   end
   
  -local function rm_directory(directory, level, prefix)
  +local function remove_directory(directory, level, prefix)
       local num_dirs = 0
       local num_files = 0
       if  posix.access(directory,"rw") then
  @@ -59,16 +65,18 @@
                   link = string.format('%s%s', link_prefix, linked_name)
                   posix.unlink(full_name)
               end
  -            printf('%s%s%s%s\n', prefix, prefix2, name, link)
  +            
  +             -- printf('%s%s%s%s\n', prefix, prefix2, name, link)
  +            
               if info.type == 'directory' then
                   local indent = is_tail and tail_leaf_indent or leaf_indent
  -                sub_dirs, sub_files = rm_directory(full_name, level+1,
  +                sub_dirs, sub_files = remove_directory(full_name, level+1,
                       prefix .. indent)
                   num_dirs = num_dirs + sub_dirs + 1
                   num_files = num_files + sub_files
                   posix.rmdir(full_name)
               else
  -                print(posix.unlink(full_name))
  +                posix.unlink(full_name)
                   num_files = num_files + 1
               end
           end
  @@ -77,13 +85,17 @@
       return num_dirs, num_files
   end
   
  -local function call_rm_directory(directory)
  -    print(directory)
  -    num_dirs, num_files = rm_directory(directory, 0, '')
  -    printf('\ndropped %d directories, %d files\n', num_dirs, num_files)
  +local function remove_directory_deep(directory)
  +    
  +    -- print(directory)
  +    
  +    num_dirs, num_files = remove_directory(directory, 0, '')
  +    
  +    -- printf('\ndropped %d directories, %d files\n', num_dirs, num_files)
  +    
       posix.rmdir(directory)
   end
  -call_rm_directory("/tmp/%{name}")
  +remove_directory_deep("/tmp/%{name}")
   
   
   %clean
  @@ -95,5 +107,4 @@
   
   %changelog
   * Mon Aug 4 2010 Elia Pinto <devzero2000@rpm5.org> 1-2
  -- change /tmp/%{name} dir to a symbolic link
  -  to /tmp/%{name}-directory
  +- First Build
  @@ .
Received on Fri Oct 1 16:40:20 2010
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.