Skip to content

Commit

Permalink
Fixed deb binary package creation
Browse files Browse the repository at this point in the history
  • Loading branch information
slamko committed Jul 5, 2022
1 parent f0c0f51 commit 529cfc2
Show file tree
Hide file tree
Showing 11 changed files with 60 additions and 133 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ spm
spm-*/
*.xbps
*.deb
*repodata
*repodata
exmperimental/
36 changes: 24 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ WEFLAGS=-Wall -Wextra -Wno-unused-parameter -Werror -pedantic -Iinclude/ -I. -Iz
CFLAGS=$(WEFLAGS) -g
VERSION=1.0_3
OPT=-O1
PKG_NAME=$(TARGET)-$(VERSION)

SRCD=src
HEADERD=include
Expand Down Expand Up @@ -51,26 +52,35 @@ $(BUILDD)/$(UTILSD)/%.o: $(SRCD)/$(UTILSD)/%.c $(HEADERSUTILS)
$(BUILDD)/$(CMDD)/%.o: $(SRCD)/$(CMDD)/%.c $(HEADERSCMD)
$(CC) $(CFLAGS) -c $< -o $@

installdirs: executable COPYING README.md
mkdir -p $(TARGET)-$(VERSION)/usr/share/licenses/$(TARGET)
mkdir -p $(TARGET)-$(VERSION)/usr/share/doc/$(TARGET)
mkdir -p $(TARGET)-$(VERSION)/usr/bin
mkdir -p $(TARGET)-$(VERSION)/usr/share/man/man1/
cp COPYING $(TARGET)-$(VERSION)/usr/share/licenses/$(TARGET)
cp README.md $(TARGET)-$(VERSION)/usr/share/doc/spm
cp $(TARGET) $(TARGET)-$(VERSION)/usr/bin
cp $(TARGET).1 $(TARGET)-$(VERSION)/usr/share/man/man1/
installdirs: release COPYING README.md
mkdir -p $(PKG_NAME)/usr/share/licenses/$(TARGET)
mkdir -p $(PKG_NAME)/usr/share/doc/$(TARGET)
mkdir -p $(PKG_NAME)/usr/bin
mkdir -p $(PKG_NAME)/usr/share/man/man1/
cp COPYING $(PKG_NAME)/usr/share/licenses/$(TARGET)
cp README.md $(PKG_NAME)/usr/share/doc/spm
cp $(TARGET) $(PKG_NAME)/usr/bin
cp $(TARGET).1 $(PKG_NAME)/usr/share/man/man1/

deb-installdirs: installdirs
mkdir -p $(TARGET)-$(VERSION)/DEBIAN
cp ./packaging/deb/DEBIAN_control $(TARGET)-$(VERSION)/DEBIAN/control
mkdir -p $(PKG_NAME)/DEBIAN
cp ./packaging/deb/DEBIAN_control $(PKG_NAME)/DEBIAN/control

include ./packaging/deb/Makefile

include ./packaging/xbps/Makefile

clean-pkgdirs:
rm -rf $(TARGET)-$(VERSION)
rm -rf $(PKG_NAME)

dist: dist-zip dist-gz

dist-zip:
git archive HEAD --format=zip > $(PKG_NAME).zip

dist-gz:
git archive HEAD --format=tar > $(PKG_NAME).tar
gzip $(PKG_NAME).tar

install: release
mkdir -p $(BIND)
Expand All @@ -94,3 +104,5 @@ uninstall:
clean:
$(RM) -r $(BUILDD)
$(RM) $(TARGET)
$(RM) *gz
$(RM) *zip
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@

Suckless software starting to gain some popularity nowadays in Linux community. However, it is unlikely to become mainstream because of its suckless nature... People do not like to manually compile and patch (resolve conflicts) suckless software. Another thing that may scareaway some amount of newcomers is suckless.org website... It is so suckless that it consists of markdown files and of course doesn't have any kind of search system. So in order to patch dwm, for example, you should walk through the list of 250 patches and find that you want...

So initially this project intended to be a command line tool for searching patches on suckless.org. However later on spm got some additional functionality like downloading applying patches. It may sound like Spm now violates suckless principals :) but I don't think so. In fact it just operates on a local clone of suckless.org page, so downloading a patch literally means copying the file, viewing a patch means ```cat```ting the file... So Spm is pretty much suckless :)
So initially this project intended to be a command line tool for searching patches on suckless.org. However later on spm got some additional functionality like downloading applying patches. It may sound like Spm now violates suckless principals :) but I don't think so. In fact it just operates on a local clone of suckless.org page, so downloading a patch literally means copying the file, viewing a patch means ```cat```ting the file...

---
### Using Spm
### Using Spmn

There is really not much more to say about the usage. All the commands are pretty intuitive with at most of one command line option:
```
Usage:
spm [command] [args] [options]
spmn [command] [args] [options]
Commands:
search <tool> [keywords] - search a patch for a <tool> with given [keywords] (default command).
load <tool> <patch> - download patch for given <tool> with <patch> name.
Expand All @@ -28,7 +28,7 @@ There is really not much more to say about the usage. All the commands are prett
open:
-b: show the web page on suckless.org for given patch in browser.
load:
-a: load and apply patch at once (the same as spm apply).
-a: load and apply patch at once (the same as spmn apply).
search:
-f: show patch description for each patch found.
apply:
Expand Down
88 changes: 0 additions & 88 deletions experimental/multithreaded-search-template.h

This file was deleted.

4 changes: 2 additions & 2 deletions packaging/deb/DEBIAN_control
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: spm
Package: spmn
Version: 0.3.1
Section: development
Priority: optional
Architecture: amd64
Depends: xdg-utils, git, libbsd0
Maintainer: Viacheslav <https://github.com/slamko/spm>
Maintainer: Viacheslav <https://github.com/slamko/spmn>
Description: Suckless patch manager
9 changes: 4 additions & 5 deletions packaging/deb/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
FROM gcc:12.1-bullseye

RUN mkdir -p /usr/src/spm
COPY . /usr/src/spm
WORKDIR /usr/src/spm
RUN mkdir -p /usr/src/spmn
COPY . /usr/src/spmn
WORKDIR /usr/src/spmn
RUN apt update && apt upgrade -y
RUN apt install -y apt-utils
RUN apt install -y make build-essential binutils lintian debhelper dh-make devscripts

RUN apt install -y make build-essential binutils lintian debhelper dh-make devscripts libbsd0 libbsd-dev
14 changes: 7 additions & 7 deletions packaging/deb/Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@

build-base-img:
build-deb-base-img:
docker build -t deb-pkg-base -f ./packaging/deb/Dockerfile .

build-bin-img:
@docker build -t deb-pkg-bin-$(TARGET)-$(VERSION) -f ./packaging/deb/bin/Dockerfile .
build-deb-bin-img:
@docker build -t deb-pkg-bin-$(PKG_NAME) -f ./packaging/deb/bin/Dockerfile .

build-deb:
@docker run -v $(shell pwd):/usr/src/$(TARGET) deb-pkg-bin-$(TARGET)-$(VERSION)
@docker run -v $(shell pwd):/usr/src/$(TARGET) --env PKG_FULL_NAME=$(PKG_NAME) deb-pkg-bin-$(PKG_NAME)

build-src-img:
@docker build -t deb-pkg-src-$(TARGET)-$(VERSION) -f ./packaging/deb/src/Dockerfile .
build-deb-src-img:
@docker build -t deb-pkg-src-$(PKG_NAME) -f ./packaging/deb/src/Dockerfile .

build-src-deb:
@docker run -v $(shell pwd):/usr/src/$(TARGET) deb-pkg-src-$(TARGET)-$(VERSION)
@docker run -v $(shell pwd):/usr/src/$(TARGET) deb-pkg-src-$(PKG_NAME)

clean-deb:
rm -f *.deb
Expand Down
2 changes: 1 addition & 1 deletion packaging/deb/bin/deb-build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh

make deb-installdirs
dpkg-deb --build spm-1.0_3/
dpkg-deb --build "$PKG_FULL_NAME"/
make clean-pkgdirs
4 changes: 2 additions & 2 deletions packaging/xbps/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
build-xbps: installdirs
./packaging/xbps/xbps-create.sh $(TARGET)-$(VERSION) "x86_64"
./packaging/xbps/xbps-create.sh $(TARGET)-$(VERSION) "amd64"
./packaging/xbps/xbps-create.sh $(PKG_NAME) "x86_64"
./packaging/xbps/xbps-create.sh $(PKG_NAME) "amd64"

clean-xbps:
$(RM) *.xbps
Expand Down
File renamed without changes.
25 changes: 14 additions & 11 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,8 @@ typedef int (*commandp)(int, char **, const char *);

#define CMD_CNT 7

result help(int argc, char **argv, const char *basecacherepo) {
KINDA_USE_3ARG(argc, argv, basecacherepo);
print_usage();
RET_OK()
}

result version(int argc, char **argv, const char *basecacherepo) {
KINDA_USE_3ARG(argc, argv, basecacherepo);
print_version();
RET_OK()
}
result help(int, char **, const char *);
result version(int, char **, const char *);

static const commandp commands[CMD_CNT] = {
&parse_sync_args, &parse_search_args, &parse_open_args,
Expand All @@ -84,6 +75,18 @@ static int local_repo_is_obsolete(struct tm *cttm, struct tm *lmttm) {
(cttm->tm_year > lmttm->tm_year && cttm->tm_mday > SYNC_INTERVAL_D);
}

result help(int argc, char **argv, const char *basecacherepo) {
KINDA_USE_3ARG(argc, argv, basecacherepo);
print_usage();
RET_OK()
}

result version(int argc, char **argv, const char *basecacherepo) {
KINDA_USE_3ARG(argc, argv, basecacherepo);
print_version();
RET_OK()
}

static result try_sync_caches(const char *basecacherepo) {
struct stat cache_sb = {0};
time_t lastmtime, curtime;
Expand Down

0 comments on commit 529cfc2

Please sign in to comment.