Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 May 2013 23:34:20 +0000
From:      "Teske, Devin" <Devin.Teske@fisglobal.com>
To:        "freebsd-current@freebsd.org" <freebsd-current@freebsd.org>
Cc:        Devin Teske <dteske@freebsd.org>
Subject:   Re: [UPDATE] sysutils/bsdconfig snapshot
Message-ID:  <13CA24D6AB415D428143D44749F57D7201F3B934@ltcfiswmsgmb21>
In-Reply-To: <13CA24D6AB415D428143D44749F57D7201F3B39B@ltcfiswmsgmb21>
References:  <13CA24D6AB415D428143D44749F57D7201F3B39B@ltcfiswmsgmb21>

next in thread | previous in thread | raw e-mail | index | archive | help
(replying to my own request with some additional details on what to try in =
this update)

On May 7, 2013, at 1:36 PM, Teske, Devin wrote:

> Hello,
>=20
> I've taken a new snapshot of HEAD usr.sbin/bsdconfig and made it availabl=
e through the ports tree (as sysutils/bsdconfig). The last snapshot was qui=
te some time months ago, so a lot has changed since then.
>=20

Files have moved, there's now a /usr/share/bsdconfig directory for shared i=
nclude files, and the fake language files have been removed. That's what yo=
u'll notice from what the new port installs.


> Most notably, we now have the beginnings of the package management module=
, edging ever-closer to a 1.0 release status.
>=20

Of which it's important to note that this initial work is based on the old =
pkg_tools and not pkgng. We'll convert it to pkgng later, but first we need=
 to make sure the framework for interacting with huge package data is usabl=
e.

One of the challenges in testing this feature is that on 9.1, there aren't =
any packages available (yet; that should change eventually -- being restore=
d retroactively).

However, if you don't use the "FTP" media types, you'll get a lot further. =
What I've been using as a test is to download the 9.0-RELEASE packages/INDE=
X file and throw that into a local "packages" directory and then point the =
"Directory" media type at the parent directory where the "packages" directo=
ry was created.

For example, =85

cd /tmp
mkdir packages
fetch ftp://ftp-archive.freebsd.org/pub/FreeBSD-Archive/old-releases/i386/9=
.0-RELEASE/packages/INDEX

Then use the "Directory" media type and enter a value of "/tmp". The "packa=
ges/INDEX" file will be found in the media ("/tmp" directory) and the the p=
ackages interface will then be presented.

If you're already running 9.0-RELEASE, then you can choose the "FTP Passive=
" media type, then choose the second menu item title "URL" and enter the UR=
L "ftp://ftp-archive.freebsd.org".

ASIDE: /me notes that he really ought to change the "FTP" routine to use a =
default $FTPMODE of "auto" instead of "active" (currently, "FTP" means expl=
icitly active, and "FTP Passive" means explicitly passive).

Once you're in the package interface, you will see:

1. List of package categories. NOTE: For a package category to be listed, i=
t has to have at least one package. This list also includes a dummy categor=
y named "All".

2. For each category (including the "All" dummy category), the number of:

2.a. packages available in that category

2.b. packages that are installed from that category

2.c. "selected" packages (a "selected" package is one that has been been ma=
rked for install, re-install, un-install, or marked as a dependency of a pa=
ckage to install/re-install)

are displayed.

3. Above the category list is a "> Review" menu item. Use this to review th=
e selections you've made.

Choosing a category intuitively displays the packages available from that c=
ategory.

In the list of packages, packages that are already installed are marked wit=
h an "X"; those marked for install have an "I"; re-install have an "R"; un-=
install, "U"; and dependencies are marked with a "D".

Selecting a package that is not marked will turn the mark into an "I".

Selecting a package that is marked with an "X" will bring up a menu asking =
if you would like to mark it for Uninstall, Re-install, or return it back t=
o just being installed.

Selecting a package that is marked as a dependency turns it into a package =
requested for installation (D mark becomes I mark). If without leaving the =
package selection screen you then re-select the same package (which was a d=
ependency turned into an "I"), the mark goes away, but if you exit and retu=
rn to the package selection menu, the mark is restored as a "D". This is be=
cause package dependencies are not calculated until you return to the categ=
ory list (when counts must be updated).

When you're navigating the menus, you may notice an asterisk (*) on some me=
nu items. This indicates that a page has been "cached". Unlike sysinstall w=
hich would spend ~10 minutes (on my hardware) processing the INDEX file, bu=
ilding the in-memory structures for all category submenus, bsdconfig only g=
enerates the menus you request, and does them on-the-fly.

The first time you are presented with the list of package categories, no ca=
tegory has an asterisk next to it. The first time you enter a package categ=
ory, this is a small 1-5 second delay (depending on hardware) to generate t=
he menu(s) for that category. When you return to the category list, that ca=
tegory will now have an asterisk displayed next to it to let you know:

a. this category has been visited and

b. the menus have been cached in-memory so re-entering this category will b=
e fast (less than one second).

Another notable feature once you get to the package menus is that not all p=
ackages are displayed on one page. There is a global PACKAGES_MENU_SIZE whi=
ch defaults to 2000 and sets the maximum number of packages that can appear=
 on one page (in contrast, sysinstall would display all 21,000+ packages on=
 one menu for the All category; sysinstall did not display "pages"). Part o=
f this is due to a limitation in that we construct the menus using dialog(1=
) and therefore are limited by ARGMAX, but it also makes navigating the men=
us more efficient as the screens can redraw faster with less content.

=3D=3D=3D

In the above, we explored entering the packages module in a straight-forwar=
d manner. However, because bsdconfig is scriptable, there's also the script=
ed fashion.

Here are three I am scripting the package menu for my testing:

Method 1: Make a sysinstall-style script=85

$ cat install.cfg
_directoryPath=3D/tmp
mediaSetDirectory
configPackages
$ bsdconfig -f install.cfg

NOTE: Again, /tmp has my "packages" directory with nothing but an "INDEX" f=
ile within

Method 2: Make a runnable script=85

$ cat localpkg.sh
#!/bin/sh
. /usr/local/share/bsdconfig/script.subr
nonInteractive=3DYES
_directoryPath=3D/tmp
mediaSetDirectory
configPackages
$ ./localpkg.sh

Method 3: So-called "HERE" document or standard pipe

$ bsdconfig -f- <<EOF
_directoryPath=3D/tmp
mediaSetDirectory
configPackages
EOF

or

$ echo "_directoryPath=3D/tmp;mediaSetDirectory;configPackages" | bsdconfig=
 -f-

=3D=3D=3D

And then there's how to debug this beast=85

Like sysinstall, you can add "debug=3D1" to your script (in any of the abov=
e 3 forms of scripting).

For example:

#!/bin/sh
debug=3D1
. /usr/local/share/bsdconfig/script.subr
nonInteractive=3DYES
_directoryPath=3D/tmp
mediaSetDirectory
configPackages

However, you should be aware=85 unlike sysinstall, the default reaction to =
"debug=3D1" is to print lots of debugging information to the console.

If you want bsdconfig to instead put its debug statements into a file (like=
 sysinstall, which created "sysinstall.debug"), set the debugFile environme=
nt variable. For example:

#!/bin/sh
debugFile=3Dbsdconfig.debug
. /usr/local/share/bsdconfig/script.subr
nonInteractive=3DYES
_directoryPath=3D/tmp
mediaSetDirectory
configPackages

But you can optionally add a "+" to the beginning of the filename and then =
debug output will appear both on the console and in the debug file (minus t=
he leading "+" of course). For example:

#!/bin/sh
debugFile=3D+bsdconfig.debug
. /usr/local/share/bsdconfig/script.subr
nonInteractive=3DYES
_directoryPath=3D/tmp
mediaSetDirectory
configPackages

But wait, there's more=85

You can access these features from the command-line. Any one of the followi=
ng is considered valid (see "bsdconfig -h" for more info):

bsdconfig -d # enables debug to console

bsdconfig -D bsdconfig.debug # enables debug to file

bsdconfig -D +bsdconfig.debug # enables debug to file and console

bsdconfig -d packages

bsdconfig packages -d

bsdconfig -D +foo packages

bsdconfig packages -D +foo




> I'd like to see if there are any interested folks out there that could gi=
ve my updated version a go and provide some feedback. Any/all feedback woul=
d be greatly appreciated.
>=20

Go through all the menus. One of the things you'll notice is that the progr=
am as a whole should feel more fluid. Everytime you enter a "submenu", the =
last item you selected is remembered and if/when you return that menu, your=
 selection is restored.

I also went through and killed a lot of "--clear" arguments to dialog(1) an=
d employed the rarely used "--keep-tite" arguments in an effort to make tra=
nsitions between screens much more fluid.

I'm interested to know how the program "feels".

Also=85 I spent considerable effort working out the "startup" module and "u=
sermgmt" modules. For the "startup" module, I implemented a third (fourth?)=
 layer of cache management (lol) which speeds up the menus even further. Fo=
r the "usermgmt" module I spent a lot of time making sure we never penalize=
 choices that are merely the result of "exploring".

I spent a lot of time just sitting down in the program and exploring trying=
 to make the program smooth through-and-through. Please let me know if you =
see any kinks or hiccups that detract from a smooth experience. A lot of th=
is stuff is as much "User eXperience" programming than it is "User Interfac=
e" programming (or back-end programming).



> Just an FYI however=85 this code is only expected to work on 9.0-R or hig=
her.

As mentioned earlier=85 in some cases it works better on 9.0 than 9.1 (e.g.=
, lack of 9.1-RELEASE packages on the main FTP repositories). But package I=
NDEX access aside with FTP media type, the experience between 9.x/10.x/HEAD=
 should be consistent.
--=20
Cheers,
Devin

_____________
The information contained in this message is proprietary and/or confidentia=
l. If you are not the intended recipient, please: (i) delete the message an=
d all copies; (ii) do not disclose, distribute or use the message in any ma=
nner; and (iii) notify the sender immediately. In addition, please be aware=
 that any message addressed to our domain is subject to archiving and revie=
w by persons other than the intended recipient. Thank you.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?13CA24D6AB415D428143D44749F57D7201F3B934>