[packages/libldm] - new

qboosh qboosh at pld-linux.org
Mon Jan 7 19:40:30 CET 2013


commit f74752307705e49dcf452cd50142588c6eb54d79
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Mon Jan 7 19:40:26 2013 +0100

    - new

 libldm-warnings.patch | 171 ++++++++++++++++++++++++++++++++++++++++++++++++++
 libldm.spec           | 147 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 318 insertions(+)
---
diff --git a/libldm.spec b/libldm.spec
new file mode 100644
index 0000000..fcdbc4f
--- /dev/null
+++ b/libldm.spec
@@ -0,0 +1,147 @@
+#
+# Conditional build:
+%bcond_without	apidocs		# do not build and package API docs
+%bcond_without	static_libs	# don't build static libraries
+#
+Summary:	A tool to manage Windows dynamic disks
+Summary(pl.UTF-8):	Narzędzie do zarządzania dynamicznymi dyskami Windows
+Name:		libldm
+Version:	0.2.3
+Release:	1
+License:	LGPL v3+ (libldm), GPL v3+ (ldmtool)
+Group:		Libraries
+Source0:	https://github.com/mdbooth/libldm/downloads/%{name}-%{version}.tar.gz
+# Source0-md5:	a7771c0a0f84dab6d7ce6a565ede4229
+Patch0:		%{name}-warnings.patch
+URL:		https://github.com/mdbooth/libldm/
+BuildRequires:	autoconf >= 2.68
+BuildRequires:	automake >= 1.6
+BuildRequires:	device-mapper-devel >= 1.0
+BuildRequires:	glib2-devel >= 1:2.32.0
+BuildRequires:	gtk-doc >= 1.14
+BuildRequires:	json-glib-devel >= 0.14.0
+BuildRequires:	libtool >= 2:2
+BuildRequires:	libuuid-devel >= 2.21.0
+BuildRequires:	libxslt-progs
+BuildRequires:	pkgconfig
+BuildRequires:	readline-devel
+BuildRequires:	zlib-devel >= 1.2.5
+Requires:	device-mapper >= 1.0
+Requires:	glib2 >= 1:2.32.0
+Requires:	json-glib >= 0.14.0
+Requires:	libuuid >= 2.21.0
+Requires:	zlib >= 1.2.5
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+libldm is a library for managing Microsoft Windows dynamic disks,
+which use Microsoft's LDM metadata. It can inspect them, and also
+create and remove device-mapper block devices which can be mounted. It
+includes ldmtool, which exposes this functionality as a command-line
+tool.
+
+%description -l pl.UTF-8
+libldm to biblioteka do zarządzania dyskami dynamicznymi Microsoft
+Windows, wykorzystującymi metadane Microsoft LDM. Biblioteka potrafi
+odczytywać informacje o nich, a także tworzyć i usuwać urządzenia
+blokowe device-mappera, które następnie można zamontować. Pakiet
+zawiera także program ldmtool, udostępniający funkcjonalność
+biblioteki w postaci narzędzia linii poleceń.
+
+%package devel
+Summary:	Header files for libldm library
+Summary(pl.UTF-8):	Pliki nagłówkowe biblioteki libldm
+Group:		Development/Libraries
+Requires:	%{name} = %{version}-%{release}
+Requires:	device-mapper-devel >= 1.0
+Requires:	glib2-devel >= 1:2.32.0
+Requires:	json-glib-devel >= 0.14.0
+Requires:	libuuid-devel >= 2.21.0
+Requires:	zlib-devel >= 1.2.5
+
+%description devel
+Header files for libldm library.
+
+%description devel -l pl.UTF-8
+Pliki nagłówkowe biblioteki libldm.
+
+%package static
+Summary:	Static libldm library
+Summary(pl.UTF-8):	Statyczna biblioteka libldm
+Group:		Development/Libraries
+Requires:	%{name}-devel = %{version}-%{release}
+
+%description static
+Static libldm library.
+
+%description static -l pl.UTF-8
+Statyczna biblioteka libldm.
+
+%package apidocs
+Summary:	libldm API documentation
+Summary(pl.UTF-8):	Dokumentacja API biblioteki libldm
+Group:		Documentation
+Requires:	gtk-doc-common
+
+%description apidocs
+API documentation for libldm library.
+
+%description apidocs -l pl.UTF-8
+Dokumentacja API biblioteki libldm.
+
+%prep
+%setup -q
+%patch0 -p1
+
+%build
+%{__libtoolize}
+%{__aclocal} -I m4
+%{__autoconf}
+%{__autoheader}
+%{__automake}
+%configure \
+	%{?with_apidocs:--enable-gtk-doc} \
+	--disable-silent-rules \
+	%{!?with_static_libs:--disable-static} \
+	--with-html-dir=%{_gtkdocdir}
+%{__make}
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+%{__make} install \
+	DESTDIR=$RPM_BUILD_ROOT
+
+# obsoleted by pkg-config
+%{__rm} $RPM_BUILD_ROOT%{_libdir}/libldm-1.0.la
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post	-p /sbin/ldconfig
+%postun	-p /sbin/ldconfig
+
+%files
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/ldmtool
+%attr(755,root,root) %{_libdir}/libldm-1.0.so.*.*.*
+%attr(755,root,root) %ghost %{_libdir}/libldm-1.0.so.0
+%{_mandir}/man1/ldmtool.1*
+
+%files devel
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/libldm-1.0.so
+%{_includedir}/ldm.h
+%{_pkgconfigdir}/ldm-1.0.pc
+
+%if %{with static_libs}
+%files static
+%defattr(644,root,root,755)
+%{_libdir}/libldm-1.0.a
+%endif
+
+%if %{with apidocs}
+%files apidocs
+%defattr(644,root,root,755)
+%{_gtkdocdir}/libldm
+%endif
diff --git a/libldm-warnings.patch b/libldm-warnings.patch
new file mode 100644
index 0000000..92fea1a
--- /dev/null
+++ b/libldm-warnings.patch
@@ -0,0 +1,171 @@
+--- libldm-0.2.3/src/Makefile.am.orig	2012-09-20 12:31:03.000000000 +0200
++++ libldm-0.2.3/src/Makefile.am	2013-01-07 19:20:40.782494058 +0100
+@@ -15,7 +15,7 @@
+ # along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ 
+ AM_CFLAGS = -Wall -Werror -Wshadow -Wextra \
+-  -Wno-unused-local-typedefs \
++  -Wno-missing-field-initializers \
+   -Wno-unused-parameter
+ 
+ libname = libldm-1.0.la
+--- libldm-0.2.3/src/mbr.c.orig	2012-07-23 17:47:49.000000000 +0200
++++ libldm-0.2.3/src/mbr.c	2013-01-07 19:20:16.992494554 +0100
+@@ -47,13 +47,13 @@
+ {
+     struct _mbr _mbr;
+ 
+-    size_t read = 0;
+-    while (read < sizeof(_mbr)) {
+-        ssize_t in = pread(fd, &_mbr + read, sizeof(struct _mbr) - read, read);
++    size_t nread = 0;
++    while (nread < sizeof(_mbr)) {
++        ssize_t in = pread(fd, &_mbr + nread, sizeof(struct _mbr) - nread, nread);
+         if (in == 0) return -MBR_ERROR_INVALID;
+         if (in == -1) return -MBR_ERROR_READ;
+ 
+-        read += in;
++        nread += in;
+     }
+ 
+     if (_mbr.magic[0] != 0x55 || _mbr.magic[1] != 0xAA)
+--- libldm-0.2.3/src/gpt.c.orig	2012-09-20 12:31:03.000000000 +0200
++++ libldm-0.2.3/src/gpt.c	2013-01-07 19:29:04.812483553 +0100
+@@ -82,14 +82,14 @@
+     const off_t gpt_start = secsize;
+ 
+     struct _gpt_head head;
+-    size_t read = 0;
+-    while (read < sizeof(head)) {
+-        ssize_t in = pread(fd, &head + read, sizeof(head) - read,
+-                           read + gpt_start);
++    size_t nread = 0;
++    while (nread < sizeof(head)) {
++        ssize_t in = pread(fd, &head + nread, sizeof(head) - nread,
++                           nread + gpt_start);
+         if (in == 0) return -GPT_ERROR_INVALID;
+         if (in == -1) return -GPT_ERROR_READ;
+ 
+-        read += in;
++        nread += in;
+     }
+ 
+     if (memcmp(head.magic, "EFI PART", 8) != 0) return -GPT_ERROR_INVALID;
+@@ -111,9 +111,9 @@
+ 
+     struct _gpt *_gpt = (*h)->gpt;
+     memcpy(_gpt, &head, sizeof(head));
+-    while (read < le32toh(head.size)) {
+-        ssize_t in = pread(fd, (char *)(_gpt) + read, le32toh(head.size) - read,
+-                           read + gpt_start);
++    while (nread < le32toh(head.size)) {
++        ssize_t in = pread(fd, (char *)(_gpt) + nread, le32toh(head.size) - nread,
++                           nread + gpt_start);
+         if (in == 0) {
+             err = -GPT_ERROR_INVALID;
+             goto error;
+@@ -123,7 +123,7 @@
+             goto error;
+         }
+ 
+-        read += in;
++        nread += in;
+     }
+ 
+     uint32_t header_crc = _gpt->header_crc;
+@@ -151,10 +151,10 @@
+     if ((*h)->pte_array == NULL) abort();
+ 
+     const off_t pte_array_start = _gpt->pte_array_start_lba * secsize;
+-    read = 0;
+-    while (read < pte_array_size) {
+-        ssize_t in = pread(fd, (*h)->pte_array + read, pte_array_size - read,
+-                           read + pte_array_start);
++    nread = 0;
++    while (nread < pte_array_size) {
++        ssize_t in = pread(fd, (*h)->pte_array + nread, pte_array_size - nread,
++                           nread + pte_array_start);
+         if (in == 0) {
+             err = -GPT_ERROR_INVALID;
+             goto error;
+@@ -164,7 +164,7 @@
+             goto error;
+         }
+ 
+-        read += in;
++        nread += in;
+     }
+ 
+     crc = crc32(0L, Z_NULL, 0);
+--- libldm-0.2.3/src/ldm.c.orig	2012-09-21 12:21:17.000000000 +0200
++++ libldm-0.2.3/src/ldm.c	2013-01-07 19:31:35.259147085 +0100
+@@ -1170,15 +1170,15 @@
+              void ** const config, GError ** const err)
+ {
+     /* Sanity check ldm_config_start and ldm_config_size */
+-    struct stat stat;
+-    if (fstat(fd, &stat) == -1) {
++    struct stat sstat;
++    if (fstat(fd, &sstat) == -1) {
+         g_set_error(err, LDM_ERROR, LDM_ERROR_IO,
+                     "Unable to stat %s: %m", path);
+         return FALSE;
+     }
+ 
+-    uint64_t size = stat.st_size;
+-    if (S_ISBLK(stat.st_mode)) {
++    uint64_t size = sstat.st_size;
++    if (S_ISBLK(sstat.st_mode)) {
+         if (ioctl(fd, BLKGETSIZE64, &size) == -1) {
+             g_set_error(err, LDM_ERROR, LDM_ERROR_IO,
+                         "Unable to get block device size for %s: %m", path);
+@@ -1205,10 +1205,10 @@
+     }
+ 
+     *config = g_malloc(config_size);
+-    size_t read = 0;
+-    while (read < config_size) {
+-        ssize_t in = pread(fd, *config + read, config_size - read,
+-                           config_start + read);
++    size_t nread = 0;
++    while (nread < config_size) {
++        ssize_t in = pread(fd, *config + nread, config_size - nread,
++                           config_start + nread);
+         if (in == 0) {
+             g_set_error(err, LDM_ERROR, LDM_ERROR_INVALID,
+                         "%s contains invalid LDM metadata", path);
+@@ -1221,7 +1221,7 @@
+             goto error;
+         }
+ 
+-        read += in;
++        nread += in;
+     }
+ 
+     return TRUE;
+@@ -1236,11 +1236,11 @@
+                    const uint64_t ph_start,
+                    struct _privhead * const privhead, GError **err)
+ {
+-    size_t read = 0;
+-    while (read < sizeof(*privhead)) {
+-        ssize_t in = pread(fd, (char *) privhead + read,
+-                           sizeof(*privhead) - read,
+-                           ph_start + read);
++    size_t nread = 0;
++    while (nread < sizeof(*privhead)) {
++        ssize_t in = pread(fd, (char *) privhead + nread,
++                           sizeof(*privhead) - nread,
++                           ph_start + nread);
+         if (in == 0) {
+             g_set_error(err, LDM_ERROR, LDM_ERROR_INVALID,
+                         "%s contains invalid LDM metadata", path);
+@@ -1253,7 +1253,7 @@
+             return FALSE;
+         }
+ 
+-        read += in;
++        nread += in;
+     }
+ 
+     if (memcmp(privhead->magic, "PRIVHEAD", 8) != 0) {
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/libldm.git/commitdiff/f74752307705e49dcf452cd50142588c6eb54d79



More information about the pld-cvs-commit mailing list