Skip to content

Commit

Permalink
Initial commit of new package management system based in mozy. This
Browse files Browse the repository at this point in the history
replaces the update feature in Xic and WRspice.  Xic and WRspice no
longer check for updates or messages on program startup.  The update
commands are still around, but call mozy with the magic ":xt_pkgs" url
that brings up the package management page.  The page lists installed
and available packages, and provides buttons to download and install
selected packages.  This can be done from the Xic/WRspice help system
or the stand-alone mozy program.
  • Loading branch information
wrcad committed Oct 10, 2017
1 parent 43d1e47 commit bbe3eff
Show file tree
Hide file tree
Showing 26 changed files with 1,193 additions and 2,033 deletions.
6 changes: 1 addition & 5 deletions mozy/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ LOCAL_LIBS = \
lib/htm.a \
lib/help.a \
lib/gtkmozy.a \
lib/update_itf.a \
$(BASE)/lib/gtkinterf.a \
$(BASE)/lib/ginterf.a \
$(BASE)/lib/miscutil.a \
Expand All @@ -51,7 +50,7 @@ INSTALL_SCRIPT = $(INSTALL) -c -m 0755
INSTALL_LIB = $(INSTALL) -c -m 0644
INSTALL_LIB_RO = $(INSTALL) -c -m 0444

SUBDIRS = src/gtkmozy src/help src/htm src/httpget src/imsave src/upd
SUBDIRS = src/gtkmozy src/help src/htm src/httpget src/imsave

#######################################################################
####### Executable and related targets ################################
Expand Down Expand Up @@ -119,9 +118,6 @@ lib/httpget.a::
lib/imsave.a::
cd src/imsave; $(MAKE)

lib/update_itf.a::
cd src/upd; $(MAKE)

$(BASE)/lib/ginterf.a::
cd $(BASE)/ginterf; $(MAKE)

Expand Down
1 change: 1 addition & 0 deletions mozy/include/help/help_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ class HLPcontext
HLPimageList* = 0);
bool checkLocation(char**, FILE*, ViewerWidget*);
void download(ViewerWidget*, char*);
void download(ViewerWidget*, stringlist*, bool);

// Image Utilities
bool isImage(const char*);
Expand Down
102 changes: 31 additions & 71 deletions mozy/include/upd/update_itf.h → mozy/include/help/help_pkgs.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,84 +38,44 @@
$Id:$
*========================================================================*/

//
// Class for downloading/installing new releases.
//

#ifndef UPDATE_ITF_H
#define UPDATE_ITF_H

// The application must subclass this and pass it to the UpdIf
// constructor.
//
struct updif_t
{
virtual ~updif_t() { }
virtual const char *HomeDir() const = 0;
virtual const char *Product() const = 0;
virtual const char *VersionString() const = 0;
virtual const char *OSname() const = 0;
virtual const char *Arch() const = 0;
virtual const char *DistSuffix() const = 0;
virtual const char *Prefix() const = 0;
};
#ifndef HELP_PKGS_H
#define HELP_PKGS_H

// Struct for parsing/composing version string. The version string is
// in the form (all ints) generation.major.minor.
// List element used for package files to download/install.
//
struct release_t
struct dl_elt_t
{
release_t(const char*);
char *string() const;
dl_elt_t(ViewerWidget *w, const char *u, const char *f = 0)
{
viewer = w;
fsel = 0;
url = lstring::copy(u);
filename = lstring::copy(f);
next = 0;
}

bool operator==(const release_t&) const;
bool operator<(const release_t&) const;
~dl_elt_t()
{
delete [] url;
delete [] filename;
}

int generation;
int major;
int minor;
ViewerWidget *viewer;
GRfilePopup *fsel;
char *url;
char *filename;
dl_elt_t *next;
};

// The interface.
//
class UpdIf
{
public:
UpdIf(const updif_t&);
~UpdIf();

const char *update_pwfile(const char*, const char*);
char *program_name();
release_t my_version();
release_t distrib_version(const char* = 0, char** = 0, char** = 0,
char ** = 0, char** = 0);
char *distrib_filename(const release_t&, const char* = 0, const char* = 0,
const char* = 0);
char *download(const char*, const char* = 0, const char* = 0, char** = 0,
bool(*)(void*, const char*) = 0);
int install(const char*, const char*, const char*, const char* = 0,
const char* = 0, char** = 0);

static char *message(const char*);
static bool new_release(const char*, const char*);
static char *get_proxy();
static const char *set_proxy(const char*, const char*);
static const char *move_proxy(const char*);

const char *username() { return (uif_user); }
const char *password() { return (uif_password); }

private:
char *uif_user;
char *uif_password;
char *uif_home;
char *uif_product;
char *uif_version;
char *uif_osname;
char *uif_arch;
char *uif_dist_suffix;
char *uif_prefix;
};
namespace pkgs {
char *pkgs_page();
int xt_install(dl_elt_t*);
char *get_download_url(const char*);
stringlist *avail_pkgs();
stringlist *local_pkgs();
char *list_avail_pkgs();
char *list_cur_pkgs();
}

#endif

6 changes: 5 additions & 1 deletion mozy/src/help/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ DEPEND_PROG = @DEPEND_PROG@ @CFLAGSG@
AR = @AR@
RANLIB = @RANLIB@
FILTER = @FILTER@
OSNAME = @OSNAME@
ARCH = @ARCH@

BASE = ../../../xt_base
INCLUDE = -I../../include -I../../include/help -I$(BASE)/include
Expand All @@ -28,6 +30,7 @@ CCFILES = \
help_cache.cc \
help_context.cc \
help_images.cc \
help_pkgs.cc \
help_read.cc \
help_startup.cc \
help_topic.cc
Expand All @@ -40,7 +43,8 @@ $(LIB_TARGET): $(CCOBJS)
$(RANLIB) $(LIB_TARGET)

.cc.o:
$(CXX) -c $(CFLAGS) $(INCLUDE) -o $@ $<
$(CXX) -c $(CFLAGS) -DOSNAME=\"$(OSNAME)\" -DARCH=\"$(ARCH)\" \
$(INCLUDE) -o $@ $<

clean:
-@rm -f $(CCOBJS) $(LIB_TARGET)
Expand Down
Loading

0 comments on commit bbe3eff

Please sign in to comment.