LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Blogs > rainbowsally
User Name
Password

Notices

Rate this Entry

make-based package installer/uninstaller update

Posted 04-09-2012 at 12:06 PM by rainbowsally
Updated 04-10-2012 at 09:39 AM by rainbowsally (info update re. ksmserver crash)

[msg updated apr 10, 2012 -rs]
Here's the link to blog with the download.

http://www.linuxquestions.org/questi...staller-34641/

Meanwhile, here's how my qt4 project is going so far and I'll include the file that turns version 1.0.1 into 1.0.2 below.

make-based qt4

One problem file was libphonon.* (Temporarily moved back to /opt) Required reinstalling phonon packages (to restore the config, probably).
[Need to unpack the phonon packages and see what configs they write.]

Another was a ksmserver crash. Probably because I was installing using KDE which has qt4 dependencies. Using LXDE, Restored from backups, then repeated the install and no prob.

[Apr 10, 2012:
The ksmserver crash was not solved. It crashed when I rebooted. I was able to 'make restore' to get back to a working KDE, however. This indicates that the problem is not a config, but an executable (bin or lib) file which I now have to identify. I'll start by comparing ldd outputs for <dir>/bin/ksmserver and seeing if there are any obvious differences. -rs]

18,429 qt4 files now moved from /opt to /usr
57 files still in /opt

[Apr 10, 2012: Nope. About 76 to go... -rs]

[If you missed it before, this qt4 installation crashed my system like WOW! Part, if not all of the problem had been that the previous make-based system (alpha) fouled up permissions in the installation destination. Now looking for other possible probs.]

The way files are moved using the make-based system is as follows:

Code:
[start]:
  init (the dat files)
  install (to get the backup fileset)
  test    
  uninstall
  restore (from backup fileset)
  move files in the TREE
  rename the backup folder
  repeat from [start].
I used 'make set-user-perms' and 'make set-root-perms' to allow me to move the files as my normal user but to install as root.

The check info dir problem is DISMALLY slow in a shell using sed to filter the names when there are like 20,000 file names. This needs to be rewritten in C.

Code:
// infodir-check.c - replacement for shell script in ~/bin/src/new-make/mktools

#include <stdio.h>  // printf()
#include <stdlib.h> // getenv()
#include <string.h> // strrchr()

void dbg(){}

char pad[256];
char HERE[256];

void cd(const char* dir)
{
  chdir(dir);
  setenv("PWD", (char*)get_current_dir_name(), 1);
}

void cd_dirname(const char* execpath)
{
  char* p;
  sprintf(pad, execpath);
  p = strrchr(pad, '/');
  if(p)
  {
    *p = 0; // needs some more checks.
    cd(pad);
  }
}

void do_check();

int main(int argc, char** argv)
{
  dbg();
  cd_dirname(argv[0]);
  cd("..");
  sprintf(HERE, getenv("PWD"));
  if(argc == 1 || strcmp(argv[1], "working"))
  {
    printf(
      "Only run this from the makefile as 'make <app>' where <app>\n"
      "is the name of the function minus the 'mktools' prefix.\n"
      "\n"
      "Press ENTER to abort now.\n"
      "\n");
    getchar();
    return 1;
  }
  do_check();
  return 0;
}

void do_check()
{
  int found = 0;
  int err = 1;
  do
  {
    FILE* fp = fopen("files.dat", "r");
    if(!fp) break;
    fseek(fp, 0, SEEK_END);
    size_t fsize = ftell(fp);
    fseek(fp, 0, SEEK_SET);
    char* buf = (char*)malloc(fsize+1);
    fread(buf, 1, fsize, fp);
    buf[fsize] = 0;
    if(strstr(buf, "/share/info/dir"))
      found++;
    err = 0;
  }while(0);
  if(err)
    printf("Can't find 'files.dat' file\n");
  else if(found)
  {
    printf("\n"
    "WARNING:\n"
    "   \n"
    "   The file share/info/dir exists in your 'files.dat'.  This file \n"
    "   cannot be processed by the current Makefile install function.\n"
    "\n"
    "   Recommend removing or renaming it for manual addition (using \n"
    "   texitools) after installation, or if you know your user has \n"
    "   texitools, you might want to add mk_post -install and -uninstall \n"
    "   functions to add and remove the directory entries correctly.\n"
    "\n"
    );
    getchar();
    return;
  }        
}
That executable MUST be in the mktools directory of the files tree so it is copied every time you execute new.make.

You may not notice much of a speed improvement for smaller packages but this speeds up that info dir check quite a bit. Check this out.

Code:
$> time mktools/infodir-check-orig working
real    1m 14.451s

$> time mktools/infodir-check-new working
real    0m 0.020s
Almost 4 thousand times faster than the script. Not 4 thousand percent, 4 thousand times.

:-)
Posted in Uncategorized
Views 274 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 07:39 AM.

Main Menu
Advertisement

My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration