I have made the following changes intended for :
  CE:Adaptation:N950-N9 / hardlink

Please review and accept or decline.
BOSS has already run some checks on this request.
See the "Messages from BOSS" section below.

https://build.pub.meego.com//request/show/4731

Thank You,
marquiz

[This message was auto-generated]

---

Request # 4731:

Messages from BOSS:

State: review at 2012-04-13T06:10:08 by bossbot

Reviews:
       accepted by bossbot : Prechecks succeeded.
       new for CE-maintainers : Please replace this text with a review and 
approve/reject the review (not the SR). BOSS will take care of the rest

Changes:
  submit: home:marquiz:n950 / hardlink -> CE:Adaptation:N950-N9 / hardlink
  
changes files:
--------------

++++++ new changes file:
--- hardlink.changes
+++ hardlink.changes
@@ -0,0 +1,11 @@
+* Sun Mar 07 2010 Anas Nashif <[email protected]> - 1.0
+- Remove epoch
+
+* Mon Feb 22 2010 Anas Nashif <[email protected]> - 1.0
+- Update Group
+
+* Tue Feb 16 2010 Anas Nashif <[email protected]> - 1.0
+- Updated yaml and sanitized spec
+
+* Wed Aug 12 2009 Anas Nashif <[email protected]> - 1.0
+- Initial import into Moblin

new:
----
  Makefile
  hardlink.1
  hardlink.c
  hardlink.changes
  hardlink.spec
  hardlink.yaml

spec files:
-----------

++++++ new spec file:
--- hardlink.spec
+++ hardlink.spec
@@ -0,0 +1,72 @@
+# 
+# Do NOT Edit the Auto-generated Part!
+# Generated by: spectacle version 0.22
+# 
+# >> macros
+# << macros
+
+Name:       hardlink
+Summary:    Create a tree of hardlinks
+Version:    1.0
+Release:    9
+Group:      System/Base
+License:    GPL+
+URL:        http://cvs.fedora.redhat.com/viewcvs/devel/hardlink/
+Source0:    hardlink.c
+Source1:    hardlink.1
+Source2:    Makefile
+Source100:  hardlink.yaml
+
+
+%description
+hardlink is used to create a tree of hard links.
+It's used by kernel installation to dramatically reduce the
+amount of diskspace used by each kernel package installed.
+
+
+
+
+%prep
+%setup -q -c -T
+
+# >> setup
+install -pm 644 %{SOURCE0} hardlink.c
+# << setup
+
+%build
+# >> build pre
+# << build pre
+
+
+
+# >> build post
+gcc $RPM_OPT_FLAGS hardlink.c -o hardlink
+
+
+# << build post
+%install
+rm -rf %{buildroot}
+# >> install pre
+# << install pre
+
+# >> install post
+rm -rf $RPM_BUILD_ROOT
+install -D -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_mandir}/man1/hardlink.1
+install -D -m 755 hardlink $RPM_BUILD_ROOT%{_sbindir}/hardlink
+
+
+# << install post
+
+
+
+
+
+
+%files
+%defattr(-,root,root,-)
+# >> files
+%{_sbindir}/hardlink
+%doc %{_mandir}/man1/hardlink.1*
+# << files
+
+

other changes:
--------------

++++++ Makefile (new)
--- Makefile
+++ Makefile
@@ -0,0 +1,6 @@
+PKG_NAME := hardlink
+SPECFILE = $(addsuffix .spec, $(PKG_NAME))
+YAMLFILE = $(addsuffix .yaml, $(PKG_NAME))
+
+include /usr/share/packaging-tools/Makefile.common
+

++++++ hardlink.1 (new)
--- hardlink.1
+++ hardlink.1
@@ -0,0 +1,41 @@
+.TH "hardlink" "1"
+.SH "NAME"
+hardlink \- Consolidate duplicate files via hardlinks
+.SH "SYNOPSIS"
+.PP
+\fBhardlink\fP [\fB-c\fP] [\fB-n\fP] [\fB-v\fP] [\fB-vv\fP] [\fB-h\fP] 
directory1 [ directory2 ... ]
+.SH "DESCRIPTION"
+.PP
+This manual page documents \fBhardlink\fP, a 
+program which consolidates duplicate files in one or more directories
+using hardlinks.
+.PP
+\fBhardlink\fP traverses one 
+or more directories searching for duplicate files.  When it finds duplicate
+files, it uses one of them as the master.  It then removes all other
+duplicates and places a hardlink for each one pointing to the master file.
+This allows for conservation of disk space where multiple directories
+on a single filesystem contain many duplicate files.
+.PP
+Since hard links can only span a single filesystem, \fBhardlink\fP
+is only useful when all directories specified are on the same filesystem.
+.SH "OPTIONS"
+.PP
+.IP "\fB-c\fP" 10
+Compare only the contents of the files being considered for consolidation.
+Disregards permission, ownership and other differences.
+.IP "\fB-n\fP" 10
+Do not perform the consolidation; only print what would be changed.
+.IP "\fB-v\fP" 10
+Print summary after hardlinking.
+.IP "\fB-vv\fP" 10
+Print every hardlinked file and bytes saved. Also print summary after 
hardlinking.
+.IP "\fB-h\fP" 10
+Show help.
+.SH "AUTHOR"
+.PP
+\fBhardlink\fP was written by Jakub Jelinek <[email protected]>. 
+.PP
+Man page written by Brian Long.
+.PP
+Man page updated by Jindrich Novy <[email protected]>

++++++ hardlink.c (new)
--- hardlink.c
+++ hardlink.c
@@ -0,0 +1,351 @@
+/* Copyright (C) 2001 Red Hat, Inc.
+
+   Written by Jakub Jelinek <[email protected]>.
+   
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+               
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+                           
+   You should have received a copy of the GNU General Public
+   License along with this program; see the file COPYING.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+  
+/*  Changes by Rémy Card to use constants and add option -n.  */
+/*  Changes by Jindrich Novy to add option -h.  */
+
+#define _GNU_SOURCE
+#include <sys/types.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <sys/mman.h>
+#include <string.h>
+#include <dirent.h>
+#include <fcntl.h>
+
+#define NHASH  131072  /* Must be a power of 2! */
+#define NAMELEN        4096
+#define NBUF   64
+
+struct _f;
+typedef struct _h {
+  struct _h *next;
+  struct _f *chain;
+  off_t size;
+  time_t mtime;
+} h;
+
+typedef struct _d {
+  struct _d *next;
+  char name[0];
+} d;
+
+d *dirs;
+
+h *hps[NHASH];
+
+int no_link = 0;
+int verbose = 0;
+int content_only = 0;
+
+typedef struct _f {
+  struct _f *next;
+  ino_t ino;
+  dev_t dev;
+  unsigned int cksum;
+  char name[0];
+} f;
+
+inline unsigned int hash(off_t size, time_t mtime)
+{
+  return (size ^ mtime) & (NHASH - 1);
+}
+
+inline int stcmp(struct stat *st1, struct stat *st2, int content_only)
+{
+  if (content_only)
+    return st1->st_size != st2->st_size;
+  return st1->st_mode != st2->st_mode || st1->st_uid != st2->st_uid ||
+         st1->st_gid != st2->st_gid || st1->st_size != st2->st_size ||
+         st1->st_mtime != st2->st_mtime;
+}
+
+long long ndirs, nobjects, nregfiles, nmmap, ncomp, nlinks, nsaved;
+
+void doexit(int i)
+{
+  if (verbose) {  
+    fprintf(stderr, "\n\n");
+    fprintf(stderr, "Directories %lld\n", ndirs);
+    fprintf(stderr, "Objects %lld\n", nobjects);
+    fprintf(stderr, "IFREG %lld\n", nregfiles);
+    fprintf(stderr, "Mmaps %lld\n", nmmap);
+    fprintf(stderr, "Comparisons %lld\n", ncomp);
+    fprintf(stderr, "%s %lld\n", (no_link ? "Would link" : "Linked"), nlinks);
+    fprintf(stderr, "%s %lld\n", (no_link ? "Would save" : "saved"), nsaved);
+  }
+  exit(i);
+}
+
+void usage(char *prog)
+{
+  fprintf (stderr, "Usage: %s [-cnvh] directories...\n", prog);
+  fprintf (stderr, "  -c    When finding candidates for linking, compare only 
file contents.\n");
+  fprintf (stderr, "  -n    Don't actually link anything, just report what 
would be done.\n");
+  fprintf (stderr, "  -v    Print summary after hardlinking.\n");
+  fprintf (stderr, "  -vv   Print every hardlinked file and bytes saved + 
summary.\n");
+  fprintf (stderr, "  -h    Show help.\n");
+  exit(255);
+}
+
+unsigned int buf[NBUF];
+char nambuf1[NAMELEN], nambuf2[NAMELEN];
+
+void rf (char *name)
+{
+  struct stat st, st2, st3;
+  nobjects++;
+  if (lstat (name, &st))
+    return;
+  if (S_ISDIR (st.st_mode)) {
+    d * dp = malloc(sizeof(d) + 1 + strlen (name));
+    if (!dp) {
+      fprintf(stderr, "\nOut of memory 3\n");
+      doexit(3);
+    }
+    strcpy (dp->name, name);
+    dp->next = dirs;
+    dirs = dp;
+  } else if (S_ISREG (st.st_mode)) {
+    int fd, i;
+    f * fp, * fp2;
+    h * hp;
+    char *p = NULL, *q;
+    char *n1, *n2;
+    int cksumsize = sizeof(buf);
+    unsigned int cksum;
+    time_t mtime = content_only ? 0 : st.st_mtime;
+    unsigned int hsh = hash (st.st_size, mtime);
+    nregfiles++;
+    if (verbose > 1)
+      fprintf(stderr, "  %s", name);
+    fd = open (name, O_RDONLY);
+    if (fd < 0) return;
+    if (st.st_size < sizeof(buf)) {
+      cksumsize = st.st_size;
+      memset (((char *)buf) + cksumsize, 0, (sizeof(buf) - cksumsize) % 
sizeof(buf[0]));
+    }
+    if (read (fd, buf, cksumsize) != cksumsize) {
+      close(fd);
+      if (verbose > 1)
+        fprintf(stderr, "\r%*s\r", (int)strlen(name)+2, "");
+      return;
+    }
+    cksumsize = (cksumsize + sizeof(buf[0]) - 1) / sizeof(buf[0]);
+    for (i = 0, cksum = 0; i < cksumsize; i++) {
+      if (cksum + buf[i] < cksum)
+        cksum += buf[i] + 1;
+      else
+        cksum += buf[i];
+    }
+    for (hp = hps[hsh]; hp; hp = hp->next)
+      if (hp->size == st.st_size && hp->mtime == mtime)
+        break;
+    if (!hp) {
+      hp = malloc(sizeof(h));
+      if (!hp) {
+        fprintf(stderr, "\nOut of memory 1\n");
+        doexit(1);
+      }
+      hp->size = st.st_size;
+      hp->mtime = mtime;
+      hp->chain = NULL;
+      hp->next = hps[hsh];
+      hps[hsh] = hp;
+    }
+    for (fp = hp->chain; fp; fp = fp->next)
+      if (fp->cksum == cksum)
+        break;
+    for (fp2 = fp; fp2 && fp2->cksum == cksum; fp2 = fp2->next)
+      if (fp2->ino == st.st_ino && fp2->dev == st.st_dev) {
+        close(fd);
+        if (verbose > 1)
+          fprintf(stderr, "\r%*s\r", (int)strlen(name)+2, "");
+        return;
+      }
+    if (fp && st.st_size > 0) {
+      p = mmap (NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
+      nmmap++;
+      if (p == (void *)-1) {
+        close(fd);
+        fprintf(stderr, "\nFailed to mmap %s\n", name);
+        return;
+      }
+    }
+    for (fp2 = fp; fp2 && fp2->cksum == cksum; fp2 = fp2->next)
+      if (!lstat (fp2->name, &st2) && S_ISREG (st2.st_mode) &&
+          !stcmp (&st, &st2, content_only) &&
+          st2.st_ino != st.st_ino &&
+          st2.st_dev == st.st_dev) {
+        int fd2 = open (fp2->name, O_RDONLY);
+        if (fd2 < 0) continue;
(152 more lines skipped)

++++++ hardlink.yaml (new)
--- hardlink.yaml
+++ hardlink.yaml
@@ -0,0 +1,19 @@
+Name: hardlink
+Summary: Create a tree of hardlinks
+Version: 1.0
+Release: 9
+Group: System/Base
+License: GPL+
+URL: http://cvs.fedora.redhat.com/viewcvs/devel/hardlink/
+Sources:
+    - hardlink.c
+    - hardlink.1
+    - Makefile
+Description: |
+    hardlink is used to create a tree of hard links.
+    It's used by kernel installation to dramatically reduce the
+    amount of diskspace used by each kernel package installed.
+
+SetupOptions: "-q -c -T"
+Builder: none
+Configure: none



Reply via email to