delorie.com/archives/browse.cgi   search  
Mail Archives: geda-user/2011/11/30/16:10:33

X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f
X-Recipient: geda-user AT delorie DOT com
X-Mailer: exmh version 2.7.2 01/07/2005 (debian 1:2.7.2-18) with nmh-1.3
X-Exmh-Isig-CompType: repl
X-Exmh-Isig-Folder: inbox
To: geda-user AT delorie DOT com
cc: karl AT aspodata DOT se
Fcc: +outbox
Subject: Re: [geda-user] Dynamic loading personal components (with subfolder) into the search component tree of gschem
In-reply-to: <CAAVSQ3vnFZkWdWn=LCbf+WSM0vOx9pwW+OaeTs47EdO8nfmC_w@mail.gmail.com>
References: <CAAVSQ3vnFZkWdWn=LCbf+WSM0vOx9pwW+OaeTs47EdO8nfmC_w AT mail DOT gmail DOT com>
Comments: In-reply-to Luigi Salvatore Palese <ultrabit AT gmail DOT com>
message dated "Tue, 29 Nov 2011 15:52:15 +0100."
Mime-Version: 1.0
Message-Id: <20111130211002.32B5081F6275@turkos.aspodata.se>
Date: Wed, 30 Nov 2011 22:10:00 +0100 (CET)
From: karl AT aspodata DOT se (Karl Hammar)
X-Virus-Scanned: ClamAV using ClamSMTP
Reply-To: geda-user AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: geda-user AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

This is a multipart MIME message.

--==_Exmh_1322686191_24130
Content-Type: text/plain; charset="iso-8859-1"

Luigi:
...
> The procedure in attachment is composed by a bash script and a guile
> script.
...

///////
Attachment "build-local-symbols-list":

  SYMPATH="/usr/local/share/symbols"
  SYMSUB="personal/"
  cd $SYMPATH ; echo > local-symbols-list ;
  IFS=$'\n'

You could do (in case you don't have a .desc in every directory):

for file in `find dir -name .desc -type f`; do
   d=`dirname $file`
   desc=`cat $file`
...


  for d in `find ./$SYMSUB -type d` ; do
	  desc="`cat $d/.desc`"
	  echo "$d" >> local-symbols-list
	  echo "$desc" >> local-symbols-list
  done

  echo "Coping local-symbols-list to ~/.gEDA folder..."
  cp local-symbols-list  ~/.gEDA/

///////
Attachment "README":

  cd my-symbols-path ; mkdir personal ;
  mv * personal
  cp build-local-symbols-list my-symbols-path

  # for each path in personal:
  echo "One Line Description" > .desc

  ------------------------------------------------------------------
  Examples path:
  capacitors/
	  .desc <--onelinecontent-- "Generic capacitors"
	  cap-1.sym
	  avx/
		  .desc <--onelinecontent- "AVX Capacitors"
		  idc.sym


  become -->

  geda symbols tree+
	  >capacitors Generic capacitors
		  cap-1.sym
	  >avx AVX Capacitors
		  idc.sym

Why do you have a .desc file when you could as easily use the
directory name as the description. E.g. why don't you instead use:

  Examples path:
  Generic\ capacitors/
	  cap-1.sym
	  AVX\ Capacitors/
		  idc.sym

Why use a file (.desc) when you can store it directly in the directory
structure, and if you instead use the directory name as description,
you can use the attached script.

///////

Overall it seems you build a file "local-symbols-list" with the
shell script "build-local-symbols-list", then you process that list
with the scheme script "local-symbols-library.scm".

Wouldn't it be great if you didn't have to run the shell script, if
the scheme script took care about that part? So you could use:

(component-library-add-tree "cvs" "${HOME}/Net/cvs/cvs.gedasymbols.org/www/user")

 or

(component-library-add-tree "personal" "/usr/local/share/symbols")

in your .gEDA/gafrc file, and it swalloped the whole tree.

If you write such a script, I'll be happy to test it.

Regards,
/Karl Hammar

-----------------------------------------------------------------------
Aspö Data
Lilla Aspö 148
S-742 94 Östhammar
Sweden
+46 173 140 57


--==_Exmh_1322686191_24130
Content-Type: text/x-sh ; name="gedasymbols.sh"
Content-Description: gedasymbols.sh
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename="gedasymbols.sh"

#!/bin/sh

dir=3D$1
pfx=3D$2

if [ ! "$pfx" ]
then
  echo gedasymbols.sh
  echo \ find dirctories with symbol files
  echo \ and make gafrc lines to add them to the library browser
  echo Usage:
  echo " gedasymbols root_of_file_tree prefix"
  echo Example:
  echo ' gedasymbols.sh ~/Net/cvs/cvs.gedasymbols.org/www/user/ cvs >> .g=
EDA/gafrc'
  exit 1
fi

cd $1

find . -type f -name \*.sym |
sed -e 's|/[^/]*$||; s/^\.\///' |
sort -u |
while read a
do
  echo "(component-library \"$1/$a\" \"$pfx/$a\")" | sed -e 's|//|/|'
done |
sort -r
--==_Exmh_1322686191_24130--


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019