Split repo commands into the new xbps-repo bin.
- Remove lib/info.c that doesn't belong in the lib and add it into the bins. - Every binary now uses its own directory on bin/. This is in preparation for future changes for correct behaviour of the library and binaries. --HG-- extra : convert_revision : 880d16378bf940c4f5478de0362afe883cd5fd2c
This commit is contained in:
24
bin/xbps-cmpver/Makefile
Normal file
24
bin/xbps-cmpver/Makefile
Normal file
@@ -0,0 +1,24 @@
|
||||
TOPDIR = ../..
|
||||
include $(TOPDIR)/vars.mk
|
||||
|
||||
OBJS = main.o
|
||||
BIN = xbps-cmpver
|
||||
|
||||
all: $(BIN)
|
||||
.PHONY: all
|
||||
|
||||
$(BIN): $(OBJS)
|
||||
$(CC) $(LDFLAGS) $^ -o $@
|
||||
|
||||
.PHONY: clean
|
||||
clean: clean-bins clean-objs
|
||||
|
||||
clean-bins:
|
||||
-rm -f $(BIN)
|
||||
|
||||
clean-objs:
|
||||
-rm -f *.o
|
||||
|
||||
install: $(BIN)
|
||||
install -d $(SBINDIR)
|
||||
install -m 755 $(BIN) $(SBINDIR)
|
||||
29
bin/xbps-cmpver/main.c
Normal file
29
bin/xbps-cmpver/main.c
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Compare package and version strings
|
||||
* @ 2008
|
||||
* Author: pancake <youterm.com>
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <xbps_api.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
if (argc<3) {
|
||||
printf("Usage: xbps-cmpver [old] [new]\n");
|
||||
printf(" xbpks-cmpver foo-1.2 foo-2.2 # $? = 1\n");
|
||||
printf(" xbpks-cmpver foo-1.2 foo-1.2 # $? = 0\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if UNIT_TEST
|
||||
printf("1.2 2.2 = %d\n", chkver("1.2", "2.2"));
|
||||
printf("1.0 10.3 = %d\n", chkver("1.0", "10.3"));
|
||||
printf("1.0 1.0 = %d\n", chkver("1.0", "1.0"));
|
||||
printf("1.0 1.2 = %d\n", chkver("1.0", "1.2"));
|
||||
printf("1.0.1 1.0.2 = %d\n", chkver("1.0.1", "1.0.2"));
|
||||
printf("1.0beta 1.0rc1 = %d\n", chkver("1.0beta", "1.0rc1"));
|
||||
#endif
|
||||
|
||||
return (xbps_cmpver_packages(argv[1], argv[2]) > 0)?1:0;
|
||||
}
|
||||
Reference in New Issue
Block a user