Skip to content
This repository was archived by the owner on Sep 27, 2023. It is now read-only.

Commit 7b9171b

Browse files
committed
sync files from pkgdb
1 parent 9f531aa commit 7b9171b

21 files changed

+213
-683
lines changed

CONTRIBUTING.md

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
# Contributing
2+
3+
## Building/Testing
4+
5+
``` shell
6+
$ nix develop;
7+
$ make;
8+
$ ls ./bin/;
9+
resolver
10+
$ make check;
11+
...<SNIP>...
12+
```
13+
14+
15+
## Building Docs
16+
17+
Docs are generated by [Doxygen](https://www.doxygen.nl/).
18+
19+
```shell
20+
$ nix develop;
21+
$ make doc;
22+
$ firefox ./docs/index.html;
23+
```
24+
25+
26+
## Making a Release
27+
28+
This project follows semantic version guidelines with then
29+
scheme `<MAJOR>.<MINOR>.<PATCH>`.
30+
31+
This means that when a release is created, the version number should be
32+
incremented using the following rules:
33+
34+
- _Bug Fixes_ and _Optimizations_ which have no effect on the availability of
35+
public interfaces should increment _patch_ version.
36+
+ When users see that _patch_ was incremented they expect to update `resolver`
37+
without making ANY changes to their existing usage.
38+
+ If you didn't add any new features, and you didn't break existing tests,
39+
you should probably bump this.
40+
- _New Features_ and _Interfaces_ such as new subcommands/flags, new C++
41+
interfaces/class member variables defined in any `<resolver>/include/` file, or
42+
any change which does not otherwise effect backwards compatibility should
43+
increment _minor_ version.
44+
+ When users see that _minor_ was incremented they expect to update `resolver`
45+
without making changes to their existing usage, but they may be able to take
46+
advantage of new features if they choose to.
47+
+ The user should expect that existing databases may be migrated to new
48+
schemas ( or regenerated ) automatically.
49+
+ If you added a new feature be sure to add new tests as well.
50+
If you didn't break any existing tests that should help reassure you that
51+
_minor_ is safe to bump.
52+
If you break unit tests you may want to investigate and confirm whether
53+
these test "public" interfaces, or internals - if you didn't break any
54+
public interfaces this should help reassure you that _minor_ is safe
55+
to bump.
56+
- _Removed Features_ or _Breaking Changes_ such as removed subcommands/flags,
57+
removed interfaces/class member variables defined in any `<resolver>/include/`
58+
file, or any change which may break existing usage patterns should increment
59+
_major_ version.
60+
+ When users see that _major_ version was incremented they know that they
61+
should only perform an update if they have available time migrate some
62+
existing usage of `resolver` in their software.
63+
+ If you break any integration tests and need to modify their output, you
64+
almost certainly need to bump the _major_ version.
65+
If you break unit tests of public interfaces you should bump
66+
_major_ version.
67+
68+
Follow the rules above strictly, and while we ideally want to avoid bumping
69+
major versions when possible - do not concern yourself with
70+
"having a high version number".
71+
72+
Semantic version numbers are not used in marketing materials, and are intended
73+
to indicate certain categories of software changes to developers and automated
74+
tools ( particularly CI/CD integration test suites ).
75+
These readers could care less if `resolver` is at version 3.2.1 or 30000.2.1!
76+
77+
78+
### `resolver` Software Version
79+
Updates to `resolver` version numbers are controlled by the text file
80+
`<resolver>/version` ( in the repository root ).
81+
This file is used to populate the CPP variable `FLOX_RESOLVER_VERSION`, the
82+
`nix` derivation's version number, and the `pkg-config` manifest file's version.
83+
84+
Publishing releases on GitHub using their WebUI is recommended AFTER you've
85+
followed the process for creating/updating release tags described below.
86+
87+
#### Creating Release Tags
88+
89+
Tagging release commits as `v<MAJOR>.<MINOR>.<PATCH>` is required, including
90+
aliases for `latest`, `v<MAJOR>`, and `v<MAJOR>.<MINOR>`.
91+
These tags are used by consuming repositories to detect breaking changes in
92+
public interfaces and minimum usable `v<MAJOR>.<MINOR>` version
93+
( to have access to certain features ).
94+
This allows automated `update`/`upgrade` utilities to be used at scale.
95+
96+
97+
For example lets say that we are releasing a new minor version which moves us
98+
from `v4.1.3` to `v4.2.0`, we would perform the following:
99+
```shell
100+
# Make sure we're up to date, and on `main'.
101+
$ git fetch;
102+
$ git checkout main;
103+
104+
$ OLD_VERSION="$( < ./version; )";
105+
# Modify old version, you can do this manually or using `semver'
106+
# ( available in the `nix develop' shell ).
107+
$ nix develop -c semver -i minor "$OLD_VERSION" > version;
108+
109+
$ NEW_VERSION="$( < ./version; )";
110+
$ echo "$NEW_VERSION";
111+
4.2.0
112+
113+
# Make a release commit
114+
$ git add ./version;
115+
$ git commit -m "release v$NEW_VERSION";
116+
117+
# Tag `HEAD' with the full `v<MAJOR>.<MINOR>.<PATCH>'
118+
$ git tag -a "v$NEW_VERSION" -m "release v$NEW_VERSION";
119+
120+
# Push the release commit
121+
$ git push;
122+
123+
# Update alias tags
124+
125+
# Point `v<MAJOR>.<MINOR>' to new release.
126+
$ git tag -f "v${NEW_VERSION%.*}" "v$NEW_VERSION";
127+
128+
# Point `v<MAJOR>' to `v<MAJOR>.<MINOR>'.
129+
$ git tag -f "v${NEW_VERSION%%.*}" "v${NEW_VERSION%.*}";
130+
131+
# Point `latest' to `v<MAJOR>'.
132+
$ git tag -f 'latest' "v${NEW_VERSION%%.*}";
133+
134+
# Push the tags!
135+
$ git push origin --tags --force;
136+
```
137+
138+
Congratulations - you basically cut a release!
139+
Next you might cruise over to github.com to the repository page and make a new
140+
release ( under the "packages" section in the right hand panel ).
141+
When making a release just be sure to select the `v<MAJOR>.<MINOR>.<PATCH>` tag
142+
as the "release tag", and you're ready to roll!
143+

CONTRIBUTING.org

Lines changed: 0 additions & 37 deletions
This file was deleted.

Doxyfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ PROJECT_LOGO =
6868
# entered, it will be relative to the location where doxygen was started. If
6969
# left blank the current directory will be used.
7070

71-
OUTPUT_DIRECTORY = ./doc
71+
OUTPUT_DIRECTORY = ./docs
7272

7373
# If the CREATE_SUBDIRS tag is set to YES then doxygen will create up to 4096
7474
# sub-directories (in 2 levels) under the output directory of each output format
@@ -1132,8 +1132,8 @@ INPUT_FILTER =
11321132
# need to set EXTENSION_MAPPING for the extension otherwise the files are not
11331133
# properly processed by doxygen.
11341134

1135-
FILTER_PATTERNS = *.cc=doc/fixup-headers.sh \
1136-
*.hh=doc/fixup-headers.sh
1135+
FILTER_PATTERNS = *.cc=build-aux/fixup-headers.sh \
1136+
*.hh=build-aux/fixup-headers.sh
11371137

11381138
# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
11391139
# INPUT_FILTER) will also be used to filter the input files that are used for
@@ -1287,7 +1287,7 @@ GENERATE_HTML = YES
12871287
# The default directory is: html.
12881288
# This tag requires that the tag GENERATE_HTML is set to YES.
12891289

1290-
HTML_OUTPUT = html
1290+
HTML_OUTPUT = .
12911291

12921292
# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
12931293
# generated HTML page (for example: .htm, .php, .asp).

Makefile

Lines changed: 39 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ endif # ifeq (Linux,$(OS))
4242
endif # ifndef libExt
4343

4444

45+
# ---------------------------------------------------------------------------- #
46+
47+
VERSION := $(file < $(MAKEFILE_DIR)/version)
48+
49+
4550
# ---------------------------------------------------------------------------- #
4651

4752
PREFIX ?= $(MAKEFILE_DIR)/out
@@ -65,17 +70,23 @@ BINS = $(patsubst src/main-%.cc,%,$(bin_SRCS))
6570

6671
# ---------------------------------------------------------------------------- #
6772

68-
CXXFLAGS ?= $(EXTRA_CFLAGS) $(EXTRA_CXXFLAGS)
69-
CXXFLAGS += '-I$(MAKEFILE_DIR)/include'
70-
LDFLAGS ?= $(EXTRA_LDFLAGS)
71-
lib_CXXFLAGS ?= -shared -fPIC
73+
EXTRA_CXXFLAGS ?= -Wall -Wextra -Wpedantic
74+
CXXFLAGS ?= $(EXTRA_CFLAGS) $(EXTRA_CXXFLAGS)
75+
CXXFLAGS += '-I$(MAKEFILE_DIR)/include'
76+
CXXFLAGS += '-DFLOX_RESOLVER_VERSION="$(VERSION)"'
77+
LDFLAGS ?= $(EXTRA_LDFLAGS)
78+
lib_CXXFLAGS ?= -shared -fPIC
79+
ifeq (Linux,$(OS))
7280
lib_LDFLAGS ?= -shared -fPIC -Wl,--no-undefined
73-
bin_CXXFLAGS ?=
74-
bin_LDFLAGS ?=
81+
else
82+
lib_LDFLAGS ?= -shared -fPIC -Wl,-undefined,error
83+
endif
84+
bin_CXXFLAGS ?=
85+
bin_LDFLAGS ?=
7586

7687
ifneq ($(DEBUG),)
77-
CXXFLAGS += -ggdb3 -pg
78-
LDFLAGS += -ggdb3 -pg
88+
CXXFLAGS += -ggdb3 -pg
89+
LDFLAGS += -ggdb3 -pg
7990
endif
8091

8192

@@ -107,23 +118,22 @@ sqlite3pp_CFLAGS := $(sqlite3pp_CFLAGS)
107118
nix_INCDIR ?= $(shell $(PKG_CONFIG) --variable=includedir nix-cmd)
108119
nix_INCDIR := $(nix_INCDIR)
109120
ifndef nix_CFLAGS
110-
nix_CFLAGS = $(boost_CFLAGS)
111-
nix_CFLAGS += $(shell $(PKG_CONFIG) --cflags nix-main nix-cmd nix-expr)
112-
nix_CFLAGS += -isystem $(shell $(PKG_CONFIG) --variable=includedir nix-cmd)
113-
nix_CFLAGS += -include $(nix_INCDIR)/nix/config.h
121+
nix_CFLAGS = $(boost_CFLAGS)
122+
nix_CFLAGS += $(shell $(PKG_CONFIG) --cflags nix-main nix-cmd nix-expr)
123+
nix_CFLAGS += -isystem $(nix_INCDIR) -include $(nix_INCDIR)/nix/config.h
114124
endif
115125
nix_CFLAGS := $(nix_CFLAGS)
116126

117127
ifndef nix_LDFLAGS
118-
nix_LDFLAGS = \
119-
$(shell $(PKG_CONFIG) --libs nix-main nix-cmd nix-expr nix-store)
120-
nix_LDFLAGS += -lnixfetchers
128+
nix_LDFLAGS = \
129+
$(shell $(PKG_CONFIG) --libs nix-main nix-cmd nix-expr nix-store)
130+
nix_LDFLAGS += -lnixfetchers
121131
endif
122132
nix_LDFLAGS := $(nix_LDFLAGS)
123133

124134
ifndef floxresolve_LDFLAGS
125-
floxresolve_LDFLAGS = '-L$(MAKEFILE_DIR)/lib' -lflox-resolve
126-
floxresolve_LDFLAGS += -Wl,--enable-new-dtags '-Wl,-rpath,$$ORIGIN/../lib'
135+
floxresolve_LDFLAGS = '-L$(MAKEFILE_DIR)/lib' -lflox-resolve
136+
floxresolve_LDFLAGS += -Wl,--enable-new-dtags '-Wl,-rpath,$$ORIGIN/../lib'
127137
endif
128138

129139

@@ -133,9 +143,13 @@ lib_CXXFLAGS += $(sqlite3_CFLAGS) $(sql_builder_CFLAGS) $(sqlite3pp_CFLAGS)
133143
bin_CXXFLAGS += $(argparse_CFLAGS)
134144
CXXFLAGS += $(nix_CFLAGS) $(nljson_CFLAGS)
135145

146+
ifeq (Linux,$(OS))
136147
lib_LDFLAGS += -Wl,--as-needed
148+
endif
137149
lib_LDFLAGS += $(nix_LDFLAGS) $(sqlite3_LDFLAGS)
150+
ifeq (Linux,$(OS))
138151
lib_LDFLAGS += -Wl,--no-as-needed
152+
endif
139153

140154
bin_LDFLAGS += $(nix_LDFLAGS) $(floxresolve_LDFLAGS)
141155

@@ -166,7 +180,8 @@ clean: FORCE
166180
-$(RM) src/*.o tests/*.o
167181
-$(RM) result
168182
-$(RM) -r $(PREFIX)
169-
-$(RM) -r doc/html
183+
-$(RM) $(addprefix docs/,*.png *.html *.svg *.css *.js)
184+
-$(RM) -r docs/search
170185
-$(RM) $(TESTS:.cc=)
171186
-$(RM) gmon.out *.log
172187

@@ -269,14 +284,17 @@ ccls: .ccls
269284

270285
# ---------------------------------------------------------------------------- #
271286

272-
.PHONY: doc
287+
.PHONY: docs
273288

274-
doc: doc/html/index.html
289+
docs: docs/index.html
275290

276-
doc/html/index.html: FORCE
291+
docs/index.html: FORCE
277292
$(DOXYGEN) ./Doxyfile
278293

279294

295+
# ---------------------------------------------------------------------------- #
296+
297+
280298
# ---------------------------------------------------------------------------- #
281299
#
282300
#

doc/fixup-headers.sh renamed to build-aux/fixup-headers.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ _as_me="fixup-headers.sh";
1717

1818
_version="0.1.0";
1919

20-
_usage_msg="USAGE: $_as_me [OPTIONS...]
21-
Pre-processor for C++ source files.
20+
_usage_msg="USAGE: $_as_me [OPTIONS...] FILE
21+
Pre-processor for a C/C++ source file.
2222
";
2323

2424
_help_msg="$_usage_msg

doc/.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

doc/preferences.org

Lines changed: 0 additions & 35 deletions
This file was deleted.

include/flox/package.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class Package {
6464
std::vector<std::string> pathS = this->getPathStrs();
6565
if ( pathS[0] == "legacyPackages" ) { return ST_LEGACY; }
6666
if ( pathS[0] == "packages" ) { return ST_PACKAGES; }
67-
if ( pathS[0] == "catalog" ) { return ST_PACKAGES; }
67+
if ( pathS[0] == "catalog" ) { return ST_CATALOG; }
6868
throw ResolverException(
6969
"Package::getSubtreeType(): Unrecognized subtree '" + pathS[0] + "'."
7070
);

0 commit comments

Comments
 (0)