Add debian directory
authorMichael Spang <mspang@csclub.uwaterloo.ca>
Tue, 22 Dec 2009 00:35:23 +0000 (19:35 -0500)
committerMichael Spang <mspang@csclub.uwaterloo.ca>
Wed, 23 Dec 2009 04:45:29 +0000 (23:45 -0500)
Signed-off-by: Michael Spang <mspang@csclub.uwaterloo.ca>
16 files changed:
.gbp.conf [new file with mode: 0644]
.gitignore
Makefile
acqprogress.cc [deleted file]
acqprogress.h [deleted file]
contrib/acqprogress.cc [new file with mode: 0644]
contrib/acqprogress.h [new file with mode: 0644]
debian/.gitignore [new file with mode: 0644]
debian/changelog [new file with mode: 0644]
debian/compat [new file with mode: 0644]
debian/control [new file with mode: 0644]
debian/copyright [new file with mode: 0644]
debian/dirs [new file with mode: 0644]
debian/install [new file with mode: 0644]
debian/rules [new file with mode: 0755]
inapt.cc

diff --git a/.gbp.conf b/.gbp.conf
new file mode 100644 (file)
index 0000000..c9ce776
--- /dev/null
+++ b/.gbp.conf
@@ -0,0 +1,3 @@
+[DEFAULT]
+sign-tags = True
+debian-tag=v%(version)s
index e436381..ba00904 100644 (file)
@@ -2,7 +2,7 @@
 *.aux
 *.log
 *.pdf
-inapt
+/inapt
 /parser.cc
 /parser.dot
 /parser.png
index eaf7630..df4e442 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,12 +1,12 @@
 CPPFLAGS := -g3 -O0 -Wall -Werror
 LDFLAGS  := -Wl,--as-needed
 INCLUDES := $(shell krb5-config --cflags)
-override CFLAGS  += -std=gnu99 $(INCLUDES)
+override CFLAGS += -std=gnu99 $(INCLUDES)
 
 all: inapt
 
-inapt: inapt.o parser.o acqprogress.o util.o
-       g++ -o inapt -g3 -Wall -Werror -lapt-pkg -lapt-inst $^
+inapt: inapt.o parser.o contrib/acqprogress.o util.o
+       g++ -o inapt -g3 -Wall -Werror -lapt-pkg $^
 
 inapt.o: inapt.h
 
@@ -21,4 +21,3 @@ parser.png: parser.dot
 
 clean:
        rm -f *.o inapt parser.png parser.dot parser.cc
-
diff --git a/acqprogress.cc b/acqprogress.cc
deleted file mode 100644 (file)
index be5e91a..0000000
+++ /dev/null
@@ -1,290 +0,0 @@
-// -*- mode: cpp; mode: fold -*-
-// Description                                                         /*{{{*/
-// $Id: acqprogress.cc,v 1.24 2003/04/27 01:56:48 doogie Exp $
-/* ######################################################################
-
-   Acquire Progress - Command line progress meter 
-   
-   ##################################################################### */
-                                                                       /*}}}*/
-// Include files                                                       /*{{{*/
-#include "acqprogress.h"
-#include <apt-pkg/acquire-item.h>
-#include <apt-pkg/acquire-worker.h>
-#include <apt-pkg/strutl.h>
-#include <apt-pkg/error.h>
-
-    
-#include <stdio.h>
-#include <signal.h>
-#include <iostream>
-
-#define _
-                                                                       /*}}}*/
-
-using namespace std;
-
-// AcqTextStatus::AcqTextStatus - Constructor                          /*{{{*/
-// ---------------------------------------------------------------------
-/* */
-AcqTextStatus::AcqTextStatus(unsigned int &ScreenWidth,unsigned int Quiet) :
-    ScreenWidth(ScreenWidth), Quiet(Quiet)
-{
-}
-                                                                       /*}}}*/
-// AcqTextStatus::Start - Downloading has started                      /*{{{*/
-// ---------------------------------------------------------------------
-/* */
-void AcqTextStatus::Start() 
-{
-   pkgAcquireStatus::Start(); 
-   BlankLine[0] = 0;
-   ID = 1;
-};
-                                                                       /*}}}*/
-// AcqTextStatus::IMSHit - Called when an item got a HIT response      /*{{{*/
-// ---------------------------------------------------------------------
-/* */
-void AcqTextStatus::IMSHit(pkgAcquire::ItemDesc &Itm)
-{
-   if (Quiet > 1)
-      return;
-
-   if (Quiet <= 0)
-      cout << '\r' << BlankLine << '\r';   
-   
-   cout << _("Hit ") << Itm.Description;
-   if (Itm.Owner->FileSize != 0)
-      cout << " [" << SizeToStr(Itm.Owner->FileSize) << "B]";
-   cout << endl;
-   Update = true;
-};
-                                                                       /*}}}*/
-// AcqTextStatus::Fetch - An item has started to download              /*{{{*/
-// ---------------------------------------------------------------------
-/* This prints out the short description and the expected size */
-void AcqTextStatus::Fetch(pkgAcquire::ItemDesc &Itm)
-{
-   Update = true;
-   if (Itm.Owner->Complete == true)
-      return;
-   
-   Itm.Owner->ID = ID++;
-   
-   if (Quiet > 1)
-      return;
-
-   if (Quiet <= 0)
-      cout << '\r' << BlankLine << '\r';
-   
-   cout << _("Get:") << Itm.Owner->ID << ' ' << Itm.Description;
-   if (Itm.Owner->FileSize != 0)
-      cout << " [" << SizeToStr(Itm.Owner->FileSize) << "B]";
-   cout << endl;
-};
-                                                                       /*}}}*/
-// AcqTextStatus::Done - Completed a download                          /*{{{*/
-// ---------------------------------------------------------------------
-/* We don't display anything... */
-void AcqTextStatus::Done(pkgAcquire::ItemDesc &Itm)
-{
-   Update = true;
-};
-                                                                       /*}}}*/
-// AcqTextStatus::Fail - Called when an item fails to download         /*{{{*/
-// ---------------------------------------------------------------------
-/* We print out the error text  */
-void AcqTextStatus::Fail(pkgAcquire::ItemDesc &Itm)
-{
-   if (Quiet > 1)
-      return;
-
-   // Ignore certain kinds of transient failures (bad code)
-   if (Itm.Owner->Status == pkgAcquire::Item::StatIdle)
-      return;
-      
-   if (Quiet <= 0)
-      cout << '\r' << BlankLine << '\r';
-   
-   if (Itm.Owner->Status == pkgAcquire::Item::StatDone)
-   {
-      cout << _("Ign ") << Itm.Description << endl;
-   }
-   else
-   {
-      cout << _("Err ") << Itm.Description << endl;
-      cout << "  " << Itm.Owner->ErrorText << endl;
-   }
-   
-   Update = true;
-};
-                                                                       /*}}}*/
-// AcqTextStatus::Stop - Finished downloading                          /*{{{*/
-// ---------------------------------------------------------------------
-/* This prints out the bytes downloaded and the overall average line
-   speed */
-void AcqTextStatus::Stop()
-{
-   pkgAcquireStatus::Stop();
-   if (Quiet > 1)
-      return;
-
-   if (Quiet <= 0)
-      cout << '\r' << BlankLine << '\r' << flush;
-
-   if (FetchedBytes != 0 && _error->PendingError() == false)
-      ioprintf(cout,_("Fetched %sB in %s (%sB/s)\n"),
-              SizeToStr(FetchedBytes).c_str(),
-              TimeToStr(ElapsedTime).c_str(),
-              SizeToStr(CurrentCPS).c_str());
-}
-                                                                       /*}}}*/
-// AcqTextStatus::Pulse - Regular event pulse                          /*{{{*/
-// ---------------------------------------------------------------------
-/* This draws the current progress. Each line has an overall percent
-   meter and a per active item status meter along with an overall 
-   bandwidth and ETA indicator. */
-bool AcqTextStatus::Pulse(pkgAcquire *Owner)
-{
-   pkgAcquireStatus::Pulse(Owner);
-   
-   if (Quiet > 0)
-      return true;
-   
-   enum {Long = 0,Medium,Short} Mode = Long;
-   
-   char Buffer[sizeof(BlankLine)];
-   char *End = Buffer + sizeof(Buffer);
-   char *S = Buffer;
-   if (ScreenWidth >= sizeof(Buffer))
-      ScreenWidth = sizeof(Buffer)-1;
-
-   // Put in the percent done
-   sprintf(S,"%ld%%",long(double((CurrentBytes + CurrentItems)*100.0)/double(TotalBytes+TotalItems)));
-
-   bool Shown = false;
-   for (pkgAcquire::Worker *I = Owner->WorkersBegin(); I != 0;
-       I = Owner->WorkerStep(I))
-   {
-      S += strlen(S);
-      
-      // There is no item running 
-      if (I->CurrentItem == 0)
-      {
-        if (I->Status.empty() == false)
-        {
-           snprintf(S,End-S," [%s]",I->Status.c_str());
-           Shown = true;
-        }
-        
-        continue;
-      }
-
-      Shown = true;
-      
-      // Add in the short description
-      if (I->CurrentItem->Owner->ID != 0)
-        snprintf(S,End-S," [%lu %s",I->CurrentItem->Owner->ID,
-                 I->CurrentItem->ShortDesc.c_str());
-      else
-        snprintf(S,End-S," [%s",I->CurrentItem->ShortDesc.c_str());
-      S += strlen(S);
-
-      // Show the short mode string
-      if (I->CurrentItem->Owner->Mode != 0)
-      {
-        snprintf(S,End-S," %s",I->CurrentItem->Owner->Mode);
-        S += strlen(S);
-      }
-            
-      // Add the current progress
-      if (Mode == Long)
-        snprintf(S,End-S," %lu",I->CurrentSize);
-      else
-      {
-        if (Mode == Medium || I->TotalSize == 0)
-           snprintf(S,End-S," %sB",SizeToStr(I->CurrentSize).c_str());
-      }
-      S += strlen(S);
-      
-      // Add the total size and percent
-      if (I->TotalSize > 0 && I->CurrentItem->Owner->Complete == false)
-      {
-        if (Mode == Short)
-           snprintf(S,End-S," %lu%%",
-                    long(double(I->CurrentSize*100.0)/double(I->TotalSize)));
-        else
-           snprintf(S,End-S,"/%sB %lu%%",SizeToStr(I->TotalSize).c_str(),
-                    long(double(I->CurrentSize*100.0)/double(I->TotalSize)));
-      }      
-      S += strlen(S);
-      snprintf(S,End-S,"]");
-   }
-
-   // Show something..
-   if (Shown == false)
-      snprintf(S,End-S,_(" [Working]"));
-      
-   /* Put in the ETA and cps meter, block off signals to prevent strangeness
-      during resizing */
-   sigset_t Sigs,OldSigs;
-   sigemptyset(&Sigs);
-   sigaddset(&Sigs,SIGWINCH);
-   sigprocmask(SIG_BLOCK,&Sigs,&OldSigs);
-   
-   if (CurrentCPS != 0)
-   {      
-      char Tmp[300];
-      unsigned long ETA = (unsigned long)((TotalBytes - CurrentBytes)/CurrentCPS);
-      sprintf(Tmp," %sB/s %s",SizeToStr(CurrentCPS).c_str(),TimeToStr(ETA).c_str());
-      unsigned int Len = strlen(Buffer);
-      unsigned int LenT = strlen(Tmp);
-      if (Len + LenT < ScreenWidth)
-      {         
-        memset(Buffer + Len,' ',ScreenWidth - Len);
-        strcpy(Buffer + ScreenWidth - LenT,Tmp);
-      }      
-   }
-   Buffer[ScreenWidth] = 0;
-   BlankLine[ScreenWidth] = 0;
-   sigprocmask(SIG_SETMASK,&OldSigs,0);
-
-   // Draw the current status
-   if (strlen(Buffer) == strlen(BlankLine))
-      cout << '\r' << Buffer << flush;
-   else
-      cout << '\r' << BlankLine << '\r' << Buffer << flush;
-   memset(BlankLine,' ',strlen(Buffer));
-   BlankLine[strlen(Buffer)] = 0;
-   
-   Update = false;
-
-   return true;
-}
-                                                                       /*}}}*/
-// AcqTextStatus::MediaChange - Media need to be swapped               /*{{{*/
-// ---------------------------------------------------------------------
-/* Prompt for a media swap */
-bool AcqTextStatus::MediaChange(string Media,string Drive)
-{
-   if (Quiet <= 0)
-      cout << '\r' << BlankLine << '\r';
-   ioprintf(cout,_("Media change: please insert the disc labeled\n"
-                  " '%s'\n"
-                  "in the drive '%s' and press enter\n"),
-           Media.c_str(),Drive.c_str());
-
-   char C = 0;
-   bool bStatus = true;
-   while (C != '\n' && C != '\r')
-   {
-      int len = read(STDIN_FILENO,&C,1);
-      if(C == 'c' || len <= 0)
-        bStatus = false;
-   }
-
-   if(bStatus)
-      Update = true;
-   return bStatus;
-}
-                                                                       /*}}}*/
diff --git a/acqprogress.h b/acqprogress.h
deleted file mode 100644 (file)
index 48f90ae..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-// -*- mode: cpp; mode: fold -*-
-// Description                                                         /*{{{*/
-// $Id: acqprogress.h,v 1.5 2003/02/02 22:24:11 jgg Exp $
-/* ######################################################################
-
-   Acquire Progress - Command line progress meter 
-   
-   ##################################################################### */
-                                                                       /*}}}*/
-#ifndef ACQPROGRESS_H
-#define ACQPROGRESS_H
-
-#include <apt-pkg/acquire.h>
-
-class AcqTextStatus : public pkgAcquireStatus
-{
-   unsigned int &ScreenWidth;
-   char BlankLine[1024];
-   unsigned long ID;
-   unsigned long Quiet;
-   
-   public:
-   
-   virtual bool MediaChange(string Media,string Drive);
-   virtual void IMSHit(pkgAcquire::ItemDesc &Itm);
-   virtual void Fetch(pkgAcquire::ItemDesc &Itm);
-   virtual void Done(pkgAcquire::ItemDesc &Itm);
-   virtual void Fail(pkgAcquire::ItemDesc &Itm);
-   virtual void Start();
-   virtual void Stop();
-   
-   bool Pulse(pkgAcquire *Owner);
-
-   AcqTextStatus(unsigned int &ScreenWidth,unsigned int Quiet);
-};
-
-#endif
diff --git a/contrib/acqprogress.cc b/contrib/acqprogress.cc
new file mode 100644 (file)
index 0000000..352595b
--- /dev/null
@@ -0,0 +1,308 @@
+/*
+Apt is copyright 1997, 1998, 1999 Jason Gunthorpe and others.
+Apt is currently developed by APT Development Team <deity@lists.debian.org>.
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+// -*- mode: cpp; mode: fold -*-
+// Description                                                         /*{{{*/
+// $Id: acqprogress.cc,v 1.24 2003/04/27 01:56:48 doogie Exp $
+/* ######################################################################
+
+   Acquire Progress - Command line progress meter 
+   
+   ##################################################################### */
+                                                                       /*}}}*/
+// Include files                                                       /*{{{*/
+#include "acqprogress.h"
+#include <apt-pkg/acquire-item.h>
+#include <apt-pkg/acquire-worker.h>
+#include <apt-pkg/strutl.h>
+#include <apt-pkg/error.h>
+
+    
+#include <stdio.h>
+#include <signal.h>
+#include <iostream>
+
+#define _
+                                                                       /*}}}*/
+
+using namespace std;
+
+// AcqTextStatus::AcqTextStatus - Constructor                          /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+AcqTextStatus::AcqTextStatus(unsigned int &ScreenWidth,unsigned int Quiet) :
+    ScreenWidth(ScreenWidth), Quiet(Quiet)
+{
+}
+                                                                       /*}}}*/
+// AcqTextStatus::Start - Downloading has started                      /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+void AcqTextStatus::Start() 
+{
+   pkgAcquireStatus::Start(); 
+   BlankLine[0] = 0;
+   ID = 1;
+};
+                                                                       /*}}}*/
+// AcqTextStatus::IMSHit - Called when an item got a HIT response      /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+void AcqTextStatus::IMSHit(pkgAcquire::ItemDesc &Itm)
+{
+   if (Quiet > 1)
+      return;
+
+   if (Quiet <= 0)
+      cout << '\r' << BlankLine << '\r';   
+   
+   cout << _("Hit ") << Itm.Description;
+   if (Itm.Owner->FileSize != 0)
+      cout << " [" << SizeToStr(Itm.Owner->FileSize) << "B]";
+   cout << endl;
+   Update = true;
+};
+                                                                       /*}}}*/
+// AcqTextStatus::Fetch - An item has started to download              /*{{{*/
+// ---------------------------------------------------------------------
+/* This prints out the short description and the expected size */
+void AcqTextStatus::Fetch(pkgAcquire::ItemDesc &Itm)
+{
+   Update = true;
+   if (Itm.Owner->Complete == true)
+      return;
+   
+   Itm.Owner->ID = ID++;
+   
+   if (Quiet > 1)
+      return;
+
+   if (Quiet <= 0)
+      cout << '\r' << BlankLine << '\r';
+   
+   cout << _("Get:") << Itm.Owner->ID << ' ' << Itm.Description;
+   if (Itm.Owner->FileSize != 0)
+      cout << " [" << SizeToStr(Itm.Owner->FileSize) << "B]";
+   cout << endl;
+};
+                                                                       /*}}}*/
+// AcqTextStatus::Done - Completed a download                          /*{{{*/
+// ---------------------------------------------------------------------
+/* We don't display anything... */
+void AcqTextStatus::Done(pkgAcquire::ItemDesc &Itm)
+{
+   Update = true;
+};
+                                                                       /*}}}*/
+// AcqTextStatus::Fail - Called when an item fails to download         /*{{{*/
+// ---------------------------------------------------------------------
+/* We print out the error text  */
+void AcqTextStatus::Fail(pkgAcquire::ItemDesc &Itm)
+{
+   if (Quiet > 1)
+      return;
+
+   // Ignore certain kinds of transient failures (bad code)
+   if (Itm.Owner->Status == pkgAcquire::Item::StatIdle)
+      return;
+      
+   if (Quiet <= 0)
+      cout << '\r' << BlankLine << '\r';
+   
+   if (Itm.Owner->Status == pkgAcquire::Item::StatDone)
+   {
+      cout << _("Ign ") << Itm.Description << endl;
+   }
+   else
+   {
+      cout << _("Err ") << Itm.Description << endl;
+      cout << "  " << Itm.Owner->ErrorText << endl;
+   }
+   
+   Update = true;
+};
+                                                                       /*}}}*/
+// AcqTextStatus::Stop - Finished downloading                          /*{{{*/
+// ---------------------------------------------------------------------
+/* This prints out the bytes downloaded and the overall average line
+   speed */
+void AcqTextStatus::Stop()
+{
+   pkgAcquireStatus::Stop();
+   if (Quiet > 1)
+      return;
+
+   if (Quiet <= 0)
+      cout << '\r' << BlankLine << '\r' << flush;
+
+   if (FetchedBytes != 0 && _error->PendingError() == false)
+      ioprintf(cout,_("Fetched %sB in %s (%sB/s)\n"),
+              SizeToStr(FetchedBytes).c_str(),
+              TimeToStr(ElapsedTime).c_str(),
+              SizeToStr(CurrentCPS).c_str());
+}
+                                                                       /*}}}*/
+// AcqTextStatus::Pulse - Regular event pulse                          /*{{{*/
+// ---------------------------------------------------------------------
+/* This draws the current progress. Each line has an overall percent
+   meter and a per active item status meter along with an overall 
+   bandwidth and ETA indicator. */
+bool AcqTextStatus::Pulse(pkgAcquire *Owner)
+{
+   pkgAcquireStatus::Pulse(Owner);
+   
+   if (Quiet > 0)
+      return true;
+   
+   enum {Long = 0,Medium,Short} Mode = Long;
+   
+   char Buffer[sizeof(BlankLine)];
+   char *End = Buffer + sizeof(Buffer);
+   char *S = Buffer;
+   if (ScreenWidth >= sizeof(Buffer))
+      ScreenWidth = sizeof(Buffer)-1;
+
+   // Put in the percent done
+   sprintf(S,"%ld%%",long(double((CurrentBytes + CurrentItems)*100.0)/double(TotalBytes+TotalItems)));
+
+   bool Shown = false;
+   for (pkgAcquire::Worker *I = Owner->WorkersBegin(); I != 0;
+       I = Owner->WorkerStep(I))
+   {
+      S += strlen(S);
+      
+      // There is no item running 
+      if (I->CurrentItem == 0)
+      {
+        if (I->Status.empty() == false)
+        {
+           snprintf(S,End-S," [%s]",I->Status.c_str());
+           Shown = true;
+        }
+        
+        continue;
+      }
+
+      Shown = true;
+      
+      // Add in the short description
+      if (I->CurrentItem->Owner->ID != 0)
+        snprintf(S,End-S," [%lu %s",I->CurrentItem->Owner->ID,
+                 I->CurrentItem->ShortDesc.c_str());
+      else
+        snprintf(S,End-S," [%s",I->CurrentItem->ShortDesc.c_str());
+      S += strlen(S);
+
+      // Show the short mode string
+      if (I->CurrentItem->Owner->Mode != 0)
+      {
+        snprintf(S,End-S," %s",I->CurrentItem->Owner->Mode);
+        S += strlen(S);
+      }
+            
+      // Add the current progress
+      if (Mode == Long)
+        snprintf(S,End-S," %lu",I->CurrentSize);
+      else
+      {
+        if (Mode == Medium || I->TotalSize == 0)
+           snprintf(S,End-S," %sB",SizeToStr(I->CurrentSize).c_str());
+      }
+      S += strlen(S);
+      
+      // Add the total size and percent
+      if (I->TotalSize > 0 && I->CurrentItem->Owner->Complete == false)
+      {
+        if (Mode == Short)
+           snprintf(S,End-S," %lu%%",
+                    long(double(I->CurrentSize*100.0)/double(I->TotalSize)));
+        else
+           snprintf(S,End-S,"/%sB %lu%%",SizeToStr(I->TotalSize).c_str(),
+                    long(double(I->CurrentSize*100.0)/double(I->TotalSize)));
+      }      
+      S += strlen(S);
+      snprintf(S,End-S,"]");
+   }
+
+   // Show something..
+   if (Shown == false)
+      snprintf(S,End-S,_(" [Working]"));
+      
+   /* Put in the ETA and cps meter, block off signals to prevent strangeness
+      during resizing */
+   sigset_t Sigs,OldSigs;
+   sigemptyset(&Sigs);
+   sigaddset(&Sigs,SIGWINCH);
+   sigprocmask(SIG_BLOCK,&Sigs,&OldSigs);
+   
+   if (CurrentCPS != 0)
+   {      
+      char Tmp[300];
+      unsigned long ETA = (unsigned long)((TotalBytes - CurrentBytes)/CurrentCPS);
+      sprintf(Tmp," %sB/s %s",SizeToStr(CurrentCPS).c_str(),TimeToStr(ETA).c_str());
+      unsigned int Len = strlen(Buffer);
+      unsigned int LenT = strlen(Tmp);
+      if (Len + LenT < ScreenWidth)
+      {         
+        memset(Buffer + Len,' ',ScreenWidth - Len);
+        strcpy(Buffer + ScreenWidth - LenT,Tmp);
+      }      
+   }
+   Buffer[ScreenWidth] = 0;
+   BlankLine[ScreenWidth] = 0;
+   sigprocmask(SIG_SETMASK,&OldSigs,0);
+
+   // Draw the current status
+   if (strlen(Buffer) == strlen(BlankLine))
+      cout << '\r' << Buffer << flush;
+   else
+      cout << '\r' << BlankLine << '\r' << Buffer << flush;
+   memset(BlankLine,' ',strlen(Buffer));
+   BlankLine[strlen(Buffer)] = 0;
+   
+   Update = false;
+
+   return true;
+}
+                                                                       /*}}}*/
+// AcqTextStatus::MediaChange - Media need to be swapped               /*{{{*/
+// ---------------------------------------------------------------------
+/* Prompt for a media swap */
+bool AcqTextStatus::MediaChange(string Media,string Drive)
+{
+   if (Quiet <= 0)
+      cout << '\r' << BlankLine << '\r';
+   ioprintf(cout,_("Media change: please insert the disc labeled\n"
+                  " '%s'\n"
+                  "in the drive '%s' and press enter\n"),
+           Media.c_str(),Drive.c_str());
+
+   char C = 0;
+   bool bStatus = true;
+   while (C != '\n' && C != '\r')
+   {
+      int len = read(STDIN_FILENO,&C,1);
+      if(C == 'c' || len <= 0)
+        bStatus = false;
+   }
+
+   if(bStatus)
+      Update = true;
+   return bStatus;
+}
+                                                                       /*}}}*/
diff --git a/contrib/acqprogress.h b/contrib/acqprogress.h
new file mode 100644 (file)
index 0000000..3627228
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+Apt is copyright 1997, 1998, 1999 Jason Gunthorpe and others.
+Apt is currently developed by APT Development Team <deity@lists.debian.org>.
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+// -*- mode: cpp; mode: fold -*-
+// Description                                                         /*{{{*/
+// $Id: acqprogress.h,v 1.5 2003/02/02 22:24:11 jgg Exp $
+/* ######################################################################
+
+   Acquire Progress - Command line progress meter 
+   
+   ##################################################################### */
+                                                                       /*}}}*/
+#ifndef ACQPROGRESS_H
+#define ACQPROGRESS_H
+
+#include <apt-pkg/acquire.h>
+
+class AcqTextStatus : public pkgAcquireStatus
+{
+   unsigned int &ScreenWidth;
+   char BlankLine[1024];
+   unsigned long ID;
+   unsigned long Quiet;
+   
+   public:
+   
+   virtual bool MediaChange(string Media,string Drive);
+   virtual void IMSHit(pkgAcquire::ItemDesc &Itm);
+   virtual void Fetch(pkgAcquire::ItemDesc &Itm);
+   virtual void Done(pkgAcquire::ItemDesc &Itm);
+   virtual void Fail(pkgAcquire::ItemDesc &Itm);
+   virtual void Start();
+   virtual void Stop();
+   
+   bool Pulse(pkgAcquire *Owner);
+
+   AcqTextStatus(unsigned int &ScreenWidth,unsigned int Quiet);
+};
+
+#endif
diff --git a/debian/.gitignore b/debian/.gitignore
new file mode 100644 (file)
index 0000000..0ee5c16
--- /dev/null
@@ -0,0 +1,3 @@
+/inapt
+/files
+/*.substvars
diff --git a/debian/changelog b/debian/changelog
new file mode 100644 (file)
index 0000000..0dc79d6
--- /dev/null
@@ -0,0 +1,5 @@
+inapt (0.1) unstable; urgency=low
+
+  * Initial Release.
+
+ -- Michael Spang <mspang@csclub.uwaterloo.ca>  Mon, 21 Dec 2009 16:58:27 -0500
diff --git a/debian/compat b/debian/compat
new file mode 100644 (file)
index 0000000..7f8f011
--- /dev/null
@@ -0,0 +1 @@
+7
diff --git a/debian/control b/debian/control
new file mode 100644 (file)
index 0000000..1b25d45
--- /dev/null
@@ -0,0 +1,17 @@
+Source: inapt
+Section: admin
+Priority: optional
+Maintainer: Michael Spang <mspang@csclub.uwaterloo.ca>
+Build-Depends: debhelper (>= 7), libapt-pkg-dev, ragel
+Standards-Version: 3.8.3
+
+Package: inapt
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: manages installed packages with a configuration file
+ Inapt is a frontent to APT that installs and removes packages
+ according to a configuration file. This is useful primarily if a
+ similar set of packages must be installed on a large number of
+ machines. The configuration file syntax allows for packages to be
+ installed conditionally upon a set of profiles assigned to each
+ machine.
diff --git a/debian/copyright b/debian/copyright
new file mode 100644 (file)
index 0000000..11712b5
--- /dev/null
@@ -0,0 +1,24 @@
+Inapt is copyright 2009 Michael Spang <mspang@csclub.uwaterloo.ca>.
+Apt is copyright 1997, 1998, 1999 Jason Gunthorpe and others.
+Apt is currently developed by APT Development Team <deity@lists.debian.org>.
+
+License: GPLv2+
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+
+See /usr/share/common-licenses/GPL-2, or
+<http://www.gnu.org/copyleft/gpl.txt> for the terms of the latest version
+of the GNU General Public License.
+
diff --git a/debian/dirs b/debian/dirs
new file mode 100644 (file)
index 0000000..236670a
--- /dev/null
@@ -0,0 +1 @@
+usr/sbin
diff --git a/debian/install b/debian/install
new file mode 100644 (file)
index 0000000..b05a43a
--- /dev/null
@@ -0,0 +1 @@
+inapt usr/sbin
diff --git a/debian/rules b/debian/rules
new file mode 100755 (executable)
index 0000000..7397337
--- /dev/null
@@ -0,0 +1,40 @@
+#!/usr/bin/make -f
+
+build:
+       dh_testdir
+       $(MAKE) CPPFLAGS='-O2 -g -Wall'
+
+clean:
+       dh_testdir
+       dh_testroot
+       dh_clean
+       $(MAKE) clean
+
+install: build
+       dh_testdir
+       dh_testroot
+       dh_prep
+       dh_installdirs
+
+binary-indep: install
+
+binary-arch: install
+       dh_testdir
+       dh_testroot
+       dh_installchangelogs
+       dh_installdocs
+       dh_installexamples
+       dh_install
+       dh_installman
+       dh_link
+       dh_strip
+       dh_compress
+       dh_fixperms
+       dh_installdeb
+       dh_shlibdeps
+       dh_gencontrol
+       dh_md5sums
+       dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
index 8f8e31e..dbb657a 100644 (file)
--- a/inapt.cc
+++ b/inapt.cc
@@ -18,7 +18,7 @@
 
 #include "inapt.h"
 #include "util.h"
-#include "acqprogress.h"
+#include "contrib/acqprogress.h"
 
 char *prog = NULL;