code:
From 37523b867d411c2f82d08128246be7e38bc9812c Mon Sep 17 00:00:00 2001
From: Paul Newall <quandry@ntlworld.com>
Date: Mon, 14 Oct 2013 22:22:53 +0100
Subject: [PATCH] Bugfix in kodakaio.c to fix segfault when non kodak scanners
 return unexpected data via avahi auto discovery

---
 backend/kodakaio.c             |   43 ++++++++++++++++++++++++++++++----------
 doc/descriptions/kodakaio.desc |    2 +-
 3 files changed, 37 insertions(+), 12 deletions(-)

diff --git a/backend/kodakaio.c b/backend/kodakaio.c
index 8c4583a..b442e50 100644
--- a/backend/kodakaio.c
+++ b/backend/kodakaio.c
@@ -127,7 +127,7 @@ for ubuntu 12.10

 #define KODAKAIO_VERSION	02
 #define KODAKAIO_REVISION	4
-#define KODAKAIO_BUILD		6
+#define KODAKAIO_BUILD		7

 /* for usb (but also used for net though it's not required). */
 #define MAX_BLOCK_SIZE		32768
@@ -2184,6 +2184,7 @@ static void resolve_callback(
     AvahiLookupResultFlags flags,
     AVAHI_GCC_UNUSED void* userdata) {

+	AvahiStringList *vid_pair_list = NULL, *pid_pair_list = NULL;
 	char *pidkey, *pidvalue;
 	char *vidkey, *vidvalue;
 	size_t valuesize;
@@ -2204,20 +2205,40 @@ static void resolve_callback(
             avahi_address_snprint(a, sizeof(a), address);

 /* Output short for Kodak ESP */
-	DBG(min(10,DBG_AUTO), "%s:%u  %s  ", a,port,host_name);
-	avahi_string_list_get_pair(avahi_string_list_find(txt, "vid"),
-		&vidkey, &vidvalue, &valuesize);
-	DBG(min(10,DBG_AUTO), "%s=%s  ", vidkey, vidvalue);
-	avahi_string_list_get_pair(avahi_string_list_find(txt, "pid"),
-		&pidkey, &pidvalue, &valuesize);
-	DBG(min(10,DBG_AUTO), "%s=%s\n", pidkey, pidvalue);
+	DBG(min(10,DBG_AUTO), "%s:%u  %s\n", a,port,host_name);

+	vid_pair_list = avahi_string_list_find(txt, "vid");
+	if(vid_pair_list != NULL) {
+		avahi_string_list_get_pair(vid_pair_list, &vidkey, &vidvalue, &valuesize);
+		DBG(min(10,DBG_AUTO), "%s=%s  ", vidkey, vidvalue);
+	}
+	else	DBG(min(10,DBG_AUTO), "failed to find key vid\n");
+
+	pid_pair_list = avahi_string_list_find(txt, "pid");
+	if(pid_pair_list != NULL) {
+		avahi_string_list_get_pair(pid_pair_list, &pidkey, &pidvalue, &valuesize);
+		DBG(min(10,DBG_AUTO), "%s=%s\n", pidkey, pidvalue);
+	}
+	else	DBG(min(10,DBG_AUTO), "failed to find key pid\n");
+
+	if(pid_pair_list != NULL && vid_pair_list != NULL) {
 		ProcessAvahiDevice(name, vidvalue, pidvalue, a);
-	avahi_free(vidkey); avahi_free(vidvalue);
-	avahi_free(pidkey); avahi_free(pidvalue);
+	}
+	else DBG(min(10,DBG_AUTO), "didn't call ProcessAvahiDevice\n");
+
+	if(vid_pair_list != NULL) {
+		avahi_free(vidkey);
+		avahi_free(vidvalue);
+		DBG(min(15,DBG_AUTO), "vidkey and vidvalue freed\n");
+	}
+	if(pid_pair_list != NULL) {
+		avahi_free(pidkey);
+		avahi_free(pidvalue);
+		DBG(min(15,DBG_AUTO), "pidkey and pidvalue freed\n");
+	}
         }
     }
-
+    DBG(min(10,DBG_AUTO), "ending resolve_callback\n");
     avahi_service_resolver_free(r);
 }

diff --git a/doc/descriptions/kodakaio.desc b/doc/descriptions/kodakaio.desc
index 7882513..5fb18ed 100644
--- a/doc/descriptions/kodakaio.desc
+++ b/doc/descriptions/kodakaio.desc
@@ -1,6 +1,6 @@
 :backend "kodakaio"
 :url "http://sourceforge.net/projects/cupsdriverkodak/"
-:version "2.4.6"
+:version "2.4.7"
 :manpage "sane-kodakaio"
 :comment "Backend for Kodak AiO ESP and Hero printers. Also possibly Advent AWL10"
 :devicetype :scanner
--
1.7.10.4


code:
--- backend/niash.c.orig	2006-02-04 12:34:28.000000000 +0100
+++ backend/niash.c	2007-02-21 15:38:12.000000000 +0100
@@ -89,7 +89,9 @@ typedef enum
   optLamp,

   optCalibrate,
-  optGamma                      /* analog gamma = single number */
+  optGamma,                     /* analog gamma = single number */
+/* have optEndOfList only to define arrays with sufficient size */
+  optEndOfList
 } EOptionIndex;

@@ -105,8 +107,8 @@ typedef union

 typedef struct
 {
-  SANE_Option_Descriptor aOptions[optLast];
-  TOptionValue aValues[optLast];
+  SANE_Option_Descriptor aOptions[optEndOfList];
+  TOptionValue aValues[optEndOfList];

   TScanParams ScanParams;
   THWParams HWParams;

repo_name: ayhanyalcinsoy/main


code:
commit 7987b0332e6b660ac7992176daeede40cab98390
Author: Nils Philippsen <nils@redhat.com>
Date:   Tue Jun 16 17:02:49 2009 +0200

    patch: open-macro

    Squashed commit of the following:

    commit ab8fe801c4f82017988cb44cb79d82d286aa0de4
    Author: Nils Philippsen <nils@redhat.com>
    Date:   Tue Jun 9 17:57:45 2009 +0200

        don't inadvertently use glibc open() macro

diff --git a/backend/mustek_pp.c b/backend/mustek_pp.c
index 8c3f06a..7e9d094 100644
--- a/backend/mustek_pp.c
+++ b/backend/mustek_pp.c
@@ -1152,7 +1152,7 @@ sane_open (SANE_String_Const devicename, SANE_Handle * handle)

 	}

-	if ((status = dev->func->open (dev->port, dev->caps, &fd)) != SANE_STATUS_GOOD) {
+	if ((status = (dev->func->open) (dev->port, dev->caps, &fd)) != SANE_STATUS_GOOD) {

 		DBG (1, "sane_open: could not open device (%s)\n",
 				sane_strstatus (status));
diff --git a/backend/pixma_common.c b/backend/pixma_common.c
index 2bcb3c1..c5e1e96 100644
--- a/backend/pixma_common.c
+++ b/backend/pixma_common.c
@@ -511,7 +511,7 @@ pixma_open (unsigned devnr, pixma_t ** handle)
   strncpy (s->id, pixma_get_device_id (devnr), sizeof (s->id) - 1);
   s->ops = s->cfg->ops;
   s->scanning = 0;
-  error = s->ops->open (s);
+  error = (s->ops->open) (s);
   if (error < 0)
     goto rollback;
   error = pixma_deactivate (s->io);
diff --git a/backend/plustek_pp.c b/backend/plustek_pp.c
index 13d1443..629e238 100644
--- a/backend/plustek_pp.c
+++ b/backend/plustek_pp.c
@@ -258,7 +258,7 @@ static int drvopen(	Plustek_Device *dev )

     DBG( _DBG_INFO, "drvopen()\n" );

-	handle = dev->open((const char*)dev->name, (void *)dev );
+	handle = (dev->open)((const char*)dev->name, (void *)dev );

 	tsecs = 0;

diff --git a/sanei/sanei_scsi.c b/sanei/sanei_scsi.c
index 69d5859..a594aba 100644
--- a/sanei/sanei_scsi.c
+++ b/sanei/sanei_scsi.c
@@ -5328,7 +5328,7 @@ sanei_scsi_find_devices (const char *findvendor, const char *findmodel,
     (*plugInInterface)->Release (plugInInterface);
     IOObjectRelease (scsiDevice);

-    ioReturnValue = (*scsiDeviceInterface)->open (scsiDeviceInterface);
+    ioReturnValue = ((*scsiDeviceInterface)->open) (scsiDeviceInterface);
     if (ioReturnValue != kIOReturnSuccess)
       {
 	DBG (5, "Error opening SCSI interface (0x%08x)\n", ioReturnValue);


code:
From 305535e303032814b65bf6d889a95f00f08a9071 Mon Sep 17 00:00:00 2001
From: Nils Philippsen <nils@redhat.com>
Date: Wed, 5 May 2010 12:49:02 +0200
Subject: [PATCH] patch: epson-expression800

Squashed commit of the following:

commit 3b501d7499357438a1fbd63fefb2f977ae3051f5
Author: Nils Philippsen <nils@redhat.com>
Date:   Wed May 5 12:14:23 2010 +0200

    Improve Epson Expression 800

    Epson Expression 800 models announce themselves as "processor", not
    "scanner".
---
 doc/descriptions/epson.desc  |    1 +
 doc/descriptions/epson2.desc |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/doc/descriptions/epson.desc b/doc/descriptions/epson.desc
index a22325c..55a0136 100644
--- a/doc/descriptions/epson.desc
+++ b/doc/descriptions/epson.desc
@@ -174,6 +174,7 @@
 :model "Expression 800"
 :interface "SCSI"
 :status :complete
+:scsi "EPSON" "Expression800" "processor"

 :model "Expression 1600"
 :interface "SCSI USB IEEE-1394"
diff --git a/doc/descriptions/epson2.desc b/doc/descriptions/epson2.desc
index 9a14f4f..56cabcd 100644
--- a/doc/descriptions/epson2.desc
+++ b/doc/descriptions/epson2.desc
@@ -241,6 +241,7 @@
 :model      "Expression 800"		; command spec
 :interface  "SCSI"
 :status     :complete
+:scsi       "EPSON" "Expression800" "processor"
 :comment    "overseas version of the GT-9600"

 :model      "Expression 836XL"		; command spec
--
1.6.6.1


code:
From d0c61e7e9b13185f424dff1f4ac697ec53089d69 Mon Sep 17 00:00:00 2001
From: Nils Philippsen <nils@redhat.com>
Date: Tue, 4 Sep 2012 16:45:14 +0200
Subject: [PATCH] patch: sane-config-multilib

Squashed commit of the following:

commit 81aa4f41bf102b08258c8e1de1c0476835329ec5
Author: Nils Philippsen <nils@redhat.com>
Date:   Tue Sep 4 16:43:34 2012 +0200

    make installed sane-config multi-lib aware again

    This partially reverts commit 77c4ea1a7aa680fb1c3ee4daa1404f21439b2c9b.
---
 tools/sane-config.in | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/tools/sane-config.in b/tools/sane-config.in
index 8e4b52a..1fae2e5 100644
--- a/tools/sane-config.in
+++ b/tools/sane-config.in
@@ -10,10 +10,6 @@ scriptname="sane-config"
 prefix="@prefix@"
 exec_prefix="@exec_prefix@"

-# using our installed *.pc only - neither default nor user paths
-export PKG_CONFIG_LIBDIR="@libdir@/pkgconfig"
-export PKG_CONFIG_PATH=""
-
 pkgconfig_package=sane-backends

 usage ()
--
1.7.11.4


code:
From 031cd8dd376ed6537afd06ca5aec5e67f5da0489 Mon Sep 17 00:00:00 2001
From: Nils Philippsen <nils@redhat.com>
Date: Fri, 31 Aug 2012 16:14:49 +0200
Subject: [PATCH] patch: soname

Squashed commit of the following:

commit 2035ced803168210a70c4946814440764e5d0186
Author: Nils Philippsen <nils@redhat.com>
Date:   Fri Aug 31 16:13:51 2012 +0200

    don't use the same SONAME for backend libs and main lib
---
 ltmain.sh | 19 -------------------
 1 file changed, 19 deletions(-)

diff --git a/ltmain.sh b/ltmain.sh
index f3eb4c8..17d1508 100755
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -8101,25 +8101,6 @@ EOF
 	  dlname=$soname
 	fi

-	# Local change for sane-backends: internal name for every lib
-	# is "libsane" not "libsane-backendname". So linking to each
-	# backend is possible. Also the following test was moved to this
-	# location.
-	# If -module or -export-dynamic was specified, set the dlname
-	if test "$module" = yes || test "$export_dynamic" = yes; then
-	  # On all known operating systems, these are identical.
-	  dlname="$soname"
-	fi
-	case $host in
-	  *mingw*)
-	    ;;
-	  *aix*)
-	    ;;
-	  *)
-	    soname=`echo $soname | sed -e "s/libsane-[A-Za-z_0-9]*/libsane/g"`
-	esac
-	# End of local change
-
 	lib="$output_objdir/$realname"
 	linknames=
 	for link
--
1.7.11.4


code:
From c7f5126447ed5335a54d9333ac37f35c2189fbf4 Mon Sep 17 00:00:00 2001
From: Nils Philippsen <nils@redhat.com>
Date: Mon, 10 Sep 2012 12:25:33 +0200
Subject: [PATCH] patch: udev

Squashed commit of the following:

commit 3d19b3eaf91fa8c3c2a78956f570d3e0f4c3f342
Author: Nils Philippsen <nils@redhat.com>
Date:   Mon Sep 10 12:25:16 2012 +0200

    adapt generated udev rules for Fedora

commit 7017c3ad1dadc27edd2c47ceec04f8648c839d53
Author: Nils Philippsen <nils@redhat.com>
Date:   Mon Sep 10 12:20:43 2012 +0200

    use group and mode macros consistently
---
 tools/sane-desc.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/tools/sane-desc.c b/tools/sane-desc.c
index 7bbd012..5c5bbe9 100644
--- a/tools/sane-desc.c
+++ b/tools/sane-desc.c
@@ -56,9 +56,9 @@
 #define COLOR_NEW          "\"#F00000\""
 #define COLOR_UNKNOWN      "\"#000000\""

-#define DEVMODE  "0664"
+#define DEVMODE  "0644"
 #define DEVOWNER "root"
-#define DEVGROUP "scanner"
+#define DEVGROUP "root"

 #ifndef PATH_MAX
 # define PATH_MAX 1024
@@ -3543,7 +3543,8 @@ print_udev (void)
     }

   printf("\n# The following rule will disable USB autosuspend for the device\n");
-  printf("ENV{libsane_matched}==\"yes\", RUN+=\"/bin/sh -c 'if test -e /sys/$env{DEVPATH}/power/control; then echo on > /sys/$env{DEVPATH}/power/control; elif test -e /sys/$env{DEVPATH}/power/level; then echo on > /sys/$env{DEVPATH}/power/level; fi'\"\n");
+  printf("ENV{libsane_matched}==\"yes\", TEST==\"power/control\", ATTR{power/control}=\"on\"\n");
+  printf("ENV{libsane_matched}==\"yes\", TEST!=\"power/control\", TEST==\"power/level\", ATTR{power/level}=\"on\"\n");

   printf ("\nLABEL=\"libsane_usb_rules_end\"\n\n");

@@ -3619,10 +3620,8 @@ print_udev (void)
     }
   printf ("LABEL=\"libsane_scsi_rules_end\"\n");

-  if (mode == output_mode_udevacl)
-    printf("\nENV{libsane_matched}==\"yes\", RUN+=\"/bin/setfacl -m g:%s:rw $env{DEVNAME}\"\n", DEVGROUP);
-  else
-    printf ("\nENV{libsane_matched}==\"yes\", MODE=\"664\", GROUP=\"scanner\"\n");
+  if (mode != output_mode_udevacl)
+    printf ("\nENV{libsane_matched}==\"yes\", MODE=\"%s\", GROUP=\"%s\"\n", DEVMODE, DEVGROUP);

   printf ("\nLABEL=\"libsane_rules_end\"\n");
 }
--
1.7.11.4


code:
--- a/backend/mustek_pp_ccd300.c.orig	2003-12-01 12:52:19.000000000 +0100
+++ b/backend/mustek_pp_ccd300.c	2009-07-29 16:29:54.000000000 +0200
@@ -940,10 +940,10 @@ get_color_line_101x (Mustek_pp_Handle *
 	  wait_bank_change (dev, priv->bank_count, 1);
 	  reset_bank_count (dev);
 	  if (priv->ccd_line >= (priv->line_step >> SANE_FIXED_SCALE_SHIFT))
-	    priv->redline = ++priv->redline % priv->green_offs;
+	    priv->redline = (priv->redline + 1) % priv->green_offs;
 	  if (priv->ccd_line >=
 	      priv->blue_offs + (priv->line_step >> SANE_FIXED_SCALE_SHIFT))
-	    priv->blueline = ++priv->blueline % priv->blue_offs;
+	    priv->blueline = (priv->blueline + 1) % priv->blue_offs;
 	  continue;
 	}

@@ -979,7 +979,7 @@ get_color_line_101x (Mustek_pp_Handle *

 	}

-      priv->redline = ++priv->redline % priv->green_offs;
+      priv->redline = (priv->redline + 1) % priv->green_offs;

       if (priv->ccd_line >= priv->green_offs && gogreen)
 	{
@@ -1013,7 +1013,7 @@ get_color_line_101x (Mustek_pp_Handle *

       if (priv->ccd_line >=
 	  priv->blue_offs + (priv->line_step >> SANE_FIXED_SCALE_SHIFT))
-	priv->blueline = ++priv->blueline % priv->blue_offs;
+	priv->blueline = (priv->blueline + 1) % priv->blue_offs;

       if (gogreen)
 	{


code:
<?xml version="1.0"?>
<!DOCTYPE PISI SYSTEM "http://www.pisilinux.org/projeler/pisi/pisi-spec.dtd">
<PISI>
    <Source>
        <Name>sane-backends</Name>
        <Homepage>http://www.sane-project.org</Homepage>
        <Packager>
            <Name>PisiLinux Community</Name>
            <Email>admins@pisilinux.org</Email>
        </Packager>
        <License>GPLv2</License>
        <Icon>sane</Icon>
        <IsA>app:console</IsA>
        <IsA>library</IsA>
        Scanner access software
        <Description>Scanner Access Now Easy (SANE) is a universal scanner interface. The SANE application programming interface provides standardized access to any raster image scanner hardware.</Description>
        <Archive sha1sum="05824922d91571e1fc2f5cdd270745783d593754" type="targz">https://sources.archlinux.org/other/sane/sane-backends-1.0.25.tar.gz</Archive>
        <BuildDependencies>
            <Dependency>libieee1284-devel</Dependency>
            <Dependency>libusb-compat-devel</Dependency>
            <Dependency>libnl-devel</Dependency>
            <Dependency>openssl-devel</Dependency>
            <Dependency>cups-devel</Dependency>
            <Dependency>libgphoto2-devel</Dependency>
            <Dependency>libv4l-devel</Dependency>
            <Dependency>avahi-devel</Dependency>
            <Dependency>libjpeg-turbo-devel</Dependency>
            <Dependency>tiff-devel</Dependency>
            <Dependency>net-snmp-devel</Dependency>
        </BuildDependencies>
        <Patches>
            <Patch level="1">sane-backends-1.0.20-open-macro.patch</Patch>
            <Patch level="1">sane-backends-1.0.23-sane-config-multilib.patch</Patch>
            <Patch level="1">sane-backends-1.0.23-soname.patch</Patch>
            <Patch level="1">sane-backends-1.0.23-udev.patch</Patch>
            <Patch level="1">archlinux/network.patch</Patch>
        </Patches>
    </Source>

    <Package>
        <Name>sane-backends</Name>
        <RuntimeDependencies>
            <Dependency>libnl</Dependency>
            <Dependency>openssl</Dependency>
            <Dependency>libusb-compat</Dependency>
            <Dependency>libieee1284</Dependency>
            <Dependency>avahi-libs</Dependency>
            <Dependency>libgphoto2</Dependency>
            <Dependency>libv4l</Dependency>
            <Dependency>tiff</Dependency>
            <Dependency>libjpeg-turbo</Dependency>
            <Dependency>net-snmp</Dependency>
            <Dependency>cups</Dependency>
            <Dependency>libexif</Dependency>
        </RuntimeDependencies>
        <Files>
            <Path fileType="data">/etc/sane.d/dll.d</Path>
            <Path fileType="data">/etc/env.d</Path>
            <Path fileType="config">/etc/sane.d</Path>
            <Path fileType="executable">/usr/bin</Path>
            <Path fileType="localedata">/usr/share/locale</Path>
            <Path fileType="executable">/usr/sbin</Path>
            <Path fileType="executable">/usr/libexec</Path>
            <Path fileType="library">/usr/lib</Path>
            <Path fileType="doc">/usr/share/doc/sane-backends/README</Path>
            <Path fileType="doc">/usr/share/doc/sane-backends/COPYING</Path>
            <Path fileType="man">/usr/share/man</Path>
            <Path fileType="data">/usr/share/pixmaps</Path>
            <Path fileType="data">/lib/udev/rules.d</Path>
            <Path fileType="data">/usr/share/sane</Path>
        </Files>
        <AdditionalFiles>
            <AdditionalFile owner="root" permission="0644" target="/usr/share/pixmaps/sane.png">sane.png</AdditionalFile>
            <AdditionalFile owner="root" permission="0644" target="/etc/env.d/30sane">30sane</AdditionalFile>
        </AdditionalFiles>
    </Package>

    <Package>
        <Name>sane-backends-devel</Name>
        Development files for sane-backends
        <RuntimeDependencies>
            <Dependency release="current">sane-backends</Dependency>
        </RuntimeDependencies>
        <Files>
            <Path fileType="header">/usr/include</Path>
            <Path fileType="data">/usr/lib/pkgconfig</Path>
        </Files>
    </Package>

    <Package>
        <Name>sane-backends-docs</Name>
        Documentation for SANE backends
        <Files>
            <Path fileType="doc">/usr/share/doc</Path>
        </Files>
    </Package>

    <History>
        <Update release="3">
            <Date>2017-04-10</Date>
            <Version>1.0.25</Version>
            <Comment>Release Bump</Comment>
            <Name>Kamil Atlı</Name>
            <Email>admin@pisilinux.org</Email>
        </Update>
        <Update release="2">
            <Date>2016-06-09</Date>
            <Version>1.0.25</Version>
            <Comment>Release Bump</Comment>
            <Name>Pisi Linux Community</Name>
            <Email>admin@pisilinux.org</Email>
        </Update>
        <Update release="1">
            <Date>2016-04-01</Date>
            <Version>1.0.25</Version>
            <Comment>First release</Comment>
            <Name>Yusuf Aydemir</Name>
            <Email>yusuf.aydemir@pisilinux.org</Email>
        </Update>
    </History>
</PISI>


code:
<?xml version="1.0" ?>
<PISI>
    <Source>
        <Name>sane-backends</Name>
        SANE (Scanner Access Now Easy) döküman ve resim tarayıcı sistemi araçları
        <Description xml:lang="tr">SANE ve uygulama programlama arayüzü (API) ile herhangi bir görüntü tarayıcı donanımına standartlaştırlmış erişim sağlar.</Description>
    </Source>

    <Package>
        <Name>sane-backends-devel</Name>
        sane-backends için geliştirme dosyaları
    </Package>

    <Package>
        <Name>sane-backends-docs</Name>
        sane-backends için belgelendirme dosyaları
    </Package>
</PISI>


code:
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Licensed under the GNU General Public License, version 3.
# See the file http://www.gnu.org/licenses/gpl.txt

from pisi.actionsapi import autotools
from pisi.actionsapi import pisitools
from pisi.actionsapi import get

def setup():
    autotools.configure("--with-gnu-ld")

def build():
    autotools.make()

def install():
    autotools.rawInstall("DESTDIR=%s" % get.installDIR())

    pisitools.dodoc("AUTHORS", "COPYING", "README")

    # There's xsane instead
    pisitools.remove("/usr/bin/xscanimage")
    pisitools.remove("/usr/share/man/man1/xscanimage.1")
    pisitools.removeDir("/usr/share/sane")


code:
commit c4cb247732767aed76502069d0b3040c4c4e5123
Author: Nils Philippsen <nils@redhat.com>
Date:   Fri Jul 31 16:21:53 2009 +0200

    patch: array-out-of-bounds

    Squashed commit of the following:

    commit 337bcefaa7a67931095b74317a266a1244978ab6
    Author: Nils Philippsen <nils@redhat.com>
    Date:   Fri Jul 31 16:03:28 2009 +0200

        fix array subscript out of bounds errors (#133121)

diff --git a/src/xcam.c b/src/xcam.c
index 2d494a5..f6859b7 100644
--- a/src/xcam.c
+++ b/src/xcam.c
@@ -1289,7 +1289,7 @@ save_frame_button (GtkWidget * widget, gpointer client_data,

       /* test for pnm formats */
       strncpy (testfilename, preferences.filename, sizeof (testfilename));
-      testfilename[sizeof (testfilename)] = 0;
+      testfilename[sizeof (testfilename) - 1] = 0;
       g_strreverse (testfilename);
       if (!((!strncmp (testfilename, "mnp.", 4)) ||
 	    (!strncmp (testfilename, "mgp.", 4)) ||
diff --git a/src/xscanimage.c b/src/xscanimage.c
index a36324f..065923d 100644
--- a/src/xscanimage.c
+++ b/src/xscanimage.c
@@ -1284,7 +1284,7 @@ scan_dialog (GtkWidget * widget, gpointer call_data)
     {				/* We are running in standalone mode */
       /* test for pnm formats */
       strncpy (testfilename, preferences.filename, sizeof (testfilename));
-      testfilename[sizeof (testfilename)] = 0;
+      testfilename[sizeof (testfilename) - 1] = 0;
       g_strreverse (testfilename);
       if (!((!strncmp (testfilename, "mnp.", 4)) ||
 	    (!strncmp (testfilename, "mgp.", 4)) ||


code:
commit ddd90b1502a263d03938b1e45a57684d576993ba
Author: Nils Philippsen <nils@redhat.com>
Date:   Fri Jul 31 16:25:58 2009 +0200

    patch: sane-backends-1.0.20

    Squashed commit of the following:

    commit 0c84326fa37bb309481c4d2658ab6cb17c9f0e85
    Author: Nils Philippsen <nils@redhat.com>
    Date:   Fri Jul 31 16:18:59 2009 +0200

        use SANE_CAP_ALWAYS_SETTABLE only if available

diff --git a/src/gtkglue.c b/src/gtkglue.c
index ba5cbf5..ec81f45 100644
--- a/src/gtkglue.c
+++ b/src/gtkglue.c
@@ -1476,8 +1476,12 @@ gsg_set_sensitivity (GSGDialog * dialog, int sensitive)
 	  || opt->type == SANE_TYPE_GROUP || !dialog->element[i].widget)
 	continue;

+#ifdef SANE_CAP_ALWAYS_SETTABLE
       if (!(opt->cap & SANE_CAP_ALWAYS_SETTABLE))
 	gtk_widget_set_sensitive (dialog->element[i].widget, sensitive);
+#else
+	gtk_widget_set_sensitive (dialog->element[i].widget, sensitive);
+#endif
     }
 }


code:
<?xml version="1.0"?>
<!DOCTYPE PISI SYSTEM "http://www.pisilinux.org/projeler/pisi/pisi-spec.dtd">
<PISI>
    <Source>
        <Name>sane-frontends</Name>
        <Homepage>http://www.sane-project.org</Homepage>
        <Packager>
            <Name>PisiLinux Community</Name>
            <Email>admins@pisilinux.org</Email>
        </Packager>
        <License>GPLv2+</License>
        <IsA>app:console</IsA>
        <Summary>Graphical frontend to SANE</Summary>
        <Description>sane-frontends includes the scanadf and xcam programs.</Description>
        <Archive sha1sum="063e11df3e32d7a43161fd37026a4dc601d5482d" type="targz">ftp://ftp.uwsg.indiana.edu/linux/gentoo/distfiles/sane-frontends-1.0.14.tar.gz</Archive>
        <BuildDependencies>
            <Dependency>sane-backends-devel</Dependency>
            <Dependency>gimp-devel</Dependency>
            <Dependency>gtk2-devel</Dependency>
        </BuildDependencies>
        <Patches>
            <Patch level="1">sane-frontends-1.0.14-array-out-of-bounds.patch</Patch>
            <Patch level="1">sane-frontends-1.0.14-sane-backends-1.0.20.patch</Patch>
        </Patches>
    </Source>

    <Package>
        <Name>sane-frontends</Name>
        <RuntimeDependencies>
            <Dependency>sane-backends</Dependency>
            <Dependency>gtk2</Dependency>
            <Dependency>glib2</Dependency>
        </RuntimeDependencies>
        <Files>
            <Path fileType="executable">/usr/bin</Path>
            <Path fileType="doc">/usr/share/doc/sane-frontends</Path>
            <Path fileType="man">/usr/share/man</Path>
        </Files>
    </Package>

    <History>
        <Update release="3">
            <Date>2017-04-09</Date>
            <Version>1.0.14</Version>
            <Comment>Release Bump</Comment>
            <Name>Kamil Atlı</Name>
            <Email>admin@pisilinux.org</Email>
        </Update>
        <Update release="2">
            <Date>2016-06-09</Date>
            <Version>1.0.14</Version>
            <Comment>Release Bump</Comment>
            <Name>Pisi Linux Community</Name>
            <Email>admin@pisilinux.org</Email>
        </Update>
        <Update release="1">
            <Date>2014-03-10</Date>
            <Version>1.0.14</Version>
            <Comment>First release</Comment>
            <Name>Varol Maksutoğlu</Name>
            <Email>waroi@pisilinux.org</Email>
        </Update>
    </History>
</PISI>


code:
<?xml version="1.0" ?>
<PISI>
    <Source>
        <Name>sane-frontends</Name>
        <Summary xml:lang="tr">SANE için grafiksel arayüz paketi</Summary>
        <Description xml:lang="tr">sane-frontends, scanadf ve xcam grafiksel araçlarını içerir.</Description>
    </Source>
</PISI>


code:
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Licensed under the GNU General Public License, version 3.
# See the file http://www.gnu.org/licenses/gpl.txt

from pisi.actionsapi import kde5
from pisi.actionsapi import get

def setup():
    kde5.configure()

def build():
    kde5.make()

def install():
    kde5.install()


code:
<?xml version="1.0" ?>
<!DOCTYPE PISI SYSTEM "http://www.pisilinux.org/projeler/pisi/pisi-spec.dtd">
<PISI>
    <Source>
        <Name>skanlite</Name>
        <Homepage>http://www.kde.org</Homepage>
        <Packager>
            <Name>PisiLinux Community</Name>
            <Email>admins@pisilinux.org</Email>
        </Packager>
        <License>LGPLv2</License>
        <IsA>app:gui</IsA>
        <Summary>Lite scanning tool for KDE</Summary>
        <Description>Skanlite, provides to use scanner device plugged in your system with Sane backend.</Description>
        <Archive sha1sum="86589d11cbab469d89348625a08145f59f186c7d" type="tarxz">http://download.kde.org/stable/skanlite/2.0/skanlite-2.0.1.tar.xz</Archive>
        <BuildDependencies>
            <Dependency>extra-cmake-modules</Dependency>
            <Dependency>qt5-base-devel</Dependency>
            <Dependency>zlib-devel</Dependency>
            <Dependency>libpng-devel</Dependency>
            <Dependency>kcoreaddons-devel</Dependency>
            <Dependency>ki18n-devel</Dependency>
            <Dependency>kxmlgui-devel</Dependency>
            <Dependency>kio-devel</Dependency>
            <Dependency>kdoctools-devel</Dependency>
            <Dependency>ktextwidgets-devel</Dependency>
            <Dependency>libksane-devel</Dependency>
        </BuildDependencies>
    </Source>

    <Package>
        <Name>skanlite</Name>
        <RuntimeDependencies>
            <Dependency>kio</Dependency>
            <Dependency>ki18n</Dependency>
            <Dependency>libgcc</Dependency>
            <Dependency>libpng</Dependency>
            <Dependency>kconfig</Dependency>
            <Dependency>kxmlgui</Dependency>
            <Dependency>libksane</Dependency>
            <Dependency>qt5-base</Dependency>
            <Dependency>kcoreaddons</Dependency>
            <Dependency>kjobwidgets</Dependency>
            <Dependency>kconfigwidgets</Dependency>
            <Dependency>kwidgetsaddons</Dependency>
            <Dependency>sane-backends</Dependency>
        </RuntimeDependencies>
        <Files>
            <Path fileType="executable">/usr/bin</Path>
            <Path fileType="doc">/usr/share/doc</Path>
            <Path fileType="data">/usr/share</Path>
        </Files>
    </Package>

    <History>
        <Update release="3">
            <Date>2017-01-12</Date>
            <Version>2.0.1</Version>
            <Comment>Version Bump</Comment>
            <Name>Stefan Gronewold</Name>
            <Email>groni@pisilinux.org</Email>
        </Update>
        <Update release="2">
            <Date>2016-05-23</Date>
            <Version>2.0</Version>
            <Comment>Release bump</Comment>
            <Name>Alihan Öztürk</Name>
            <Email>alihan@pisilinux.org</Email>
        </Update>
        <Update release="1">
            <Date>2016-02-02</Date>
            <Version>2.0</Version>
            <Comment>First release</Comment>
            <Name>Alihan Öztürk</Name>
            <Email>alihan@pisilinux.org</Email>
        </Update>
    </History>
</PISI>


code:
<?xml version="1.0" ?>
<PISI>
    <Source>
        <Name>skanlite</Name>
        <Summary xml:lang="tr">KDE için hafif bir tarayıcı aracı</Summary>
        <Description xml:lang="tr">Skanlite, sisteminize takılı tarayıcı aygıtlarını Sane uygulaması ile birlikte kullanmanıza olanak sağlar.</Description>
    </Source>
</PISI>


code:
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Licensed under the GNU General Public License, version 3.
# See the file http://www.gnu.org/licenses/gpl.txt

from pisi.actionsapi import autotools
from pisi.actionsapi import pisitools
from pisi.actionsapi import get
from pisi.actionsapi import shelltools

def setup():
    options = "--disable-aload"

    if get.buildTYPE() == "emul32":
        options += " --disable-python"
        shelltools.export("CFLAGS", "%s -m32" % get.CFLAGS())

    autotools.autoreconf("-fi")

    autotools.configure(options)
    pisitools.dosed("libtool", " -shared ", " -Wl,--as-needed -shared ")

    # rpath fix
    pisitools.dosed("libtool", "^hardcode_libdir_flag_spec=.*", "hardcode_libdir_flag_spec=\"\"")
    pisitools.dosed("libtool", "^runpath_var=LD_RUN_PATH", "runpath_var=DIE_RPATH_DIE")

def build():
    autotools.make()

def install():
    autotools.rawInstall("DESTDIR=%s" % get.installDIR())

    if get.buildTYPE() == "emul32": return

    pisitools.dodoc("ChangeLog", "TODO", "COPYING", "doc/*.txt")


code:
<?xml version="1.0" ?>
<!DOCTYPE PISI SYSTEM "http://www.pisilinux.org/projeler/pisi/pisi-spec.dtd">
<PISI>
    <Source>
        <Name>alsa-lib</Name>
        <Homepage>http://www.alsa-project.org/</Homepage>
        <Packager>
            <Name>PisiLinux Community</Name>
            <Email>admins@pisilinux.org</Email>
        </Packager>
        <License>GPLv2</License>
        <IsA>library</IsA>
        <IsA>app:console</IsA>
        The Advanced Linux Sound Architecture (ALSA) library
        <Description>alsa-lib provides ALSA runtime libraries to simplify application programming and provide higher level functionality as well as support for the older OSS API, providing binary compatibility for most OSS programs.</Description>
        <Archive sha1sum="636ac0b2b759108ca9b0f4efa1c3e8650cf9c9f6" type="tarbz2">ftp://ftp.alsa-project.org/pub/lib/alsa-lib-1.1.5.tar.bz2</Archive>
        <BuildDependencies>
            <Dependency>python-devel</Dependency>
        </BuildDependencies>
    </Source>

    <Package>
        <Name>alsa-lib</Name>
         <RuntimeDependencies>
            <Dependency>python</Dependency>
        </RuntimeDependencies>
        <Files>
            <Path fileType="library">/usr/lib</Path>
            <Path fileType="executable">/usr/bin</Path>
            <Path fileType="doc">/usr/share/doc</Path>
            <Path fileType="data">/usr/share/alsa</Path>
        </Files>
    </Package>

    <Package>
        <Name>alsa-lib-devel</Name>
        Development files for alsa-lib
        <RuntimeDependencies>
            <Dependency release="current">alsa-lib</Dependency>
        </RuntimeDependencies>
        <Files>
            <Path fileType="data">/usr/lib/pkgconfig</Path>
            <Path fileType="data">/usr/lib32/pkgconfig</Path>
            <Path fileType="header">/usr/include/sys</Path>
            <Path fileType="header">/usr/include/alsa</Path>
            <Path fileType="data">/usr/share/aclocal</Path>
            <Path fileType="man">/usr/share/man/man3</Path>
        </Files>
    </Package>

    <Package>
        <Name>alsa-lib-32bit</Name>
        <PartOf>emul32</PartOf>
        32-bit shared libraries for alsa-lib
        <BuildType>emul32</BuildType>
        <BuildDependencies>

        </BuildDependencies>
        <RuntimeDependencies>

        </RuntimeDependencies>
        <Files>
            <Path fileType="library">/usr/lib32</Path>
        </Files>
    </Package>

    <History>
        <Update release="5">
            <Date>2018-01-07</Date>
            <Version>1.1.5</Version>
            <Comment>Version Bump</Comment>
            <Name>Pisi Linux Community</Name>
            <Email>admin@pisilinux.org</Email>
        </Update>
        <Update release="4">
            <Date>2017-02-06</Date>
            <Version>1.1.3</Version>
            <Comment>Version Bump</Comment>
            <Name>Pisi Linux Community</Name>
            <Email>admin@pisilinux.org</Email>
        </Update>
        <Update release="3">
            <Date>2016-06-09</Date>
            <Version>1.1.1</Version>
            <Comment>Release Bump</Comment>
            <Name>Pisi Linux Community</Name>
            <Email>admin@pisilinux.org</Email>
        </Update>
        <Update release="2">
            <Date>2016-05-03</Date>
            <Version>1.1.1</Version>
            <Comment>Version bump.</Comment>
            <Name>Alihan Öztürk</Name>
            <Email>alihan@pisilinux.org</Email>
        </Update>
        <Update release="1">
            <Date>2015-03-04</Date>
            <Version>1.0.29</Version>
            <Comment>First release</Comment>
            <Name>Hakan Yıldız</Name>
            <Email>hknyldz93@gmail.com</Email>
        </Update>
    </History>
</PISI>


code:
<?xml version="1.0" ?>
<PISI>
    <Source>
        <Name>alsa-lib</Name>
        Gelişmiş Linux Ses Mimarisi kütüphanesi
        <Description xml:lang="tr">alsa-lib, ses aygıtlarına erişim sağlayarak kolayca uygulama yazılmasını sağlayan bir kütüphanedir.</Description>
    </Source>

    <Package>
        <Name>alsa-lib-devel</Name>
        alsa-lib için geliştirme dosyaları
    </Package>

    <Package>
        <Name>alsa-lib-32bit</Name>
        alsa-lib için 32-bit paylaşımlı kitaplıklar
    </Package>
</PISI>


code:
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Licensed under the GNU General Public License, version 3.
# See the file http://www.gnu.org/licenses/gpl.txt

from pisi.actionsapi import autotools
from pisi.actionsapi import pisitools
from pisi.actionsapi import shelltools
from pisi.actionsapi import get

console_tools = ["as10k1", "hdsploader", "hda-verb",
                 "mixartloader", "vxloader",
                 "usx2yloader", "sscape_ctl",
                 "sb16_csp", "as10k1", "ld10k1",
                 "us428control", "seq/sbiload"]

gui_tools = ["envy24control", "rmedigicontrol", "hdspconf",
             "hdspmixer", "echomixer", "hwmixvolume"]

alsa_tools = gui_tools + console_tools

docs = ["README", "AUTHORS", "COPYING", "TODO", "NEWS", "ChangeLog"]

if "_" in get.srcVERSION():
    WorkDir = get.srcNAME()

def setup():
    for tool in alsa_tools:
        shelltools.cd(tool)
        if tool in ["hdspconf", "ld10k1"]:
            autotools.autoreconf("-fi")
        autotools.configure()
        shelltools.cd("..")

def build():
    for tool in alsa_tools:
        shelltools.cd(tool)
        autotools.make()
        shelltools.cd("..")

def install():
    for tool in alsa_tools:
        shelltools.cd(tool)
        autotools.rawInstall("DESTDIR=\"%s\"" % get.installDIR())

        for doc in [d for d in docs if shelltools.can_access_file(d)]:
            if tool in gui_tools:
                srctag = "alsa-tools-gui"
            else:
                srctag = get.srcNAME()

            pisitools.insinto("/usr/share/doc/%s/%s" % (srctag, tool), doc)

        shelltools.cd("..")

    pisitools.remove("/usr/share/applications/hdspmixer.desktop")
    pisitools.remove("/usr/share/applications/hdspconf.desktop")


code:
# TASCAM US-428 usb sound card.
SUBSYSTEM=="usb", ACTION=="add", ATTRS{idVendor}=="1604", ATTRS{idProduct}=="8000", RUN+="/lib/udev/tascam_fw"
SUBSYSTEM=="usb", ACTION=="add", ATTRS{idVendor}=="1604", ATTRS{idProduct}=="8001", RUN+="/lib/udev/tascam_fpga"

# TASCAM US-224 usb sound card.
SUBSYSTEM=="usb", ACTION=="add", ATTRS{idVendor}=="1604", ATTRS{idProduct}=="8004", RUN+="/lib/udev/tascam_fw"
SUBSYSTEM=="usb", ACTION=="add", ATTRS{idVendor}=="1604", ATTRS{idProduct}=="8005", RUN+="/lib/udev/tascam_fpga"

# TASCAM US-122 usb sound card.
SUBSYSTEM=="usb", ACTION=="add", ATTRS{idVendor}=="1604", ATTRS{idProduct}=="8006", RUN+="/lib/udev/tascam_fw"
SUBSYSTEM=="usb", ACTION=="add", ATTRS{idVendor}=="1604", ATTRS{idProduct}=="8007", RUN+="/lib/udev/tascam_fpga"


code:
diff -p -up ./hdspconf/src/Makefile.am.tv ./hdspconf/src/Makefile.am
--- ./hdspconf/src/Makefile.am.tv	2008-06-10 11:15:09.000000000 +0200
+++ ./hdspconf/src/Makefile.am	2008-06-10 11:15:01.000000000 +0200
@@ -1,4 +1,5 @@
 bin_PROGRAMS = hdspconf
+hdspconf_LDADD = @LDFLAGS@
 hdspconf_SOURCES = \
 	hdspconf.cxx \
 	defines.h \
diff -p -up ./src/Makefile.am.tv ./src/Makefile.am
--- ./hdspmixer/src/Makefile.am.tv	2008-06-10 11:51:47.000000000 +0200
+++ ./hdspmixer/src/Makefile.am	2008-06-10 11:52:06.000000000 +0200
@@ -1,4 +1,5 @@
 bin_PROGRAMS = hdspmixer
+hdspmixer_LDADD = @LDFLAGS@
 hdspmixer_SOURCES = \
 	hdspmixer.cxx \
 	HDSPMixerWindow.cxx \


code:
[Desktop Entry]
Type=Application
Name=Echomixer
Name[tr]=Echomixer
GenericName=Echoaudio soundcard tool
GenericName[tr]=Echoaudio ses kartı aracı
Icon=alsa-tools
Exec=echomixer
Terminal=false
Categories=AudioVideo;Audio;


code:
[Desktop Entry]
Type=Application
Name=envy24control
Name[tr]=envy24control
GenericName=envy24(ice1712) based soundcard tool
GenericName[tr]=envy24(ice1712) ses kartı aracı
Icon=alsa-tools
Exec=envy24control
Terminal=false
Categories=AudioVideo;Audio;


code:
diff -Naur alsa-tools-1.0.18/hdsploader/Makefile.in alsa-tools-1.0.18-patched/hdsploader/Makefile.in
--- alsa-tools-1.0.18/hdsploader/Makefile.in	2008-10-29 14:48:40.000000000 +0200
+++ alsa-tools-1.0.18-patched/hdsploader/Makefile.in	2008-10-31 11:36:40.000000000 +0200
@@ -158,7 +158,7 @@

 # # Process this file with automake to produce Makefile.in.
 MYNAME = hdsploader
-AM_CFLAGS = -DDATAPATH=\"$(datadir)/alsa/firmware/$(MYNAME)\"
+AM_CFLAGS = -DDATAPATH=\"/lib/firmware/$(MYNAME)\"
 hdsploader_SOURCES = hdsploader.c
 EXTRA_DIST = gitcompile depcomp
 all: all-am
diff -Naur alsa-tools-1.0.18/mixartloader/Makefile.in alsa-tools-1.0.18-patched/mixartloader/Makefile.in
--- alsa-tools-1.0.18/mixartloader/Makefile.in	2008-10-29 14:48:56.000000000 +0200
+++ alsa-tools-1.0.18-patched/mixartloader/Makefile.in	2008-10-31 11:36:58.000000000 +0200
@@ -159,7 +159,7 @@
 # # Process this file with automake to produce Makefile.in.
 AUTOMAKE_OPTIONS = 1.3 foreign
 MYNAME = mixartloader
-AM_CFLAGS = -DDATAPATH=\"$(datadir)/alsa/firmware/$(MYNAME)\"
+AM_CFLAGS = -DDATAPATH=\"/lib/firmware/$(MYNAME)\"
 mixartloader_SOURCES = mixartloader.c
 EXTRA_DIST = gitcompile depcomp
 all: all-am
diff -Naur alsa-tools-1.0.18/pcxhrloader/Makefile.in alsa-tools-1.0.18-patched/pcxhrloader/Makefile.in
--- alsa-tools-1.0.18/pcxhrloader/Makefile.in	2008-10-29 14:49:00.000000000 +0200
+++ alsa-tools-1.0.18-patched/pcxhrloader/Makefile.in	2008-10-31 11:37:27.000000000 +0200
@@ -159,7 +159,7 @@
 # # Process this file with automake to produce Makefile.in.
 AUTOMAKE_OPTIONS = 1.3 foreign
 MYNAME = pcxhrloader
-AM_CFLAGS = -DDATAPATH=\"$(datadir)/alsa/firmware/$(MYNAME)\"
+AM_CFLAGS = -DDATAPATH=\"/lib/firmware/$(MYNAME)\"
 pcxhrloader_SOURCES = pcxhrloader.c
 EXTRA_DIST = gitcompile depcomp
 all: all-am
diff -Naur alsa-tools-1.0.18/usx2yloader/Makefile.in alsa-tools-1.0.18-patched/usx2yloader/Makefile.in
--- alsa-tools-1.0.18/usx2yloader/Makefile.in	2008-10-29 14:49:27.000000000 +0200
+++ alsa-tools-1.0.18-patched/usx2yloader/Makefile.in	2008-10-31 11:37:46.000000000 +0200
@@ -163,7 +163,7 @@
 # # Process this file with automake to produce Makefile.in.
 AUTOMAKE_OPTIONS = 1.3 foreign
 MYNAME = usx2yloader
-AM_CFLAGS = -DDATAPATH=\"$(datadir)/alsa/firmware/$(MYNAME)\"
+AM_CFLAGS = -DDATAPATH=\"/lib/firmware/$(MYNAME)\"
 usx2yloader_SOURCES = usx2yloader.c
 EXTRA_DIST = gitcompile depcomp tascam_fw.usermap tascam_fw.in tascam_fpga.in
 hotplug_files = tascam_fw.usermap tascam_fw tascam_fpga
diff -Naur alsa-tools-1.0.18/vxloader/Makefile.in alsa-tools-1.0.18-patched/vxloader/Makefile.in
--- alsa-tools-1.0.18/vxloader/Makefile.in	2008-10-29 14:49:31.000000000 +0200
+++ alsa-tools-1.0.18-patched/vxloader/Makefile.in	2008-10-31 11:38:09.000000000 +0200
@@ -159,7 +159,7 @@
 # # Process this file with automake to produce Makefile.in.
 AUTOMAKE_OPTIONS = 1.3 foreign
 MYNAME = vxloader
-AM_CFLAGS = -DDATAPATH=\"$(datadir)/alsa/firmware/$(MYNAME)\"
+AM_CFLAGS = -DDATAPATH=\"/lib/firmware/$(MYNAME)\"
 vxloader_SOURCES = vxloader.c
 EXTRA_DIST = gitcompile depcomp
 all: all-am


code:
[Desktop Entry]
Type=Application
Name=HDSPConf
Name[tr]=HDSPConf
GenericName=Hammerfall HDSP soundcard tool
GenericName[tr]=Hammerfall HDSP ses kartı aracı
Icon=hdspconf
Exec=hdspconf
Terminal=false
Categories=AudioVideo;Audio;


code:
[Desktop Entry]
Type=Application
Name=HDSPMixer
Name[tr]=HDSPMixer
GenericName=RME Hammerfall DSP Mixer
GenericName[tr]=RME Hammerfall için karıştırıcı
Icon=hdspmixer
Exec=hdspmixer
Terminal=false
Categories=AudioVideo;Audio;


code:
[Desktop Entry]
Encoding=UTF-8
Name=Hwmixvolume
GenericName=Hardware Mixer Volumes
GenericName[tr]=Donanımsal Ses Karıştırıcı Seviyeleri
Comment=Control the volume of individual streams on sound cards that use hardware mixing
Comment[tr]=Donanımsal karıştırıcı kullanan ses kartlarındaki farklı akışların ses şiddetini ayarlayın
Exec=hwmixvolume
Icon=hwmixvolume
Terminal=false
Type=Application
Categories=Application;AudioVideo;
Version=0.9.4


code:
[Desktop Entry]
Type=Application
Name=Rmedigicontrol
Name[tr]=Rmedigicontrol
GenericName=RME Digi32/96 soundcard tool
GenericName[tr]=RME Digi32/96 ses kartı aracı
Icon=alsa-tools
Exec=rmedigicontrol
Terminal=false
Categories=AudioVideo;Audio;


code:
diff -Naur alsa-tools-1.0.18/usx2yloader/Makefile.am alsa-tools-1.0.18-patched/usx2yloader/Makefile.am
--- alsa-tools-1.0.18/usx2yloader/Makefile.am	2008-10-29 14:42:12.000000000 +0200
+++ alsa-tools-1.0.18-patched/usx2yloader/Makefile.am	2008-10-31 15:14:01.000000000 +0200
@@ -11,8 +11,8 @@

 EXTRA_DIST = gitcompile depcomp tascam_fw.usermap tascam_fw.in tascam_fpga.in

-hotplug_files = tascam_fw.usermap tascam_fw tascam_fpga
-hotplugdir = /etc/hotplug/usb
+hotplug_files = tascam_fw tascam_fpga
+hotplugdir = /lib/udev
 hotplug_SCRIPTS = $(hotplug_files)

diff -Naur alsa-tools-1.0.18/usx2yloader/Makefile.in alsa-tools-1.0.18-patched/usx2yloader/Makefile.in
--- alsa-tools-1.0.18/usx2yloader/Makefile.in	2008-10-29 14:49:27.000000000 +0200
+++ alsa-tools-1.0.18-patched/usx2yloader/Makefile.in	2008-10-31 15:14:47.000000000 +0200
@@ -166,8 +166,8 @@
 AM_CFLAGS = -DDATAPATH=\"$(datadir)/alsa/firmware/$(MYNAME)\"
 usx2yloader_SOURCES = usx2yloader.c
 EXTRA_DIST = gitcompile depcomp tascam_fw.usermap tascam_fw.in tascam_fpga.in
-hotplug_files = tascam_fw.usermap tascam_fw tascam_fpga
-hotplugdir = /etc/hotplug/usb
+hotplug_files =  tascam_fw tascam_fpga
+hotplugdir = /lib/udev
 hotplug_SCRIPTS = $(hotplug_files)
 all: all-am


code:
<?xml version="1.0" ?>
<!DOCTYPE PISI SYSTEM "http://www.pisilinux.org/projeler/pisi/pisi-spec.dtd">
<PISI>
    <Source>
        <Name>alsa-tools</Name>
        <Homepage>http://www.alsa-project.org/</Homepage>
        <Packager>
            <Name>PisiLinux Community</Name>
            <Email>admins@pisilinux.org</Email>
        </Packager>
        <License>GPLv2</License>
        <IsA>app:console</IsA>
        <IsA>app:gui</IsA>
        ALSA configuration tools
        <Description>alsa-tools contains ALSA (Advanced Linux Sound Architecture) tools like firmware loaders and sound card control utilities for specific sound cards.</Description>
        <Archive sha1sum="2e747236773254fec557ab337469dac6f37d4e06" type="tarbz2">ftp://ftp.alsa-project.org/pub/tools/alsa-tools-1.1.5.tar.bz2</Archive>
        <BuildDependencies>
            <Dependency>gtk2-devel</Dependency>
            <Dependency>fltk-devel</Dependency>
            <Dependency>alsa-lib-devel</Dependency>
        </BuildDependencies>
        <Patches>
            <Patch level="1">usx2yloader_udev.patch</Patch>
            <Patch level="1">firmware_locations.patch</Patch>
            <Patch>alsa-tools-1.0.17rc1-fix-link.patch</Patch>
        </Patches>
    </Source>

    <Package>
        <Name>alsa-tools</Name>
        ALSA console tools
        <Description>alsa-tools is a collection of console applications for controlling sound cards like EchoAudio, Envy24, etc.</Description>
        <RuntimeDependencies>
            <Dependency>libgcc</Dependency>
            <Dependency>alsa-lib</Dependency>
        </RuntimeDependencies>
        <Files>
            <Path fileType="executable">/usr/bin</Path>
            <Path fileType="executable">/usr/sbin</Path>
            <Path fileType="executable">/lib/udev</Path>
            <Path fileType="library">/usr/lib</Path>
            <Path fileType="data">/lib/udev/rules.d</Path>
            <Path fileType="data">/usr/share/ld10k1</Path>
            <Path fileType="data">/usr/share/sounds</Path>
            <Path fileType="man">/usr/share/man</Path>
            <Path fileType="doc">/usr/share/doc/alsa-tools</Path>
        </Files>
        <AdditionalFiles>
            <AdditionalFile target="/lib/udev/rules.d/90-alsa-tools-firmware.rules" permission="0644">90-alsa-tools-firmware.rules</AdditionalFile>
        </AdditionalFiles>
    </Package>

    <Package>
        <Name>alsa-tools-gui</Name>
        Graphical frontends for some ALSA tools
        <Description>alsa-tools-gui is a collection of GUI based ALSA tools for controlling sound cards like EchoAudio, Envy24, Hammerfall HDSP, RMedigicontrol.</Description>
        <RuntimeDependencies>
            <Dependency>fltk</Dependency>
            <Dependency>gtk2</Dependency>
            <Dependency>glib2</Dependency>
            <Dependency>alsa-lib</Dependency>
        </RuntimeDependencies>
        <Files>
            <Path fileType="man">/usr/share/man/man1/envy24control.1</Path>
            <Path fileType="doc">/usr/share/doc/alsa-tools-gui</Path>
            <Path fileType="data">/usr/share/applications</Path>
            <Path fileType="data">/usr/share/pixmaps</Path>
            <Path fileType="executable">/usr/bin/echomixer</Path>
            <Path fileType="executable">/usr/bin/envy24control</Path>
            <Path fileType="executable">/usr/bin/hwmixvolume</Path>
            <Path fileType="executable">/usr/bin/hdspconf</Path>
            <Path fileType="executable">/usr/bin/hdspmixer</Path>
            <Path fileType="executable">/usr/bin/rmedigicontrol</Path>
            <Path fileType="executable">/usr/bin/qlo10k1</Path>
        </Files>
        <AdditionalFiles>
            <AdditionalFile target="/usr/share/pixmaps/alsa-tools.xpm" permission="0644">alsa-tools.xpm</AdditionalFile>
            <AdditionalFile target="/usr/share/pixmaps/hwmixvolume.png" permission="0644">hwmixvolume.png</AdditionalFile>
            <AdditionalFile target="/usr/share/applications/echomixer.desktop" permission="0644">echomixer.desktop</AdditionalFile>
            <AdditionalFile target="/usr/share/applications/envy24control.desktop" permission="0644">envy24control.desktop</AdditionalFile>
            <AdditionalFile target="/usr/share/applications/hdspmixer.desktop" permission="0644">hdspmixer.desktop</AdditionalFile>
            <AdditionalFile target="/usr/share/applications/hdspconf.desktop" permission="0644">hdspconf.desktop</AdditionalFile>
            <AdditionalFile target="/usr/share/applications/hwmixvolume.desktop" permission="0644">hwmixvolume.desktop</AdditionalFile>
            <AdditionalFile target="/usr/share/applications/rmedigicontrol.desktop" permission="0644">rmedigicontrol.desktop</AdditionalFile>
        </AdditionalFiles>
    </Package>

    <Package>
        <Name>alsa-tools-devel</Name>
        Development files for alsa-tools
        <RuntimeDependencies>
            <Dependency>alsa-tools</Dependency>
        </RuntimeDependencies>
        <Files>
            <Path fileType="header">/usr/include</Path>
            <Path fileType="data">/usr/share/aclocal</Path>
            <Path fileType="man">/usr/share/man/man3</Path>
        </Files>
    </Package>

    <History>
        <Update release="5">
            <Date>2018-01-07</Date>
            <Version>1.1.5</Version>
            <Comment>Version Bump</Comment>
            <Name>Pisi Linux Community</Name>
            <Email>admin@pisilinux.org</Email>
        </Update>
        <Update release="4">
            <Date>2017-02-12</Date>
            <Version>1.1.3</Version>
            <Comment>Version Bump</Comment>
            <Name>Pisi Linux Community</Name>
            <Email>admin@pisilinux.org</Email>
        </Update>
        <Update release="3">
            <Date>2016-06-09</Date>
            <Version>1.1.0</Version>
            <Comment>Release Bump</Comment>
            <Name>Pisi Linux Community</Name>
            <Email>admin@pisilinux.org</Email>
        </Update>
        <Update release="2">
            <Date>2016-05-03</Date>
            <Version>1.1.0</Version>
            <Comment>Version bump.</Comment>
            <Name>Alihan Öztürk</Name>
            <Email>alihan@pisilinux.org</Email>
        </Update>
        <Update release="1">
            <Date>2015-03-04</Date>
            <Version>1.0.29</Version>
            <Comment>First release</Comment>
            <Name>Hakan Yıldız</Name>
            <Email>hknyldz93@gmail.com</Email>
        </Update>
    </History>
</PISI>


code:
<?xml version="1.0" ?>
<PISI>
    <Source>
        <Name>alsa-tools</Name>
        Gelişmiş Linux Ses Mimarisi araçları
    </Source>

    <Package>
        <Name>alsa-tools-devel</Name>
        alsa-tools için geliştirme dosyaları
    </Package>
</PISI>


code:
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Licensed under the GNU General Public License, version 3.
# See the file http://www.gnu.org/licenses/gpl.txt

from pisi.actionsapi import autotools
from pisi.actionsapi import pisitools
from pisi.actionsapi import shelltools
from pisi.actionsapi import get

def setup():
    autotools.configure("--sbindir=/sbin \
                         --with-systemdsystemunitdir=no \
                         --disable-alsaconf")

def build():
    autotools.make()

def install():
    autotools.rawInstall("DESTDIR=%s" % get.installDIR())

    pisitools.dodoc("ChangeLog", "README", "TODO", "seq/aconnect/README.aconnect", "seq/aseqnet/README.aseqnet")


code:
from comar.service import *
import os

serviceType = "local"
serviceDefault = "on"
serviceDesc = _({"en": "Store/Restore Mixer Levels",
                 "tr": "Karıştırıcı Seviyeleri Yönetimi"})

@synchronized
def start():
    # Store mixer levels
    os.system("/sbin/alsactl restore")

@synchronized
def stop():
    # Store mixer levels
    os.system("/sbin/alsactl store")

def status():
    return True


code:
CTL{reset}="mixer"
CTL{name}="PC Speaker Playback Volume",CTL{do_search}=="1", \
  CTL{values}="$env{pvolume}",RESULT!="0",CTL{values}="0"
CTL{name}="PC Speaker Playback Switch",CTL{do_search}=="1", \
  CTL{values}="off"

CTL{reset}="mixer"
CTL{name}="PC Beep Playback Volume",CTL{do_search}=="1", \
  CTL{values}="$env{pvolume}",RESULT!="0",CTL{values}="0"
CTL{name}="PC Beep Playback Switch",CTL{do_search}=="1", \
  CTL{values}="off"

CTL{reset}="mixer"
CTL{name}="Beep Playback Volume",CTL{do_search}=="1", \
  CTL{values}="$env{pvolume}",RESULT!="0",CTL{values}="0"
CTL{name}="Beep Playback Switch",CTL{do_search}=="1", \
  CTL{values}="off"


code:
#
# ALSA library configuration file for alsactl tool
# (/usr/share/alsa tree is not necessary for alsactl)
#

ctl.hw {
    @args [ CARD ]
    @args.CARD {
        type string
        default "0"
    }
    type hw
    card $CARD
}


code:
#!/bin/sh

exec /sbin/alsactl -E ALSA_CONFIG_PATH=/etc/alsa/alsactl.conf init


code:
.TH ALSAUNMUTE 1 "21 April 2010"
.SH NAME
alsaunmute \- a simple script to initialize ALSA sound devices

.SH DESCRIPTION
\fBalsaunmute\fP is a shell script which runs the \fBalsactl(1)\fP
utility with \fIinit\fP argument (see the script for details).

.SH OPTIONS
None

.SS
Example:
\fBalsaunmute\fR

.SH SEE ALSO
\fB
alsactl(1),
alsamixer(1),
amixer(1)
\fP

.SH BUGS
None known.

.SH AUTHOR
\fBalsaunmute\fP is by Jaroslav Kysela <perex@perex.cz>


code:
<?xml version="1.0" ?>
<!DOCTYPE PISI SYSTEM "http://www.pisilinux.org/projeler/pisi/pisi-spec.dtd">
<PISI>
    <Source>
        <Name>alsa-utils</Name>
        <Homepage>http://www.alsa-project.org/</Homepage>
        <Packager>
            <Name>PisiLinux Community</Name>
            <Email>admins@pisilinux.org</Email>
        </Packager>
        <License>GPLv2</License>
        <IsA>app:console</IsA>
        <Summary>Advanced Linux Sound Architecture (ALSA) utilities</Summary>
        <Description>alsa-utils contains command line utilities for the Advanced Linux Sound Architecture (ALSA).</Description>
        <Archive sha1sum="9e89d1df027e1e49da5f149544b97e5227ec252c" type="tarbz2">ftp://ftp.alsa-project.org/pub/utils/alsa-utils-1.1.5.tar.bz2</Archive>
        <BuildDependencies>
            <Dependency>xmlto</Dependency>
            <Dependency>util-linux</Dependency>
            <Dependency>libxslt</Dependency>
            <Dependency>eudev-devel</Dependency>
            <Dependency>ncurses-devel</Dependency>
            <Dependency>libsamplerate-devel</Dependency>
            <Dependency>alsa-lib-devel</Dependency>
        </BuildDependencies>
    </Source>

    <Package>
        <Name>alsa-utils</Name>
        <RuntimeDependencies>
            <!--Dependency>dialog</Dependency-->
            <Dependency>ncurses</Dependency>
            <Dependency>alsa-lib</Dependency>
            <Dependency>libsamplerate</Dependency>
        </RuntimeDependencies>
        <Files>
            <Path fileType="config">/etc</Path>
            <Path fileType="executable">/sbin</Path>
            <Path fileType="doc">/usr/share/doc</Path>
            <Path fileType="man">/usr/share/man</Path>
            <Path fileType="data">/var/lib/alsa</Path>
            <Path fileType="executable">/usr/bin</Path>
            <Path fileType="data">/usr/share/alsa</Path>
            <Path fileType="data">/lib/udev/rules.d</Path>
            <Path fileType="data">/usr/share/sounds</Path>
            <Path fileType="data">/lib/systemd/system</Path>
            <Path fileType="localedata">/usr/share/locale</Path>
        </Files>
        <AdditionalFiles>
            <AdditionalFile owner="root" permission="0755" target="/usr/bin/alsaunmute">alsaunmute</AdditionalFile>
            <AdditionalFile owner="root" permission="0644" target="/etc/alsa/01beep.conf">01beep.conf</AdditionalFile>
            <AdditionalFile owner="root" permission="0644" target="/etc/alsa/alsactl.conf">alsactl.conf</AdditionalFile>
            <AdditionalFile owner="root" permission="0644" target="/usr/share/man/man1/alsaunmute.1">alsaunmute.1</AdditionalFile>
        </AdditionalFiles>
        <Provides>
            <COMAR script="service.py" name="alsactl">System.Service</COMAR>
        </Provides>
    </Package>

    <History>
        <Update release="5">
            <Date>2018-01-07</Date>
            <Version>1.1.5</Version>
            <Comment>Version Bump</Comment>
            <Name>Pisi Linux Community</Name>
            <Email>admin@pisilinux.org</Email>
        </Update>
        <Update release="4">
            <Date>2017-02-12</Date>
            <Version>1.1.3</Version>
            <Comment>Version Bump</Comment>
            <Name>Pisi Linux Community</Name>
            <Email>admin@pisilinux.org</Email>
        </Update>
        <Update release="3">
            <Date>2016-06-09</Date>
            <Version>1.1.1</Version>
            <Comment>Release Bump</Comment>
            <Name>Pisi Linux Community</Name>
            <Email>admin@pisilinux.org</Email>
        </Update>
        <Update release="2">
            <Date>2016-05-03</Date>
            <Version>1.1.1</Version>
            <Comment>Version bump</Comment>
            <Name>Alihan Öztürk</Name>
            <Email>alihan@pisilinux.org</Email>
        </Update>
        <Update release="1">
            <Date>2015-03-04</Date>
            <Version>1.0.29</Version>
            <Comment>First release</Comment>
            <Name>Hakan Yıldız</Name>
            <Email>hknyldz93@gmail.com</Email>
        </Update>
    </History>
</PISI>


code:
<?xml version="1.0" ?>
<PISI>
    <Source>
        <Name>alsa-utils</Name>
        <Summary xml:lang="tr">ALSA araçları</Summary>
        <Description xml:lang="tr">Alsa-utils Linux işletim sistemlerinde ses ve MIDI fonksiyonlarının gerçekleştirilmesini sağlayan gelişmiş Linux ses mimarisidir</Description>
    </Source>
</PISI>


code:
<PISI>
    <Name>hardware.sound</Name>
</PISI>


code:
<PISI>
    <Name>hardware.virtualization</Name>
</PISI>


code:
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2016 TUBITAK/UEKAE
# Licensed under the GNU General Public License, version 2.
# See the file http://www.gnu.org/copyleft/gpl.txt.

from pisi.actionsapi import autotools
from pisi.actionsapi import pisitools
from pisi.actionsapi import shelltools
from pisi.actionsapi import get

def build():
    shelltools.export("GOPATH", "%s" % get.workDIR())

    shelltools.cd("%s" % get.workDIR())
    shelltools.move("containerd-*", "containerd")

    shelltools.makedirs("src/github.com/docker")
    shelltools.system("ln -rsf containerd*  src/github.com/docker")

    shelltools.cd("src/github.com/docker/containerd")

    shelltools.system("LDFLAGS= make")

def install():
    shelltools.cd("%s/containerd" % get.workDIR())

    pisitools.dobin("bin/*")

    # symlink containerd/run (nice integration with docker)
    pisitools.dosym("/usr/bin/containerd", "/usr/bin/docker-containerd")
    pisitools.dosym("/usr/bin/containerd-shim", "/usr/bin/docker-containerd-shim")
    pisitools.dosym("/usr/bin/ctr", "/usr/bin/docker-containerd-ctr")

    pisitools.dodoc("MAINTAINERS", "README*")


code:
<?xml version="1.0" ?>
<!DOCTYPE PISI SYSTEM "http://www.pardus.org.tr/projeler/pisi/pisi-spec.dtd">
<PISI>
    <Source>
        <Name>containerd</Name>
        <Homepage>https://containerd.tools/</Homepage>
        <Packager>
            <Name>Ertuğrul Erata</Name>
            <Email>ertugrulerata@gmail.com</Email>
        </Packager>
        <License>Apache-2.0</License>
        <Summary>A daemon to control runC, built for performance and density.</Summary>
        <Description>is a daemon with an API and a command line client, to manage containers on one machine. It uses runC to run containers according to the OCI specification.</Description>
        <Archive sha1sum="db3ec28d045109952e0615f5a3bea39816dfac17" type="targz">https://github.com/docker/containerd/archive/v0.2.2.tar.gz</Archive>
        <BuildDependencies>
            <Dependency>golang</Dependency>
            <Dependency>git</Dependency>
        </BuildDependencies>
    </Source>

    <Package>
        <Name>containerd</Name>
        <RuntimeDependencies>
            <Dependency>runc</Dependency>
        </RuntimeDependencies>
        <Files>
            <Path fileType="executable">/usr/bin</Path>
            <Path fileType="data">/usr/share/doc</Path>
        </Files>
    </Package>

    <History>
        <Update release="2">
            <Date>2017-03-20</Date>
            <Version>0.2.2</Version>
            <Comment>Rebuild</Comment>
            <Name>Ertuğrul Erata</Name>
            <Email>ertugrulerata@gmail.com</Email>
        </Update>
        <Update release="1">
            <Date>2016-07-12</Date>
            <Version>0.2.2</Version>
            <Comment>First release</Comment>
            <Name>Ertuğrul Erata</Name>
            <Email>ertugrulerata@gmail.com</Email>
        </Update>
    </History>
</PISI>


code:
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Licensed under the GNU General Public License, version 3.
# See the file http://www.gnu.org/licenses/gpl.txt

from pisi.actionsapi import pisitools
from pisi.actionsapi import autotools
from pisi.actionsapi import shelltools
from pisi.actionsapi import get

shelltools.export("AUTO_GOPATH", "1")
shelltools.export("DOCKER_GITCOMMIT", "b9f10c9")
shelltools.export("GOROOT","/usr/lib/go")
shelltools.export("GOPATH", "%s" % get.workDIR())

shelltools.export("CGO_CFLAGS", "-I/usr/include")
shelltools.export("CGO_LDFLAGS", "-L/usr/lib")
shelltools.export("DOCKER_BUILDTAGS","seccomp")
#shelltools.export("DOCKER_INITPATH", "/usr/lib/docker/dockerinit")

NoStrip=["/"]

def build():
    #shelltools.cd("docker")
    shelltools.system("hack/make.sh dynbinary")

def install():
    pisitools.dobin("bundles/1.11.2/dynbinary/docker")
    pisitools.dobin("bundles/1.11.2/dynbinary/docker-1.11.2")

    # insert udev rules
    pisitools.insinto("/lib/udev/rules.d", "contrib/udev/*.rules")

    #insert contrib in docs
    pisitools.insinto("/usr/share/doc/docker", "contrib")

    pisitools.dodoc("VERSION", "LICENSE", "README.md", "AUTHORS", "CONTRIBUTING.md", "CHANGELOG.md", "NOTICE")


code:
#!/usr/bin/python

import os, re

OUR_NAME = "docker"
OUR_DESC = "docker"

logfile = "/var/log/docker.log"

def postInstall(fromVersion, fromRelease, toVersion, toRelease):
    try:
        os.system("/usr/sbin/groupadd %s" % OUR_NAME)
        os.system("usermod -a -G docker %s" % os.getusername())
        os.system("/bin/touch %s" % logfile)
        os.system("/bin/chown root:docker %s" % logfile)
        os.system("chmod 0644 %s" % logfile)
    except:
        pass

def preRemove():
    try:
        os.system ("groupdel %s" % OUR_NAME)
    except:
        pass


code:
from comar.service import *
import os

serviceType = "local"
serviceDefault = "off"
serviceDesc = _({"en": "Docker Management Service",
                 "tr": "Docker Yönetim Hizmeti"})

pidfile = "/var/run/docker.pid"
logfile = "/var/log/docker.log"

@synchronized
def start():
    os.environ["PATH"] = "/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/sbin:/usr/local/bin"
    os.system("/sbin/modprobe -va bridge nf_nat br_netfilter")

    startService(command="/usr/bin/docker",
                args="daemon -p %s %s" % (pidfile, config.get("DOCKER_OPTS")),
                detach=True,
                pidfile=pidfile,
                donotify=True)

@synchronized
def stop():
    stopService(command="/usr/bin/docker",
                donotify=True)

def status():
    return isServiceRunning(pidfile)


code:
#!/bin/sh
# Copyright 2011 Canonical, Inc
#           2014 Tianon Gravi
# Author: Serge Hallyn <serge.hallyn@canonical.com>
#         Tianon Gravi <admwiggin@gmail.com>
set -e

# for simplicity this script provides no flexibility

# if cgroup is mounted by fstab, don't run
# don't get too smart - bail on any uncommented entry with 'cgroup' in it
if grep -v '^#' /etc/fstab | grep -q cgroup; then
	echo 'cgroups mounted from fstab, not mounting /sys/fs/cgroup'
	exit 0
fi

# kernel provides cgroups?
if [ ! -e /proc/cgroups ]; then
	exit 0
fi

# if we don't even have the directory we need, something else must be wrong
if [ ! -d /sys/fs/cgroup ]; then
	exit 0
fi

# mount /sys/fs/cgroup if not already done
if ! mountpoint -q /sys/fs/cgroup; then
	mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup
fi

cd /sys/fs/cgroup

# get/mount list of enabled cgroup controllers
for sys in $(awk '!/^#/ { if ($4 == 1) print $1 }' /proc/cgroups); do
	mkdir -p $sys
	if ! mountpoint -q $sys; then
		if ! mount -n -t cgroup -o $sys cgroup $sys; then
			rmdir $sys || true
		fi
	fi
done

# example /proc/cgroups:
#  #subsys_name	hierarchy	num_cgroups	enabled
#  cpuset	2	3	1
#  cpu	3	3	1
#  cpuacct	4	3	1
#  memory	5	3	0
#  devices	6	3	1
#  freezer	7	3	1
#  blkio	8	3	1

exit 0


code:
#!/bin/sh
# Copyright 2011 Canonical, Inc
#           2014 Tianon Gravi
# Author: Serge Hallyn <serge.hallyn@canonical.com>
#         Tianon Gravi <admwiggin@gmail.com>
set -e

# we don't care to move tasks around gratuitously - just umount the cgroups

# if we don't even have the directory we need, something else must be wrong
if [ ! -d /sys/fs/cgroup ]; then
	exit 0
fi

# if /sys/fs/cgroup is not mounted, we don't bother
if ! mountpoint -q /sys/fs/cgroup; then
	exit 0
fi

cd /sys/fs/cgroup

for sys in *; do
	if mountpoint -q $sys; then
		umount $sys
	fi
	if [ -d $sys ]; then
		rmdir $sys || true
	fi
done

exit 0


code:
# /etc/conf.d/docker: config file for /etc/init.d/docker

# where the docker daemon output gets piped
DOCKER_LOGFILE="/var/log/docker.log"

# where docker's pid get stored
DOCKER_PIDFILE="/var/run/docker.pid"

# where the docker daemon itself is run from
DOCKER_BINARY="/usr/bin/docker"

# any other random options you want to pass to docker
DOCKER_OPTS=""


code:
<?xml version="1.0" ?>
<!DOCTYPE PISI SYSTEM "http://www.pisilinux.org/projeler/pisi/pisi-spec.dtd">
<PISI>
    <Source>
        <Name>docker</Name>
        <Homepage>http://docker.io</Homepage>
        <Packager>
            <Name>Ertuğrul Erata</Name>
            <Email>ertugrulerata@gmail.com</Email>
        </Packager>
        <License>Apache</License>
        <IsA>app:console</IsA>
        <Summary>Pack, ship and run any application as a lightweight container</Summary>
        <Description>An open platform for distributed applications for developers and sysadmins</Description>
        <!--fix sha1sum-->
        <Archive sha1sum="3725a90651a4eabb4784fc252f3090af53a91339" type="targz">https://github.com/docker/docker/archive/v1.11.2.tar.gz</Archive>
        <BuildDependencies>
            <Dependency>git</Dependency>
            <Dependency versionFrom="1.6.2">golang</Dependency>
            <Dependency>btrfs-progs-devel</Dependency>
            <Dependency>device-mapper-devel</Dependency>
            <Dependency>sqlite-devel</Dependency>
            <Dependency>libseccomp-devel</Dependency>
            <!--Dependency>runc</Dependency>
            <Dependency>containerd</Dependency-->
        </BuildDependencies>
        <Patches>
        </Patches>
    </Source>
    <Package>
        <Name>docker</Name>
        <RuntimeDependencies>
            <Dependency>git</Dependency>
            <Dependency>aufs-util</Dependency>
            <Dependency>sqlite</Dependency>
            <Dependency>device-mapper</Dependency>
            <Dependency>btrfs-progs</Dependency>
            <Dependency>bridge-utils</Dependency>
            <Dependency>iproute2</Dependency>
            <Dependency>iptables</Dependency>
            <Dependency>libseccomp</Dependency>
            <Dependency>runc</Dependency>
            <Dependency>containerd</Dependency>
        </RuntimeDependencies>
        <Files>
            <Path fileType="config">/etc</Path>
            <Path fileType="executable">/usr/bin/</Path>
            <Path fileType="library">/usr/lib/docker</Path>
            <Path fileType="data">/usr/share/</Path>
            <Path fileType="data">/lib/udev/rules.d</Path>
        </Files>
        <AdditionalFiles>
            <AdditionalFile owner="root" permission="0644" target="/usr/share/doc/docker/contrib/cgroupfs-mount">cgroupfs-mount</AdditionalFile>
            <AdditionalFile owner="root" permission="0655" target="/usr/share/doc/docker/contrib/cgroupfs-umount">cgroupfs-umount</AdditionalFile>
            <AdditionalFile owner="root" permission="0644" target="/etc/conf.d/docker">docker.confd</AdditionalFile>
        </AdditionalFiles>
        <Provides>
            <COMAR script="service.py">System.Service</COMAR>
            <COMAR script="package.py">System.Package</COMAR>
        </Provides>
    </Package>

    <History>
        <Update release="6">
            <Date>2017-03-20</Date>
            <Version>1.11.2</Version>
            <Comment>Rebuild.</Comment>
            <Name>Ertuğrul Erata</Name>
            <Email>ertugrulerata@gmail.com</Email>
        </Update>
        <Update release="5">
            <Date>2016-08-28</Date>
            <Version>1.11.2</Version>
            <Comment>Rebuild for package.py</Comment>
            <Name>Ertuğrul Erata</Name>
            <Email>ertugrulerata@gmail.com</Email>
        </Update>
        <Update release="4">
            <Date>2016-07-11</Date>
            <Version>1.11.2</Version>
            <Comment>Version bump.</Comment>
            <Name>Ertuğrul Erata</Name>
            <Email>ertugrulerata@gmail.com</Email>
        </Update>
        <Update release="3">
            <Date>2016-06-28</Date>
            <Version>1.10.3</Version>
            <Comment>Release Bump</Comment>
            <Name>Pisi Linux Community</Name>
            <Email>admin@pisilinux.org</Email>
        </Update>
        <Update release="2">
            <Date>2016-05-25</Date>
            <Version>1.10.3</Version>
            <Comment>Release bump.</Comment>
            <Name>Ertuğrul Erata</Name>
            <Email>ertugrulerata@gmail.com</Email>
        </Update>
        <Update release="1">
            <Date>2016-05-25</Date>
            <Version>1.10.3</Version>
            <Comment>First release.</Comment>
            <Name>Ertuğrul Erata</Name>
            <Email>ertugrulerata@gmail.com</Email>
        </Update>
    </History>
</PISI>


code:
<?xml version="1.0" ?>
<PISI>
    <Source>
        <Name>docker</Name>
        <Summary xml:lang="tr">Herhangi bir uygulamayı paketleyip çalıştırmak için hafif kontenyer</Summary>
        <Description xml:lang="tr">Geliştirici ve Sistem Yöneticileri için açık ve dağıtık platform</Description>
    </Source>
</PISI>


code:
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Licensed under the GNU General Public License, version 3.
# See the file http://www.gnu.org/licenses/gpl.txt

from pisi.actionsapi import get
from pisi.actionsapi import autotools
from pisi.actionsapi import pisitools
from pisi.actionsapi import shelltools

def setup():
    for f in ["src/Makefile.am", "src/Makefile.in", "daemon/Makefile.am", "daemon/Makefile.in"]:
        pisitools.dosed(f, "\$\(localstatedir\)(\/run\/libvirt)", "\\1")
    for f in ["daemon/libvirtd.c", "daemon/libvirtd.conf", "daemon/test_libvirtd.aug.in"]:
        pisitools.dosed(f, "\/var(\/run\/libvirt)", "\\1")
    for f in ["src/locking/virtlockd.pod", "src/virtlockd.8.in", "daemon/libvirtd.8.in", "daemon/libvirtd.pod", ]:
        pisitools.dosed(f, "LOCALSTATEDIR(\/run\/libvirt)", "\\1")
    autotools.configure("--with-init-script=none \
                         --with-remote-pid-file=/run/libvirtd.pid \
                         --with-qemu-user=qemu \
                         --with-qemu-group=qemu \
                         --with-lxc \
                         --with-udev \
                         --with-qemu \
                         --with-sasl \
                         --with-audit \
                         --with-numactl \
                         --with-yajl \
                         --with-avahi \
                         --with-netcf \
                         --with-libssh2=/usr/lib \
                         --with-capng \
                         --with-polkit \
                         --with-python \
                         --with-network \
                         --with-libvirtd \
                         --with-storage-fs \
                         --with-storage-scsi \
                         --with-storage-mpath \
                         --with-storage-disk \
                         --with-storage-lvm \
                         --without-vbox \
                         --without-vmware \
                         --without-esx \
                         --without-storage-iscsi \
                         --without-hal \
                         --without-xen \
                         --without-phyp \
                         --without-uml \
                         --without-openvz \
                         --without-selinux \
                         --without-apparmor \
                         --disable-static")

def build():
    autotools.make()

#def check():
 #   for v in ["XDG_HOME", "XDG_CACHE_HOME", "XDG_CONFIG_HOME"]:
  #      shelltools.export(v, get.workDIR())
   # autotools.make("check")

def install():
    autotools.rawInstall("DESTDIR=%s" % get.installDIR())
    pisitools.removeDir("/usr/share/gtk-doc")

    pisitools.dodoc("AUTHORS", "NEWS", "README*", "ChangeLog")


code:
#/usr/bin/python

import os

permissions = {
                "/etc/libvirt"                          :   ["0700", "root:root"],
                "/etc/libvirt/qemu"                     :   ["0700", "root:root"],
                "/etc/libvirt/nwfilter"                 :   ["0700", "root:root"],
                "/etc/libvirt/qemu/networks"            :   ["0700", "root:root"],
                "/etc/libvirt/qemu/networks/autostart"  :   ["0700", "root:root"],
                "/var/log/libvirt"                      :   ["0700", "root:root"],
                "/var/log/libvirt/qemu"                 :   ["0700", "root:root"],
                "/var/log/libvirt/lxc"                  :   ["0700", "root:root"],
                "/var/log/libvirt/uml"                  :   ["0700", "root:root"],
                "/var/lib/libvirt"                      :   ["0755", "root:root"],
                "/var/lib/libvirt/images"               :   ["0711", "root:root"],
                "/var/lib/libvirt/boot"                 :   ["0711", "root:root"],
                "/var/lib/libvirt/qemu"                 :   ["0750", "qemu:qemu"],
                "/var/lib/libvirt/lxc"                  :   ["0700", "root:root"],
                "/var/lib/libvirt/uml"                  :   ["0700", "root:root"],
                "/var/lib/libvirt/network"              :   ["0700", "root:root"],
                "/var/lib/libvirt/dnsmasq"              :   ["0755", "root:root"],
                "/var/cache/libvirt/qemu"               :   ["0750", "qemu:qemu"],
                "/var/cache/libvirt"                    :   ["0700", "root:root"],
                "/run/libvirt"                      :   ["0755", "root:root"],
                "/run/libvirt/qemu"                 :   ["0700", "qemu:qemu"],
                "/run/libvirt/uml"                  :   ["0700", "root:root"],
                "/usr/libexec/libvirt_proxy"            :   ["4755", "root:root"],
            }

def postInstall(fromVersion, fromRelease, toVersion, toRelease):
    for _file, perms in permissions.items():
        # The list above is general, some paths may not exist depending on the configuration
        if os.path.exists(_file):
            os.system("/bin/chown -R %s %s" % (perms[1], _file))
            os.system("/bin/chmod %s %s" % (perms[0], _file))
    os.system("groupadd libvirt")
    os.system("usermod -G libvirt %s" % os.getusername())


code:
# -*- coding: utf-8 -*-
from comar.service import *
import os

serviceType = "local"
serviceDesc = _({"en": "libvirt virtualization API daemon",
                 "tr": "libvirt sanallaştırma hizmeti"})
serviceDefault = "on"

PIDFILE         = "/run/libvirt/libvirtd.pid"
KRB5_KTNAME     = "/etc/libvirt/krb5.tab"
LIBVIRTD_CONFIG = "/etc/libvirt/libvirtd.conf"

@synchronized
def start():
    os.environ["KRB5_KTNAME"] = config.get("KRB5_KTNAME", KRB5_KTNAME)
    os.environ["PATH"] = "/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/sbin:/usr/local/bin"

    if os.path.exists(PIDFILE):
        os.unlink(PIDFILE)

    startService(command="/usr/sbin/libvirtd",
                 args="--daemon --config %s %s --pid-file %s" % (
                     config.get("LIBVIRTD_ARGS", ""),
                     config.get("LIBVIRTD_CONFIG", LIBVIRTD_CONFIG),
                     PIDFILE,
                     ),
                 donotify=True)

@synchronized
def stop():
    stopService(pidfile="/run/libvirt/libvirtd.pid",
                donotify=True)
    if os.path.exists(PIDFILE):
        os.unlink(PIDFILE)

@synchronized
def reload():
    if os.path.exists(PIDFILE):
        os.kill(int(open(PIDFILE, "r").read().strip()), 1)

def status():
    return isServiceRunning(pidfile=PIDFILE)


code:
# Override the default config file
#LIBVIRTD_CONFIG=/etc/libvirt/libvirtd.conf

# Listen for TCP/IP connections
# NB. must setup TLS/SSL keys prior to using this
#LIBVIRTD_ARGS="--listen"

# Override Kerberos service keytab for SASL/GSSAPI
#KRB5_KTNAME=/etc/libvirt/krb5.tab

# Override the QEMU/SDL default audio driver probing when
# starting virtual machines using SDL graphics
#
# NB these have no effect for VMs using VNC
#QEMU_AUDIO_DRV=sdl
#
#SDL_AUDIODRIVER=pulse


code:
--- src/qemu/qemu_capabilities.c~	2014-01-10 20:27:38.383264024 +0100
+++ src/qemu/qemu_capabilities.c	2014-01-10 20:28:02.696597278 +0100
@@ -638,14 +638,14 @@ virQEMUCapsFindBinaryForArch(virArch hos
     if (guestarch == VIR_ARCH_I686 &&
         !ret &&
         hostarch == VIR_ARCH_X86_64) {
-        ret = virFindFileInPath("qemu-system-x86_64");
+        ret = virFindFileInPath("qemu-kvm");
         if (ret && !virFileIsExecutable(ret))
             VIR_FREE(ret);
     }

     if (guestarch == VIR_ARCH_I686 &&
         !ret) {
-        ret = virFindFileInPath("qemu");
+        ret = virFindFileInPath("qemu-kvm");
         if (ret && !virFileIsExecutable(ret))
             VIR_FREE(ret);
     }


code:
d /run/libvirt/qemu 0700 qemu qemu  - -
d /run/libvirt/lxc 0755 root root - -
d /run/libvirt/uml 0755 root root - -
d /run/libvirt/network 0755 root root - -


code:
<?xml version="1.0" ?>
<!DOCTYPE PISI SYSTEM "http://www.pisilinux.org/projeler/pisi/pisi-spec.dtd">
<PISI>
    <Source>
        <Name>libvirt</Name>
        <Homepage>http://www.libvirt.org/</Homepage>
        <Packager>
            <Name>PisiLinux Community</Name>
            <Email>admins@pisilinux.org</Email>
        </Packager>
        <License>LGPLv2.1</License>
        <IsA>app:console</IsA>
        Library providing a simple API to several virtualization systems
        <Description>libvirt is a toolkit to interact with the virtualization capabilities of recent versions of Linux (and other OSes). libvirt supports Xen hypervisor, QEMU emulator, KVM hypervisor, LXC Linux container system, OpenVZ Linux container system, User Mode Linux paravirtualized kernel and VirtualBox hypervisor together with remote management possibilities.</Description>
        <Archive sha1sum="8a38fd5a0538a8ac05c8e4722bc4015c51237be0" type="tarxz">http://libvirt.org/sources/libvirt-3.0.0.tar.xz</Archive>
        <BuildDependencies>
            <Dependency>qemu</Dependency>
            <Dependency>lvm2-devel</Dependency>
            <Dependency>attr-devel</Dependency>
            <Dependency>audit-devel</Dependency>
            <Dependency>avahi-devel</Dependency>
            <Dependency>netcf-devel</Dependency>
            <Dependency>numactl-devel</Dependency>
            <Dependency>libpciaccess-devel</Dependency>
            <Dependency>yajl-devel</Dependency>
            <Dependency>polkit-devel</Dependency>
            <Dependency>dbus-devel</Dependency>
            <Dependency>util-linux</Dependency>
            <Dependency>gnutls-devel</Dependency>
            <Dependency>parted-devel</Dependency>
            <Dependency>device-mapper-devel</Dependency>
            <Dependency>libnl-devel</Dependency>
            <Dependency>python-devel</Dependency>
            <Dependency>cyrus-sasl-devel</Dependency>
            <Dependency>libcap-ng-devel</Dependency>
            <Dependency>readline-devel</Dependency>
        </BuildDependencies>
        <Patches>

        </Patches>
    </Source>

    <Package>
        <Name>libvirt</Name>
        <RuntimeDependencies>
            <Dependency>dbus</Dependency>
            <Dependency>yajl</Dependency>
            <Dependency>audit</Dependency>
            <Dependency>eudev</Dependency>
            <Dependency>libnl</Dependency>
            <Dependency>netcf</Dependency>
            <Dependency>gnutls</Dependency>
            <Dependency>parted</Dependency>
            <Dependency>libcap</Dependency>
            <Dependency>libxml2</Dependency>
            <Dependency>numactl</Dependency>
            <Dependency>readline</Dependency>
            <Dependency>libcap-ng</Dependency>
            <Dependency>avahi-libs</Dependency>
            <Dependency>cyrus-sasl</Dependency>
            <Dependency>libpciaccess</Dependency>
            <Dependency>device-mapper</Dependency>
            <Dependency>libutil-linux</Dependency>
        </RuntimeDependencies>
        <Files>
            <Path fileType="config">/etc</Path>
            <Path fileType="config">/usr/lib/tmpfiles.d/libvirt.conf</Path>
            <Path fileType="executable">/usr/bin</Path>
            <Path fileType="executable">/usr/libexec</Path>
            <Path fileType="executable">/usr/sbin</Path>
            <Path fileType="library">/usr/lib</Path>
            <Path fileType="doc">/usr/share/doc</Path>
            <Path fileType="data">/usr/share/augeas</Path>
            <Path fileType="data">/usr/share/polkit-1</Path>
            <Path fileType="data">/usr/share/libvirt</Path>
            <Path fileType="data">/usr/share/systemtap</Path>
            <Path fileType="man">/usr/share/man</Path>
            <Path fileType="data">/var</Path>
            <Path fileType="data">/run</Path>
            <Path fileType="localedata">/usr/share/locale</Path>
        </Files>
        <AdditionalFiles>
            <AdditionalFile owner="root" permission="0644" target="/usr/lib/tmpfiles.d/libvirt.conf">tmpfiles.conf</AdditionalFile>
            <AdditionalFile owner="root" permission="0644" target="/etc/conf.d/libvirt">libvirt.confd</AdditionalFile>
        </AdditionalFiles>
        <Provides>
            <COMAR script="service.py">System.Service</COMAR>
            <COMAR script="package.py">System.Package</COMAR>
        </Provides>
    </Package>

    <Package>
        <Name>libvirt-devel</Name>
        Development files for libvirt
        <RuntimeDependencies>
            <Dependency release="current">libvirt</Dependency>
        </RuntimeDependencies>
        <Files>
            <Path fileType="header">/usr/include/libvirt</Path>
            <Path fileType="data">/usr/lib/pkgconfig</Path>
        </Files>
    </Package>

    <History>
        <Update release="3">
            <Date>2017-01-29</Date>
            <Version>3.0.0</Version>
            <Comment>Version bump.</Comment>
            <Name>Stefan Gronewold</Name>
            <Email>groni@pisilinux.org</Email>
        </Update>
        <Update release="2">
            <Date>2016-06-09</Date>
            <Version>1.3.0</Version>
            <Comment>Release Bump</Comment>
            <Name>Pisi Linux Community</Name>
            <Email>admin@pisilinux.org</Email>
        </Update>
        <Update release="1">
            <Date>2015-12-31</Date>
            <Version>1.3.0</Version>
            <Comment>First release</Comment>
            <Name>Ayhan Yalçınsoy</Name>
            <Email>ayhanyalcinsoy@pisilinux.org</Email>
        </Update>
    </History>
</PISI>


code:
<?xml version="1.0" ?>
<PISI>
    <Source>
        <Name>libvirt</Name>
        Birçok sanallaştırma sistemine kolay erişim sağlayan bir kütüphane
        <Description xml:lang="tr">libvirt yeni linux sürümlerinin sunduğu sanallaştırma özellikleriyle etkileşimi kolaylaştıran bir kütüphanedir. Xen, KVM ve VirtualBox hipervizorleri, QEMU emulatörü, LXC linux konteyner sistemi, User Mode Linux paravirtual sanallaştırma sistemi gibi sistemlerle birlikte çalışabilir ve tüm bu sistemlerin uzaktan yönetimi için de kullanılabilir.</Description>
    </Source>

    <Package>
        <Name>libvirt-devel</Name>
        libvirt için geliştirme dosyaları
    </Package>
</PISI>


code:
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Licensed under the GNU General Public License, version 3.
# See the file http://www.gnu.org/licenses/gpl.txt

from pisi.actionsapi import autotools
from pisi.actionsapi import pisitools
from pisi.actionsapi import shelltools
from pisi.actionsapi import get

NoStrip = ["/usr/share/qemu"]

shelltools.export("LC_ALL", "C")

# disable debug to prevent memory exhaustion by linker
# cflags = get.CFLAGS().replace("-fpie", "").replace("-fstack-protector", "").replace("-ggdb3 -funwind-tables -fasynchronous-unwind-tables", "")
cflags = get.CFLAGS().replace("-fpie", "").replace("-fstack-protector", "")

#extraldflags="-Wl,--build-id"
#buildldflags="VL_LDFLAGS=-Wl,--build-id"
extraldflags=""
buildldflags=""

soundDrivers = "pa,sdl,alsa"
builddirkvmtest = "kvm/test"

#targetKvmList = "i386-softmmu x86_64-softmmu i386-linux-user x86_64-linux-user"
targetListKvm = "x86_64-softmmu"
targetList = "i386-softmmu x86_64-softmmu arm-softmmu cris-softmmu m68k-softmmu \
              mips-softmmu mipsel-softmmu mips64-softmmu mips64el-softmmu ppc-softmmu \
              ppcemb-softmmu ppc64-softmmu sh4-softmmu sh4eb-softmmu sparc-softmmu \
              i386-linux-user x86_64-linux-user alpha-linux-user arm-linux-user \
              armeb-linux-user cris-linux-user m68k-linux-user mips-linux-user \
              mipsel-linux-user ppc-linux-user ppc64-linux-user ppc64abi32-linux-user \
              sh4-linux-user sh4eb-linux-user sparc-linux-user sparc64-linux-user \
              sparc32plus-linux-user"

cfgParamsCommon = '--prefix=/usr \
                   --sysconfdir=/etc \
                   --mandir=/usr/share/man \
                   --cc="%s" \
                   --host-cc="%s" \
                   --extra-cflags="%s" \
                   --extra-ldflags="%s" \
                   --audio-drv-list="%s" \
                   --libexecdir=/usr/lib/qemu \
                   --disable-xen \
                   --disable-werror \
                   --localstatedir=/ \
                   --disable-strip' % (get.CC(), get.CC(), cflags, extraldflags, soundDrivers)

def printfancy(msg):
    print
    print "===== %s =====" % msg
    print

def setup():
    # disable fdt until dtc is in repo
    # pisitools.dosed("configure", 'fdt="yes"', 'fdt="no"')

    shelltools.export("CFLAGS", cflags)
    shelltools.export("LDFLAGS", extraldflags)

    # different build dir setups are not supported yet, so we build kvm by hand for now
    printfancy("configuring kvm")
    autotools.rawConfigure('%s \
                            --target-list="%s" \
                            ' % (cfgParamsCommon, targetListKvm))

    printfancy("building kvm")
    autotools.make("V=1 -j1 config-host.h %s" % buildldflags)
    autotools.make("V=1 %s" % buildldflags)
    shelltools.copy("x86_64-softmmu/qemu-system-x86_64", "qemu-kvm")
    autotools.make("clean")

    # kvmtest stuff is not in upstream tarball anymore, but they may put it back, be ready
    #printfancy("configuring kvmtest")
    #shelltools.cd(builddirkvmtest)
    #autotools.rawConfigure("--prefix=/usr \
    #                        --kerneldir=../../kernel")
    #shelltools.cd("../..")

    printfancy("configuring qemu")
    autotools.rawConfigure('%s \
                            --target-list="%s" \
                            --disable-kvm \
                            ' % (cfgParamsCommon, targetList))
                            #--interp-prefix=%{_prefix}/qemu-%%M \

                            #--enable-system \
                            #--enable-linux-user \

def build():
    shelltools.export("CFLAGS", cflags)
    shelltools.export("LDFLAGS", extraldflags)

    printfancy("building qemu")
    autotools.make("V=1 -j1 config-host.h %s" % buildldflags)
    autotools.make("V=1 %s" % buildldflags)

    #printfancy("building kvmtest")
    #autotools.make("-C %s V=1 kvmtrace" % builddirkvmtest)

def install():
    autotools.rawInstall('DESTDIR="%s"' % get.installDIR())

    # Install kvm-tools
    #pisitools.dobin("kvm/test/kvmtrace")
    #pisitools.dobin("kvm/test/kvmtrace_format")
    #pisitools.dobin("kvm/kvm_stat")
    pisitools.dobin("qemu-kvm")
    shelltools.system("chmod u+s %s/usr/lib/qemu/qemu-bridge-helper" % get.installDIR())
    pisitools.insinto("/etc/sasl2/", "qemu.sasl", "qemu.conf")

    for i in ["pc-bios/README", "LICENSE", "README", "COPYING*"]:
        pisitools.dodoc(i)


code:
from comar.service import *
import os

serviceType = "local"
serviceDefault = "conditional"
serviceDesc = _({"en": "Kernel Samepage Merging",
                 "tr": "Kernel Aynısayfa Birleştirici"})
serviceConf = "ksm"

SYSFS_KSM_RUN = "/sys/kernel/mm/ksm/run"
SYSFS_KSM_MAX_KERNEL_PAGES = "/sys/kernel/mm/ksm/max_kernel_pages"

# unless KSM_MAX_KERNEL_PAGES is set, let ksm munch up to half of total memory.
def default_max_kernel_pages():
    max_kernel_pages = config.get("KSM_MAX_KERNEL_PAGES", "")
    if max_kernel_pages != "":
        return max_kernel_pages

    total = 0
    with open("/proc/meminfo", "r") as _meminfo:
        for line in _meminfo.readlines():
            if "MemTotal" in line:
                total = int(line.split()[-2])
                break

    pagesize = int(os.sysconf("SC_PAGESIZE"))
    return (total * 1024 / pagesize / 2)

@synchronized
def start():
    max_kernel_pages = str(default_max_kernel_pages())
    if os.path.exists(SYSFS_KSM_MAX_KERNEL_PAGES):
        open(SYSFS_KSM_MAX_KERNEL_PAGES, "w").write(max_kernel_pages)

    open(SYSFS_KSM_RUN, "w").write("1")

@synchronized
def stop():
    if os.path.exists(SYSFS_KSM_RUN):
        open(SYSFS_KSM_RUN, "w").write("0")

def ready():
    status = is_on()
    if status == "on" or (status == "conditional" and os.path.exists(SYSFS_KSM_RUN)):
        start()

def status():
    ret = False
    try:
        ret = (open(SYSFS_KSM_RUN, "r").read().strip() == "1")
    except IOError:
        pass

    return ret


code:
from comar.service import *
import os

serviceType = "local"
serviceDefault = "off"
serviceDesc = _({"en": "Kernel Samepage Merging Tuned Daemon",
                 "tr": "Kernel Aynısayfa Birleştirici İnce Ayarlı Sunucu"})

serviceConf = "ksm"

ksmtuned = "/usr/sbin/ksmtuned"
ksmtunedpid = "/run/ksmtune.pid"

@synchronized
def start():
    startService(command=ksmtuned,
                 pidfile=ksmtunedpid,
                 donotify=True)

@synchronized
def stop():
    stopService(pidfile=ksmtunedpid,
                donotify=True)

def status():
    return isServiceRunning(ksmtunedpid)


code:
KERNEL=="kvm", GROUP="kvm", MODE="0660"
KERNEL=="vhost-net", GROUP="kvm", MODE="0660", TAG+="uaccess", OPTIONS+="static_node=vhost-net"


code:
# The maximum number of unswappable kernel pages
# which may be allocated by ksm (0 for unlimited)
# If unset, defaults to half of total memory
# KSM_MAX_KERNEL_PAGES=


code:
#!/bin/bash
#
# Copyright 2009 Red Hat, Inc. and/or its affiliates.
# Released under the GPL
#
# Author:      Dan Kenigsberg <danken@redhat.com>
#
# ksmtuned - a simple script that controls whether (and with what vigor) ksm
# should search for duplicated pages.
#
# starts ksm when memory commited to qemu processes exceeds a threshold, and
# make ksm work harder and harder untill memory load falls below that
# threshold.
#
# send SIGUSR1 to this process right after a new qemu process is started, or
# following its death, to retune ksm accordingly
#
# needs testing and ironing. contact danken@redhat.com if something breaks.

if [ -f /etc/ksmtuned.conf ]; then
    . /etc/ksmtuned.conf
fi

debug() {
    if [ -n "$DEBUG" ]; then
        s="`/bin/date`: $*"
        [ -n "$LOGFILE" ] && echo "$s" >> "$LOGFILE" || echo "$s"
    fi
}

KSM_MONITOR_INTERVAL=${KSM_MONITOR_INTERVAL:-60}
KSM_NPAGES_BOOST=${KSM_NPAGES_BOOST:-300}
KSM_NPAGES_DECAY=${KSM_NPAGES_DECAY:--50}

KSM_NPAGES_MIN=${KSM_NPAGES_MIN:-64}
KSM_NPAGES_MAX=${KSM_NPAGES_MAX:-1250}
# millisecond sleep between ksm scans for 16Gb server. Smaller servers sleep
# more, bigger sleep less.
KSM_SLEEP_MSEC=${KSM_SLEEP_MSEC:-10}

KSM_THRES_COEF=${KSM_THRES_COEF:-20}
KSM_THRES_CONST=${KSM_THRES_CONST:-2048}

total=`awk '/^MemTotal:/ {print $2}' /proc/meminfo`
debug total $total

npages=0
sleep=$[KSM_SLEEP_MSEC * 16 * 1024 * 1024 / total]
[ $sleep -le 10 ] && sleep=10
debug sleep $sleep
thres=$[total * KSM_THRES_COEF / 100]
if [ $KSM_THRES_CONST -gt $thres ]; then
    thres=$KSM_THRES_CONST
fi
debug thres $thres

KSMCTL () {
    case x$1 in
        xstop)
            echo 0 > /sys/kernel/mm/ksm/run
            ;;
        xstart)
            echo $2 > /sys/kernel/mm/ksm/pages_to_scan
            echo $3 > /sys/kernel/mm/ksm/sleep_millisecs
            echo 1 > /sys/kernel/mm/ksm/run
            ;;
    esac
}

committed_memory () {
    # calculate how much memory is committed to running qemu processes
    local progname
    progname=${1:-qemu-kvm}
    ps -C "$progname" -o rsz | awk '{ sum += $1 }; END { print sum }'
}

free_memory () {
    awk '/^(MemFree|Buffers|Cached):/ {free += $2}; END {print free}' \
                /proc/meminfo
}

increase_npages() {
    local delta
    delta=${1:-0}
    npages=$[npages + delta]
    if [ $npages -lt $KSM_NPAGES_MIN ]; then
        npages=$KSM_NPAGES_MIN
    elif [ $npages -gt $KSM_NPAGES_MAX ]; then
        npages=$KSM_NPAGES_MAX
    fi
    echo $npages
}

adjust () {
    local free committed
    free=`free_memory`
    committed=`committed_memory`
    debug committed $committed free $free
    if [ $[committed + thres] -lt $total -a $free -gt $thres ]; then
        KSMCTL stop
        debug "$[committed + thres] < $total and free > $thres, stop ksm"
        return 1
    fi
    debug "$[committed + thres] > $total, start ksm"
    if [ $free -lt $thres ]; then
        npages=`increase_npages $KSM_NPAGES_BOOST`
        debug "$free < $thres, boost"
    else
        npages=`increase_npages $KSM_NPAGES_DECAY`
        debug "$free > $thres, decay"
    fi
    KSMCTL start $npages $sleep
    debug "KSMCTL start $npages $sleep"
    return 0
}

function nothing () {
    :
}

loop () {
    trap nothing SIGUSR1
    while true
    do
        sleep $KSM_MONITOR_INTERVAL &
        wait $!
        adjust
    done
}

PIDFILE=${PIDFILE-/run/ksmtune.pid}
if touch "$PIDFILE"; then
  loop &
  echo $! > "$PIDFILE"
fi


code:
# Configuration file for ksmtuned.

# How long ksmtuned should sleep between tuning adjustments
# KSM_MONITOR_INTERVAL=60

# Millisecond sleep between ksm scans for 16Gb server.
# Smaller servers sleep more, bigger sleep less.
# KSM_SLEEP_MSEC=10

# KSM_NPAGES_BOOST=300
# KSM_NPAGES_DECAY=-50
# KSM_NPAGES_MIN=64
# KSM_NPAGES_MAX=1250

# KSM_THRES_COEF=20
# KSM_THRES_CONST=2048

# uncomment the following if you want ksmtuned debug info

# LOGFILE=/var/log/ksmtuned
# DEBUG=1


code:
#!/bin/bash
#
# ksmtuned     Kernel Samepage Merging (KSM) Tuning Daemon
#
# Author:      Dan Kenigsberg <danken@redhat.com>
#
# Copyright 2009 Red Hat, Inc. and/or its affiliates.
# Released under the GPL
#
# chkconfig: 345 85 15
# description: The KSM tuning daemon controls whether (and with what vigor) \
#              ksm should ksm search duplicated pages.
# processname: ksmtuned
# config: /etc/ksmtuned.conf
# pidfile: /run/ksmtuned.pid
#
### BEGIN INIT INFO
# Provides: ksmtuned
# Required-Start:
# Required-Stop:
# Should-Start:
# Default-Start: 3 4 5
# Short-Description: tune the speed of ksm
# Description: The Kernel Samepage Merging control Daemon is a simple script
#   that controls whether (and with what vigor) should ksm search duplicated
#   memory pages.
#   needs testing and ironing. contact danken@redhat.com if something breaks.
### END INIT INFO

. /etc/rc.d/init.d/functions

prog=ksmtuned
ksmtuned=/usr/sbin/ksmtuned
pidfile=${PIDFILE-/run/ksmtune.pid}
RETVAL=0

start() {
    echo -n $"Starting $prog: "
    daemon --pidfile=${pidfile} $ksmtuned
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
}

stop() {
    echo -n $"Stopping $prog: "
    killproc -p ${pidfile}
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog
}

restart() {
    stop
    start
}

condrestart() {
    [ -e /var/lock/subsys/$prog ] && restart || :
}

case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  status)
        status -p ${pidfile} $prog
	RETVAL=$?
	;;
  restart)
	restart
	;;
  condrestart)
	condrestart
	;;
  retune)
        kill -SIGUSR1 `cat ${pidfile}`
        RETVAL=$?
        ;;
  *)
	echo $"Usage: $prog {start|stop|restart|condrestart|status|retune|help}"
	RETVAL=3
esac

exit $RETVAL